resourcesresults

package
v0.0.281 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceAssociatedControl

type ResourceAssociatedControl struct {
	ControlID               string                   `json:"controlID"`
	Name                    string                   `json:"name"`
	Status                  apis.StatusInfo          `json:"status"`
	ResourceAssociatedRules []ResourceAssociatedRule `json:"rules,omitempty"`
}

ResourceAssociatedControl control that is associated to a resource

func (*ResourceAssociatedControl) GetID

func (control *ResourceAssociatedControl) GetID() string

GetID get control ID

func (*ResourceAssociatedControl) GetName

func (control *ResourceAssociatedControl) GetName() string

GetID get control ID

func (*ResourceAssociatedControl) GetStatus

func (control *ResourceAssociatedControl) GetStatus(f *helpersv1.Filters) apis.IStatus

Status get control status

func (*ResourceAssociatedControl) GetSubStatus added in v0.0.227

func (control *ResourceAssociatedControl) GetSubStatus() apis.ScanningSubStatus

GetSubStatus get control sub status

func (*ResourceAssociatedControl) ListRules

func (control *ResourceAssociatedControl) ListRules() []ResourceAssociatedRule

ListRules return list of rules

func (*ResourceAssociatedControl) SetID

func (control *ResourceAssociatedControl) SetID(id string)

SetID set control ID

func (*ResourceAssociatedControl) SetName

func (control *ResourceAssociatedControl) SetName(name string)

SetID set control ID

func (*ResourceAssociatedControl) SetStatus added in v0.0.227

func (control *ResourceAssociatedControl) SetStatus(c reporthandling.Control)

SetStatus set control status and sub status

SetStatus set control status and sub status according to the following logic:
1. Calculate control status with all the resource associated rules:
	1.1 if the status is failed and the control contains attributes of actionRequired: requires/manual review,
		the status is skipped and the sub status is requires/manual review
	1.2 if the control contains attributes of actionRequired: configuration and the configuration is not set,
		the status is skipped and the sub status is configuration

type ResourceAssociatedRule

type ResourceAssociatedRule struct {
	ControlConfigurations map[string][]string                `json:"controlConfigurations,omitempty"`
	Name                  string                             `json:"name"`
	Status                apis.ScanningStatus                `json:"status"`
	SubStatus             apis.ScanningSubStatus             `json:"subStatus"`
	Paths                 []armotypes.PosturePaths           `json:"paths,omitempty"`
	Exception             []armotypes.PostureExceptionPolicy `json:"exception,omitempty"`
	RelatedResourcesIDs   []string                           `json:"relatedResourcesIDs,omitempty"`
}

ResourceAssociatedRule failed rule that is associated to a resource

func (*ResourceAssociatedRule) GetName

func (rule *ResourceAssociatedRule) GetName() string

GetName get rule name

func (*ResourceAssociatedRule) GetStatus

func (rule *ResourceAssociatedRule) GetStatus(f *helpersv1.Filters) apis.IStatus

GetStatus get rule status

func (*ResourceAssociatedRule) GetSubStatus added in v0.0.227

func (rule *ResourceAssociatedRule) GetSubStatus() apis.ScanningSubStatus

GetSubStatus get rule sub status

func (*ResourceAssociatedRule) SetName

func (rule *ResourceAssociatedRule) SetName(n string)

SetName set rule name

func (*ResourceAssociatedRule) SetStatus added in v0.0.227

SetStatus set rule status and sub status

type Result

type Result struct {
	RawResource         *reporthandling.Resource            `json:"rawResource,omitempty"`
	PrioritizedResource *prioritization.PrioritizedResource `json:"prioritizedResource,omitempty"`
	ResourceID          string                              `json:"resourceID"` // <apigroup>/<namespace>/<kind>/<name>
	AssociatedControls  []ResourceAssociatedControl         `json:"controls,omitempty"`
	// contains filtered or unexported fields
}

Result - resource result resourceID and the controls that where tested against the resource, along with the raw resource and prioritization information

func MockResults

func MockResults() []Result

func (*Result) GetResourceID

func (result *Result) GetResourceID() string

GetResourceID get the resource ID

func (*Result) GetStatus

func (result *Result) GetStatus(f *helpersv1.Filters) apis.IStatus

Status get resource status

func (*Result) ListControls

func (result *Result) ListControls() []ResourceAssociatedControl

// ListControls return list of controls

func (*Result) ListControlsIDs

func (result *Result) ListControlsIDs(f *helpersv1.Filters) *helpersv1.AllLists

ListFailedControls return list of failed controls IDs

func (*Result) ListControlsNames

func (result *Result) ListControlsNames(f *helpersv1.Filters) *helpersv1.AllLists

ListFailedControls return list of controls IDs

func (*Result) ListRules

func (result *Result) ListRules() []ResourceAssociatedRule

ListRules return list of rules

func (*Result) ListRulesOfControl

func (result *Result) ListRulesOfControl(controlID, controlName string) []ResourceAssociatedRule

ListRulesOfControl return list of rules related to a controlID or controlName

func (*Result) SetExceptions

func (result *Result) SetExceptions(workload workloadinterface.IMetadata, exceptionsPolicies []armotypes.PostureExceptionPolicy, clusterName string, controls map[string]reporthandling.Control, opts ...ResultOption)

SetExceptions add exceptions to result.

If the caller has already instanciated an exceptions processor, the latter may be reused with option "WithExceptionsProcessor(processor)".

func (*Result) SetResourceID

func (result *Result) SetResourceID(resourceID string)

SetResourceID set the resource ID

type ResultOption added in v0.0.225

type ResultOption func(*resultOptions)

ResultOption allows for fine-grained tuning of the Result methods.

func WithExceptionsProcessor added in v0.0.225

func WithExceptionsProcessor(processor *exceptions.Processor) ResultOption

WithExceptionsProcessor allows the SetExceptions method to reuse an already allocated exceptions.Processor.

Jump to

Keyboard shortcuts

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