opa

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEngineNotFound error = &errEngineNotFound{}

ErrEngineNotFound is returned by LookupEngine if no wasm engine was registered by that name.

Functions

func RegisterEngine

func RegisterEngine(name string, e Engine)

RegisterEngine registers an evaluation engine by its target name. Note that the "rego" target is always available.

Types

type Engine

type Engine interface {
	New() EvalEngine
}

Engine repesents a factory for instances of EvalEngine implementations

func LookupEngine

func LookupEngine(name string) (Engine, error)

LookupEngine allows retrieving an engine registered by name

type EvalEngine

type EvalEngine interface {
	Init() (EvalEngine, error)
	Entrypoints(context.Context) (map[string]int32, error)
	WithPolicyBytes([]byte) EvalEngine
	WithDataJSON(any) EvalEngine
	Eval(context.Context, EvalOpts) (*Result, error)
	SetData(context.Context, any) error
	SetDataPath(context.Context, []string, any) error
	RemoveDataPath(context.Context, []string) error
	Close()
}

EvalEngine is the interface implemented by an engine used to eval a policy

type EvalOpts

type EvalOpts struct {
	Input                       *any
	Metrics                     metrics.Metrics
	Entrypoint                  int32
	Time                        time.Time
	Seed                        io.Reader
	InterQueryBuiltinCache      cache.InterQueryCache
	InterQueryBuiltinValueCache cache.InterQueryValueCache
	NDBuiltinCache              builtins.NDBCache
	PrintHook                   print.Hook
	Capabilities                *ast.Capabilities
}

EvalOpts define options for performing an evaluation.

type Result

type Result struct {
	Result []byte
}

Result holds the evaluation result.

Jump to

Keyboard shortcuts

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