apis

package
v0.0.245 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 1 Imported by: 21

Documentation

Index

Constants

View Source
const (
	SeverityCriticalString = "Critical"
	SeverityHighString     = "High"
	SeverityMediumString   = "Medium"
	SeverityLowString      = "Low"
	SeverityUnknownString  = "Unknown"
)
View Source
const (
	SeverityUnknown  = iota
	SeverityLow      = iota
	SeverityMedium   = iota
	SeverityHigh     = iota
	SeverityCritical = iota
)
View Source
const (
	StatusPassed            ScanningStatus    = "passed"
	StatusFailed            ScanningStatus    = "failed"
	StatusSkipped           ScanningStatus    = "skipped"
	SubStatusException      ScanningSubStatus = "w/exceptions"
	SubStatusIrrelevant     ScanningSubStatus = "irrelevant"
	SubStatusConfiguration  ScanningSubStatus = "configuration"
	SubStatusIntegration    ScanningSubStatus = "integration"
	SubStatusRequiresReview ScanningSubStatus = "requires review"
	SubStatusManualReview   ScanningSubStatus = "manual review"
	SubStatusUnknown        ScanningSubStatus = "" // keep this empty
	StatusUnknown           ScanningStatus    = "" // keep this empty

	StatusExcluded   ScanningStatus = "excluded"   // Deprecated
	StatusIrrelevant ScanningStatus = "irrelevant" // Deprecated
	StatusError      ScanningStatus = "error"      // Deprecated
)
View Source
const NumberOfSeverities = 5

Variables

This section is empty.

Functions

func CompareStatusAndSubStatus added in v0.0.227

func CompareStatusAndSubStatus(a, b ScanningStatus, aSub, bSub ScanningSubStatus) (ScanningStatus, ScanningSubStatus)

CompareStatusAndSubStatus receive two statuses + sub statuses and returns the more significant one

status/sub status level:
	1. status=failed or status=unknown:
		sub status = ""
	2. status=skipped:
		if aSub or bSub are configuration/integration/review:
			sub status = aSub or bSub
		else:
			sub status = status=unknown
	3. status=passed:
		if aSub or bSub are exception/irrelevant:
			sub status = aSub or bSub
		else:
			sub status = status=unknown

func ControlSeverityToInt

func ControlSeverityToInt(baseScore float32) int

func ControlSeverityToString

func ControlSeverityToString(baseScore float32) string

func ConvertStatusToNewStatus added in v0.0.227

func ConvertStatusToNewStatus(status ScanningStatus) (ScanningStatus, ScanningSubStatus)

ConvertStatusToNewStatus convert old status (exclude, irrelevant) to new status and sub status

func GetSupportedSeverities added in v0.0.194

func GetSupportedSeverities() []string

GetSupportedSeverities returns a slice of supported severities

func SeverityNumberToString added in v0.0.185

func SeverityNumberToString(severityNumber int) string

Types

type CloudProviderName added in v0.0.217

type CloudProviderName string
const (
	GCP CloudProviderName = "GCP" // TODO: Why do we have this name ??
	GKE CloudProviderName = "GKE"
	EKS CloudProviderName = "EKS"
	AKS CloudProviderName = "AKS"
)

func (CloudProviderName) Compare added in v0.0.217

func (c CloudProviderName) Compare(other string) bool

Compare returns true if the given string is equal to the cloud provider name

func (CloudProviderName) ToString added in v0.0.220

func (c CloudProviderName) ToString() string

Convert the cloud provider name to string

type ICloudParser added in v0.0.217

type ICloudParser interface {

	// Get the full and original name of the cluster. For example, for a cluster named "gke_project_zone_my-cluster" in GKE, the name is "gke_project_zone_my-cluster"
	GetName() string

	// Get provider name
	Provider() CloudProviderName

	// Parse the name of the cluster and return the prefix, suffix. For example, for a cluster named "gke_project_zone_my-cluster" in GKE, the prefix is "gke_project_zone" and the suffix is "my-cluster"
	Parse() (string, string, error)
}

type IStatus

type IStatus interface {
	Status() ScanningStatus
	GetSubStatus() ScanningSubStatus
	Info() string
	IsPassed() bool
	IsFailed() bool
	IsSkipped() bool
}

IStatus interface handling status

type ScanningStatus

type ScanningStatus string

func Compare

func Compare(a, b ScanningStatus) ScanningStatus

Compare receive two statuses and returns the more significant one

status level:
	1. failed
	2. skipped
	3. passed

e.g.:
Compare(failed, skipped) -> failed
Compare(passed, skipped) -> skipped
Compare(failed, skipped) -> failed
Compare(skipped, passed) -> skipped

type ScanningSubStatus added in v0.0.227

type ScanningSubStatus string

type StatusInfo

type StatusInfo struct {
	InnerStatus ScanningStatus    `json:"status,omitempty"`
	SubStatus   ScanningSubStatus `json:"subStatus,omitempty"`
	InnerInfo   string            `json:"info,omitempty"`
}

func (*StatusInfo) GetSubStatus added in v0.0.231

func (s *StatusInfo) GetSubStatus() ScanningSubStatus

func (*StatusInfo) Info

func (s *StatusInfo) Info() string

func (*StatusInfo) IsFailed

func (s *StatusInfo) IsFailed() bool

IsFailed is the status fail

func (*StatusInfo) IsPassed

func (s *StatusInfo) IsPassed() bool

IsPassed is the status pass

func (*StatusInfo) IsSkipped

func (s *StatusInfo) IsSkipped() bool

IsSkipped is the status skipped

func (*StatusInfo) Status

func (s *StatusInfo) Status() ScanningStatus

type StatusMsg added in v0.0.227

type StatusMsg string
const (
	SubStatusConfigurationInfo  StatusMsg = "Control configurations are empty"
	SubStatusRequiresReviewInfo StatusMsg = "Control type is requires-review"
	SubStatusManualReviewInfo   StatusMsg = "Control type is manual-review"
)

Jump to

Keyboard shortcuts

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