commands

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: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultCommand

func NewDefaultCommand() *cobra.Command

NewDefaultCommand creates the default command

func NewParseCommand

func NewParseCommand(ctx context.Context) *cobra.Command

NewParseCommand creates a parse command. This command can be used for printing structured inputs from unstructured configuration inputs.

func NewPluginCommand

func NewPluginCommand(ctx context.Context) *cobra.Command

NewPluginCommand creates a new plugin command

func NewPluginInstallCommand

func NewPluginInstallCommand(ctx context.Context) *cobra.Command

NewPluginInstallCommand creates the install plugin subcommand

func NewPullCommand

func NewPullCommand(ctx context.Context) *cobra.Command

NewPullCommand creates a new pull command to allow users to download individual policies

func NewPushCommand

func NewPushCommand(ctx context.Context, logger *log.Logger) *cobra.Command

NewPushCommand creates a new push command which allows users to push bundles to an OCI registry

func NewTestCommand

func NewTestCommand(ctx context.Context) *cobra.Command

NewTestCommand creates a new test command

func NewVerifyCommand

func NewVerifyCommand(ctx context.Context) *cobra.Command

NewVerifyCommand creates a new verify command which allows users to validate their rego unit tests

func ValidOutputs

func ValidOutputs() []string

ValidOutputs returns the available output formats for reporting tests

Types

type CheckResult

type CheckResult struct {
	FileName  string
	Warnings  []Result
	Failures  []Result
	Successes []Result
}

CheckResult describes the result of a conftest evaluation. warning and failure "errors" produced by rego should be considered separate from other classes of exceptions.

type JSONOutputManager

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

JSONOutputManager formats its output to JSON

func NewDefaultJSONOutputManager

func NewDefaultJSONOutputManager() *JSONOutputManager

NewDefaultJSONOutputManager creates a new JSONOutputManager using the default logger

func NewJSONOutputManager

func NewJSONOutputManager(l *log.Logger) *JSONOutputManager

NewJSONOutputManager creates a new JSONOutputManager with a given logger instance

func (*JSONOutputManager) Flush

func (j *JSONOutputManager) Flush() error

Flush writes the contents of the managers buffer to the console

func (*JSONOutputManager) Put

func (j *JSONOutputManager) Put(cr CheckResult) error

Put puts the result of the check to the manager in the managers buffer

type OutputManager

type OutputManager interface {
	Put(cr CheckResult) error
	Flush() error
}

OutputManager controls how results of an evaluation will be recorded and reported to the end user

func GetOutputManager

func GetOutputManager(outputFormat string, color bool) OutputManager

GetOutputManager returns the OutputManager based on the user input

type Result

type Result struct {
	Message  string
	Metadata map[string]interface{}
	Traces   []error
}

Result describes the result of a single rule evaluation.

func NewResult

func NewResult(message string, traces []error) Result

NewResult creates a new result from the given message

func (Result) Error

func (r Result) Error() string

type StandardOutputManager

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

StandardOutputManager writes to stdout

func NewDefaultStandardOutputManager

func NewDefaultStandardOutputManager(color bool) *StandardOutputManager

NewDefaultStandardOutputManager creates a new StandardOutputManager using the default logger

func NewStandardOutputManager

func NewStandardOutputManager(l *log.Logger, color bool) *StandardOutputManager

NewStandardOutputManager creates a new StandardOutputManager given a logger instance

func (*StandardOutputManager) Flush

func (s *StandardOutputManager) Flush() error

Flush writes the contents of the managers buffer to the console

func (*StandardOutputManager) Put

Put puts the result of the check to the manager in the managers buffer

type TAPOutputManager

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

TAPOutputManager formats its output in TAP format

func NewDefaultTAPOutputManager

func NewDefaultTAPOutputManager() *TAPOutputManager

NewDefaultTAPOutputManager creates a new TAPOutputManager using the default logger

func NewTAPOutputManager

func NewTAPOutputManager(l *log.Logger) *TAPOutputManager

NewTAPOutputManager creates a new TAPOutputManager with a given logger instance

func (*TAPOutputManager) Flush

func (t *TAPOutputManager) Flush() error

Flush is currently a NOOP

func (*TAPOutputManager) Put

func (t *TAPOutputManager) Put(cr CheckResult) error

Put puts the result of the check to the manager in the managers buffer

type TableOutputManager

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

TableOutputManager formats its output in a table

func NewDefaultTableOutputManager

func NewDefaultTableOutputManager() *TableOutputManager

NewDefaultTableOutputManager creates a new TableOutputManager using standard out

func NewTableOutputManager

func NewTableOutputManager(w io.Writer) *TableOutputManager

NewTableOutputManager creates a new TableOutputManager with a given Writer

func (*TableOutputManager) Flush

func (t *TableOutputManager) Flush() error

Flush writes the contents of the managers buffer to the console

func (*TableOutputManager) Put

Put puts the result of the check to the manager in the managers buffer

type TestRun

type TestRun struct {
	Compiler *ast.Compiler
	Store    storage.Store
}

TestRun stores the compiler and store for a test run

func (TestRun) GetResult

func (t TestRun) GetResult(ctx context.Context, namespaces []string, input interface{}) (CheckResult, error)

GetResult returns the result of testing the structured data against their policies

Jump to

Keyboard shortcuts

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