Documentation
¶
Index ¶
- Constants
- type EventType
- type Function
- type FunctionManager
- type Permission
- type Policy
- type PolicyAndRolePolicyCount
- type PolicyManager
- type PolicyStore
- type PolicyStoreManager
- type PolicyStoreManagerADS
- type PolicyStoreWatcher
- type RolePolicy
- type RolePolicyManager
- type Service
- type ServiceManager
- type StorageChangeChannel
- type StoreChangeEvent
- type StoreManager
- type StoreUpdateData
Constants ¶
View Source
const ( Grant = "grant" Deny = "deny" )
View Source
const ( TypeK8SCluster = "k8s-cluster" TypeApplication = "application" )
View Source
const GlobalService = "global"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Function ¶
type Function struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
FuncURL string `json:"funcURL"` //used by speedle/sphinx ADS
LocalFuncURL string `json:"localFuncURL,omitempty"` //used by sphinx runtime proxy to get better performance
CA string `json:"ca,omitempty"` //security related configurations
ResultCachable bool `json:"resultCachable,omitempty"` //false by default
ResultTTL int64 `json:"resultTTL,omitempty"` // TTL of function result in second
Metadata map[string]string `json:"metadata,omitempty"`
}
type FunctionManager ¶
type Permission ¶
type Policy ¶
type Policy struct {
ID string `json:"id"`
Name string `json:"name"`
Effect string `json:"effect,omitempty"`
Permissions []*Permission `json:"permissions,omitempty"`
Principals [][]string `json:"principals,omitempty"`
Condition string `json:"condition,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type PolicyManager ¶
type PolicyManager interface {
CreatePolicy(serviceName string, policy *Policy) (*Policy, error)
DeletePolicy(serviceName string, id string) error
DeletePolicies(serviceName string) error
GetPolicy(serviceName string, id string) (*Policy, error)
ListAllPolicies(serviceName string, filter string) ([]*Policy, error)
GetPolicyCount(serviceName string) (int64, error)
}
type PolicyStore ¶
type PolicyStoreManager ¶
type PolicyStoreManager interface {
ServiceManager
StoreManager
PolicyManager
RolePolicyManager
FunctionManager
PolicyStoreWatcher
}
type PolicyStoreManagerADS ¶
type PolicyStoreManagerADS interface {
Type() string
ReadPolicyStore() (*PolicyStore, error)
GetService(serviceName string) (*Service, error)
GetPolicy(serviceName string, id string) (*Policy, error)
GetRolePolicy(serviceName string, id string) (*RolePolicy, error)
GetFunction(funcName string) (*Function, error)
PolicyStoreWatcher
}
type PolicyStoreWatcher ¶
type PolicyStoreWatcher interface {
Watch() (StorageChangeChannel, error)
StopWatch()
}
type RolePolicy ¶
type RolePolicy struct {
ID string `json:"id"`
Name string `json:"name"`
Effect string `json:"effect,omitempty"`
Roles []string `json:"roles,omitempty"`
Principals []string `json:"principals,omitempty"`
Resources []string `json:"resources,omitempty"`
ResourceExpressions []string `json:"resourceExpressions,omitempty"`
Condition string `json:"condition,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type RolePolicyManager ¶
type RolePolicyManager interface {
CreateRolePolicy(serviceName string, policy *RolePolicy) (*RolePolicy, error)
DeleteRolePolicy(serviceName string, id string) error
DeleteRolePolicies(serviceName string) error
GetRolePolicy(serviceName string, id string) (*RolePolicy, error)
ListAllRolePolicies(serviceName string, filter string) ([]*RolePolicy, error)
GetRolePolicyCount(serviceName string) (int64, error)
}
type ServiceManager ¶
type ServiceManager interface {
CreateService(service *Service) error
DeleteService(serviceName string) error
DeleteServices() error
GetService(serviceName string) (*Service, error)
ListAllServices() ([]*Service, error)
GetServiceCount() (int64, error)
GetServiceNames() ([]string, error)
GetPolicyAndRolePolicyCounts() (map[string]*PolicyAndRolePolicyCount, error)
}
type StorageChangeChannel ¶
type StorageChangeChannel chan StoreChangeEvent
StorageChangeChannel is the channel through which the policy evaluator gets StoreChangeEvent for refreshing cache TODO It's better to change to pointer type @tony
type StoreChangeEvent ¶
type StoreChangeEvent struct {
Type EventType
// Event ID
ID int64
// Event content.
// In case of a delete event, the content is the identity of the deleted item, such as the application name;
// in case of put events, the content is the value of the newly created item, like an application
Content interface{}
}
type StoreManager ¶
type StoreManager interface {
ReadPolicyStore() (*PolicyStore, error)
WritePolicyStore(*PolicyStore) error
Type() string
}
type StoreUpdateData ¶
type StoreUpdateData struct {
ServiceName string
Data interface{}
}
Click to show internal directories.
Click to hide internal directories.