fake

package
v0.0.0-...-6b55861 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTesting = errors.New("test error")

Functions

This section is empty.

Types

type Driver

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

Driver is a threadsafe Rego environment for compiling Rego in ConstraintTemplates, registering Constraints, and executing queries.

func New

func New(name string) *Driver

func (*Driver) AddConstraint

func (d *Driver) AddConstraint(_ context.Context, constraint *unstructured.Unstructured) error

AddConstraint adds Constraint to storage. Used to validate state in tests.

func (*Driver) AddData

func (d *Driver) AddData(_ context.Context, _ string, _ storage.Path, _ interface{}) error

AddData should not be a thing that drivers handle.

func (*Driver) AddTemplate

func (d *Driver) AddTemplate(_ context.Context, ct *templates.ConstraintTemplate) error

AddTemplate adds templ to Driver. Normalizes modules into usable forms for use in queries.

func (*Driver) Dump

func (d *Driver) Dump(_ context.Context) (string, error)

func (*Driver) GetConstraintsForTemplate

func (d *Driver) GetConstraintsForTemplate(template *templates.ConstraintTemplate) map[string]*unstructured.Unstructured

func (*Driver) GetDescriptionForStat

func (d *Driver) GetDescriptionForStat(_ string) (string, error)

func (*Driver) GetTemplateCode

func (d *Driver) GetTemplateCode() map[string]string

func (*Driver) Name

func (d *Driver) Name() string

Name returns the name of the driver.

func (*Driver) Query

func (d *Driver) Query(_ context.Context, _ string, constraints []*unstructured.Unstructured, _ interface{}, _ ...reviews.ReviewOpt) (*drivers.QueryResponse, error)

func (*Driver) RemoveConstraint

func (d *Driver) RemoveConstraint(_ context.Context, constraint *unstructured.Unstructured) error

RemoveConstraint removes Constraint from Rego storage. Used to validate state in tests.

func (*Driver) RemoveData

func (d *Driver) RemoveData(_ context.Context, _ string, _ storage.Path) error

RemoveData should not be a thing that drivers handle.

func (*Driver) RemoveTemplate

func (d *Driver) RemoveTemplate(_ context.Context, ct *templates.ConstraintTemplate) error

RemoveTemplate removes all Compilers and Constraints for templ. Returns nil if templ does not exist.

func (*Driver) SetErrOnAddConstraint

func (d *Driver) SetErrOnAddConstraint(raiseErr bool)

func (*Driver) SetErrOnAddTemplate

func (d *Driver) SetErrOnAddTemplate(raiseErr bool)

func (*Driver) SetErrOnRemoveConstraint

func (d *Driver) SetErrOnRemoveConstraint(raiseErr bool)

func (*Driver) SetErrOnRemoveTemplate

func (d *Driver) SetErrOnRemoveTemplate(raiseErr bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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