results

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	// ID is the identifier for the rule of this result.
	ID string
	// Violations contains a list of each violation for the rule from the OPA evaluator
	Violations []string
	// Deprecated: Value contains the raw result of the rule from the OPA evaluator.
	Value interface{}
	// Package references the package the rule belongs to.
	Package string
}

Result holds the information about the result of a check

func (*Result) IsFailureState

func (r *Result) IsFailureState() bool

IsFailureState returns true if there are Violations If Violations are missing, the Value is parsed and if it is a bool that is negated and returned, otherwise false

func (*Result) IsSuccessState

func (r *Result) IsSuccessState() bool

IsSuccessState returns true if there are no Violations If Violations are missing, the Value is parsed and if it is a bool that is used, otherwise false

type ResultCollection

type ResultCollection []*Result

ResultCollection is a collection of Result

func NewResultCollection

func NewResultCollection() *ResultCollection

NewResultCollection returns an empty ResultCollection.

func NewResultCollectionFromRegoResultSet

func NewResultCollectionFromRegoResultSet(rs *rego.ResultSet) (*ResultCollection, error)

NewResultCollectionFromRegoResultSet creates a new ResultCollection from a rego.ResultSet.

func Parse

func Parse(rawResult []byte) (*ResultCollection, error)

Parse takes the raw result of evaluating a set of rego rules in preflight and returns a ResultCollection collection.

func (*ResultCollection) Add

func (r *ResultCollection) Add(rr []*Result)

Add adds a slice of results to the collection.

func (*ResultCollection) ByID

func (r *ResultCollection) ByID() map[string]*Result

ByID returns a map of results by ID.

func (*ResultCollection) ListFailing

func (r *ResultCollection) ListFailing() []*Result

ListFailing returns a subset of the results that have failed.

func (*ResultCollection) ListPassing

func (r *ResultCollection) ListPassing() []*Result

ListPassing returns a subset of the results that have passed.

func (*ResultCollection) Serialize

func (r *ResultCollection) Serialize(w io.Writer) error

Serialize serializes a ResultCollection into a JSON representation and writes it.

Jump to

Keyboard shortcuts

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