Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PolicyVersion ¶
func PolicyVersion(version string, params EvalParams) string
Types ¶
type CheckOpt ¶
type CheckOpt func(*CheckOptions)
CheckOpt defines options for engine Check calls.
func WithDefaultPolicyVersion ¶
WithDefaultPolicyVersion sets the default policy version for the engine.
func WithGlobals ¶
WithGlobals sets the global variables for the engine.
func WithLenientScopeSearch ¶
func WithLenientScopeSearch() CheckOpt
WithLenientScopeSearch enables lenient scope search.
func WithNowFunc ¶
WithNowFunc sets the function for determining `now` during condition evaluation. The function should return the same timestamp every time it is invoked.
func WithTraceSink ¶
type CheckOptions ¶
type CheckOptions struct {
TracerSink tracer.Sink
EvalParams EvalParams
}
func NewCheckOptions ¶
func NewCheckOptions(ctx context.Context, conf *Conf, opts ...CheckOpt) *CheckOptions
func (*CheckOptions) DefaultPolicyVersion ¶
func (co *CheckOptions) DefaultPolicyVersion() string
func (*CheckOptions) Globals ¶
func (co *CheckOptions) Globals() map[string]any
func (*CheckOptions) LenientScopeSearch ¶
func (co *CheckOptions) LenientScopeSearch() bool
func (*CheckOptions) NowFunc ¶
func (co *CheckOptions) NowFunc() func() time.Time
type Conf ¶
type Conf struct {
// Globals are environment-specific variables to be made available to policy conditions.
Globals map[string]any `yaml:"globals" conf:",example={\"environment\": \"staging\"}"`
// DefaultPolicyVersion defines what version to assume if the request does not specify one.
DefaultPolicyVersion string `yaml:"defaultPolicyVersion" conf:",example=\"default\""`
// LenientScopeSearch configures the engine to ignore missing scopes and search upwards through the scope tree until it finds a usable policy.
LenientScopeSearch bool `yaml:"lenientScopeSearch" conf:",example=false"`
// PolicyLoaderTimeout is the timeout for loading policies from the policy store.
PolicyLoaderTimeout time.Duration `yaml:"policyLoaderTimeout" conf:",example=2s"`
NumWorkers uint `yaml:"numWorkers" conf:",ignore"`
}
Conf is optional configuration for engine.
func (*Conf) SetDefaults ¶
func (c *Conf) SetDefaults()
type EvalParams ¶
type Evaluator ¶
type Evaluator interface {
Check(context.Context, []*enginev1.CheckInput, ...CheckOpt) ([]*enginev1.CheckOutput, error)
Plan(context.Context, *enginev1.PlanResourcesInput, ...CheckOpt) (*enginev1.PlanResourcesOutput, error)
}
Click to show internal directories.
Click to hide internal directories.