Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPolicyNotFound = errors.New("Policy not found")
ErrPolicyNotFound is returned when a policy could not be found
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type PolicyDownloader ¶
type PolicyDownloader struct {
Downloader
}
func (*PolicyDownloader) DownloadPolicy ¶
func (pdown *PolicyDownloader) DownloadPolicy(id string) ([]byte, error)
type PolicyRegistry ¶
type PolicyRegistry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry(options ...RegistryOption) *PolicyRegistry
NewRegistry returns a new instance of policy registry with default registry storage and policy downloader registry can be created with default options as r := NewRegistry() or with itw own custom options - ie specify a registry storage backend r := NewRegistry(MemStore)
func (*PolicyRegistry) ListPolicies ¶
func (pr *PolicyRegistry) ListPolicies() []string
type PolicyStorage ¶
type PolicyStorage interface { ListPolicies() ([]string, error) GetPolicy(string) ([]byte, error) UpsertPolicy(string, []byte) error //DeletePolicy(string) error HasPolicy(string) bool }
PolicyStorage defines the interface for policy module storage.
type RegistryOption ¶
type RegistryOption func(*PolicyRegistry)
var ( MemStore RegistryOption = func(pr *PolicyRegistry) { pr.registry = NewMemStore() } FSStore = func(basedir string) RegistryOption { return func(pr *PolicyRegistry) { pr.registry = NewFSStore(basedir) } } )
type Store ¶
type Store interface { PolicyStorage }
Store defines the interface for any Policy Storage implementation
func NewFSStore ¶
NewFSStore returns an empty store based on local file system
Click to show internal directories.
Click to hide internal directories.