Documentation
¶
Index ¶
- type Result
- type ResultCollection
- func FilterResultCollection(resultCollection *ResultCollection, disabledRuleIDs, enabledRuleIDs []string) *ResultCollection
- func NewResultCollection() *ResultCollection
- func NewResultCollectionFromRegoResultSet(rs *rego.ResultSet) (*ResultCollection, error)
- func Parse(rawResult []byte) (*ResultCollection, error)
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 ¶
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 ¶
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 FilterResultCollection ¶
func FilterResultCollection(resultCollection *ResultCollection, disabledRuleIDs, enabledRuleIDs []string) *ResultCollection
FilterResultCollection filters a collection of results based on lists of disabled and enabled rule IDs and returns a filtered ResultCollection. The filtered ResultCollection does not include results for disabled rules. If the enabled rules list is not empty the filtered ResultCollection only contains results for enabled rules.
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.