evaluator

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractStringFromMetadata

func ExtractStringFromMetadata(result Result, key string) string

ExtractStringFromMetadata returns the string value from the result metadata at the given key.

Types

type Data

type Data map[string]any

type Evaluator

type Evaluator interface {
	Evaluate(ctx context.Context, inputs []string) ([]Outcome, Data, error)

	// Destroy performs any cleanup needed
	Destroy()

	// CapabilitiesPath returns the path to the file where capabilities are defined
	CapabilitiesPath() string
}

func NewConftestEvaluator

func NewConftestEvaluator(ctx context.Context, policySources []source.PolicySource, p policy.Policy, source ecc.Source) (Evaluator, error)

NewConftestEvaluator returns initialized conftestEvaluator implementing Evaluator interface

func NewConftestEvaluatorWithNamespace

func NewConftestEvaluatorWithNamespace(ctx context.Context, policySources []source.PolicySource, p policy.Policy, source ecc.Source, namespace []string) (Evaluator, error)

set the policy namespace

type Outcome

type Outcome struct {
	FileName   string   `json:"filename"`
	Namespace  string   `json:"namespace"`
	Successes  []Result `json:"successes,omitempty"`
	Skipped    []Result `json:"skipped,omitempty"`
	Warnings   []Result `json:"warnings,omitempty"`
	Failures   []Result `json:"failures,omitempty"`
	Exceptions []Result `json:"exceptions,omitempty"`
}

type Result

type Result struct {
	Message  string                 `json:"msg"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Outputs  []string               `json:"outputs,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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