models

package
v1.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodAll                = "*"
	KindResource             = "resource"
	UserKind     SubjectKind = "user"
	GroupKind    SubjectKind = "group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CollaborationInstance added in v1.18.0

type CollaborationInstance struct {
	ID                primitive.ObjectID `bson:"_id,omitempty"            json:"id,omitempty"`
	ProjectName       string             `bson:"project_name"             json:"project_name"`
	CreateTime        int64              `bson:"create_time"              json:"create_time"`
	UpdateTime        int64              `bson:"update_time"              json:"update_time"`
	LastVisitTime     int64              `bson:"last_visit_time"          json:"last_visit_time"`
	CollaborationName string             `bson:"collaboration_name"       json:"collaboration_name"`
	RecycleDay        int64              `bson:"recycle_day"              json:"recycle_day"`
	Revision          int64              `bson:"revision"                 json:"revision"`
	UserUID           string             `bson:"user_uid"                 json:"user_uid"`
	PolicyName        string             `bson:"policy_name"              json:"policy_name"`
	Workflows         []WorkflowCIItem   `bson:"workflows"                json:"workflows"`
	Products          []ProductCIItem    `bson:"products"                 json:"products"`
}

func (CollaborationInstance) TableName added in v1.18.0

func (CollaborationInstance) TableName() string

type CollaborationType added in v1.18.0

type CollaborationType string
const (
	CollaborationShare CollaborationType = "share"
	CollaborationNew   CollaborationType = "new"
)

type MatchAttribute added in v1.10.0

type MatchAttribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Policy added in v1.7.0

type Policy struct {
	Name        string               `bson:"name"              json:"name"`
	Namespace   string               `bson:"namespace"         json:"namespace"`
	Description string               `bson:"description"       json:"description"`
	CreateTime  int64                `bson:"create_time"       json:"create_time"`
	UpdateTime  int64                `bson:"update_time"       json:"update_time"`
	Rules       []*Rule              `bson:"rules"             json:"rules"`
	CreateBy    string               `bson:"create_by"         json:"create_by"`
	UpdateBy    string               `bson:"update_by"         json:"update_by"`
	Type        setting.ResourceType `bson:"type"              json:"type"`
}

Policy is a namespaced or cluster scoped, logical grouping of PolicyRules that can be referenced as a unit by a PolicyBinding. for a cluster scoped Policy, namespace is empty.

func (Policy) TableName added in v1.7.0

func (Policy) TableName() string

type PolicyBinding added in v1.10.0

type PolicyBinding struct {
	Name      string `bson:"name"      json:"name"`
	Namespace string `bson:"namespace"  json:"namespace"`

	// Subjects holds references to the objects the Policy applies to.
	Subjects []*Subject `bson:"subjects"    json:"subjects"`

	// PolicyRef can reference a namespaced or cluster scoped Policy.
	PolicyRef *PolicyRef           `bson:"policy_ref"  json:"policy_ref"`
	Type      setting.ResourceType `bson:"type"        json:"type"`
}

PolicyBinding references a Policy, but does not contain it. It adds who information via Subjects. PolicyBinding in a given namespace only have effect in that namespace. for a cluster scoped PolicyBinding, namespace is empty.

func (PolicyBinding) TableName added in v1.10.0

func (PolicyBinding) TableName() string

type PolicyRef added in v1.10.0

type PolicyRef struct {
	Name string `bson:"name" json:"name"`

	// Namespace of the referenced object. if the object is cluster scoped, namespace is empty.
	Namespace string `bson:"namespace" json:"namespace"`
}

PolicyRef contains information that points to the policy being used

type ProductCIItem added in v1.18.0

type ProductCIItem struct {
	Name              string            `bson:"name"               json:"name"`
	BaseName          string            `bson:"base_name"          json:"base_name"`
	CollaborationType CollaborationType `bson:"collaboration_type" json:"collaboration_type"`
	RecycleDay        int64             `bson:"recycle_day"        json:"recycle_day"`
	Verbs             []string          `bson:"verbs"              json:"verbs"`
}

type Role

type Role struct {
	Name      string               `bson:"name"      json:"name"`
	Desc      string               `bson:"desc"      json:"desc"`
	Namespace string               `bson:"namespace" json:"namespace"`
	Rules     []*Rule              `bson:"rules"     json:"rules"`
	Type      setting.ResourceType `bson:"type"     json:"type"`
}

Role is a namespaced or cluster scoped, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. for a cluster scoped Role, namespace is empty.

func (Role) TableName

func (Role) TableName() string

type RoleBinding

type RoleBinding struct {
	Name      string `bson:"name"      json:"name"`
	Namespace string `bson:"namespace" json:"namespace"`

	// Subjects holds references to the objects the role applies to.
	Subjects []*Subject `bson:"subjects" json:"subjects"`

	// RoleRef can reference a namespaced or cluster scoped Role.
	RoleRef *RoleRef `bson:"role_ref" json:"roleRef"`
}

RoleBinding references a role, but does not contain it. It adds who information via Subjects. RoleBindings in a given namespace only have effect in that namespace. for a cluster scoped RoleBinding, namespace is empty.

func (RoleBinding) TableName

func (RoleBinding) TableName() string

type RoleRef

type RoleRef struct {
	Name string `bson:"name" json:"name"`

	// Namespace of the referenced object. if the object is cluster scoped, namespace is empty.
	Namespace string `bson:"namespace" json:"namespace"`
}

RoleRef contains information that points to the role being used

type Rule added in v1.7.0

type Rule struct {
	// Verbs is a list of http methods or resource actions that apply to ALL the Resources contained in this rule. '*' represents all methods.
	Verbs []string `bson:"verbs"         json:"verbs"`

	// Resources is a list of resources this rule applies to. '*' represents all resources.
	Resources       []string         `bson:"resources" json:"resources"`
	Kind            string           `bson:"kind"     json:"kind"`
	MatchAttributes []MatchAttribute `bson:"match_attributes" json:"match_attributes"`
}

Rule holds information that describes a policy rule, but does not contain information about whom the rule applies to. If Kind is "resource", verbs are resource actions, while resources are resource names

type Subject

type Subject struct {
	// Kind of object being referenced. allowed values are "User", "Group".
	Kind SubjectKind `bson:"kind" json:"kind"`
	// unique identifier of the object being referenced.
	UID string `bson:"uid" json:"uid"`
}

Subject contains a reference to the object or user identities a role binding applies to.

type SubjectKind

type SubjectKind string

type WorkflowCIItem added in v1.18.0

type WorkflowCIItem struct {
	WorkflowType string `bson:"workflow_type" json:"workflow_type"`
	Name         string `bson:"name"               json:"name"`
	// workflow display name, it can be modified by users, so we don't save it.
	DisplayName       string            `bson:"-"                  json:"display_name"`
	BaseName          string            `bson:"base_name"          json:"base_name"`
	CollaborationType CollaborationType `bson:"collaboration_type" json:"collaboration_type"`
	Verbs             []string          `bson:"verbs"              json:"verbs"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL