compile

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ModuleAssign is the module to import to handle rego team policy.
	ModuleAssign = ast.MustParseModuleWithOpts(
		regoAssignModule,
		ast.ParserOptions{
			RegoVersion:       ast.RegoVersion(1),
			AllFutureKeywords: true,
			Capabilities:      ast.CapabilitiesForThisVersion(),
		},
	)
	// ModuleAccess is the module to import to handle rego access policy.
	ModuleAccess = ast.MustParseModuleWithOpts(
		regoAccessModule,
		ast.ParserOptions{
			RegoVersion:       ast.RegoVersion(1),
			AllFutureKeywords: true,
			Capabilities:      ast.CapabilitiesForThisVersion(),
		},
	)

	// ModuleContent is the module to import to handle rego content policy.
	ModuleContent = ast.MustParseModuleWithOpts(
		regoContentModule,
		ast.ParserOptions{
			RegoVersion:       ast.RegoVersion(1),
			AllFutureKeywords: true,
			Capabilities:      ast.CapabilitiesForThisVersion(),
		},
	)
)

Functions

func GetRegoModuleAccess

func GetRegoModuleAccess() []byte

GetRegoModuleAccess returns the code for the access module.

func GetRegoModuleAssign

func GetRegoModuleAssign() []byte

GetRegoModuleAssign returns the code for the assign module.

func GetRegoModuleContent

func GetRegoModuleContent() []byte

GetRegoModuleContent returns the code for the content module.

func Lua

func Lua(code []byte) (*lua.FunctionProto, error)

Lua compiles the given lua code.

func Rego

func Rego(policy string, name string, modules ...*ast.Module) (*ast.Compiler, error)

Rego returns a compiler that compiled the given policy. It is compiled with the with given modules.

func RegoFormat

func RegoFormat(policy string) (string, error)

RegoFormat formats the given rego policy.

func RegoQueryAccess

func RegoQueryAccess(ctx context.Context, comp *ast.Compiler) (rego.PreparedEvalQuery, error)

RegoQueryAccess runs the access query using the given *ast.Compiler.

func RegoQueryAssign

func RegoQueryAssign(ctx context.Context, comp *ast.Compiler) (rego.PreparedEvalQuery, error)

RegoQueryAssign runs the assign query using the given *ast.Compiler.

func RegoQueryContent

func RegoQueryContent(ctx context.Context, comp *ast.Compiler) (rego.PreparedEvalQuery, error)

RegoQueryContent runs the content query using the given *ast.Compiler.

Types

This section is empty.

Jump to

Keyboard shortcuts

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