Documentation
¶
Index ¶
- Variables
- func GetPacks() (keys []string)
- func Init(configPath string) error
- func LineBreakReplacer(s string) string
- func NewConfigDecoder(path string) (decoder *yaml.Decoder, file *os.File, err error)
- func SetLogFilter(minLevel string, writer io.Writer)
- func SetVar(field interface{}, varName string, defaultValue interface{})
- func ValidateConfigPath(path string) error
- type APIM
- type Azure
- type CloudProviders
- type Excludable
- type K8sAzure
- type Kubernetes
- type Meta
- type Probe
- type Scenario
- type ServicePacks
- type Storage
- type VarOptions
- func (ctx *VarOptions) AuditDir() string
- func (ctx *VarOptions) CucumberDir() string
- func (ctx *VarOptions) GetTags() string
- func (ctx *VarOptions) GetWriteDirectory() string
- func (ctx *VarOptions) LogConfigState()
- func (ctx *VarOptions) Overwrite() bool
- func (ctx *VarOptions) SetTags(tags map[string][]string)
Constants ¶
This section is empty.
Variables ¶
var Requirements = map[string][]string{
"Storage": {"Provider"},
"APIM": {"Provider"},
"Kubernetes": {"AuthorisedContainerRegistry", "UnauthorisedContainerRegistry"},
}
Requirements is used to dictate the required config vars for each service pack
var Spinner *spinner.Spinner
Spinner holds the current state of the CLI spinner
Functions ¶
func GetPacks ¶
func GetPacks() (keys []string)
GetPacks returns a list of pack names (as specified by internal/config/requirements.go)
func LineBreakReplacer ¶
LineBreakReplacer replaces carriage return (\r), linefeed (\n), formfeed (\f) and other similar characters with a space.
func NewConfigDecoder ¶ added in v0.0.23
NewConfigDecoder reads the provided into a new yaml decoder and leaves the file open
func SetLogFilter ¶
SetLogFilter will override the minimum log level.
func SetVar ¶
func SetVar(field interface{}, varName string, defaultValue interface{})
SetVar fetches the env var or sets the default value as needed for the specified field from VarOptions
func ValidateConfigPath ¶
ValidateConfigPath simply ensures the file exists
Types ¶
type APIM ¶
type APIM struct {
Provider string `yaml:"Provider"` // Placeholder!
Probes []Probe `yaml:"Probes"`
}
APIM service pack config options
func (APIM) IsExcluded ¶
IsExcluded will log and return exclusion configuration
type Azure ¶
type Azure struct {
Excluded string `yaml:"Excluded"`
TenantID string `yaml:"TenantID"`
SubscriptionID string `yaml:"SubscriptionID"`
ClientID string `yaml:"ClientID"`
ClientSecret string `yaml:"ClientSecret"`
ResourceGroup string `yaml:"ResourceGroup"`
ResourceLocation string `yaml:"ResourceLocation"`
ManagementGroup string `yaml:"ManagementGroup"`
}
Azure config options that may be required by any service pack
type CloudProviders ¶
type CloudProviders struct {
Azure Azure `yaml:"Azure"`
}
CloudProviders config options
type Excludable ¶
type Excludable interface {
IsExcluded() bool
}
Excludable is used for testing purposes only
type Kubernetes ¶
type Kubernetes struct {
KeepPods string `yaml:"KeepPods"` // TODO: Change type to bool, this would allow us to remove logic from kubernetes.GetKeepPodsFromConfig()
Probes []Probe `yaml:"Probes"`
KubeConfigPath string `yaml:"KubeConfig"`
KubeContext string `yaml:"KubeContext"`
SystemClusterRoles []string `yaml:"SystemClusterRoles"`
AuthorisedContainerRegistry string `yaml:"AuthorisedContainerRegistry"`
ProbeImage string `yaml:"ProbeImage"`
ContainerRequiredDropCapabilities []string `yaml:"ContainerRequiredDropCapabilities"`
ContainerAllowedAddCapabilities []string `yaml:"ContainerAllowedAddCapabilities"`
ApprovedVolumeTypes []string `yaml:"ApprovedVolumeTypes"`
UnapprovedHostPort string `yaml:"UnapprovedHostPort"`
SystemNamespace string `yaml:"SystemNamespace"`
ProbeNamespace string `yaml:"ProbeNamespace"`
DashboardPodNamePrefix string `yaml:"DashboardPodNamePrefix"`
Azure K8sAzure `yaml:"Azure"`
}
Kubernetes config options
func (Kubernetes) IsExcluded ¶
func (k Kubernetes) IsExcluded() bool
IsExcluded will log and return exclusion configuration
type Probe ¶
type Probe struct {
Name string `yaml:"Name"`
Excluded string `yaml:"Excluded"`
Scenarios []Scenario `yaml:"Scenarios"`
}
Probe config options
func (Probe) IsExcluded ¶
IsExcluded will log and return exclusion configuration
type Scenario ¶
Scenario config options
func (Scenario) IsExcluded ¶
IsExcluded will log and return exclusion configuration
type ServicePacks ¶
type ServicePacks struct {
Kubernetes Kubernetes `yaml:"Kubernetes"`
Storage Storage `yaml:"Storage"`
APIM APIM `yaml:"APIM"`
}
ServicePacks config options
type Storage ¶
type Storage struct {
Provider string `yaml:"Provider"` // Placeholder!
Probes []Probe `yaml:"Probes"`
}
Storage service pack config options
func (Storage) IsExcluded ¶
IsExcluded will log and return exclusion configuration
type VarOptions ¶
type VarOptions struct {
// NOTE: Env and Defaults are ONLY available if corresponding logic is added to defaults.go
Run []string `yaml:"Run"`
ServicePacks ServicePacks `yaml:"ServicePacks"`
CloudProviders CloudProviders `yaml:"CloudProviders"`
OutputType string `yaml:"OutputType"`
WriteDirectory string `yaml:"WriteDirectory"`
AuditEnabled string `yaml:"AuditEnabled"`
LogLevel string `yaml:"LogLevel"`
OverwriteHistoricalAudits string `yaml:"OverwriteHistoricalAudits"`
TagExclusions []string `yaml:"TagExclusions"`
WriteConfig string `yaml:"WriteConfig"`
Tags string // set by flags
VarsFile string // set by flags only
NoSummary bool // set by flags only
Silent bool // set by flags only
Meta Meta // set by CLI options only
ResultsFormat string // set by flags only
}
VarOptions contains all top-level config vars
var Vars VarOptions
Vars is a singleton instance of VarOptions
func NewConfig ¶
func NewConfig(c string) (VarOptions, error)
NewConfig overrides the current config.Vars values
func (*VarOptions) AuditDir ¶
func (ctx *VarOptions) AuditDir() string
AuditDir creates and returns -audit- directory within WriteDirectory
func (*VarOptions) CucumberDir ¶
func (ctx *VarOptions) CucumberDir() string
CucumberDir creates and returns -cucumber- directory within WriteDirectory
func (*VarOptions) GetTags ¶
func (ctx *VarOptions) GetTags() string
GetTags returns Tags, prioritising command line parameter over vars file
func (*VarOptions) GetWriteDirectory ¶
func (ctx *VarOptions) GetWriteDirectory() string
GetWriteDirectory creates and returns the output folder specified in settings + executable name
func (*VarOptions) LogConfigState ¶
func (ctx *VarOptions) LogConfigState()
LogConfigState will write the config file to the write directory
func (*VarOptions) Overwrite ¶
func (ctx *VarOptions) Overwrite() bool
Overwrite returns the string value of the OverwriteHistoricalAudits in bool format
func (*VarOptions) SetTags ¶
func (ctx *VarOptions) SetTags(tags map[string][]string)
SetTags will parse the tags specified in Vars.Tags