etcd

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: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscoverPrefix  = "/isAllowedRequests/"
	DefaultPageSize = int64(1000)
)
View Source
const (
	KeySeparator    = "/"
	PoliciesKey     = "policies"
	RolePoliciesKey = "role_policies"
	ServicesKey     = "services"
	FunctionsKey    = "functions"
	ServiceTypeKey  = "type"
)
View Source
const (
	StoreType = "etcd"

	//Following are keys of etcd store properties
	IsEmbeddedEtcdKey             = "IsEmbeddedEtcd"
	EmbeddedEtcdDataDirKey        = "EmbeddedEtcdDataDir"
	EtcdEndpointKey               = "EtcdEndpoint"
	EtcdKeyPrefixKey              = "EtcdKeyPrefix"
	EtcdTLSClientCertFileKey      = "EtcdTLSCertFile"
	EtcdTLSClientKeyFileKey       = "EtcdTLSKeyFile"
	EtcdTLSClientTrustedCAFileKey = "EtcdTLSTrustedCAFile"
	EtcdTLSAllowedCNKey           = "EtcdTLSAllowedCN"
	EtcdTLSServerNameKey          = "EtcdTLSServerName"
	EtcdTLSCRLFileKey             = "EtcdTLSCRLFile"
	EtcdTLSInsecureSkipVerifyKey  = "EtcdTLSInsecureSkipVerify"

	IsEmbeddedEtcdFlagName             = "etcdstore-isembedded"
	EmbeddedEtcdDataDirFlagName        = "etcdstore-embeddedDataDir"
	EtcdEndpointFlagName               = "etcdstore-endpoint"
	EtcdKeyPrefixFlagName              = "etcdstore-keyprefix"
	EtcdTLSClientCertFileFlagName      = "etcdstore-tls-cert"
	EtcdTLSClientKeyFileFlagName       = "etcdstore-tls-key"
	EtcdTLSClientTrustedCAFileFlagName = "etcdstore-tls-ca"
	EtcdTLSAllowedCNFlagName           = "etcdstore-tls-allowedCN"
	EtcdTLSServerNameFlagName          = "etcdstore-tls-serverName"
	EtcdTLSCRLFileFlagName             = "etcdstore-tls-crlFile"
	EtcdTLSInsecureSkipVerifyFlagName  = "etcdstore-tls-insecureSkipVerify"

	//default property values
	DefaultKeyPrefix           = "/speedle_ps/"
	DefaultEtcdStoreEndpoint   = "localhost:2379"
	DefaultEtcdStoreKeyPrefix  = "/speedle_ps/"
	DefaultEtcdStoreIsEmbedded = false
)

Variables

This section is empty.

Functions

func CleanEmbeddedEtcd

func CleanEmbeddedEtcd(etcd *embed.Etcd, etcdDir string)

CleanEmbedEtcd free the resource of embed etcd, and remove the tmp directory which is used to store data

func StartEmbeddedEtcd

func StartEmbeddedEtcd(dataDir string) (etcd *embed.Etcd, etcdDir string, err error)

StartEmbeddedEtcd start a embed etcd which use a clean tmp directory to store data

Types

type Etcd3StoreBuilder

type Etcd3StoreBuilder struct{}

func (Etcd3StoreBuilder) GetStoreParams

func (esb Etcd3StoreBuilder) GetStoreParams() map[string]string

func (Etcd3StoreBuilder) NewStore

func (esb Etcd3StoreBuilder) NewStore(config map[string]interface{}) (pms.PolicyStoreManager, error)

type Store

type Store struct {
	Config    *clientv3.Config
	KeyPrefix string
	// contains filtered or unexported fields
}

func (*Store) CreateFunction

func (s *Store) CreateFunction(function *pms.Function) (*pms.Function, error)

func (*Store) CreatePolicy

func (s *Store) CreatePolicy(serviceName string, policy *pms.Policy) (*pms.Policy, error)

func (*Store) CreateRolePolicy

func (s *Store) CreateRolePolicy(serviceName string, rolePolicy *pms.RolePolicy) (*pms.RolePolicy, error)

func (*Store) CreateService

func (s *Store) CreateService(service *pms.Service) error

func (*Store) DeleteFunction

func (s *Store) DeleteFunction(funcName string) error

func (*Store) DeleteFunctions

func (s *Store) DeleteFunctions() error

func (*Store) DeletePolicies

func (s *Store) DeletePolicies(serviceName string) error

func (*Store) DeletePolicy

func (s *Store) DeletePolicy(serviceName string, id string) error

func (*Store) DeleteRequests

func (s *Store) DeleteRequests(keys []string) error

func (*Store) DeleteRolePolicies

func (s *Store) DeleteRolePolicies(serviceName string) error

func (*Store) DeleteRolePolicy

func (s *Store) DeleteRolePolicy(serviceName string, id string) error

func (*Store) DeleteService

func (s *Store) DeleteService(serviceName string) error

delete application from etcd3

func (*Store) DeleteServices

func (s *Store) DeleteServices() error

func (*Store) GeneratePolicies

func (d *Store) GeneratePolicies(serviceName, principalType, principalName, principalIDD string) (map[string]*pms.Service, int64, error)

This method is implemented as common method at evaluator part

func (*Store) GetDiscoverRequests

func (s *Store) GetDiscoverRequests(serviceName string) ([]*ads.RequestContext, int64, error)

func (*Store) GetDiscoverRequestsSinceRevision

func (s *Store) GetDiscoverRequestsSinceRevision(serviceName string, revision int64) ([]*ads.RequestContext, int64, error)

func (*Store) GetFunction

func (s *Store) GetFunction(funcName string) (*pms.Function, error)

func (*Store) GetFunctionCount

func (s *Store) GetFunctionCount() (int64, error)

func (*Store) GetLastDiscoverRequest

func (s *Store) GetLastDiscoverRequest(serviceName string) (*ads.RequestContext, int64, error)

func (*Store) GetPolicies

func (s *Store) GetPolicies(serviceName string, startID string, amount int) (policies []*pms.Policy, nextID string, err error)

TODO: to be implemented

func (*Store) GetPolicy

func (s *Store) GetPolicy(serviceName string, id string) (*pms.Policy, error)

func (*Store) GetPolicyAndRolePolicyCounts

func (s *Store) GetPolicyAndRolePolicyCounts() (map[string]*pms.PolicyAndRolePolicyCount, error)

func (*Store) GetPolicyCount

func (s *Store) GetPolicyCount(serviceName string) (int64, error)

func (*Store) GetRequests

func (s *Store) GetRequests(keyPrefix string, pageSize int64) ([]*ads.RequestContext, int64, error)

func (*Store) GetRolePolicies

func (s *Store) GetRolePolicies(serviceName string, startID string, amount int) (policies []*pms.RolePolicy, nextID string, err error)

TODO: to be implemented

func (*Store) GetRolePolicy

func (s *Store) GetRolePolicy(serviceName string, id string) (*pms.RolePolicy, error)

func (*Store) GetRolePolicyCount

func (s *Store) GetRolePolicyCount(serviceName string) (int64, error)

func (*Store) GetService

func (s *Store) GetService(serviceName string) (*pms.Service, error)

func (*Store) GetServiceCount

func (s *Store) GetServiceCount() (int64, error)

func (*Store) GetServiceItself

func (s *Store) GetServiceItself(serviceName string) (*pms.Service, error)

func (*Store) GetServiceNames

func (s *Store) GetServiceNames() (serviceNames []string, err error)

func (*Store) GetServices

func (s *Store) GetServices(startName string, amount int, retrivePolcies bool) ([]*pms.Service, string, error)

TODO: to be implemented

func (*Store) ListAllFunctions

func (s *Store) ListAllFunctions(filter string) ([]*pms.Function, error)

func (*Store) ListAllPolicies

func (s *Store) ListAllPolicies(serviceName string, filter string) ([]*pms.Policy, error)

For policy manager

func (*Store) ListAllRolePolicies

func (s *Store) ListAllRolePolicies(serviceName string, filter string) ([]*pms.RolePolicy, error)

For role policy manager

func (*Store) ListAllServices

func (s *Store) ListAllServices() (services []*pms.Service, err error)

func (*Store) PutRequest

func (s *Store) PutRequest(request *ads.RequestContext) (int64, error)

func (*Store) ReadPolicyStore

func (s *Store) ReadPolicyStore() (*pms.PolicyStore, error)

read policy store from etcd3

func (*Store) ResetDiscoverRequests

func (s *Store) ResetDiscoverRequests(serviceName string) error

func (*Store) SaveDiscoverRequest

func (s *Store) SaveDiscoverRequest(request *ads.RequestContext) error

func (*Store) StopWatch

func (s *Store) StopWatch()

func (*Store) Type

func (s *Store) Type() string

get the storage type of the store

func (*Store) Watch

func (s *Store) Watch() (pms.StorageChangeChannel, error)

func (*Store) WritePolicyStore

func (s *Store) WritePolicyStore(ps *pms.PolicyStore) error

write policy store to etcd3

Jump to

Keyboard shortcuts

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