compile

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyConditionIndex  = errors.New("empty condition index")
	ErrNoMatchingConditions = errors.New("no matching conditions")
	ErrUnexpectedInput      = errors.New("unexpected input")
	ErrUnexpectedResult     = errors.New("unexpected result")
)
View Source
var (
	ErrAmbiguousDerivedRole = errors.New("ambiguous derived role")
	ErrCodeGenFailure       = errors.New("code generation failure")
	ErrCompileError         = errors.New("compile error")
	ErrImportNotFound       = errors.New("import not found")
	ErrInvalidImport        = errors.New("invalid import")
	ErrInvalidMatchExpr     = errors.New("invalid match expression")
	ErrNoEvaluator          = errors.New("no evaluator available")
	ErrUnknownDerivedRole   = errors.New("unknown derived role")
)
View Source
var ErrPolicyNotExecutable = errors.New("policy not executable")

Functions

func BatchCompile

func BatchCompile(queue <-chan *policy.CompilationUnit) error

Types

type CELConditionEvaluator

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

func (*CELConditionEvaluator) Eval

func (ce *CELConditionEvaluator) Eval(input interface{}) (bool, error)

type ConditionEvaluator

type ConditionEvaluator interface {
	Eval(input interface{}) (bool, error)
}

type ConditionIndex

type ConditionIndex map[namer.ModuleID]ConditionMap

func NewConditionIndex

func NewConditionIndex() ConditionIndex

func (ConditionIndex) Add

func (ci ConditionIndex) Add(modName string, condMap ConditionMap)

func (ConditionIndex) AddConditionEvaluator

func (ci ConditionIndex) AddConditionEvaluator(modName, key string, condEval ConditionEvaluator)

func (ConditionIndex) GetConditionEvaluator

func (ci ConditionIndex) GetConditionEvaluator(modName, key string) (ConditionEvaluator, error)

type ConditionMap

type ConditionMap map[string]ConditionEvaluator

func NewConditionMap

func NewConditionMap(conds map[string]*codegen.CELCondition) (ConditionMap, error)

func NewConditionMapFromRepr

func NewConditionMapFromRepr(conds map[string]*exprpb.CheckedExpr) (ConditionMap, error)

type Error

type Error struct {
	File        string
	Err         error
	Description string
}

Error describes an error encountered during compilation.

func (*Error) Display

func (e *Error) Display() string

func (*Error) Error

func (e *Error) Error() string

func (*Error) MarshalJSON

func (e *Error) MarshalJSON() ([]byte, error)

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorList

type ErrorList []*Error

func (ErrorList) Display

func (e ErrorList) Display() string

func (ErrorList) ErrOrNil

func (e ErrorList) ErrOrNil() error

func (ErrorList) Error

func (e ErrorList) Error() string

type EvalResult

type EvalResult struct {
	PolicyKey             string
	Effects               map[string]effectv1.Effect
	EffectiveDerivedRoles []string
}

type Evaluator

type Evaluator interface {
	Eval(ctx context.Context, queryCache cache.InterQueryCache, input ast.Value) (*EvalResult, error)
}

func Compile

func Compile(unit *policy.CompilationUnit) (Evaluator, error)

type Manager

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

func NewManager

func NewManager(ctx context.Context, store storage.Store) *Manager

func (*Manager) GetEvaluator

func (c *Manager) GetEvaluator(ctx context.Context, modID namer.ModuleID) (Evaluator, error)

func (*Manager) OnStorageEvent

func (c *Manager) OnStorageEvent(events ...storage.Event)

func (*Manager) SubscriberID

func (c *Manager) SubscriberID() string

Jump to

Keyboard shortcuts

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