Documentation
¶
Index ¶
- Constants
- Variables
- type CelEvaluatorImplementation
- type EvaluationError
- type Evaluator
- func (e *Evaluator) ExecChainedSelector(ctx context.Context, opts *options.EvaluatorOptions, ...) ([]attestation.Subject, error)
- func (e *Evaluator) ExecTenet(ctx context.Context, opts *options.EvaluatorOptions, tenet *papi.Tenet, ...) (*papi.EvalResult, error)
- func (e *Evaluator) RegisterPlugin(plugin api.Plugin) error
- type Plugin
Constants ¶
View Source
const ( VarNamePredicate = "predicate" VarNamePredicates = "predicates" VarNameContext = "context" VarNameOutputs = "outputs" VarNameSubject = "subject" )
Variables ¶
View Source
var Class = class.Class("cel@v0")
Functions ¶
This section is empty.
Types ¶
type CelEvaluatorImplementation ¶
type CelEvaluatorImplementation interface {
CompileCode(*cel.Env, string) (*cel.Ast, error)
CreateEnvironment(*options.EvaluatorOptions, map[string]Plugin) (*cel.Env, error)
BuildVariables(*options.EvaluatorOptions, map[string]Plugin, *papi.Tenet, *evalcontext.EvaluationContext, []attestation.Predicate) (*map[string]any, error)
EnsurePredicates(*papi.Tenet, *map[string]any) (*papi.EvalResult, error)
EvaluateOutputs(*cel.Env, map[string]*cel.Ast, *map[string]any) (map[string]any, error)
Evaluate(*cel.Env, *cel.Ast, *map[string]any) (*papi.EvalResult, error)
Assert(*papi.ResultSet) bool
BuildSelectorVariables(*options.EvaluatorOptions, map[string]Plugin, *evalcontext.EvaluationContext, *papi.Policy, attestation.Subject, *papi.ChainedPredicate, attestation.Predicate) (*map[string]any, error)
EvaluateChainedSelector(*cel.Env, *cel.Ast, *map[string]any) ([]attestation.Subject, error)
}
type EvaluationError ¶
EvaluationError captures error details when executing CEL code
func (*EvaluationError) Error ¶
func (ee *EvaluationError) Error() string
type Evaluator ¶
type Evaluator struct {
Environment *cel.Env
Plugins map[string]Plugin
// contains filtered or unexported fields
}
Evaluator implements the evaluator.Evaluator interface to evaluate CEL code
func NewWithOptions ¶
func NewWithOptions(opts *options.EvaluatorOptions) (*Evaluator, error)
func (*Evaluator) ExecChainedSelector ¶
func (e *Evaluator) ExecChainedSelector( ctx context.Context, opts *options.EvaluatorOptions, chained *papi.ChainedPredicate, predicate attestation.Predicate, ) ([]attestation.Subject, error)
func (*Evaluator) ExecTenet ¶
func (e *Evaluator) ExecTenet( ctx context.Context, opts *options.EvaluatorOptions, tenet *papi.Tenet, predicates []attestation.Predicate, ) (*papi.EvalResult, error)
Exec executes each tenet and returns the combined results
type Plugin ¶
type Plugin interface {
// CanRegisterDataFor implements the plugin api function that flags if
// the plugin is compatible with a class of evaluator
CanRegisterFor(class.Class) bool
// EnvVariables returns the data (as a cel.Variable list) that will be
// registered as global variables in the evaluation environment
Library() cel.EnvOption
// VarValues returns the values of the variables handled by the plugin
VarValues(*papi.Policy, attestation.Subject, []attestation.Predicate) map[string]any
}
Click to show internal directories.
Click to hide internal directories.