genpolicy

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Rules is a Rego module that verifies agent requests.
	Rules []byte
	// Settings is a json config file that holds platform-specific configuration.
	Settings []byte
	// Bin is the genpolicy binary.
	Bin []byte
}

Config contains configuration files for genpolicy.

func NewConfig

func NewConfig(platform platforms.Platform) *Config

NewConfig selects the appropriate genpolicy configuration for the target platform.

type Runner

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

Runner is a wrapper around the genpolicy tool.

Create an instance with New(), call Run() to execute the tool, and call Teardown() afterwards to clean up temporary files.

func New

func New(rulesPath, settingsPath, cachePath string, bin []byte) (*Runner, error)

New creates a new Runner for the given configuration.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, yamlPath string, logger *slog.Logger) error

Run runs the tool on the given yaml.

Run can be called more than once.

func (*Runner) Teardown

func (r *Runner) Teardown() error

Teardown cleans up temporary files and should be called after the last Run.

Jump to

Keyboard shortcuts

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