scheme

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByNamespace added in v0.2.3

type ByNamespace orderedmap.OrderedMap // Must be exported for json marshal

ByNamespace maps Namespace to the default scheme

func NewByNamespace added in v0.2.3

func NewByNamespace() *ByNamespace

func ToByNamespace added in v0.2.3

func ToByNamespace(m *orderedmap.OrderedMap) *ByNamespace

func (*ByNamespace) AsOrderedMap added in v0.2.3

func (s *ByNamespace) AsOrderedMap() *orderedmap.OrderedMap

func (*ByNamespace) UnsafeGet added in v0.2.3

func (s *ByNamespace) UnsafeGet(namespace string) *Flattened

type ByResource added in v0.2.3

type ByResource orderedmap.OrderedMap // Must be exported for json marshal

ByResource maps Resource to the default scheme

func NewByResource added in v0.2.3

func NewByResource() *ByResource

func ToByResource added in v0.2.3

func ToByResource(m *orderedmap.OrderedMap) *ByResource

func (*ByResource) AsOrderedMap added in v0.2.3

func (s *ByResource) AsOrderedMap() *orderedmap.OrderedMap

func (*ByResource) UnsafeGet added in v0.2.3

func (s *ByResource) UnsafeGet(resourceType string) *Flattened

type BySeverity added in v0.2.3

type BySeverity orderedmap.OrderedMap // Must be exported for json marshal

BySeverity maps Resource to the default scheme

func NewBySeverity added in v0.2.3

func NewBySeverity() *BySeverity

func ToBySeverity added in v0.2.3

func ToBySeverity(m *orderedmap.OrderedMap) *BySeverity

func (*BySeverity) AsOrderedMap added in v0.2.3

func (s *BySeverity) AsOrderedMap() *orderedmap.OrderedMap

func (*BySeverity) UnsafeGet added in v0.2.3

func (s *BySeverity) UnsafeGet(severity string) *Flattened

type Flattened added in v0.2.3

type Flattened orderedmap.OrderedMap

Flattened maps policy-qualified-names to OutputData It is used as the default output, from which the converter selects the desired scheme

func NewFlattenedScheme

func NewFlattenedScheme() *Flattened

func ToFlattenedScheme added in v0.2.3

func ToFlattenedScheme(m *orderedmap.OrderedMap) *Flattened

func Unmarshal added in v0.2.3

func Unmarshal(data []byte) (*Flattened, error)

Unmarshal unmarshalls a typed json and returns the underlying Flattened scheme

func (*Flattened) AsOrderedMap added in v0.2.3

func (s *Flattened) AsOrderedMap() *orderedmap.OrderedMap

func (*Flattened) FilterByViolation added in v0.2.3

func (s *Flattened) FilterByViolation(filter ViolationFilter) *Flattened

func (*Flattened) FilteredByStatus added in v0.2.3

func (s *Flattened) FilteredByStatus(status analyzers.PolicyStatus) *Flattened

func (*Flattened) GetPolicyData added in v0.2.3

func (s *Flattened) GetPolicyData(policyName string) OutputData

func (*Flattened) OnlyFailedViolations added in v0.2.3

func (s *Flattened) OnlyFailedViolations() *Flattened

func (*Flattened) ShallowClone added in v0.2.3

func (s *Flattened) ShallowClone() *Flattened

func (*Flattened) Sorted added in v0.2.3

func (s *Flattened) Sorted(lessFunc func(a *orderedmap.Pair, b *orderedmap.Pair) bool) *Flattened

func (*Flattened) SortedByNamespace added in v0.2.3

func (s *Flattened) SortedByNamespace() *Flattened

func (*Flattened) SortedBySeverity added in v0.2.3

func (s *Flattened) SortedBySeverity() *Flattened

func (*Flattened) UnmarshalJSON added in v0.2.3

func (s *Flattened) UnmarshalJSON(data []byte) error

UnmarshalJSON implements unmarshaling for the Flattened scheme (called by json.Unmarshal) by rebuilding the scheme from the ordered maps.

type OutputData

type OutputData struct {
	PolicyInfo PolicyInfo  `json:"policyInfo"`
	Violations []Violation `json:"violations"`
}

func AppendViolations

func AppendViolations(o OutputData, violations ...Violation) OutputData

func NewOutputData

func NewOutputData(policyInfo PolicyInfo) OutputData

func (OutputData) Clone

func (o OutputData) Clone() OutputData

type PolicyInfo

type PolicyInfo struct {
	Title                    string              `json:"title"`
	Description              string              `json:"description"`
	PolicyName               string              `json:"policyName"`
	FullyQualifiedPolicyName string              `json:"fullyQualifiedPolicyName"`
	Severity                 severity.Severity   `json:"severity"`
	Threat                   []string            `json:"threat"`
	RemediationSteps         []string            `json:"remediationSteps"`
	Namespace                namespace.Namespace `json:"namespace"`
}

type Scheme added in v0.2.3

type Scheme interface {
	AsOrderedMap() *orderedmap.OrderedMap
}

type SchemeType added in v0.2.3

type SchemeType = string
const (
	TypeFlattened        SchemeType = "flattened"
	TypeGroupByNamespace SchemeType = "group-by-namespace"
	TypeGroupByResource  SchemeType = "group-by-resource"
	TypeGroupBySeverity  SchemeType = "group-by-severity"

	DefaultScheme = TypeFlattened
)

func DetectSchemeType added in v0.2.3

func DetectSchemeType(s Scheme) (SchemeType, error)

func SchemeTypes added in v0.2.3

func SchemeTypes() []SchemeType

type TypedScheme added in v0.2.3

type TypedScheme[T any] struct {
	Type    SchemeType `json:"type"`
	Content T          `json:"content"`
}

func NewTyped added in v0.2.3

func NewTyped[T any](t SchemeType, content T) *TypedScheme[T]

func NewTypedMarshalable added in v0.2.3

func NewTypedMarshalable(t SchemeType, content Scheme) *TypedScheme[*orderedmap.OrderedMap]

type Violation

type Violation struct {
	ViolationEntityType string                 `json:"violationEntityType"`
	CanonicalLink       string                 `json:"canonicalLink"`
	Aux                 *orderedmap.OrderedMap `json:"aux"`
	Status              analyzers.PolicyStatus `json:"status"`
}

type ViolationFilter

type ViolationFilter func(violation Violation) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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