Documentation
¶
Index ¶
- Constants
- Variables
- type CheckAccessResult
- type RbacConfig
- func (m *RbacConfig) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *RbacConfig) CloneVT() *RbacConfig
- func (this *RbacConfig) EqualMessageVT(thatMsg any) bool
- func (this *RbacConfig) EqualVT(that *RbacConfig) bool
- func (x *RbacConfig) GetBindings() []*RbacRoleBinding
- func (x *RbacConfig) GetRoles() []*RbacRole
- func (x *RbacConfig) MarshalJSON() ([]byte, error)
- func (x *RbacConfig) MarshalProtoJSON(s *json.MarshalState)
- func (x *RbacConfig) MarshalProtoText() string
- func (m *RbacConfig) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RbacConfig) MarshalToVT(dAtA []byte) (int, error)
- func (m *RbacConfig) MarshalVT() (dAtA []byte, err error)
- func (*RbacConfig) ProtoMessage()
- func (x *RbacConfig) Reset()
- func (m *RbacConfig) SizeVT() (n int)
- func (x *RbacConfig) String() string
- func (x *RbacConfig) UnmarshalJSON(b []byte) error
- func (x *RbacConfig) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *RbacConfig) UnmarshalVT(dAtA []byte) error
- type RbacRole
- func (m *RbacRole) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *RbacRole) CloneVT() *RbacRole
- func (this *RbacRole) EqualMessageVT(thatMsg any) bool
- func (this *RbacRole) EqualVT(that *RbacRole) bool
- func (x *RbacRole) GetBuiltin() bool
- func (x *RbacRole) GetDisplayName() string
- func (x *RbacRole) GetId() string
- func (x *RbacRole) GetRules() []*RbacRule
- func (x *RbacRole) MarshalJSON() ([]byte, error)
- func (x *RbacRole) MarshalProtoJSON(s *json.MarshalState)
- func (x *RbacRole) MarshalProtoText() string
- func (m *RbacRole) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RbacRole) MarshalToVT(dAtA []byte) (int, error)
- func (m *RbacRole) MarshalVT() (dAtA []byte, err error)
- func (*RbacRole) ProtoMessage()
- func (x *RbacRole) Reset()
- func (m *RbacRole) SizeVT() (n int)
- func (x *RbacRole) String() string
- func (x *RbacRole) UnmarshalJSON(b []byte) error
- func (x *RbacRole) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *RbacRole) UnmarshalVT(dAtA []byte) error
- type RbacRoleBinding
- func (m *RbacRoleBinding) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *RbacRoleBinding) CloneVT() *RbacRoleBinding
- func (this *RbacRoleBinding) EqualMessageVT(thatMsg any) bool
- func (this *RbacRoleBinding) EqualVT(that *RbacRoleBinding) bool
- func (x *RbacRoleBinding) GetCreatedAt() int64
- func (x *RbacRoleBinding) GetId() string
- func (x *RbacRoleBinding) GetRoleId() string
- func (x *RbacRoleBinding) GetScope() RbacScope
- func (x *RbacRoleBinding) GetScopeId() string
- func (x *RbacRoleBinding) GetSubjectId() string
- func (x *RbacRoleBinding) MarshalJSON() ([]byte, error)
- func (x *RbacRoleBinding) MarshalProtoJSON(s *json.MarshalState)
- func (x *RbacRoleBinding) MarshalProtoText() string
- func (m *RbacRoleBinding) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RbacRoleBinding) MarshalToVT(dAtA []byte) (int, error)
- func (m *RbacRoleBinding) MarshalVT() (dAtA []byte, err error)
- func (*RbacRoleBinding) ProtoMessage()
- func (x *RbacRoleBinding) Reset()
- func (m *RbacRoleBinding) SizeVT() (n int)
- func (x *RbacRoleBinding) String() string
- func (x *RbacRoleBinding) UnmarshalJSON(b []byte) error
- func (x *RbacRoleBinding) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *RbacRoleBinding) UnmarshalVT(dAtA []byte) error
- type RbacRule
- func (m *RbacRule) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *RbacRule) CloneVT() *RbacRule
- func (this *RbacRule) EqualMessageVT(thatMsg any) bool
- func (this *RbacRule) EqualVT(that *RbacRule) bool
- func (x *RbacRule) GetResourceType() string
- func (x *RbacRule) GetVerbs() []string
- func (x *RbacRule) MarshalJSON() ([]byte, error)
- func (x *RbacRule) MarshalProtoJSON(s *json.MarshalState)
- func (x *RbacRule) MarshalProtoText() string
- func (m *RbacRule) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RbacRule) MarshalToVT(dAtA []byte) (int, error)
- func (m *RbacRule) MarshalVT() (dAtA []byte, err error)
- func (*RbacRule) ProtoMessage()
- func (x *RbacRule) Reset()
- func (m *RbacRule) SizeVT() (n int)
- func (x *RbacRule) String() string
- func (x *RbacRule) UnmarshalJSON(b []byte) error
- func (x *RbacRule) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *RbacRule) UnmarshalVT(dAtA []byte) error
- type RbacScope
- func (x RbacScope) Enum() *RbacScope
- func (x RbacScope) MarshalJSON() ([]byte, error)
- func (x RbacScope) MarshalProtoJSON(s *json.MarshalState)
- func (x RbacScope) MarshalProtoText() string
- func (x RbacScope) MarshalText() ([]byte, error)
- func (x RbacScope) String() string
- func (x *RbacScope) UnmarshalJSON(b []byte) error
- func (x *RbacScope) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *RbacScope) UnmarshalText(b []byte) error
Constants ¶
const ( RoleAdmin = "admin" RoleSubscriber = "subscriber" RoleSubscriberReadonly = "subscriber_readonly" RoleOwner = "owner" RoleEditor = "editor" RoleViewer = "viewer" )
Built-in role IDs.
const ( ResourceTypeBlockStore = "BlockStore" ResourceTypeOrganization = "Organization" ResourceTypeBillingAccount = "BillingAccount" ResourceTypeSession = "Session" ResourceTypePlatform = "Platform" )
Resource type constants.
const ( VerbRead = "read" VerbWriteOps = "write_ops" VerbValidate = "validate" VerbManageConfig = "manage_config" VerbTransfer = "transfer" )
SharedObject verbs.
const ( VerbPush = "push" VerbPull = "pull" VerbManage = "manage" )
BlockStore verbs.
const ( VerbView = "view" VerbManageMembers = "manage_members" VerbManageBilling = "manage_billing" VerbManageSpaces = "manage_spaces" )
Organization verbs.
const ( VerbManageSubscription = "manage_subscription" VerbManagePayment = "manage_payment" )
BillingAccount verbs.
const ( VerbCreate = "create" VerbRevoke = "revoke" )
Session verbs.
const VerbAdmin = "admin"
Platform verbs.
const VerbWildcard = "*"
VerbWildcard grants all verbs for a resource type.
Variables ¶
var ( RbacScope_name = map[int32]string{ 0: "RBAC_SCOPE_UNKNOWN", 1: "RBAC_SCOPE_PLATFORM", 2: "RBAC_SCOPE_ORGANIZATION", 3: "RBAC_SCOPE_RESOURCE", } RbacScope_value = map[string]int32{ "RBAC_SCOPE_UNKNOWN": 0, "RBAC_SCOPE_PLATFORM": 1, "RBAC_SCOPE_ORGANIZATION": 2, "RBAC_SCOPE_RESOURCE": 3, } )
Enum value maps for RbacScope.
var SOParticipantRoleRequiredVerbs = map[int32][]string{ 4: {VerbRead, VerbWriteOps, VerbValidate, VerbManageConfig}, 3: {VerbRead, VerbWriteOps, VerbValidate}, 2: {VerbRead, VerbWriteOps}, 1: {VerbRead}, }
SOParticipantRoleRequiredVerbs maps SOParticipantRole enum values to the RBAC verbs required for the verb containment check.
var SOParticipantRoleToRbacRole = map[int32]string{ 4: RoleOwner, 3: RoleEditor, 2: RoleEditor, 1: RoleViewer, }
SOParticipantRoleToRbacRole maps SOParticipantRole enum values to RBAC role IDs for syncRoleBindings.
Functions ¶
This section is empty.
Types ¶
type CheckAccessResult ¶
type CheckAccessResult struct {
// Allowed indicates whether access is granted.
Allowed bool
// MatchedBinding is the binding that granted access.
MatchedBinding *RbacRoleBinding
}
CheckAccessResult is the result of an access check.
func CheckAccess ¶
func CheckAccess( roles []*RbacRole, bindings []*RbacRoleBinding, resourceType string, verb string, ) CheckAccessResult
CheckAccess evaluates whether the subject has the given verb on resourceType within the provided bindings and roles.
type RbacConfig ¶
type RbacConfig struct {
// roles is the list of roles.
Roles []*RbacRole `protobuf:"bytes,1,rep,name=roles,proto3" json:"roles,omitempty"`
// bindings is the list of role bindings.
Bindings []*RbacRoleBinding `protobuf:"bytes,2,rep,name=bindings,proto3" json:"bindings,omitempty"`
// contains filtered or unexported fields
}
RbacConfig contains a set of roles and bindings.
func (*RbacConfig) CloneMessageVT ¶
func (m *RbacConfig) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*RbacConfig) CloneVT ¶
func (m *RbacConfig) CloneVT() *RbacConfig
func (*RbacConfig) EqualMessageVT ¶
func (this *RbacConfig) EqualMessageVT(thatMsg any) bool
func (*RbacConfig) EqualVT ¶
func (this *RbacConfig) EqualVT(that *RbacConfig) bool
func (*RbacConfig) GetBindings ¶
func (x *RbacConfig) GetBindings() []*RbacRoleBinding
func (*RbacConfig) GetRoles ¶
func (x *RbacConfig) GetRoles() []*RbacRole
func (*RbacConfig) MarshalJSON ¶
func (x *RbacConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshals the RbacConfig to JSON.
func (*RbacConfig) MarshalProtoJSON ¶
func (x *RbacConfig) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the RbacConfig message to JSON.
func (*RbacConfig) MarshalProtoText ¶
func (x *RbacConfig) MarshalProtoText() string
func (*RbacConfig) MarshalToSizedBufferVT ¶
func (m *RbacConfig) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*RbacConfig) MarshalToVT ¶
func (m *RbacConfig) MarshalToVT(dAtA []byte) (int, error)
func (*RbacConfig) MarshalVT ¶
func (m *RbacConfig) MarshalVT() (dAtA []byte, err error)
func (*RbacConfig) ProtoMessage ¶
func (*RbacConfig) ProtoMessage()
func (*RbacConfig) Reset ¶
func (x *RbacConfig) Reset()
func (*RbacConfig) SizeVT ¶
func (m *RbacConfig) SizeVT() (n int)
func (*RbacConfig) String ¶
func (x *RbacConfig) String() string
func (*RbacConfig) UnmarshalJSON ¶
func (x *RbacConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the RbacConfig from JSON.
func (*RbacConfig) UnmarshalProtoJSON ¶
func (x *RbacConfig) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the RbacConfig message from JSON.
func (*RbacConfig) UnmarshalVT ¶
func (m *RbacConfig) UnmarshalVT(dAtA []byte) error
type RbacRole ¶
type RbacRole struct {
// id is the unique identifier for this role.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// display_name is the human-readable name.
DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"displayName,omitempty"`
// rules is the list of permission rules in this role.
Rules []*RbacRule `protobuf:"bytes,3,rep,name=rules,proto3" json:"rules,omitempty"`
// builtin indicates this role is system-defined.
Builtin bool `protobuf:"varint,4,opt,name=builtin,proto3" json:"builtin,omitempty"`
// contains filtered or unexported fields
}
RbacRole defines a named collection of permission rules.
func BuiltinRoles ¶
func BuiltinRoles() []*RbacRole
BuiltinRoles returns all built-in role definitions.
func (*RbacRole) CloneMessageVT ¶
func (m *RbacRole) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*RbacRole) EqualMessageVT ¶
func (*RbacRole) GetBuiltin ¶
func (*RbacRole) GetDisplayName ¶
func (*RbacRole) MarshalJSON ¶
MarshalJSON marshals the RbacRole to JSON.
func (*RbacRole) MarshalProtoJSON ¶
func (x *RbacRole) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the RbacRole message to JSON.
func (*RbacRole) MarshalProtoText ¶
func (*RbacRole) MarshalToSizedBufferVT ¶
func (*RbacRole) ProtoMessage ¶
func (*RbacRole) ProtoMessage()
func (*RbacRole) UnmarshalJSON ¶
UnmarshalJSON unmarshals the RbacRole from JSON.
func (*RbacRole) UnmarshalProtoJSON ¶
func (x *RbacRole) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the RbacRole message from JSON.
func (*RbacRole) UnmarshalVT ¶
type RbacRoleBinding ¶
type RbacRoleBinding struct {
// id is the unique identifier for this binding.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// role_id is the role being bound.
RoleId string `protobuf:"bytes,2,opt,name=role_id,json=roleId,proto3" json:"roleId,omitempty"`
// subject_id is the account receiving the role.
SubjectId string `protobuf:"bytes,3,opt,name=subject_id,json=subjectId,proto3" json:"subjectId,omitempty"`
// scope is the scope level of this binding.
Scope RbacScope `protobuf:"varint,4,opt,name=scope,proto3" json:"scope,omitempty"`
// scope_id is the target ID for org/resource scope (empty for platform).
ScopeId string `protobuf:"bytes,5,opt,name=scope_id,json=scopeId,proto3" json:"scopeId,omitempty"`
// created_at is the creation timestamp in milliseconds.
CreatedAt int64 `protobuf:"varint,6,opt,name=created_at,json=createdAt,proto3" json:"createdAt,omitempty"`
// contains filtered or unexported fields
}
RbacRoleBinding binds a role to a subject within a scope.
func (*RbacRoleBinding) CloneMessageVT ¶
func (m *RbacRoleBinding) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*RbacRoleBinding) CloneVT ¶
func (m *RbacRoleBinding) CloneVT() *RbacRoleBinding
func (*RbacRoleBinding) EqualMessageVT ¶
func (this *RbacRoleBinding) EqualMessageVT(thatMsg any) bool
func (*RbacRoleBinding) EqualVT ¶
func (this *RbacRoleBinding) EqualVT(that *RbacRoleBinding) bool
func (*RbacRoleBinding) GetCreatedAt ¶
func (x *RbacRoleBinding) GetCreatedAt() int64
func (*RbacRoleBinding) GetId ¶
func (x *RbacRoleBinding) GetId() string
func (*RbacRoleBinding) GetRoleId ¶
func (x *RbacRoleBinding) GetRoleId() string
func (*RbacRoleBinding) GetScope ¶
func (x *RbacRoleBinding) GetScope() RbacScope
func (*RbacRoleBinding) GetScopeId ¶
func (x *RbacRoleBinding) GetScopeId() string
func (*RbacRoleBinding) GetSubjectId ¶
func (x *RbacRoleBinding) GetSubjectId() string
func (*RbacRoleBinding) MarshalJSON ¶
func (x *RbacRoleBinding) MarshalJSON() ([]byte, error)
MarshalJSON marshals the RbacRoleBinding to JSON.
func (*RbacRoleBinding) MarshalProtoJSON ¶
func (x *RbacRoleBinding) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the RbacRoleBinding message to JSON.
func (*RbacRoleBinding) MarshalProtoText ¶
func (x *RbacRoleBinding) MarshalProtoText() string
func (*RbacRoleBinding) MarshalToSizedBufferVT ¶
func (m *RbacRoleBinding) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*RbacRoleBinding) MarshalToVT ¶
func (m *RbacRoleBinding) MarshalToVT(dAtA []byte) (int, error)
func (*RbacRoleBinding) MarshalVT ¶
func (m *RbacRoleBinding) MarshalVT() (dAtA []byte, err error)
func (*RbacRoleBinding) ProtoMessage ¶
func (*RbacRoleBinding) ProtoMessage()
func (*RbacRoleBinding) Reset ¶
func (x *RbacRoleBinding) Reset()
func (*RbacRoleBinding) SizeVT ¶
func (m *RbacRoleBinding) SizeVT() (n int)
func (*RbacRoleBinding) String ¶
func (x *RbacRoleBinding) String() string
func (*RbacRoleBinding) UnmarshalJSON ¶
func (x *RbacRoleBinding) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the RbacRoleBinding from JSON.
func (*RbacRoleBinding) UnmarshalProtoJSON ¶
func (x *RbacRoleBinding) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the RbacRoleBinding message from JSON.
func (*RbacRoleBinding) UnmarshalVT ¶
func (m *RbacRoleBinding) UnmarshalVT(dAtA []byte) error
type RbacRule ¶
type RbacRule struct {
// resource_type is the type of resource this rule applies to.
ResourceType string `protobuf:"bytes,1,opt,name=resource_type,json=resourceType,proto3" json:"resourceType,omitempty"`
// verbs is the list of allowed verbs (or "*" for all).
Verbs []string `protobuf:"bytes,2,rep,name=verbs,proto3" json:"verbs,omitempty"`
// contains filtered or unexported fields
}
RbacRule defines a permission rule granting verbs on a resource type.
func (*RbacRule) CloneMessageVT ¶
func (m *RbacRule) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*RbacRule) EqualMessageVT ¶
func (*RbacRule) GetResourceType ¶
func (*RbacRule) MarshalJSON ¶
MarshalJSON marshals the RbacRule to JSON.
func (*RbacRule) MarshalProtoJSON ¶
func (x *RbacRule) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the RbacRule message to JSON.
func (*RbacRule) MarshalProtoText ¶
func (*RbacRule) MarshalToSizedBufferVT ¶
func (*RbacRule) ProtoMessage ¶
func (*RbacRule) ProtoMessage()
func (*RbacRule) UnmarshalJSON ¶
UnmarshalJSON unmarshals the RbacRule from JSON.
func (*RbacRule) UnmarshalProtoJSON ¶
func (x *RbacRule) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the RbacRule message from JSON.
func (*RbacRule) UnmarshalVT ¶
type RbacScope ¶
type RbacScope int32
RbacScope defines the scope level for role bindings.
func (RbacScope) MarshalJSON ¶
MarshalJSON marshals the RbacScope to JSON.
func (RbacScope) MarshalProtoJSON ¶
func (x RbacScope) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the RbacScope to JSON.
func (RbacScope) MarshalProtoText ¶
func (RbacScope) MarshalText ¶
MarshalText marshals the RbacScope to text.
func (*RbacScope) UnmarshalJSON ¶
UnmarshalJSON unmarshals the RbacScope from JSON.
func (*RbacScope) UnmarshalProtoJSON ¶
func (x *RbacScope) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the RbacScope from JSON.
func (*RbacScope) UnmarshalText ¶
UnmarshalText unmarshals the RbacScope from text.