policies

package
v2.0.0-ccit-pre2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRegoPackage = "clouditor.metrics"

DefaultRegoPackage is the default package name for the Rego files

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlsSource

type ControlsSource interface {
	Controls() ([]*orchestrator.Control, error)
}

ControlsSource is used to retrieve a list of controls

type MetricsSource

type MetricsSource interface {
	Metrics() ([]*assessment.Metric, error)
	MetricConfiguration(targetID string, metric *assessment.Metric) (*assessment.MetricConfiguration, error)
	MetricImplementation(lang assessment.MetricImplementation_Language, metric *assessment.Metric) (*assessment.MetricImplementation, error)
}

MetricsSource is used to retrieve a list of metrics and to retrieve a metric configuration as well as implementation for a particular metric (and certification target)

type PolicyEval

type PolicyEval interface {
	// Eval evaluates a given evidence against a metric coming from the metrics source. In order to avoid unnecessarily
	// unwrapping, the callee of this function needs to supply the unwrapped ontology resource, since they most likely
	// unwrapped the resource already, e.g. to check for validation.
	Eval(evidence *evidence.Evidence, r ontology.IsResource, related map[string]ontology.IsResource, src MetricsSource) (data []*Result, err error)
	HandleMetricEvent(event *orchestrator.MetricChangeEvent) (err error)
}

PolicyEval is an interface for the policy evaluation engine

func NewRegoEval

func NewRegoEval(opts ...RegoEvalOption) PolicyEval

type RegoEvalOption

type RegoEvalOption func(re *regoEval)

func WithPackageName

func WithPackageName(pkg string) RegoEvalOption

WithPackageName is an option to configure the package name

type Result

type Result struct {
	Applicable  bool
	Compliant   bool
	TargetValue interface{}
	Operator    string
	MetricID    string
	Config      *assessment.MetricConfiguration
}

Jump to

Keyboard shortcuts

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