policy

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCompiler

func BuildCompiler(files []string) (*ast.Compiler, error)

BuildCompiler compiles all of the given Rego policies and returns the Compiler containing the compilation state

func Detect

func Detect(url string, dst string) (string, error)

Detect determines whether a url is a known source url from which we can download files. If a known source is found, the url is formatted, otherwise an error is returned.

func Download

func Download(ctx context.Context, dst string, urls []string) error

Download downloads the given policies into the given destination

func GetNamespaces

func GetNamespaces(regoFiles []string, compiler *ast.Compiler) ([]string, error)

GetNamespaces returns a list of all namespaces in a set of given policies

func ReadFiles

func ReadFiles(path string) ([]string, error)

ReadFiles returns all of the policy files (not including tests) at the given path including its subdirectories.

func ReadFilesWithTests

func ReadFilesWithTests(path string) ([]string, error)

ReadFilesWithTests returns all of the policies and test files at the given path including its subdirectories. Test files are Rego files that have a suffix of _test.rego

func RuntimeTerm

func RuntimeTerm() *ast.Term

RuntimeTerm returns the opa.runtime Rego term.

func StoreFromDataFiles

func StoreFromDataFiles(paths []string) (storage.Store, error)

StoreFromDataFiles returns an Open Policy Agent Store with the loaded documents found in the paths. Any JSON or YAML document could be a valid document.

Types

This section is empty.

Jump to

Keyboard shortcuts

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