file

package
v0.0.0-...-b236520 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: UPL-1.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StoreType = "file"

	//following are keys of file store properties
	FileLocationKey = "FileLocation"

	FileLocationFlagName = "filestore-loc"

	DefaultFileStoreLocation = "/tmp/speedle-test-file-store.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStoreBuilder

type FileStoreBuilder struct{}

func (FileStoreBuilder) GetStoreParams

func (fs FileStoreBuilder) GetStoreParams() map[string]string

func (FileStoreBuilder) NewStore

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

type RequestItem

type RequestItem struct {
	Index   int64               `json:"index"`
	Request *ads.RequestContext `json:"request"`
}

type Store

type Store struct {
	FileLocation 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

CreateService creates a new service

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

DeleteService deletes a service named ${serviceName} from a file

func (*Store) DeleteServices

func (s *Store) DeleteServices() error

DeleteServices deletes all services from a file

func (*Store) GeneratePolicies

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

Generate policies for principal based on existing request logs. Generate policies for all principals when principalXXX are empty.

func (*Store) GetDiscoverRequests

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

GetDiscoverRequests gets request logs for a service. Get all requests when serviceName is empty.

func (*Store) GetDiscoverRequestsSinceRevision

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

GetDiscoverRequestsSinceRevision gets request logs since a revision.

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)

GetLastDiscoverRequest gets last request log

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)

GetPolicyAndRolePolicyCounts returns a map, in which the key is the service name, and the value is the count of both policies and role policies in the service.

func (*Store) GetPolicyCount

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

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)

GetService gets the detailed info of a service

func (*Store) GetServiceCount

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

GetServiceCount gets the service count

func (*Store) GetServiceNames

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

GetServiceNames reads all the service names

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() ([]*pms.Service, error)

ListAllServices lists all the services

func (*Store) ReadPolicyStore

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

ReadPolicyStore reads policy store from a file

func (*Store) ResetDiscoverRequests

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

ResetDiscoverRequests cleans request logs for a service. Clean all request logs when serviceName is empty.

func (*Store) SaveDiscoverRequest

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

SaveDiscoverRequest saves discover request

func (*Store) StopWatch

func (s *Store) StopWatch()

func (*Store) Type

func (s *Store) Type() string

func (*Store) Watch

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

func (*Store) WritePolicyStore

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

WritePolicyStore writes policies to a file

func (*Store) WriteService

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

WriteService writes a service into a file

type StoreContent

type StoreContent struct {
	Requests []*RequestItem `json:"requests"`
}

Jump to

Keyboard shortcuts

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