cautils

package
v1.0.64 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ComponentIdentifier = "Posture"
)
View Source
const ValueNotFound = -1

Variables

View Source
var (
	CustomerGUID          = ""
	ClusterName           = ""
	EventReceiverURL      = ""
	NotificationServerURL = ""
	DashboardBackendURL   = ""
	RestAPIPort           = "4001"
)

CA environment vars

View Source
var DescriptionDisplay = color.New(color.Faint, color.FgWhite).FprintfFunc()
View Source
var FailureDisplay = color.New(color.Bold, color.FgHiRed).FprintfFunc()
View Source
var FailureTextDisplay = color.New(color.Faint, color.FgHiRed).FprintfFunc()
View Source
var InfoDisplay = color.New(color.Bold, color.FgHiYellow).FprintfFunc()
View Source
var InfoTextDisplay = color.New(color.Faint, color.FgHiYellow).FprintfFunc()
View Source
var SimpleDisplay = color.New(color.Bold, color.FgHiWhite).FprintfFunc()
View Source
var Spinner *spinner.Spinner
View Source
var SuccessDisplay = color.New(color.Bold, color.FgHiGreen).FprintfFunc()

Functions

func ConvertLabelsToString

func ConvertLabelsToString(labels map[string]string) string

func ConvertStringToLabels

func ConvertStringToLabels(labelsStr string) map[string]string

ConvertStringToLabels convert a string "a=b;c=d" to map: {"a":"b", "c":"d"}

func ErrorDisplay

func ErrorDisplay(str string)

func IsSilent

func IsSilent() bool

func ProgressTextDisplay

func ProgressTextDisplay(str string)

func ScanStartDisplay

func ScanStartDisplay()

func SetSilentMode

func SetSilentMode(s bool)

func StartSpinner

func StartSpinner()

func StopSpinner

func StopSpinner()

func StringInSlice

func StringInSlice(strSlice []string, str string) int

func SuccessTextDisplay

func SuccessTextDisplay(str string)

Types

type ComponentConfig

type ComponentConfig struct {
	Exceptions Exception `json:"exceptions"`
}

type DownloadInfo added in v1.0.35

type DownloadInfo struct {
	Path          string
	FrameworkName string
}

type Exception

type Exception struct {
	Ignore        *bool                 `json:"ignore"`        // ignore test results
	MultipleScore *opapolicy.AlertScore `json:"multipleScore"` // MultipleScore number - float32
	Namespaces    []string              `json:"namespaces"`
	Regex         string                `json:"regex"` // not supported
}

type K8SResources

type K8SResources map[string]interface{}

K8SResources map[<api group>/<api version>/<resource>]<resource object>

type OPASessionObj

type OPASessionObj struct {
	Frameworks    []opapolicy.Framework
	K8SResources  *K8SResources
	PostureReport *opapolicy.PostureReport
}

func NewOPASessionObj

func NewOPASessionObj(frameworks []opapolicy.Framework, k8sResources *K8SResources) *OPASessionObj

func NewOPASessionObjMock

func NewOPASessionObjMock() *OPASessionObj

type ScanInfo added in v1.0.35

type ScanInfo struct {
	PolicyGetter       getter.IPolicyGetter
	PolicyIdentifier   opapolicy.PolicyIdentifier
	UseFrom            string
	UseDefault         bool
	Format             string
	Output             string
	ExcludedNamespaces string
	InputPatterns      []string
	Silent             bool
	FailThreshold      uint16
}

func (*ScanInfo) Init added in v1.0.35

func (scanInfo *ScanInfo) Init()

func (*ScanInfo) ScanRunningCluster added in v1.0.35

func (scanInfo *ScanInfo) ScanRunningCluster() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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