models

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodAll    = "*"
	KindResource = "resource"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionRule added in v1.7.0

type ActionRule struct {
	Method   string `bson:"method"   json:"method"`
	Endpoint string `bson:"endpoint" json:"endpoint"`
}

type Policy added in v1.7.0

type Policy struct {
	Resource    string        `bson:"resource"    json:"resource"`
	Alias       string        `bson:"alias"       json:"alias"`
	Description string        `bson:"description" json:"description"`
	Rules       []*PolicyRule `bson:"rules"       json:"rules"`
}

func (Policy) TableName added in v1.7.0

func (Policy) TableName() string

type PolicyRule

type PolicyRule struct {
	Action      string        `bson:"action"      json:"action"`
	Alias       string        `bson:"alias"       json:"alias"`
	Description string        `bson:"description" json:"description"`
	Rules       []*ActionRule `bson:"rules"       json:"rules"`
}

type Role

type Role struct {
	Name      string  `bson:"name"      json:"name"`
	Namespace string  `bson:"namespace" json:"namespace"`
	Rules     []*Rule `bson:"rules"     json:"rules"`
}

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"`
}

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
const (
	UserKind  SubjectKind = "user"
	GroupKind SubjectKind = "group"
)

Jump to

Keyboard shortcuts

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