policy

package
v1.5.0-alpha7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoResult error = errors.New("the query did not return a result")

Functions

func Scrypt

func Scrypt(password, salt []byte) ([]byte, error)

Types

type Policy

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

Policy is an executable bundle of Rego policy documents.

func FromFS

func FromFS(source fs.FS, path string) (*Policy, error)

Load a policy from the passed filesystem and path. Path can either be a single file, or a directory. In the latter case, all of the files in the directory will be loaded as policy documents and will be in scope for prepared queries.

func FromPath

func FromPath(path string) (*Policy, error)

Load a policy from the host filesystem at path. Path can either be a single file, or a directory. In the latter case, all of the files in the directory will be loaded as policy documents and will be in scope for prepared queries.

func FromPathOrDefault

func FromPathOrDefault(path string, def *Policy) (*Policy, error)

Like FromPath, but returns a default if the path is empty.

type Query

type Query[Input, Output any] func(ctx context.Context, input Input) (Output, error)

Query is a function that will execute a policy with provided input and return the result.

func AddQuery

func AddQuery[Input, Output any](runner *Policy, rule string) Query[Input, Output]

AddQuery prepares a query of a certain rule from the policy expecting a certain input type and returns a function that will execute the query when given input of that type.

Jump to

Keyboard shortcuts

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