pms

package
v0.0.0-...-1643d90 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: UPL-1.0 Imports: 0 Imported by: 0

Documentation

Index

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 EventType

type EventType uint8
const (
	INVALID EventType = iota
	SERVICE_DELETE
	SERVICE_ADD
	POLICY_DELETE
	POLICY_ADD
	ROLEPOLICY_DELETE
	ROLEPOLICY_ADD
	FUNCTION_DELETE
	FUNCTION_ADD
	SYNC_RELOAD
	FULL_RELOAD
)

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 FunctionManager interface {
	CreateFunction(function *Function) (*Function, error)
	DeleteFunction(funcName string) error
	DeleteFunctions() error
	GetFunction(funcName string) (*Function, error)
	ListAllFunctions(filter string) ([]*Function, error)
	GetFunctionCount() (int64, error)
}

type Permission

type Permission struct {
	Resource           string   `json:"resource,omitempty"`
	ResourceExpression string   `json:"resourceExpression,omitempty"`
	Actions            []string `json:"actions,omitempty"`
}

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 PolicyAndRolePolicyCount

type PolicyAndRolePolicyCount struct {
	PolicyCount     int64 `json:"policycount,omitempty"`
	RolePolicyCount int64 `json:"rolePolicycount,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 PolicyStore struct {
	Functions []*Function `json:"functions,omitempty"`
	Services  []*Service  `json:"services,omitempty"`
}

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 Service

type Service struct {
	Name         string            `json:"name" binding:"required"`
	Type         string            `json:"type,omitempty"`
	Policies     []*Policy         `json:"policies,omitempty"`
	RolePolicies []*RolePolicy     `json:"rolePolicies,omitempty"`
	Metadata     map[string]string `json:"metadata,omitempty"`
}

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{}
}

Jump to

Keyboard shortcuts

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