reportsummary

package
v0.0.232 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 5 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlCriteria

type ControlCriteria string
const (
	EControlCriteriaID   ControlCriteria = "ID"
	EControlCriteriaName ControlCriteria = "name" // DEPRECATED
)

type ControlSummaries

type ControlSummaries map[string]ControlSummary

func (*ControlSummaries) GetControl

func (controlSummaries *ControlSummaries) GetControl(criteria ControlCriteria, value string) IControlSummary

get control either by criteria = "ID" and value <controlID> or criteria = name and <controlName>

func (*ControlSummaries) GetIDs

func (controlSummaries *ControlSummaries) GetIDs() []string

=============== ControlSummaries

func (*ControlSummaries) ListControlsIDs

func (controlSummaries *ControlSummaries) ListControlsIDs() *helpersv1.AllLists

func (*ControlSummaries) ListResourcesIDs

func (controlSummaries *ControlSummaries) ListResourcesIDs() *helpersv1.AllLists

func (*ControlSummaries) NumberOfControls

func (controlSummaries *ControlSummaries) NumberOfControls() ICounters

might be redundant

type ControlSummary

type ControlSummary struct {
	StatusInfo        apis.StatusInfo     `json:"statusInfo,omitempty"`
	ControlID         string              `json:"controlID"`
	Name              string              `json:"name"`
	Status            apis.ScanningStatus `json:"status"` // backward compatibility
	Description       string              `json:"-"`
	Remediation       string              `json:"-"`
	ResourceIDs       helpersv1.AllLists  `json:"resourceIDs"`
	StatusCounters    StatusCounters      `json:",inline"`
	SubStatusCounters SubStatusCounters   `json:",inline"`
	Score             float32             `json:"score"`
	ScoreFactor       float32             `json:"scoreFactor"`
}

ControlSummary summary of scanning from a single control perspective

func (*ControlSummary) Append

func (controlSummary *ControlSummary) Append(status apis.IStatus, ids ...string)

Append increases the counter based on the status

func (*ControlSummary) CalculateStatus

func (controlSummary *ControlSummary) CalculateStatus()

func (*ControlSummary) GetDescription

func (controlSummary *ControlSummary) GetDescription() string

GetDescription get control description

func (*ControlSummary) GetID

func (controlSummary *ControlSummary) GetID() string

GetID return control ID

func (*ControlSummary) GetName

func (controlSummary *ControlSummary) GetName() string

GetName return control name

func (*ControlSummary) GetRemediation

func (controlSummary *ControlSummary) GetRemediation() string

GetRemediation get control remediation

func (*ControlSummary) GetScore

func (controlSummary *ControlSummary) GetScore() float32

GetScore return control score

func (*ControlSummary) GetScoreFactor

func (controlSummary *ControlSummary) GetScoreFactor() float32

GetScoreFactor return control score

func (*ControlSummary) GetStatus

func (controlSummary *ControlSummary) GetStatus() apis.IStatus

GetStatus get the control status. returns an apis.StatusInfo object

func (*ControlSummary) GetSubStatus added in v0.0.227

func (controlSummary *ControlSummary) GetSubStatus() apis.ScanningSubStatus

GetSubStatus get the control sub status. returns an apis.StatusInfo object

func (*ControlSummary) ListResourcesIDs

func (controlSummary *ControlSummary) ListResourcesIDs() *helpersv1.AllLists

=================================== Counters ============================================

func (*ControlSummary) NumberOfResources

func (controlSummary *ControlSummary) NumberOfResources() ICounters

Deprecated use 'ResourcesCounters' instead NumberOfResources get the status counters

func (*ControlSummary) SetStatus

func (controlSummary *ControlSummary) SetStatus(statusInfo *apis.StatusInfo)

func (*ControlSummary) SetSubStatus added in v0.0.227

func (controlSummary *ControlSummary) SetSubStatus(subStatus apis.ScanningSubStatus)

func (*ControlSummary) StatusesCounters added in v0.0.231

func (controlSummary *ControlSummary) StatusesCounters() (ICounters, ISubCounters)

NumberOfResources get the status counters

type FrameworkSummary

type FrameworkSummary struct {
	Controls       ControlSummaries    `json:"controls,omitempty"` // mapping of control - map[<control ID>]<control summary>
	Name           string              `json:"name"`               // framework name
	Status         apis.ScanningStatus `json:"status"`
	Version        string              `json:"version"`
	StatusCounters StatusCounters      `json:",inline"`
	Score          float32             `json:"score"`
}

FrameworkSummary summary of scanning from a single framework perspective

func (*FrameworkSummary) CalculateStatus

func (frameworkSummary *FrameworkSummary) CalculateStatus()

SetStatus set the framework status based on the resource counters

func (*FrameworkSummary) GetControls

func (frameworkSummary *FrameworkSummary) GetControls() IControlsSummaries

Controls return the controls

func (*FrameworkSummary) GetName

func (frameworkSummary *FrameworkSummary) GetName() string

GetName return framework name

func (*FrameworkSummary) GetScore

func (frameworkSummary *FrameworkSummary) GetScore() float32

GetScore return framework score

func (*FrameworkSummary) GetStatus

func (frameworkSummary *FrameworkSummary) GetStatus() apis.IStatus

Status get the framework status. returns an apis.ScanningStatus object

func (*FrameworkSummary) Increase

func (frameworkSummary *FrameworkSummary) Increase(status apis.IStatus)

Increase increases the counter based on the status

func (*FrameworkSummary) ListControls

func (frameworkSummary *FrameworkSummary) ListControls() []IControlSummary

ListControls list all controls

func (*FrameworkSummary) ListControlsIDs

func (frameworkSummary *FrameworkSummary) ListControlsIDs() *helpersv1.AllLists

func (*FrameworkSummary) ListControlsNames

func (frameworkSummary *FrameworkSummary) ListControlsNames() *helpersv1.AllLists

ListControlsNames list all framework names

func (*FrameworkSummary) ListResourcesIDs

func (frameworkSummary *FrameworkSummary) ListResourcesIDs() *helpersv1.AllLists

List resources IDs

func (*FrameworkSummary) NumberOfControls

func (frameworkSummary *FrameworkSummary) NumberOfControls() ICounters

func (*FrameworkSummary) NumberOfResources

func (frameworkSummary *FrameworkSummary) NumberOfResources() ICounters

NumberOfExcluded get the number of excluded resources

type IBasicPostureReport

type IBasicPostureReport interface {
	GetCustomerGUID() string
	GetClusterName() string
	GetReportGUID() string
	GetJobID() string
	GetTimestamp() *time.Time
}

type IControlSummary

type IControlSummary interface {
	IPolicies
	GetScoreFactor() float32

	// GetID get control ID
	GetID() string

	// GetRemediation get control remediation
	GetRemediation() string

	// GetDescription get control description
	GetDescription() string

	// Get SubStatus() get control sub status
	GetSubStatus() apis.ScanningSubStatus

	StatusesCounters() (ICounters, ISubCounters)
}

type IControlsSummaries

type IControlsSummaries interface {
	GetControl(criteria ControlCriteria, value string) IControlSummary

	NumberOfControls() ICounters
	ListControlsIDs() *helpersv1.AllLists
	ListResourcesIDs() *helpersv1.AllLists
}

type ICounters

type ICounters interface {
	Passed() int
	Skipped() int
	Failed() int
	Excluded() int // deprecated
	All() int
}

type IFrameworkSummary

type IFrameworkSummary interface {
	IPolicies
	ListControls() []IControlSummary
	NumberOfControls() ICounters
}

type IPolicies

type IPolicies interface {
	GetStatus() apis.IStatus
	CalculateStatus()
	ListResourcesIDs() *helpersv1.AllLists

	// Counters
	NumberOfResources() ICounters

	// Score
	GetScore() float32

	// Name
	GetName() string
}

type ISeverityCounters added in v0.0.190

type ISeverityCounters interface {
	NumberOfCriticalSeverity() int
	NumberOfHighSeverity() int
	NumberOfMediumSeverity() int
	NumberOfLowSeverity() int
	Increase(severity string, amount int)
}

type ISubCounters added in v0.0.231

type ISubCounters interface {
	All() int
	Ignored() int
}

type PostureAttributes

type PostureAttributes struct {
	Attribute string   `json:"attributeName"`
	Values    []string `json:"values"`
}

type PostureCounters

type PostureCounters struct {
	PassedCounter   int `json:"passed"`
	FailedCounter   int `json:"failed"`
	SkippedCounter  int `json:"skipped"`
	ExcludedCounter int `json:"excluded"` // Deprecated
}

func (*PostureCounters) All

func (pcounter *PostureCounters) All() int

func (*PostureCounters) Excluded

func (pcounter *PostureCounters) Excluded() int

deprecated

func (*PostureCounters) Failed

func (pcounter *PostureCounters) Failed() int

Failed get the number of failed posture object

func (*PostureCounters) Increase

func (pcounter *PostureCounters) Increase(status apis.IStatus)

func (*PostureCounters) Passed

func (pcounter *PostureCounters) Passed() int

NumberOfPassed get the number of passed posture object

func (*PostureCounters) Skipped

func (pcounter *PostureCounters) Skipped() int

NumberOfSkipped get the number of skipped posture object

type SeverityCounters added in v0.0.190

type SeverityCounters struct {
	CriticalSeverityCounter int `json:"criticalSeverity"`
	HighSeverityCounter     int `json:"highSeverity"`
	MediumSeverityCounter   int `json:"mediumSeverity"`
	LowSeverityCounter      int `json:"lowSeverity"`
}

func (*SeverityCounters) Increase added in v0.0.191

func (sc *SeverityCounters) Increase(severity string, amount int)

Increase increments the counter of a given severity by a given amount

func (*SeverityCounters) NumberOfCriticalSeverity added in v0.0.203

func (sc *SeverityCounters) NumberOfCriticalSeverity() int

func (*SeverityCounters) NumberOfHighSeverity added in v0.0.203

func (sc *SeverityCounters) NumberOfHighSeverity() int

func (*SeverityCounters) NumberOfLowSeverity added in v0.0.203

func (sc *SeverityCounters) NumberOfLowSeverity() int

func (*SeverityCounters) NumberOfMediumSeverity added in v0.0.203

func (sc *SeverityCounters) NumberOfMediumSeverity() int

type StatusCounters added in v0.0.231

type StatusCounters struct {
	PassedResources   int `json:"passedResources"`
	FailedResources   int `json:"failedResources"`
	SkippedResources  int `json:"skippedResources"`
	ExcludedResources int `json:"excludedResources"` // Deprecated
}

func (*StatusCounters) All added in v0.0.231

func (resourceCounters *StatusCounters) All() int

NumberOfAll get the number of all resources

func (*StatusCounters) Excluded added in v0.0.231

func (resourceCounters *StatusCounters) Excluded() int

deprecated

func (*StatusCounters) Failed added in v0.0.231

func (resourceCounters *StatusCounters) Failed() int

NumberOfFailed get the number of failed resources

func (*StatusCounters) Increase added in v0.0.231

func (resourceCounters *StatusCounters) Increase(status apis.IStatus)

Increase increases the counter based on the status

func (*StatusCounters) Passed added in v0.0.231

func (resourceCounters *StatusCounters) Passed() int

NumberOfPassed get the number of passed resources

func (*StatusCounters) Set added in v0.0.231

func (resourceCounters *StatusCounters) Set(allLists *helpersv1.AllLists)

NumberOfExcluded get the number of excluded resources

func (*StatusCounters) Skipped added in v0.0.231

func (resourceCounters *StatusCounters) Skipped() int

NumberOfSkipped get the number of skipped resources

type SubStatusCounters added in v0.0.231

type SubStatusCounters struct {
	IgnoredResources int `json:"ignoredResources"`
}

func (*SubStatusCounters) All added in v0.0.231

func (subStatusCounters *SubStatusCounters) All() int

func (*SubStatusCounters) Ignored added in v0.0.231

func (subStatusCounters *SubStatusCounters) Ignored() int

func (*SubStatusCounters) Increase added in v0.0.231

func (subStatusCounters *SubStatusCounters) Increase(status apis.IStatus)

Increase increases the counter based on the status

type SummaryDetails

type SummaryDetails struct {
	Controls                  ControlSummaries    `json:"controls,omitempty"`
	Status                    apis.ScanningStatus `json:"status"`
	Frameworks                []FrameworkSummary  `json:"frameworks"`
	ResourcesSeverityCounters SeverityCounters    `json:"resourcesSeverityCounters,omitempty"`
	ControlsSeverityCounters  SeverityCounters    `json:"controlsSeverityCounters,omitempty"`
	StatusCounters            StatusCounters      `json:",inline"`
	Score                     float32             `json:"score"`
}

SummaryDetails detailed summary of the scanning. will contain versions, counters, etc.

func MockSummaryDetails

func MockSummaryDetails() *SummaryDetails

func (*SummaryDetails) AppendResourceResult

func (summaryDetails *SummaryDetails) AppendResourceResult(resourceResult *resourcesresults.Result)

AppendResourceResult appends the given resource result to the summary

Updates any necessary info accordingly

func (*SummaryDetails) CalculateStatus

func (summaryDetails *SummaryDetails) CalculateStatus()

SetStatus set the framework status based on the resource counters

func (*SummaryDetails) ControlName

func (summaryDetails *SummaryDetails) ControlName(controlID string) string

================================================================================

func (*SummaryDetails) GetControlsSeverityCounters added in v0.0.203

func (summaryDetails *SummaryDetails) GetControlsSeverityCounters() ISeverityCounters

GetResourcesSeverityCounters get the resources severity counters

func (*SummaryDetails) GetResourcesSeverityCounters added in v0.0.190

func (summaryDetails *SummaryDetails) GetResourcesSeverityCounters() ISeverityCounters

GetResourcesSeverityCounters get the resources severity counters

func (*SummaryDetails) GetScore

func (summaryDetails *SummaryDetails) GetScore() float32

GetScore return score

func (*SummaryDetails) GetStatus

func (summaryDetails *SummaryDetails) GetStatus() *helpersv1.Status

Status get the scan status. returns an apis.ScanningStatus object

func (*SummaryDetails) Increase

func (summaryDetails *SummaryDetails) Increase(status apis.IStatus)

Increase increases the counter based on the status

func (*SummaryDetails) InitResourcesSummary

func (summaryDetails *SummaryDetails) InitResourcesSummary(controlInfoMap map[string]apis.StatusInfo)

InitResourcesSummary must run this AFTER initializing the controls

func (*SummaryDetails) ListControls

func (summaryDetails *SummaryDetails) ListControls() []IControlSummary

ListControls list all controls

func (*SummaryDetails) ListControlsIDs

func (summaryDetails *SummaryDetails) ListControlsIDs() *helpersv1.AllLists

func (*SummaryDetails) ListControlsNames

func (summaryDetails *SummaryDetails) ListControlsNames() *helpersv1.AllLists

ListControlsNames list all framework names

func (*SummaryDetails) ListFrameworks

func (summaryDetails *SummaryDetails) ListFrameworks() []IFrameworkSummary

ListFrameworks list all frameworks

func (*SummaryDetails) ListFrameworksNames

func (summaryDetails *SummaryDetails) ListFrameworksNames() *helpersv1.AllLists

ListFrameworksNames list all framework names

func (*SummaryDetails) ListResourcesIDs

func (summaryDetails *SummaryDetails) ListResourcesIDs() *helpersv1.AllLists

ListResourcesIDs list all resources IDs

func (*SummaryDetails) NumberOfControls

func (summaryDetails *SummaryDetails) NumberOfControls() ICounters

NumberOfControls get number of controls

func (*SummaryDetails) NumberOfResources

func (summaryDetails *SummaryDetails) NumberOfResources() ICounters

NumberOfExcluded get the number of excluded resources

Jump to

Keyboard shortcuts

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