reportsummary

package
v0.0.191 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 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"
)

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"`
	Description      string              `json:"-"`
	Remediation      string              `json:"-"`
	ResourceIDs      helpersv1.AllLists  `json:"resourceIDs"`
	ResourceCounters ResourceCounters    `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()

CalculateStatus set the control status based on the resource counters

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.ScanningStatus object

func (*ControlSummary) ListResourcesIDs

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

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

func (*ControlSummary) NumberOfResources

func (controlSummary *ControlSummary) NumberOfResources() ICounters

NumberOf get the number of resources

func (*ControlSummary) SetStatus

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

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"`
	ResourceCounters ResourceCounters    `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
}

type IControlsSummaries

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

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

type ICounters

type ICounters interface {
	Excluded() int
	Passed() int
	Skipped() int
	Failed() int
	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 {
	NumberOfResourcesWithCriticalSeverity() int
	NumberOfResourcesWithHighSeverity() int
	NumberOfResourcesWithMediumSeverity() int
	NumberOfResourcesWithLowSeverity() int
	Increase(severity string, amount int)
}

type ListPolicies

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

func (*ListPolicies) All

func (all *ListPolicies) All() []IPolicies

func (*ListPolicies) Append

func (all *ListPolicies) Append(status apis.ScanningStatus, policy IPolicies)

Append append single string to matching status list

func (*ListPolicies) Excluded

func (all *ListPolicies) Excluded() []IPolicies

func (*ListPolicies) Failed

func (all *ListPolicies) Failed() []IPolicies

func (*ListPolicies) Other

func (all *ListPolicies) Other() []IPolicies

func (*ListPolicies) Passed

func (all *ListPolicies) Passed() []IPolicies

func (*ListPolicies) Skipped

func (all *ListPolicies) Skipped() []IPolicies

func (*ListPolicies) Update

func (all *ListPolicies) Update(all2 *ListPolicies)

Update AllLists objects with

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"`
	ExcludedCounter int `json:"excluded"`
	SkippedCounter  int `json:"skipped"`
	IgnoredCounter  int `json:"ignored"`
	UnknownCounter  int `json:"unknown"`
}

func (*PostureCounters) All

func (pcounter *PostureCounters) All() int

func (*PostureCounters) Excluded

func (pcounter *PostureCounters) Excluded() int

NumberOfExcluded get the number of excluded posture object

func (*PostureCounters) Failed

func (pcounter *PostureCounters) Failed() int

Failed get the number of failed posture object

func (*PostureCounters) Ignored

func (pcounter *PostureCounters) Ignored() int

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

func (*PostureCounters) Unknown

func (pcounter *PostureCounters) Unknown() int

type ResourceCounters

type ResourceCounters struct {
	PassedResources   int `json:"passedResources"`
	FailedResources   int `json:"failedResources"`
	ExcludedResources int `json:"excludedResources"`
}

func (*ResourceCounters) All

func (resourceCounters *ResourceCounters) All() int

NumberOfAll get the number of all resources

func (*ResourceCounters) Excluded

func (resourceCounters *ResourceCounters) Excluded() int

NumberOfExcluded get the number of excluded resources

func (*ResourceCounters) Failed

func (resourceCounters *ResourceCounters) Failed() int

NumberOfFailed get the number of failed resources

func (*ResourceCounters) Increase

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

Increase increases the counter based on the status

func (*ResourceCounters) Passed

func (resourceCounters *ResourceCounters) Passed() int

NumberOfPassed get the number of passed resources

func (*ResourceCounters) Set

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

NumberOfExcluded get the number of excluded resources

func (*ResourceCounters) Skipped

func (resourceCounters *ResourceCounters) Skipped() int

NumberOfSkipped get the number of skipped resources

type SeverityCounters added in v0.0.190

type SeverityCounters struct {
	ResourcesWithCriticalSeverityCounter int `json:"criticalSeverity"`
	ResourcesWithHighSeverityCounter     int `json:"highSeverity"`
	ResourcesWithMediumSeverityCounter   int `json:"mediumSeverity"`
	ResourcesWithLowSeverityCounter      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) NumberOfResourcesWithCriticalSeverity added in v0.0.190

func (sc *SeverityCounters) NumberOfResourcesWithCriticalSeverity() int

func (*SeverityCounters) NumberOfResourcesWithHighSeverity added in v0.0.190

func (sc *SeverityCounters) NumberOfResourcesWithHighSeverity() int

func (*SeverityCounters) NumberOfResourcesWithLowSeverity added in v0.0.190

func (sc *SeverityCounters) NumberOfResourcesWithLowSeverity() int

func (*SeverityCounters) NumberOfResourcesWithMediumSeverity added in v0.0.190

func (sc *SeverityCounters) NumberOfResourcesWithMediumSeverity() int

type SummaryDetails

type SummaryDetails struct {
	SeverityCounters SeverityCounters    `json:"severityCounters,omitempty"`
	Controls         ControlSummaries    `json:"controls,omitempty"` // mapping of control - map[<control ID>]<control summary>
	Status           apis.ScanningStatus `json:"status"`             // overall status
	Frameworks       []FrameworkSummary  `json:"frameworks"`         // list of framework summary
	ResourceCounters ResourceCounters    `json:",inline"`
	Score            float32             `json:"score"` // overall 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) GetResourcesSeverityCounters added in v0.0.190

func (summaryDetails *SummaryDetails) GetResourcesSeverityCounters() ISeverityCounters

updateSummaryWithResource get the result of a single resource. If resource not found will return nil

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