policy

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0, BSD-3-Clause, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(ctx context.Context, key, namespace, scope string, value []byte, ttl int) error
}

type RegoCache

type RegoCache interface {
	Set(key string, policy *storage.Policy)
	Get(key string) (policy *storage.Policy, found bool)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(storage Storage, policyCache RegoCache, cache Cache, logger *zap.Logger) *Service

func (*Service) Evaluate

Evaluate executes a policy with the given input.

Note: The policy must follow strict conventions so that such generic evaluation function could work: package declaration inside the policy must be exactly the same as 'group.policy'. For example: Evaluating the URL: `.../policies/mygroup/example/1.0/evaluation` will return results correctly, only if the package declaration inside the policy is: `package mygroup.example`.

func (*Service) Lock

func (s *Service) Lock(ctx context.Context, req *policy.LockRequest) error

Lock a policy so that it cannot be evaluated.

func (*Service) Unlock

func (s *Service) Unlock(ctx context.Context, req *policy.UnlockRequest) error

Unlock a policy so it can be evaluated again.

type Storage

type Storage interface {
	Policy(ctx context.Context, group, name, version string) (*storage.Policy, error)
	SetPolicyLock(ctx context.Context, group, name, version string, lock bool) error
}

Directories

Path Synopsis
policydatafakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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