doop

package
v0.0.0-...-c5d1820 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedReport

type AggregatedReport struct {
	ClusterIdentities map[string]map[string]string `json:"cluster_identities"`
	Templates         []ReportForTemplate          `json:"templates"`
}

AggregatedReport is the data structure that doop-api produces. It aggregates multiple instances of type Report from different clusters.

func (*AggregatedReport) Sort

func (r *AggregatedReport) Sort()

Sort sorts all lists in this report in the respective canonical order.

type MetadataForConstraint

type MetadataForConstraint struct {
	Severity         string `json:"severity,omitempty"`
	TemplateSource   string `json:"template_source,omitempty"`
	ConstraintSource string `json:"constraint_source,omitempty"`
	Docstring        string `json:"docstring,omitempty"`
	// AuditTimestamp is always present in type Report, but omitted in type AggregatedReport.
	AuditTimestamp string `json:"auditTimestamp,omitempty"`
}

MetadataForConstraint appears in type ReportForConstraint.

type Report

type Report struct {
	ClusterIdentity map[string]string   `json:"cluster_identity"`
	Templates       []ReportForTemplate `json:"templates"`
}

Report is the data structure that doop-analyzer produces.

func (Report) SetClusterName

func (r Report) SetClusterName(clusterName string) Report

SetClusterName sets the ClusterName field on all Violation objects in this Report. This is used at report loading time to prepare the report for aggregation. The self-return is used to shorten setup code in unit tests.

type ReportForConstraint

type ReportForConstraint struct {
	Name     string                `json:"name"`
	Metadata MetadataForConstraint `json:"metadata"`
	// Before processing, Violations is filled and ViolationGroups is nil.
	// After processing, Violations is nil and ViolationGroups is filled.
	Violations      []Violation      `json:"violations,omitempty"`
	ViolationGroups []ViolationGroup `json:"violation_groups,omitempty"`
}

ReportForConstraint appears in type ReportForTemplate.

func (*ReportForConstraint) Sort

func (r *ReportForConstraint) Sort()

Sort sorts all lists in this report in the respective canonical order.

type ReportForTemplate

type ReportForTemplate struct {
	Kind        string                `json:"kind"`
	Constraints []ReportForConstraint `json:"constraints"`
}

ReportForTemplate appears in type Report.

func (*ReportForTemplate) Sort

func (r *ReportForTemplate) Sort()

Sort sorts all lists in this report in the respective canonical order.

type Violation

type Violation struct {
	// All fields are omitempty because we compress ViolationGroups by omitting all fields
	// from instances that are identical to the respective fields in the pattern.
	Kind           string            `json:"kind,omitempty"`
	Name           string            `json:"name,omitempty"`
	Namespace      string            `json:"namespace,omitempty"`
	Message        string            `json:"message,omitempty"`
	ObjectIdentity map[string]string `json:"object_identity,omitempty"`
	// This field is only set when this Violation appears as a ViolationGroup instance inside an AggregatedReport.
	// It is written by Report.SetClusterName() at report loading time.
	ClusterName string `json:"cluster,omitempty"`
}

Violation describes a single policy violation, or the common pattern within a ViolationGroup.

func (Violation) Cloned

func (v Violation) Cloned() Violation

Cloned returns a deep copy of this Violation.

func (Violation) CompareTo

func (v Violation) CompareTo(other Violation) int

CompareTo is a three-way compare between violations. As per the usual convention, 0 means `v == other`, negative means `v < other`, and positive means `v > other`.

func (Violation) DifferenceTo

func (v Violation) DifferenceTo(pattern Violation) Violation

DifferenceTo returns a copy of this violation, with all fields cleared out that are identical to the pattern.

func (Violation) IsEqualTo

func (v Violation) IsEqualTo(other Violation) bool

IsEqualTo works like reflect.DeepEqual(), but is faster and thus a better fit for hot loops.

type ViolationGroup

type ViolationGroup struct {
	Pattern   Violation   `json:"pattern"`
	Instances []Violation `json:"instances"`
}

ViolationGroup describes a set of one or more policy violations that follow a common pattern.

Jump to

Keyboard shortcuts

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