Documentation ¶
Index ¶
- Constants
- func ErrorToHTTPStatus(err error) int
- func IPInRange(ipAddress string, cidr string) (bool, error)
- func IsLoopback(ipAddress string) (bool, error)
- func IsMulticast(ipAddress string) (bool, error)
- func IsTimeInRange(currentTimeStr string, startTimeStr string, endTimeStr string) bool
- func ParseTemplate(templateStr string, principal *PrincipalExt, resource *types.Resource, ...) ([]byte, error)
- func TemplateFuncs(principal *PrincipalExt, req *services.AuthRequest) template.FuncMap
- type AuthError
- type AuthServiceProvider
- type ClientType
- type Closeable
- type Config
- func (c *Config) ACLModelFile() (string, error)
- func (c *Config) ACLPolicyFile() (string, error)
- func (c *Config) CAFile() (string, error)
- func (c *Config) ClientCertFile() (string, error)
- func (c *Config) ClientKeyFile() (string, error)
- func (c *Config) ClientNobodyCertFile() (string, error)
- func (c *Config) ClientNobodyKeyFile() (string, error)
- func (c *Config) ClientRootCertFile() (string, error)
- func (c *Config) ClientRootKeyFile() (string, error)
- func (c *Config) ServerCertFile() (string, error)
- func (c *Config) ServerKeyFile() (string, error)
- func (c *Config) SetupTLSClient() (tlsConfig *tls.Config, err error)
- func (c *Config) SetupTLSServer(addr string) (tlsConfig *tls.Config, err error)
- func (c *Config) TLSClient() (tlsC TLSConfig, err error)
- func (c *Config) TLSNobodyClient() (tlsC TLSConfig, err error)
- func (c *Config) TLSRootClient() (tlsC TLSConfig, err error)
- func (c *Config) Validate() error
- type DatabaseError
- type DuplicateError
- type DynamoDBConfig
- type Factory
- type GroupBuilder
- type GroupExt
- type HashIndex
- type InternalError
- type MarshalError
- type NotFoundError
- type OrganizationBuilder
- func (b *OrganizationBuilder) Build() (*types.Organization, error)
- func (b *OrganizationBuilder) WithId(id string) *OrganizationBuilder
- func (b *OrganizationBuilder) WithName(name string) *OrganizationBuilder
- func (b *OrganizationBuilder) WithNamespaces(namespaces ...string) *OrganizationBuilder
- func (b *OrganizationBuilder) WithUrl(url string) *OrganizationBuilder
- type OrganizationExt
- type PermissionBuilder
- func (b *PermissionBuilder) Build() (*types.Permission, error)
- func (b *PermissionBuilder) WithActions(actions ...string) *PermissionBuilder
- func (b *PermissionBuilder) WithConstraints(constraints string) *PermissionBuilder
- func (b *PermissionBuilder) WithEffect(effect types.Effect) *PermissionBuilder
- func (b *PermissionBuilder) WithNamespace(namespace string) *PermissionBuilder
- func (b *PermissionBuilder) WithResourceId(resourceID string) *PermissionBuilder
- func (b *PermissionBuilder) WithScope(scope string) *PermissionBuilder
- type PermissionExt
- type PersistenceProvider
- type PrincipalBuilder
- func (b *PrincipalBuilder) Build() (*types.Principal, error)
- func (b *PrincipalBuilder) WithAttribute(name string, val string) *PrincipalBuilder
- func (b *PrincipalBuilder) WithEmail(email string) *PrincipalBuilder
- func (b *PrincipalBuilder) WithName(name string) *PrincipalBuilder
- func (b *PrincipalBuilder) WithNamespaces(namespaces ...string) *PrincipalBuilder
- func (b *PrincipalBuilder) WithOrganizationId(id string) *PrincipalBuilder
- func (b *PrincipalBuilder) WithUsername(username string) *PrincipalBuilder
- type PrincipalExt
- func (x *PrincipalExt) AddPermission(perm *types.Permission) error
- func (x *PrincipalExt) AllPermissions() (res []*types.Permission)
- func (x *PrincipalExt) CheckConstraints(req *services.AuthRequest, resource *types.Resource, constraints string) (bool, string, error)
- func (x *PrincipalExt) CheckPermission(req *services.AuthRequest) (res *services.AuthResponse, err error)
- func (x *PrincipalExt) GroupHashIndex() string
- func (x *PrincipalExt) GroupNames() (res []string)
- func (x *PrincipalExt) Groups() (res []*types.Group)
- func (x *PrincipalExt) Hash() string
- func (x *PrincipalExt) LatestGroupRoleDate() (latestGroupRoleDate *timestamppb.Timestamp)
- func (x *PrincipalExt) RelationNames(resourceID string) (res []string)
- func (x *PrincipalExt) RelationNamesByResourceName(resourceName string) (res []string)
- func (x *PrincipalExt) Relations() (res []*types.Relationship)
- func (x *PrincipalExt) RelationsByResource(resourceID string) (res []*types.Relationship)
- func (x *PrincipalExt) ResourceByName(resourceName string) *types.Resource
- func (x *PrincipalExt) ResourceNames() (names []string)
- func (x *PrincipalExt) Resources() (res []*types.Resource)
- func (x *PrincipalExt) ResourcesByPartialNameAndAction(resourceName string, action string) (arr []*types.Resource)
- func (x *PrincipalExt) RoleHashIndex() string
- func (x *PrincipalExt) RoleNames() (res []string)
- func (x *PrincipalExt) Roles() (res []*types.Role)
- func (x *PrincipalExt) String() string
- func (x *PrincipalExt) ToGetPrincipalResponse() *services.GetPrincipalResponse
- func (x *PrincipalExt) ToMap(req *services.AuthRequest, resource *types.Resource) (res map[string]any)
- func (x *PrincipalExt) Validate() error
- type RedisConfig
- type RelationshipBuilder
- func (b *RelationshipBuilder) Build() (*types.Relationship, error)
- func (b *RelationshipBuilder) WithAttribute(name string, val string) *RelationshipBuilder
- func (b *RelationshipBuilder) WithNamespace(namespace string) *RelationshipBuilder
- func (b *RelationshipBuilder) WithPrincipalId(id string) *RelationshipBuilder
- func (b *RelationshipBuilder) WithRelation(relation string) *RelationshipBuilder
- func (b *RelationshipBuilder) WithResourceId(id string) *RelationshipBuilder
- type RelationshipExt
- type ResourceBuilder
- func (b *ResourceBuilder) Build() (*types.Resource, error)
- func (b *ResourceBuilder) WithAllowedActions(actions ...string) *ResourceBuilder
- func (b *ResourceBuilder) WithAttribute(name string, val string) *ResourceBuilder
- func (b *ResourceBuilder) WithCapacity(capacity int) *ResourceBuilder
- func (b *ResourceBuilder) WithName(name string) *ResourceBuilder
- func (b *ResourceBuilder) WithNamespace(namespace string) *ResourceBuilder
- type ResourceExt
- type ResourceInstanceExt
- type RoleBuilder
- type RoleExt
- type TLSConfig
- type ValidationError
Constants ¶
const ( // NotFoundCode error NotFoundCode string = "EC100404" // DuplicateCode error DuplicateCode string = "EC100409" // ValidationCode error ValidationCode string = "EC100400" // DatabaseCode error DatabaseCode string = "EC100510" // NetworkCode error NetworkCode string = "EC100511" // TemplateCode error TemplateCode string = "EC100512" // MarshalCode error MarshalCode string = "EC100511" // InternalCode error InternalCode string = "EC100599" // AuthCode error AuthCode string = "EC100401" // MultiplePermissionsMatchedCode error MultiplePermissionsMatchedCode string = "EC100451" // ConflictingPermissionsCode error ConflictingPermissionsCode string = "EC100452" )
const ( // RootClientType admin access RootClientType = ClientType("root") // NobodyClientType without any access NobodyClientType = ClientType("nobody") // DefaultClientType with specified access DefaultClientType = ClientType("client") )
const BytesInInt32 = 4
BytesInInt32 constant
const NextOffsetHeader = "X-Next-Offset"
Variables ¶
This section is empty.
Functions ¶
func IsLoopback ¶
IsLoopback checks if the provided IP address is a loopback address.
func IsMulticast ¶
IsMulticast checks if the provided IP address is a multicast address.
func IsTimeInRange ¶
IsTimeInRange checks if time is in range of start and end time.
func ParseTemplate ¶
func ParseTemplate( templateStr string, principal *PrincipalExt, resource *types.Resource, req *services.AuthRequest, ) ([]byte, error)
ParseTemplate parses GO template with dynamic parameters
func TemplateFuncs ¶
func TemplateFuncs( principal *PrincipalExt, req *services.AuthRequest, ) template.FuncMap
TemplateFuncs returns template functions
Types ¶
type AuthError ¶
type AuthError struct {
Message string
}
AuthError error
func NewAuthErrorWithCode ¶
NewAuthErrorWithCode constructor
type AuthServiceProvider ¶
type AuthServiceProvider string
AuthServiceProvider defines enum for auth service implementation
const ( // DatabaseAuthServiceProvider uses database based on PersistenceProvider DatabaseAuthServiceProvider AuthServiceProvider = "DATABASE" // GrpcAuthServiceProvider uses gRPC client based on PersistenceProvider GrpcAuthServiceProvider AuthServiceProvider = "GRPC" // HttpAuthServiceProvider uses HTTP client based on PersistenceProvider HttpAuthServiceProvider AuthServiceProvider = "HTTP" )
type Config ¶
type Config struct { Redis RedisConfig `yaml:"redis" env:"REDIS"` DynamoDB DynamoDBConfig `yaml:"ddb" env:"DYNAMODB"` GrpcSasl bool `yaml:"grpc_sasl"` GrpcListenPort string `yaml:"grpc_listen_port" env:"GRPC_PORT"` HttpListenPort string `yaml:"http_listen_port" env:"HTTP_PORT"` ResourceInstanceExpiration time.Duration `yaml:"resource_instance_expiration"` HttpClientTimeout time.Duration `yaml:"http_client_timeout"` Debug bool `yaml:"debug"` Dir string `yaml:"dir" env:"CONFIG_DIR"` PersistenceProvider PersistenceProvider `yaml:"persistence_provider" env:"PERSISTENCE_PROVIDER"` AuthServiceProvider AuthServiceProvider `yaml:"auth_service_provider" env:"AUTH_SERVICE_PROVIDER"` MaxCacheSize int `yaml:"max_cache_size"` CacheExpirationMillis int `yaml:"cache_expiration_millis"` MaxGroupRoleLevels int `yaml:"max_group_role_levels"` ProxyURL string `yaml:"proxy_url"` Version *version.Info `yaml:"-"` }
Config -- Default Config
func (*Config) ACLModelFile ¶
func (*Config) ACLPolicyFile ¶
func (*Config) ClientCertFile ¶
func (*Config) ClientKeyFile ¶
func (*Config) ClientNobodyCertFile ¶
func (*Config) ClientNobodyKeyFile ¶
func (*Config) ClientRootCertFile ¶
func (*Config) ClientRootKeyFile ¶
func (*Config) ServerCertFile ¶
func (*Config) ServerKeyFile ¶
func (*Config) SetupTLSClient ¶
func (*Config) SetupTLSServer ¶
func (*Config) TLSNobodyClient ¶
func (*Config) TLSRootClient ¶
type DatabaseError ¶
type DatabaseError struct {
Message string
}
DatabaseError error
func NewDatabaseError ¶
func NewDatabaseError(msg string) *DatabaseError
NewDatabaseError constructor
func (*DatabaseError) Error ¶
func (e *DatabaseError) Error() string
type DuplicateError ¶
type DuplicateError struct {
Message string
}
DuplicateError error
func NewDuplicateError ¶
func NewDuplicateError(msg string) *DuplicateError
NewDuplicateError constructor
func (*DuplicateError) Error ¶
func (e *DuplicateError) Error() string
type DynamoDBConfig ¶
type DynamoDBConfig struct { AutoCreateTables bool `yaml:"auto_create_tables" mapstructure:"auto_create_tables"` TenantPartitionName string `yaml:"tenant_partition_name" mapstructure:"tenant_partition_name"` IDName string `yaml:"id_name" mapstructure:"id_name"` ReadCapacityUnits int64 `yaml:"read_capacity_units" mapstructure:"read_capacity_units"` WriteCapacityUnits int64 `yaml:"write_capacity_units" mapstructure:"write_capacity_units"` AWSRegion string `yaml:"aws_region" mapstructure:"aws_region"` Endpoint string `yaml:"endpoint" mapstructure:"endpoint" env:"DDB_ENDPOINT"` }
DynamoDBConfig config
type GroupBuilder ¶
type GroupBuilder struct { // Namespace of group. Namespace string // Name of the group. Name string // RoleIDs that are associated. RoleIds []string // Optional parent ids. ParentIds []string }
GroupBuilder - A collection of principals that are treated as a single unit for the purpose of granting permissions.
func (*GroupBuilder) WithName ¶
func (b *GroupBuilder) WithName(name string) *GroupBuilder
WithName setter
func (*GroupBuilder) WithNamespace ¶
func (b *GroupBuilder) WithNamespace(namespace string) *GroupBuilder
WithNamespace setter
func (*GroupBuilder) WithParentIds ¶
func (b *GroupBuilder) WithParentIds(ids ...string) *GroupBuilder
WithParentIds setter
type GroupExt ¶
GroupExt - A collection of principals that are treated as a single unit for the purpose of granting permissions.
type HashIndex ¶
type HashIndex struct { Hash string `json:"hash,omitempty"` Ids []string `json:"ids,omitempty"` Updated *timestamppb.Timestamp `json:"updated,omitempty"` }
HashIndex for indexing
func NewHashIndex ¶
NewHashIndex constructor
type InternalError ¶
type InternalError struct {
Message string
}
InternalError error
func NewInternalError ¶
func NewInternalError(msg string, code string) *InternalError
NewInternalError constructor
func (*InternalError) Error ¶
func (e *InternalError) Error() string
type MarshalError ¶
type MarshalError struct {
Message string
}
MarshalError error
func (*MarshalError) Error ¶
func (e *MarshalError) Error() string
type NotFoundError ¶
type NotFoundError struct {
Message string
}
NotFoundError error
func NewNotFoundError ¶
func NewNotFoundError(msg string) *NotFoundError
NewNotFoundError constructor
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type OrganizationBuilder ¶
type OrganizationBuilder struct { // ID unique identifier assigned to this organization. Id string // Name of organization. Name string // Allowed Namespaces for organization. Namespaces []string // url for organization. Url string }
OrganizationBuilder that owns roles, groups, relations, and principals for a given namespace.
func NewOrganizationBuilder ¶
func NewOrganizationBuilder() *OrganizationBuilder
NewOrganizationBuilder constructor
func (*OrganizationBuilder) Build ¶
func (b *OrganizationBuilder) Build() (*types.Organization, error)
Build helper
func (*OrganizationBuilder) WithId ¶
func (b *OrganizationBuilder) WithId(id string) *OrganizationBuilder
WithId setter
func (*OrganizationBuilder) WithName ¶
func (b *OrganizationBuilder) WithName(name string) *OrganizationBuilder
WithName setter
func (*OrganizationBuilder) WithNamespaces ¶
func (b *OrganizationBuilder) WithNamespaces(namespaces ...string) *OrganizationBuilder
WithNamespaces setter
func (*OrganizationBuilder) WithUrl ¶
func (b *OrganizationBuilder) WithUrl(url string) *OrganizationBuilder
WithUrl setter
type OrganizationExt ¶
type OrganizationExt struct {
Delegate *types.Organization
}
OrganizationExt that owns roles, groups, relations, and principals for a given namespace.
func NewOrganizationExt ¶
func NewOrganizationExt(delegate *types.Organization) *OrganizationExt
NewOrganizationExt constructor
func (*OrganizationExt) String ¶
func (x *OrganizationExt) String() string
type PermissionBuilder ¶
type PermissionBuilder struct { // Namespace of permission Namespace string // Scope for permission. Scope string // Actions that can be performed. Actions []string // Resource for the action. ResourceId string // Effect Permitted or Denied Effect types.Effect // Constraints expression with dynamic properties. Constraints string }
PermissionBuilder - An action that a principal is allowed to perform on a particular resource.
func NewPermissionBuilder ¶
func NewPermissionBuilder() *PermissionBuilder
NewPermissionBuilder constructor
func (*PermissionBuilder) Build ¶
func (b *PermissionBuilder) Build() (*types.Permission, error)
Build helper
func (*PermissionBuilder) WithActions ¶
func (b *PermissionBuilder) WithActions(actions ...string) *PermissionBuilder
WithActions setter
func (*PermissionBuilder) WithConstraints ¶
func (b *PermissionBuilder) WithConstraints(constraints string) *PermissionBuilder
WithConstraints setter
func (*PermissionBuilder) WithEffect ¶
func (b *PermissionBuilder) WithEffect(effect types.Effect) *PermissionBuilder
WithEffect setter
func (*PermissionBuilder) WithNamespace ¶
func (b *PermissionBuilder) WithNamespace(namespace string) *PermissionBuilder
WithNamespace setter
func (*PermissionBuilder) WithResourceId ¶
func (b *PermissionBuilder) WithResourceId(resourceID string) *PermissionBuilder
WithResourceId setter
func (*PermissionBuilder) WithScope ¶
func (b *PermissionBuilder) WithScope(scope string) *PermissionBuilder
WithScope setter
type PermissionExt ¶
type PermissionExt struct {
Delegate *types.Permission
}
PermissionExt - An action that a principal is allowed to perform on a particular resource.
func NewPermissionExt ¶
func NewPermissionExt(delegate *types.Permission) *PermissionExt
NewPermissionExt constructor
func (*PermissionExt) String ¶
func (x *PermissionExt) String() string
type PersistenceProvider ¶
type PersistenceProvider string
PersistenceProvider defines enum for persistence provider.
const ( // RedisPersistenceProvider uses redis RedisPersistenceProvider PersistenceProvider = "REDIS" // DynamoDBPersistenceProvider uses DynamoDB DynamoDBPersistenceProvider PersistenceProvider = "DYNAMODB" // MemoryPersistenceProvider uses in-memory MemoryPersistenceProvider PersistenceProvider = "MEMORY" )
type PrincipalBuilder ¶
type PrincipalBuilder struct { // OrganizationId of the principal user. OrganizationId string // Allowed Namespaces for organization. Namespaces []string // Username of the principal user. Username string // Name of the principal user. Name string // Email of the principal user. Email string // Attributes of principal Attributes map[string]string // Groups that the principal belongs to. GroupIds []string // Roles that the principal belongs to. RoleIds []string // Permissions that the principal belongs to. PermissionIds []string // Relationships that the principal belongs to. RelationIds []string }
PrincipalBuilder - The entity (which could be a user, system, or another service) that is making the request.
func NewPrincipalBuilder ¶
func NewPrincipalBuilder() *PrincipalBuilder
NewPrincipalBuilder constructor
func (*PrincipalBuilder) Build ¶
func (b *PrincipalBuilder) Build() (*types.Principal, error)
Build helper
func (*PrincipalBuilder) WithAttribute ¶
func (b *PrincipalBuilder) WithAttribute(name string, val string) *PrincipalBuilder
WithAttribute setter
func (*PrincipalBuilder) WithEmail ¶
func (b *PrincipalBuilder) WithEmail(email string) *PrincipalBuilder
WithEmail setter
func (*PrincipalBuilder) WithName ¶
func (b *PrincipalBuilder) WithName(name string) *PrincipalBuilder
WithName setter
func (*PrincipalBuilder) WithNamespaces ¶
func (b *PrincipalBuilder) WithNamespaces(namespaces ...string) *PrincipalBuilder
WithNamespaces setter
func (*PrincipalBuilder) WithOrganizationId ¶
func (b *PrincipalBuilder) WithOrganizationId(id string) *PrincipalBuilder
WithOrganizationId setter
func (*PrincipalBuilder) WithUsername ¶
func (b *PrincipalBuilder) WithUsername(username string) *PrincipalBuilder
WithUsername setter
type PrincipalExt ¶
type PrincipalExt struct { Delegate *types.Principal Organization *types.Organization GroupsByName map[string]*types.Group RolesByName map[string]*types.Role RelationsById map[string]*types.Relationship ResourcesById map[string]*types.Resource PermissionsByResourceName map[string]map[string]*types.Permission }
PrincipalExt - The entity (which could be a user, system, or another service) that is making the request.
func NewPrincipalExt ¶
func NewPrincipalExt(delegate *types.Principal) *PrincipalExt
NewPrincipalExt constructor
func NewPrincipalExtFromResponse ¶
func NewPrincipalExtFromResponse( res *services.GetPrincipalResponse, ) *PrincipalExt
func (*PrincipalExt) AddPermission ¶
func (x *PrincipalExt) AddPermission(perm *types.Permission) error
AddPermission helper
func (*PrincipalExt) AllPermissions ¶
func (x *PrincipalExt) AllPermissions() (res []*types.Permission)
AllPermissions Getter
func (*PrincipalExt) CheckConstraints ¶
func (x *PrincipalExt) CheckConstraints( req *services.AuthRequest, resource *types.Resource, constraints string) (bool, string, error)
func (*PrincipalExt) CheckPermission ¶
func (x *PrincipalExt) CheckPermission( req *services.AuthRequest, ) (res *services.AuthResponse, err error)
func (*PrincipalExt) GroupHashIndex ¶
func (x *PrincipalExt) GroupHashIndex() string
GroupHashIndex calculator
func (*PrincipalExt) GroupNames ¶
func (x *PrincipalExt) GroupNames() (res []string)
GroupNames Getter
func (*PrincipalExt) LatestGroupRoleDate ¶
func (x *PrincipalExt) LatestGroupRoleDate() (latestGroupRoleDate *timestamppb.Timestamp)
LatestGroupRoleDate helper
func (*PrincipalExt) RelationNames ¶
func (x *PrincipalExt) RelationNames(resourceID string) (res []string)
RelationNames Getter
func (*PrincipalExt) RelationNamesByResourceName ¶
func (x *PrincipalExt) RelationNamesByResourceName(resourceName string) (res []string)
RelationNamesByResourceName Getter
func (*PrincipalExt) Relations ¶
func (x *PrincipalExt) Relations() (res []*types.Relationship)
Relations Getter
func (*PrincipalExt) RelationsByResource ¶
func (x *PrincipalExt) RelationsByResource(resourceID string) (res []*types.Relationship)
RelationsByResource Getter
func (*PrincipalExt) ResourceByName ¶
func (x *PrincipalExt) ResourceByName(resourceName string) *types.Resource
ResourceByName Getter
func (*PrincipalExt) ResourceNames ¶
func (x *PrincipalExt) ResourceNames() (names []string)
ResourceNames Getter
func (*PrincipalExt) Resources ¶
func (x *PrincipalExt) Resources() (res []*types.Resource)
Resources Getter
func (*PrincipalExt) ResourcesByPartialNameAndAction ¶
func (x *PrincipalExt) ResourcesByPartialNameAndAction(resourceName string, action string) (arr []*types.Resource)
ResourcesByPartialNameAndAction Getter
func (*PrincipalExt) RoleHashIndex ¶
func (x *PrincipalExt) RoleHashIndex() string
RoleHashIndex calculator
func (*PrincipalExt) String ¶
func (x *PrincipalExt) String() string
func (*PrincipalExt) ToGetPrincipalResponse ¶
func (x *PrincipalExt) ToGetPrincipalResponse() *services.GetPrincipalResponse
ToGetPrincipalResponse helper
func (*PrincipalExt) ToMap ¶
func (x *PrincipalExt) ToMap( req *services.AuthRequest, resource *types.Resource, ) (res map[string]any)
ToMap helper
type RedisConfig ¶
type RedisConfig struct { Host string `yaml:"host" mapstructure:"host"` Port int `yaml:"port" mapstructure:"port"` Password string `yaml:"password" mapstructure:"password"` PoolSize int `yaml:"pool_size" mapstructure:"pool_size"` }
RedisConfig redis config
type RelationshipBuilder ¶
type RelationshipBuilder struct { // Namespace of relationship. Namespace string // Relation name. Relation string // PrincipalID for relationship. PrincipalId string // ResourceID for relationship. ResourceId string // Attributes of relationship. Attributes map[string]string }
RelationshipBuilder - represents a relationship between a resource and a principal.
func NewRelationshipBuilder ¶
func NewRelationshipBuilder() *RelationshipBuilder
NewRelationshipBuilder constructor
func (*RelationshipBuilder) Build ¶
func (b *RelationshipBuilder) Build() (*types.Relationship, error)
Build helper
func (*RelationshipBuilder) WithAttribute ¶
func (b *RelationshipBuilder) WithAttribute(name string, val string) *RelationshipBuilder
WithAttribute setter
func (*RelationshipBuilder) WithNamespace ¶
func (b *RelationshipBuilder) WithNamespace(namespace string) *RelationshipBuilder
WithNamespace setter
func (*RelationshipBuilder) WithPrincipalId ¶
func (b *RelationshipBuilder) WithPrincipalId(id string) *RelationshipBuilder
WithPrincipalId setter
func (*RelationshipBuilder) WithRelation ¶
func (b *RelationshipBuilder) WithRelation(relation string) *RelationshipBuilder
WithRelation setter
func (*RelationshipBuilder) WithResourceId ¶
func (b *RelationshipBuilder) WithResourceId(id string) *RelationshipBuilder
WithResourceId setter
type RelationshipExt ¶
type RelationshipExt struct {
Delegate *types.Relationship
}
RelationshipExt - represents a relationship between a resource and a principal.
func NewRelationshipExt ¶
func NewRelationshipExt(delegate *types.Relationship) *RelationshipExt
NewRelationshipExt constructor
func (*RelationshipExt) String ¶
func (x *RelationshipExt) String() string
type ResourceBuilder ¶
type ResourceBuilder struct { // Namespace of resource. Namespace string // Name of the resource. Name string // capacity of resource. Capacity int32 // Attributes of resource. Attributes map[string]string // AllowedActions that can be performed. AllowedActions []string }
ResourceBuilder - The object that the principal wants to access (e.g., a file, a database record).
func (*ResourceBuilder) Build ¶
func (b *ResourceBuilder) Build() (*types.Resource, error)
Build helper
func (*ResourceBuilder) WithAllowedActions ¶
func (b *ResourceBuilder) WithAllowedActions(actions ...string) *ResourceBuilder
WithAllowedActions setter
func (*ResourceBuilder) WithAttribute ¶
func (b *ResourceBuilder) WithAttribute(name string, val string) *ResourceBuilder
WithAttribute setter
func (*ResourceBuilder) WithCapacity ¶
func (b *ResourceBuilder) WithCapacity(capacity int) *ResourceBuilder
WithCapacity setter
func (*ResourceBuilder) WithName ¶
func (b *ResourceBuilder) WithName(name string) *ResourceBuilder
WithName setter
func (*ResourceBuilder) WithNamespace ¶
func (b *ResourceBuilder) WithNamespace(namespace string) *ResourceBuilder
WithNamespace setter
type ResourceExt ¶
ResourceExt - The object that the principal wants to access (e.g., a file, a database record).
func NewResourceExt ¶
func NewResourceExt(delegate *types.Resource) *ResourceExt
NewResourceExt constructor
func (*ResourceExt) String ¶
func (x *ResourceExt) String() string
type ResourceInstanceExt ¶
type ResourceInstanceExt struct {
Delegate *types.ResourceInstance
}
ResourceInstanceExt - instance of the resource for tracking quota of resource.
func NewResourceInstanceExt ¶
func NewResourceInstanceExt( namespace string, resourceID string, principalID string) *ResourceInstanceExt
NewResourceInstanceExt constructor
func (*ResourceInstanceExt) String ¶
func (x *ResourceInstanceExt) String() string
func (*ResourceInstanceExt) Validate ¶
func (x *ResourceInstanceExt) Validate() error
Validate helper
type RoleBuilder ¶
type RoleBuilder struct { // Namespace of role. Namespace string // Name of role Name string // PermissionIDs that can be performed. PermissionIds []string // Optional parent ids ParentIds []string }
RoleBuilder - A named collection of permissions that can be assigned to a principal.
func (*RoleBuilder) WithName ¶
func (b *RoleBuilder) WithName(name string) *RoleBuilder
WithName setter
func (*RoleBuilder) WithNamespace ¶
func (b *RoleBuilder) WithNamespace(namespace string) *RoleBuilder
WithNamespace setter
func (*RoleBuilder) WithParentIds ¶
func (b *RoleBuilder) WithParentIds(ids ...string) *RoleBuilder
WithParentIds setter
type TLSConfig ¶
type ValidationError ¶
type ValidationError struct {
Message string
}
ValidationError error
func NewValidationError ¶
func NewValidationError(msg string) *ValidationError
NewValidationError constructor