rego

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDirectory added in v1.3.0

func LoadDirectory(fsys fs.FS, path string, cb func(r RegoFile) error) error

func LoadOSFiles

func LoadOSFiles(paths []string, cb func(r RegoFile) error) error

func LoadRegula

func LoadRegula(userOnly bool, cb func(r RegoFile) error) error

func LoadTestInputs

func LoadTestInputs(paths []string, inputTypes []loader.InputType, cb func(r RegoFile) error) error

func RegisterBuiltins

func RegisterBuiltins()

func RunREPL

func RunREPL(options *RunREPLOptions) error

func RunRules

func RunRules(options *RunRulesOptions) (*rego.Result, error)

RunRules runs regula and user-specified rules on loaded inputs

func RunTest

func RunTest(options *RunTestOptions) error

func ScanView added in v1.3.0

func ScanView(options *ScanViewOptions) (*rego.Result, error)

RunRules runs regula and user-specified rules on loaded inputs

Types

type EmbeddedInclude added in v1.3.0

type EmbeddedInclude struct {
	FS        fs.FS
	Directory string
}

EmbeddedInclude can be used to load embedded rego code when regula is used as a library.

type RegoFile

type RegoFile interface {
	Raw() []byte
	String() string
	AstModule() (*ast.Module, error)
	RegoModule() func(r *rego.Rego)
	Path() string
}

func NewTestInput

func NewTestInput(regulaInput loader.RegulaInput) (RegoFile, error)

type RunREPLOptions

type RunREPLOptions struct {
	Ctx          context.Context
	UserOnly     bool
	Includes     []string
	NoTestInputs bool
}

type RunRulesOptions

type RunRulesOptions struct {
	Ctx              context.Context
	UserOnly         bool
	Includes         []string
	EmbeddedIncludes []EmbeddedInclude
	Input            []loader.RegulaInput
}

RunRulesOptions is the set of options for RunRules

type RunTestOptions

type RunTestOptions struct {
	Ctx          context.Context
	Includes     []string
	Trace        bool
	NoTestInputs bool
}

type ScanViewOptions added in v1.3.0

type ScanViewOptions struct {
	Ctx      context.Context
	UserOnly bool
	Includes []string
	Input    []loader.RegulaInput
}

RunRulesOptions is the set of options for RunRules

Jump to

Keyboard shortcuts

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