result

package
v0.0.0-...-a1fe3bc Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueryResults

type QueryResults struct {
	// Source specifies the target that was tested.
	Source source.Source
	// Successes is the number of successes queries.
	Successes int
	// Failures is the list of failed queries.
	Failures []Result
	// Warnings is the list of warning queries.
	Warnings []Result
	// Exceptions is the list of exception queries.
	Exceptions []Result
}

QueryResults specifies the results against a target.

func (QueryResults) Merge

func (qr QueryResults) Merge(other QueryResults) QueryResults

Merge merges two results into a new one. The new result uses Source from the first result.

type Result

type Result struct {
	// Query is the OPA query that was executed.
	Query string
	// Rule is the rule executed by the query.
	Rule policy.Rule
	// RuleDocLink is the link to the documentation of the rule.
	RuleDocLink string
	// Message is the message that was returned by the rule.
	Message string
	// Metadata is the extra metadata that was returned by the rule.
	Metadata map[string]interface{}
}

Result specifies the result of a policy rule query.

func FromRegoExpression

func FromRegoExpression(
	query string,
	expression *rego.ExpressionValue,
) ([]Result, error)

FromRegoExpression resolves result from rego expression. Based on: https://github.com/open-policy-agent/conftest/blob/f18b7bbde2fdbd766c8348dff3a0a24792eb98c7/policy/engine.go#L439-L443

func (Result) Passed

func (r Result) Passed() bool

Passed tells if the result is passed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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