service

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const PresetScope = ""
View Source
const SystemScope = "*"

Variables

This section is empty.

Functions

func CreateOrUpdatePolicyRegistration added in v1.7.0

func CreateOrUpdatePolicyRegistration(p *types.PolicyMeta, _ *zap.SugaredLogger) error

func CreateOrUpdateSystemPolicyBinding added in v1.10.0

func CreateOrUpdateSystemPolicyBinding(ns string, rb *PolicyBinding, logger *zap.SugaredLogger) error

func CreateOrUpdateSystemRoleBinding added in v1.7.0

func CreateOrUpdateSystemRoleBinding(ns string, rb *RoleBinding, logger *zap.SugaredLogger) error

func CreatePolicies added in v1.10.0

func CreatePolicies(ns string, policies []*Policy, _ *zap.SugaredLogger) error

func CreatePolicy added in v1.10.0

func CreatePolicy(ns string, policy *Policy, _ *zap.SugaredLogger) error

func CreatePolicyBindings added in v1.10.0

func CreatePolicyBindings(ns string, rbs []*PolicyBinding, logger *zap.SugaredLogger) error

func CreateRole

func CreateRole(ns string, role *Role, _ *zap.SugaredLogger) error

func CreateRoleBindings added in v1.7.0

func CreateRoleBindings(ns string, rbs []*RoleBinding, logger *zap.SugaredLogger) error

func DeletePolicies added in v1.10.0

func DeletePolicies(names []string, projectName string, logger *zap.SugaredLogger) error

func DeletePolicy added in v1.10.0

func DeletePolicy(name string, projectName string, logger *zap.SugaredLogger) error

func DeletePolicyBinding added in v1.10.0

func DeletePolicyBinding(name string, projectName string, _ *zap.SugaredLogger) error

func DeletePolicyBindings added in v1.10.0

func DeletePolicyBindings(names []string, projectName string, userID string, _ *zap.SugaredLogger) error

func DeleteRole added in v1.7.0

func DeleteRole(name string, projectName string, logger *zap.SugaredLogger) error

func DeleteRoleBinding added in v1.7.0

func DeleteRoleBinding(name string, projectName string, _ *zap.SugaredLogger) error

func DeleteRoleBindings added in v1.7.0

func DeleteRoleBindings(names []string, projectName string, userID string, _ *zap.SugaredLogger) error

func DeleteRoles added in v1.7.0

func DeleteRoles(names []string, projectName string, logger *zap.SugaredLogger) error

func GetResourcesPermission added in v1.10.0

func GetResourcesPermission(uid string, projectName string, resourceType string, resources []string, logger *zap.SugaredLogger) (map[string][]string, error)

GetResourcesPermission get resources action list for frontend to show icon

func ListUserAllPoliciesByPolicyBindings added in v1.12.0

func ListUserAllPoliciesByPolicyBindings(policyBindings []*models.PolicyBinding) ([]*models.Policy, error)

func ListUserAllRoleBindings added in v1.10.0

func ListUserAllRoleBindings(projectName, uid string) ([]*models.RoleBinding, error)

func ListUserAllRolesByRoleBindings added in v1.10.0

func ListUserAllRolesByRoleBindings(roleBindings []*models.RoleBinding) ([]*models.Role, error)

func SearchSystemRoleBindings added in v1.12.0

func SearchSystemRoleBindings(uids []string, _ *zap.SugaredLogger) (map[string][]*RoleBinding, error)

func UpdateOrCreatePolicy added in v1.10.0

func UpdateOrCreatePolicy(ns string, policy *Policy, _ *zap.SugaredLogger) error

func UpdateOrCreatePolicyBinding added in v1.10.0

func UpdateOrCreatePolicyBinding(ns string, rb *PolicyBinding, logger *zap.SugaredLogger) error

func UpdateOrCreateRole added in v1.7.0

func UpdateOrCreateRole(ns string, role *Role, _ *zap.SugaredLogger) error

func UpdateOrCreateRoleBinding added in v1.7.0

func UpdateOrCreateRoleBinding(ns string, rb *RoleBinding, logger *zap.SugaredLogger) error

func UpdatePolicy added in v1.10.0

func UpdatePolicy(ns string, policy *Policy, log *zap.SugaredLogger) error

func UpdateRole added in v1.7.0

func UpdateRole(ns string, role *Role, _ *zap.SugaredLogger) error

func UpdateRoleBindings added in v1.10.0

func UpdateRoleBindings(ns string, rbs []*RoleBinding, userID string, logger *zap.SugaredLogger) error

Types

type GetUserRulesByProjectResp added in v1.12.0

type GetUserRulesByProjectResp struct {
	IsSystemAdmin       bool                `json:"is_system_admin"`
	IsProjectAdmin      bool                `json:"is_project_admin"`
	ProjectVerbs        []string            `json:"project_verbs"`
	WorkflowVerbsMap    map[string][]string `json:"workflow_verbs_map"`
	EnvironmentVerbsMap map[string][]string `json:"environment_verbs_map"`
}

func GetUserRulesByProject added in v1.12.0

func GetUserRulesByProject(uid string, projectName string, log *zap.SugaredLogger) (*GetUserRulesByProjectResp, error)

type GetUserRulesResp added in v1.12.0

type GetUserRulesResp struct {
	IsSystemAdmin    bool                `json:"is_system_admin"`
	ProjectAdminList []string            `json:"project_admin_list"`
	ProjectVerbMap   map[string][]string `json:"project_verb_map"`
	SystemVerbs      []string            `json:"system_verbs"`
}

func GetUserRules added in v1.12.0

func GetUserRules(uid string, log *zap.SugaredLogger) (*GetUserRulesResp, error)

type ListPolicyResp added in v1.10.0

type ListPolicyResp struct {
	Policies []Policy `json:"policies"`
}

type Policy added in v1.7.0

type Policy struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	UpdateTime  int64   `json:"update_time"`
	Rules       []*Rule `json:"rules,omitempty"`
}

func GetPolicies added in v1.10.0

func GetPolicies(names string, log *zap.SugaredLogger) ([]*Policy, error)

func GetPolicy added in v1.10.0

func GetPolicy(ns, name string, log *zap.SugaredLogger) (*Policy, error)

func ListPolicies added in v1.10.0

func ListPolicies(projectName string, _ *zap.SugaredLogger) ([]*Policy, error)

type PolicyBinding added in v1.10.0

type PolicyBinding struct {
	Name   string               `json:"name"`
	UID    string               `json:"uid"`
	Policy string               `json:"policy"`
	Preset bool                 `json:"preset"`
	Type   setting.ResourceType `json:"type"`
}

func ListPolicyBindings added in v1.10.0

func ListPolicyBindings(ns, uid string, _ *zap.SugaredLogger) ([]*PolicyBinding, error)

func ListPolicyBindingsByPolicy added in v1.10.0

func ListPolicyBindingsByPolicy(ns, policyName string, publicPolicy bool, _ *zap.SugaredLogger) ([]*PolicyBinding, error)

type PolicyDefinition added in v1.7.0

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

func GetPolicyRegistrationDefinitions added in v1.7.0

func GetPolicyRegistrationDefinitions(scope, envType string, _ *zap.SugaredLogger) ([]*PolicyDefinition, error)

type PolicyRuleDefinition added in v1.7.0

type PolicyRuleDefinition struct {
	Action      string `json:"action"`
	Alias       string `json:"alias"`
	Description string `json:"description"`
}

type Role

type Role struct {
	Name  string  `json:"name"`
	Rules []*Rule `json:"rules,omitempty"`
	// if the role is created by user , set the type to "custom"
	// if the role is created by system , set the type  to "system"
	Type setting.ResourceType `json:"type,omitempty"`
	// frontend default select flag
	Select    bool   `json:"select,omitempty"`
	Namespace string `json:"namespace"`
	Desc      string `json:"desc,omitempty"`
}

func GetRole added in v1.7.0

func GetRole(ns, name string, _ *zap.SugaredLogger) (*Role, error)

func ListRoles added in v1.7.0

func ListRoles(projectName string, _ *zap.SugaredLogger) ([]*Role, error)

type RoleBinding

type RoleBinding struct {
	Name   string               `json:"name"`
	UID    string               `json:"uid"`
	Role   string               `json:"role"`
	Preset bool                 `json:"preset"`
	Type   setting.ResourceType `json:"type"`
}

func ListRoleBindings added in v1.7.0

func ListRoleBindings(ns, uid string, _ *zap.SugaredLogger) ([]*RoleBinding, error)

type Rule added in v1.7.0

type Rule struct {
	Verbs            []string                `json:"verbs"`
	Resources        []string                `json:"resources"`
	Kind             string                  `json:"kind"`
	MatchAttributes  []models.MatchAttribute `json:"match_attributes"`
	RelatedResources []string                `json:"related_resources"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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