apis

package
v0.0.218 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 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 NumberOfSeverities = 5

Variables

This section is empty.

Functions

func ControlSeverityToInt

func ControlSeverityToInt(baseScore float32) int

func ControlSeverityToString

func ControlSeverityToString(baseScore float32) string

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

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
	Info() string
	IsPassed() bool
	IsFailed() bool
	IsExcluded() bool
	IsSkipped() bool
}

IStatus interface handling status

type ScanningStatus

type ScanningStatus string
const (
	StatusPassed     ScanningStatus = "passed"
	StatusExcluded   ScanningStatus = "excluded"
	StatusIgnored    ScanningStatus = "ignored"
	StatusFailed     ScanningStatus = "failed"
	StatusSkipped    ScanningStatus = "skipped"
	StatusUnknown    ScanningStatus = "" // keep this empty
	StatusIrrelevant ScanningStatus = "irrelevant"
	StatusError      ScanningStatus = "error"
)
const (
	InfoStatusSkipped ScanningStatus = "skipped"
)

func Compare

func Compare(a, b ScanningStatus) ScanningStatus

Compare receive two statuses and returns the more significant one

status level:
	1. failed
	2. excludes
	3. passed
	4. skipped/ignore

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

type StatusInfo

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

func (*StatusInfo) Info

func (s *StatusInfo) Info() string

func (*StatusInfo) IsExcluded

func (s *StatusInfo) IsExcluded() bool

IsExcluded is the status excluded

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

Jump to

Keyboard shortcuts

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