Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigFileFullPath() string
- func ConvertLabelsToString(labels map[string]string) string
- func ConvertStringToLabels(labelsStr string) map[string]string
- func DeleteConfig(k8s *k8sinterface.KubernetesApi) error
- func DeleteConfigFile() error
- func DeleteConfigMap(k8s *k8sinterface.KubernetesApi) error
- func ErrorDisplay(str string)
- func GetValueFromConfigJson(key string) (string, error)
- func IsRegistered(clusterConfig *ClusterConfig) bool
- func IsSilent() bool
- func IsSubmitted(clusterConfig *ClusterConfig) bool
- func PrettyJson(data interface{}) ([]byte, error)
- func ProgressTextDisplay(str string)
- func ScanStartDisplay()
- func SetKeyValueInConfigJson(key string, value string) error
- func SetSilentMode(s bool)
- func StartSpinner()
- func StopSpinner()
- func StringInSlice(strSlice []string, str string) int
- func SuccessTextDisplay(str string)
- type ClusterConfig
- func (c *ClusterConfig) GenerateURL()
- func (c *ClusterConfig) GetBackendAPI() getter.IBackend
- func (c *ClusterConfig) GetClusterName() string
- func (c *ClusterConfig) GetConfigObj() *ConfigObj
- func (c *ClusterConfig) GetCustomerGUID() string
- func (c *ClusterConfig) GetDefaultNS() string
- func (c *ClusterConfig) GetK8sAPI() *k8sinterface.KubernetesApi
- func (c *ClusterConfig) GetValueByKeyFromConfigMap(key string) (string, error)
- func (c *ClusterConfig) LoadConfig()
- func (c *ClusterConfig) SetConfig(customerGUID string) error
- func (c *ClusterConfig) SetKeyValueInConfigmap(key string, value string) error
- func (c *ClusterConfig) ToMapString() map[string]interface{}
- type ComponentConfig
- type ConfigObj
- type DownloadInfo
- type EmptyConfig
- func (c *EmptyConfig) GenerateURL()
- func (c *EmptyConfig) GetBackendAPI() getter.IBackend
- func (c *EmptyConfig) GetClusterName() string
- func (c *EmptyConfig) GetConfigObj() *ConfigObj
- func (c *EmptyConfig) GetCustomerGUID() string
- func (c *EmptyConfig) GetDefaultNS() string
- func (c *EmptyConfig) GetK8sAPI() *k8sinterface.KubernetesApi
- func (c *EmptyConfig) SetConfig(customerGUID string) error
- type Exception
- type Getters
- type IClusterConfig
- type K8SResources
- type OPASessionObj
- type ScanInfo
Constants ¶
const (
ComponentIdentifier = "Posture"
)
const ValueNotFound = -1
Variables ¶
var ( CustomerGUID = "" ClusterName = "" EventReceiverURL = "" NotificationServerURL = "" DashboardBackendURL = "" RestAPIPort = "4001" )
CA environment vars
var InfoDisplay = color.New(color.Bold, color.FgHiYellow).FprintfFunc()
var InfoTextDisplay = color.New(color.Bold, color.FgHiYellow).FprintfFunc()
var SimpleDisplay = color.New().FprintfFunc()
var Spinner *spinner.Spinner
Functions ¶
func ConfigFileFullPath ¶ added in v1.0.65
func ConfigFileFullPath() string
func ConvertLabelsToString ¶
func ConvertStringToLabels ¶
ConvertStringToLabels convert a string "a=b;c=d" to map: {"a":"b", "c":"d"}
func DeleteConfig ¶ added in v1.0.65
func DeleteConfig(k8s *k8sinterface.KubernetesApi) error
func DeleteConfigFile ¶ added in v1.0.65
func DeleteConfigFile() error
func DeleteConfigMap ¶ added in v1.0.65
func DeleteConfigMap(k8s *k8sinterface.KubernetesApi) error
func ErrorDisplay ¶
func ErrorDisplay(str string)
func GetValueFromConfigJson ¶ added in v1.0.47
func IsRegistered ¶ added in v1.0.65
func IsRegistered(clusterConfig *ClusterConfig) bool
Check if the customer is registered
func IsSubmitted ¶ added in v1.0.65
func IsSubmitted(clusterConfig *ClusterConfig) bool
Check if the customer is submitted
func PrettyJson ¶ added in v1.0.37
func ProgressTextDisplay ¶
func ProgressTextDisplay(str string)
func ScanStartDisplay ¶
func ScanStartDisplay()
func SetKeyValueInConfigJson ¶ added in v1.0.47
func SetSilentMode ¶
func SetSilentMode(s bool)
func StartSpinner ¶
func StartSpinner()
func StopSpinner ¶
func StopSpinner()
func StringInSlice ¶
func SuccessTextDisplay ¶
func SuccessTextDisplay(str string)
Types ¶
type ClusterConfig ¶ added in v1.0.42
type ClusterConfig struct {
// contains filtered or unexported fields
}
func NewClusterConfig ¶ added in v1.0.42
func NewClusterConfig(k8s *k8sinterface.KubernetesApi, backendAPI getter.IBackend) *ClusterConfig
func (*ClusterConfig) GenerateURL ¶ added in v1.0.42
func (c *ClusterConfig) GenerateURL()
func (*ClusterConfig) GetBackendAPI ¶ added in v1.0.65
func (c *ClusterConfig) GetBackendAPI() getter.IBackend
func (*ClusterConfig) GetClusterName ¶ added in v1.0.84
func (c *ClusterConfig) GetClusterName() string
func (*ClusterConfig) GetConfigObj ¶ added in v1.0.65
func (c *ClusterConfig) GetConfigObj() *ConfigObj
func (*ClusterConfig) GetCustomerGUID ¶ added in v1.0.42
func (c *ClusterConfig) GetCustomerGUID() string
func (*ClusterConfig) GetDefaultNS ¶ added in v1.0.65
func (c *ClusterConfig) GetDefaultNS() string
func (*ClusterConfig) GetK8sAPI ¶ added in v1.0.65
func (c *ClusterConfig) GetK8sAPI() *k8sinterface.KubernetesApi
func (*ClusterConfig) GetValueByKeyFromConfigMap ¶ added in v1.0.47
func (c *ClusterConfig) GetValueByKeyFromConfigMap(key string) (string, error)
func (*ClusterConfig) LoadConfig ¶ added in v1.0.65
func (c *ClusterConfig) LoadConfig()
func (*ClusterConfig) SetConfig ¶ added in v1.0.84
func (c *ClusterConfig) SetConfig(customerGUID string) error
func (*ClusterConfig) SetKeyValueInConfigmap ¶ added in v1.0.47
func (c *ClusterConfig) SetKeyValueInConfigmap(key string, value string) error
func (*ClusterConfig) ToMapString ¶ added in v1.0.42
func (c *ClusterConfig) ToMapString() map[string]interface{}
type ComponentConfig ¶
type ComponentConfig struct {
Exceptions Exception `json:"exceptions"`
}
type ConfigObj ¶ added in v1.0.42
type ConfigObj struct { CustomerGUID string `json:"customerGUID"` Token string `json:"invitationParam"` CustomerAdminEMail string `json:"adminMail"` ClusterName string `json:"clusterName"` }
type DownloadInfo ¶ added in v1.0.35
type EmptyConfig ¶ added in v1.0.44
type EmptyConfig struct { }
====================================================================================== ============================= Mock Config ============================================ ======================================================================================
func NewEmptyConfig ¶ added in v1.0.44
func NewEmptyConfig() *EmptyConfig
func (*EmptyConfig) GenerateURL ¶ added in v1.0.44
func (c *EmptyConfig) GenerateURL()
func (*EmptyConfig) GetBackendAPI ¶ added in v1.0.65
func (c *EmptyConfig) GetBackendAPI() getter.IBackend
func (*EmptyConfig) GetClusterName ¶ added in v1.0.84
func (c *EmptyConfig) GetClusterName() string
func (*EmptyConfig) GetConfigObj ¶ added in v1.0.65
func (c *EmptyConfig) GetConfigObj() *ConfigObj
func (*EmptyConfig) GetCustomerGUID ¶ added in v1.0.44
func (c *EmptyConfig) GetCustomerGUID() string
func (*EmptyConfig) GetDefaultNS ¶ added in v1.0.65
func (c *EmptyConfig) GetDefaultNS() string
func (*EmptyConfig) GetK8sAPI ¶ added in v1.0.65
func (c *EmptyConfig) GetK8sAPI() *k8sinterface.KubernetesApi
func (*EmptyConfig) SetConfig ¶ added in v1.0.84
func (c *EmptyConfig) SetConfig(customerGUID string) error
type Exception ¶
type Exception struct { Ignore *bool `json:"ignore"` // ignore test results MultipleScore *reporthandling.AlertScore `json:"multipleScore"` // MultipleScore number - float32 Namespaces []string `json:"namespaces"` Regex string `json:"regex"` // not supported }
type Getters ¶ added in v1.0.36
type Getters struct { ExceptionsGetter getter.IExceptionsGetter PolicyGetter getter.IPolicyGetter }
type IClusterConfig ¶ added in v1.0.42
type IClusterConfig interface { // set SetConfig(customerGUID string) error // getters GetClusterName() string GetCustomerGUID() string GetConfigObj() *ConfigObj GetK8sAPI() *k8sinterface.KubernetesApi GetBackendAPI() getter.IBackend GetDefaultNS() string GenerateURL() }
====================================================================================== =============================== interface ============================================ ======================================================================================
func ClusterConfigSetup ¶ added in v1.0.65
func ClusterConfigSetup(scanInfo *ScanInfo, k8s *k8sinterface.KubernetesApi, beAPI getter.IBackend) IClusterConfig
ClusterConfigSetup - Setup the desired cluster behavior regarding submittion to the Armo BE
type K8SResources ¶
type K8SResources map[string]interface{}
K8SResources map[<api group>/<api version>/<resource>]<resource object>
type OPASessionObj ¶
type OPASessionObj struct { Frameworks []reporthandling.Framework K8SResources *K8SResources Exceptions []armotypes.PostureExceptionPolicy PostureReport *reporthandling.PostureReport }
func NewOPASessionObj ¶
func NewOPASessionObj(frameworks []reporthandling.Framework, k8sResources *K8SResources) *OPASessionObj
func NewOPASessionObjMock ¶
func NewOPASessionObjMock() *OPASessionObj
type ScanInfo ¶ added in v1.0.35
type ScanInfo struct { Getters PolicyIdentifier reporthandling.PolicyIdentifier UseExceptions string // Load exceptions configuration UseFrom string // Load framework from local file (instead of download). Use when running offline UseDefault bool // Load framework from cached file (instead of download). Use when running offline Format string // Format results (table, json, junit ...) Output string // Store results in an output file, Output file name ExcludedNamespaces string // DEPRECATED? InputPatterns []string // Yaml files input patterns Silent bool // Silent mode - Do not print progress logs FailThreshold uint16 // Failure score threshold Submit bool // Submit results to Armo BE Local bool // Do not submit results Account string // account ID FrameworkScan bool // false if scanning control }
func (*ScanInfo) ScanRunningCluster ¶ added in v1.0.35
func (*ScanInfo) SetClusterConfig ¶ added in v1.0.84
func (scanInfo *ScanInfo) SetClusterConfig() (IClusterConfig, *k8sinterface.KubernetesApi)