opa

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOpaProvider added in v0.6.0

func CreateOpaProvider(ctx context.Context, spec *OpaSpec) (types.Provider, error)

func GetValidatedAssets

func GetValidatedAssets(ctx context.Context, regoPolicy string, dataset map[string]interface{}, output *OpaOutput) (types.Result, error)

GetValidatedAssets performs the validation of the dataset against the given rego policy

Types

type OpaOutput added in v0.2.0

type OpaOutput struct {
	// optional: Specifies the JSON path to a boolean value indicating the validation result.
	Validation string `json:"validation" yaml:"validation"`
	// optional: any additional observations to include (fields must resolve to strings)
	Observations []string `json:"observations" yaml:"observations"`
}

OpaOutput Defines the output structure for OPA validation results, including validation status and additional observations.

type OpaProvider added in v0.2.0

type OpaProvider struct {
	// Context is the context that the OPA policy is being evaluated in
	Context context.Context `json:"context" yaml:"context"`

	// Spec is the specification of the OPA policy
	Spec *OpaSpec `json:"spec,omitempty" yaml:"spec,omitempty"`
}

func (OpaProvider) Evaluate added in v0.2.0

func (o OpaProvider) Evaluate(resources types.DomainResources) (types.Result, error)

type OpaSpec added in v0.2.0

type OpaSpec struct {
	// Required: Rego is the OPA policy
	Rego string `json:"rego" yaml:"rego"`
	// Optional: Output is the output of the OPA policy
	Output *OpaOutput `json:"output,omitempty" yaml:"output,omitempty"`
}

OpaSpec is the specification of the OPA policy, required if the provider type is opa

Jump to

Keyboard shortcuts

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