domain

package
v0.0.0-...-794f3e4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	// RootClientType admin access
	RootClientType = ClientType("root")

	// NobodyClientType without any access
	NobodyClientType = ClientType("nobody")

	// DefaultClientType with specified access
	DefaultClientType = ClientType("client")
)
View Source
const BytesInInt32 = 4

BytesInInt32 constant

View Source
const NextOffsetHeader = "X-Next-Offset"

Variables

This section is empty.

Functions

func ErrorToHTTPStatus

func ErrorToHTTPStatus(err error) int

ErrorToHTTPStatus helper

func IPInRange

func IPInRange(ipAddress string, cidr string) (bool, error)

IPInRange checks if ipaddress is in CIDR range

func IsLoopback

func IsLoopback(ipAddress string) (bool, error)

IsLoopback checks if the provided IP address is a loopback address.

func IsMulticast

func IsMulticast(ipAddress string) (bool, error)

IsMulticast checks if the provided IP address is a multicast address.

func IsTimeInRange

func IsTimeInRange(
	currentTimeStr string,
	startTimeStr string,
	endTimeStr string,
) bool

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 NewAuthError

func NewAuthError(msg string) *AuthError

NewAuthError constructor

func NewAuthErrorWithCode

func NewAuthErrorWithCode(msg string, code string) *AuthError

NewAuthErrorWithCode constructor

func (*AuthError) Error

func (e *AuthError) Error() string

func (*AuthError) String

func (e *AuthError) String() string

String getter

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 ClientType

type ClientType string

ClientType alias

type Closeable

type Closeable interface {
	Close() error
}

Closeable can be closed

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 NewConfig

func NewConfig(configFile string) (*Config, error)

NewConfig -- initializes the Default Configuration

func (*Config) ACLModelFile

func (c *Config) ACLModelFile() (string, error)

func (*Config) ACLPolicyFile

func (c *Config) ACLPolicyFile() (string, error)

func (*Config) CAFile

func (c *Config) CAFile() (string, error)

func (*Config) ClientCertFile

func (c *Config) ClientCertFile() (string, error)

func (*Config) ClientKeyFile

func (c *Config) ClientKeyFile() (string, error)

func (*Config) ClientNobodyCertFile

func (c *Config) ClientNobodyCertFile() (string, error)

func (*Config) ClientNobodyKeyFile

func (c *Config) ClientNobodyKeyFile() (string, error)

func (*Config) ClientRootCertFile

func (c *Config) ClientRootCertFile() (string, error)

func (*Config) ClientRootKeyFile

func (c *Config) ClientRootKeyFile() (string, error)

func (*Config) ServerCertFile

func (c *Config) ServerCertFile() (string, error)

func (*Config) ServerKeyFile

func (c *Config) ServerKeyFile() (string, error)

func (*Config) SetupTLSClient

func (c *Config) SetupTLSClient() (tlsConfig *tls.Config, err error)

func (*Config) SetupTLSServer

func (c *Config) SetupTLSServer(addr string) (tlsConfig *tls.Config, err error)

func (*Config) TLSClient

func (c *Config) TLSClient() (tlsC TLSConfig, err error)

func (*Config) TLSNobodyClient

func (c *Config) TLSNobodyClient() (tlsC TLSConfig, err error)

func (*Config) TLSRootClient

func (c *Config) TLSRootClient() (tlsC TLSConfig, err error)

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures config is correct

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

func (*DatabaseError) String

func (e *DatabaseError) String() string

String getter

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

func (*DuplicateError) String

func (e *DuplicateError) String() string

String getter

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

func (*DynamoDBConfig) Validate

func (c *DynamoDBConfig) Validate() error

Validate - validates

type Factory

type Factory[T any] func() *T

Factory helper

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 NewGroupBuilder

func NewGroupBuilder() *GroupBuilder

NewGroupBuilder constructor

func (*GroupBuilder) Build

func (b *GroupBuilder) Build() (*types.Group, error)

Build helper

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

type GroupExt struct {
	Delegate *types.Group
}

GroupExt - A collection of principals that are treated as a single unit for the purpose of granting permissions.

func NewGroupExt

func NewGroupExt(delegate *types.Group) *GroupExt

NewGroupExt constructor

func (*GroupExt) Hash

func (x *GroupExt) Hash() string

Hash calculator

func (*GroupExt) String

func (x *GroupExt) String() string

func (*GroupExt) Validate

func (x *GroupExt) Validate() error

Validate helper

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

func NewHashIndex(hash string, ids []string) *HashIndex

NewHashIndex constructor

func (*HashIndex) Validate

func (x *HashIndex) Validate() error

Validate helper

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

func (*InternalError) String

func (e *InternalError) String() string

String getter

type MarshalError

type MarshalError struct {
	Message string
}

MarshalError error

func NewMarshalError

func NewMarshalError(msg string) *MarshalError

NewMarshalError constructor

func (*MarshalError) Error

func (e *MarshalError) Error() string

func (*MarshalError) String

func (e *MarshalError) String() string

String getter

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

func (*NotFoundError) String

func (e *NotFoundError) String() string

String getter

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

Build helper

func (*OrganizationBuilder) WithId

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

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

func (*OrganizationExt) Validate

func (x *OrganizationExt) Validate() error

Validate helper

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) Hash

func (x *PermissionExt) Hash() string

Hash calculator

func (*PermissionExt) String

func (x *PermissionExt) String() string

func (*PermissionExt) Validate

func (x *PermissionExt) Validate() error

Validate helper

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) Groups

func (x *PrincipalExt) Groups() (res []*types.Group)

Groups Getter

func (*PrincipalExt) Hash

func (x *PrincipalExt) Hash() string

Hash calculator

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) RoleNames

func (x *PrincipalExt) RoleNames() (res []string)

RoleNames Getter

func (*PrincipalExt) Roles

func (x *PrincipalExt) Roles() (res []*types.Role)

Roles Getter

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

func (*PrincipalExt) Validate

func (x *PrincipalExt) Validate() error

Validate 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

func (*RedisConfig) Validate

func (c *RedisConfig) Validate() error

Validate - validates

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

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) Hash

func (x *RelationshipExt) Hash() string

Hash calculator

func (*RelationshipExt) String

func (x *RelationshipExt) String() string

func (*RelationshipExt) Validate

func (x *RelationshipExt) Validate() error

Validate helper

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 NewResourceBuilder

func NewResourceBuilder() *ResourceBuilder

NewResourceBuilder constructor

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

type ResourceExt struct {
	Delegate *types.Resource
}

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) Hash

func (x *ResourceExt) Hash() string

Hash calculator

func (*ResourceExt) String

func (x *ResourceExt) String() string

func (*ResourceExt) Validate

func (x *ResourceExt) Validate() error

Validate helper

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) Hash

func (x *ResourceInstanceExt) Hash() string

Hash calculator

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 NewRoleBuilder

func NewRoleBuilder() *RoleBuilder

NewRoleBuilder constructor

func (*RoleBuilder) Build

func (b *RoleBuilder) Build() (*types.Role, error)

Build helper

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 RoleExt

type RoleExt struct {
	Delegate *types.Role
}

RoleExt - A named collection of permissions that can be assigned to a principal.

func NewRoleExt

func NewRoleExt(delegate *types.Role) *RoleExt

NewRoleExt constructor

func (*RoleExt) Hash

func (x *RoleExt) Hash() string

Hash calculator

func (*RoleExt) String

func (x *RoleExt) String() string

func (*RoleExt) Validate

func (x *RoleExt) Validate() error

Validate helper

type TLSConfig

type TLSConfig struct {
	CertFile      string
	KeyFile       string
	CAFile        string
	ServerAddress string
	Server        bool
}

func (TLSConfig) SetupTLS

func (c TLSConfig) SetupTLS() (tlsConfig *tls.Config, err error)

type ValidationError

type ValidationError struct {
	Message string
}

ValidationError error

func NewValidationError

func NewValidationError(msg string) *ValidationError

NewValidationError constructor

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error getter

func (*ValidationError) String

func (e *ValidationError) String() string

String getter

Jump to

Keyboard shortcuts

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