equivalence

package
v0.8.76 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffKind added in v0.8.39

type DiffKind string

DiffKind represents the type of difference

const (
	DiffAdded   DiffKind = "added"
	DiffRemoved DiffKind = "removed"
	DiffChanged DiffKind = "changed"
)

type EquivalenceChecker

type EquivalenceChecker struct {
	// contains filtered or unexported fields
}

EquivalenceChecker determines whether two EnterpriseContractPolicy specs produce the same evaluation result for a given image at a specific time.

func NewEquivalenceChecker

func NewEquivalenceChecker(effectiveTime time.Time, imageInfo *ImageInfo) *EquivalenceChecker

func (*EquivalenceChecker) AreEquivalent

func (ec *EquivalenceChecker) AreEquivalent(spec1, spec2 ecc.EnterpriseContractPolicySpec) (bool, error)

AreEquivalent checks equivalence only

func (*EquivalenceChecker) AreEquivalentWithDifferences added in v0.8.39

func (ec *EquivalenceChecker) AreEquivalentWithDifferences(spec1, spec2 ecc.EnterpriseContractPolicySpec) (bool, []PolicyDifference, error)

AreEquivalentWithDifferences returns equivalence and structured diffs

func (*EquivalenceChecker) GenerateUnifiedDiffOutput added in v0.8.39

func (ec *EquivalenceChecker) GenerateUnifiedDiffOutput(differences []PolicyDifference) string

func (*EquivalenceChecker) GenerateUnifiedDiffOutputWithLabels added in v0.8.39

func (ec *EquivalenceChecker) GenerateUnifiedDiffOutputWithLabels(differences []PolicyDifference, fromLabel, toLabel string) string

func (*EquivalenceChecker) NormalizePolicy added in v0.8.39

NormalizePolicy exposes normalization publicly

type FieldPath added in v0.8.39

type FieldPath []string

FieldPath represents a structured path to a field (e.g. ["ruleData","paths","/foo/bar"])

type ImageInfo

type ImageInfo struct {
	Digest string
	Ref    string
	URL    string
}

ImageInfo represents information about an image for volatile config matching

type NormalizedPolicy

type NormalizedPolicy struct {
	Buckets []PolicyBucket
}

NormalizedPolicy is a normalized view of a policy spec

type PolicyBucket

type PolicyBucket struct {
	PolicyURIs []string
	DataURIs   []string
	RuleData   map[string]interface{}
	Include    []string
	Exclude    []string
	// Optional labels (collected names from sources) for nicer headers (if desired later)
	Names []string
}

PolicyBucket represents one normalized policy "source entry"

type PolicyDifference added in v0.8.39

type PolicyDifference struct {
	BucketKey     string
	Field         string    // kept for compatibility and sorting
	Path          FieldPath // future-proof path support
	Kind          DiffKind
	VSAValue      any
	SuppliedValue any
	Summary       string
}

PolicyDifference represents a structured difference between two policies

func (PolicyDifference) IsAdded added in v0.8.39

func (pd PolicyDifference) IsAdded() bool

func (PolicyDifference) IsChanged added in v0.8.39

func (pd PolicyDifference) IsChanged() bool

func (PolicyDifference) IsRemoved added in v0.8.39

func (pd PolicyDifference) IsRemoved() bool

Jump to

Keyboard shortcuts

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