Documentation ¶
Index ¶
- Constants
- Variables
- func LoadVersionMessages(ctx *TestCommandContext, args []string, cmd *cobra.Command) error
- func New(ctx *TestCommandContext) *cobra.Command
- func SetSilentMode(cmd *cobra.Command)
- func TestWrapper(ctx *TestCommandContext, args []string, testCommandFlags *TestCommandFlags) error
- type CliClient
- type EvaluationPrinter
- type EvaluationResultData
- type Evaluator
- type K8sValidator
- type LocalConfig
- type Messager
- type Reader
- type TestCommandContext
- type TestCommandData
- type TestCommandFlags
- type ValidationManager
- func (v *ValidationManager) AggregateIgnoredYamlFiles(ignoredFilesChan chan *extractor.FileConfigurations, wg *sync.WaitGroup)
- func (v *ValidationManager) AggregateInvalidK8sFiles(invalidFilesChan chan *extractor.InvalidFile, wg *sync.WaitGroup)
- func (v *ValidationManager) AggregateInvalidYamlFiles(invalidFilesChan chan *extractor.InvalidFile, wg *sync.WaitGroup)
- func (v *ValidationManager) AggregateK8sValidationWarningsPerValidFile(filesWithWarningsChan chan *validation.FileWithWarning, wg *sync.WaitGroup)
- func (v *ValidationManager) AggregateValidK8sFiles(validK8sFilesConfigurationsChan chan *extractor.FileConfigurations, ...)
- func (v *ValidationManager) GetK8sValidationSummaryStr(filesCount int) string
- func (v *ValidationManager) GetK8sValidationWarningPerValidFile() validation.K8sValidationWarningPerValidFile
- func (v *ValidationManager) IgnoredFiles() []*extractor.FileConfigurations
- func (v *ValidationManager) IgnoredFilesCount() int
- func (v *ValidationManager) InvalidK8sFiles() []*extractor.InvalidFile
- func (v *ValidationManager) InvalidK8sFilesCount() int
- func (v *ValidationManager) InvalidYamlFiles() []*extractor.InvalidFile
- func (v *ValidationManager) InvalidYamlFilesCount() int
- func (v *ValidationManager) ValidK8sConfigurationsCount() int
- func (v *ValidationManager) ValidK8sFilesConfigurationsCount() int
- func (v *ValidationManager) ValidOrSkippedK8sFilesConfigurations() []*extractor.FileConfigurations
Constants ¶
View Source
const ( DatreePolicyConfig = "DATREE_POLICY_CONFIG" DatreeSchemaLocations = "DATREE_SCHEMA_LOCATION" )
Variables ¶
View Source
var ViolationsFoundError = errors.New("")
Functions ¶
func LoadVersionMessages ¶
func LoadVersionMessages(ctx *TestCommandContext, args []string, cmd *cobra.Command) error
func New ¶
func New(ctx *TestCommandContext) *cobra.Command
func SetSilentMode ¶
func TestWrapper ¶ added in v1.5.19
func TestWrapper(ctx *TestCommandContext, args []string, testCommandFlags *TestCommandFlags) error
Types ¶
type EvaluationPrinter ¶
type EvaluationPrinter interface { GetWarningsText(warnings []printer.Warning, quiet bool) string GetSummaryTableText(summary printer.Summary) string PrintMessage(messageText string, messageColor string) PrintError(messageText string, messageColor string) PrintPromptMessage(promptMessage string) GetEvaluationSummaryText(evaluationSummary printer.EvaluationSummary, k8sVersion string) string SetTheme(theme *printer.Theme) }
type EvaluationResultData ¶
type EvaluationResultData struct { ValidationManager *ValidationManager RulesCount int FormattedResults evaluation.FormattedResults AdditionalJUnitData evaluation.AdditionalJUnitData PromptMessage string }
type Evaluator ¶
type Evaluator interface { Evaluate(policyCheckData evaluation.PolicyCheckData) (evaluation.PolicyCheckResultData, error) SendEvaluationResult(evaluationRequestData evaluation.EvaluationRequestData) (*cliClient.SendEvaluationResultsResponse, error) }
type K8sValidator ¶
type K8sValidator interface { ValidateResources(filesConfigurations chan *extractor.FileConfigurations, concurrency int, skipSchemaValidation bool) (chan *extractor.FileConfigurations, chan *extractor.InvalidFile, chan *validation.FileWithWarning) InitClient(k8sVersion string, ignoreMissingSchemas bool, schemaLocations []string, permissiveSchema bool) GetK8sFiles(filesConfigurationsChan chan *extractor.FileConfigurations, concurrency int) (chan *extractor.FileConfigurations, chan *extractor.FileConfigurations) }
type LocalConfig ¶
type LocalConfig interface {
GetLocalConfiguration() (*localConfig.LocalConfig, error)
}
type Messager ¶
type Messager interface {
LoadVersionMessages(cliVersion string) chan *messager.VersionMessage
}
type TestCommandContext ¶
type TestCommandContext struct { CliVersion string CiContext *ciContext.CIContext LocalConfig LocalConfig Evaluator Evaluator Messager Messager K8sValidator K8sValidator Printer EvaluationPrinter Reader Reader CliClient CliClient FilesExtractor files.FilesExtractorInterface StartTime time.Time OpenBrowserContext utils.OpenBrowserContext }
type TestCommandData ¶
type TestCommandData struct { Output string SaveResults string K8sVersion string ExcludePattern string IgnoreMissingSchemas bool OnlyK8sFiles bool Verbose bool NoRecord bool Policy policy_factory.Policy SchemaLocations []string Token string RegistrationURL string PromptRegistrationURL string ClientId string SkipSchemaValidation bool SaveRendered bool PermissiveSchema bool Quiet bool IsOffline bool }
func GenerateTestCommandData ¶
func GenerateTestCommandData(testCommandFlags *TestCommandFlags, localConfigContent *localConfig.LocalConfig, evaluationPrerunDataResp *cliClient.EvaluationPrerunDataResponse) (*TestCommandData, error)
type TestCommandFlags ¶
type TestCommandFlags struct { Output string SaveResults string K8sVersion string ExcludePattern string IgnoreMissingSchemas bool OnlyK8sFiles bool Verbose bool PolicyName string SchemaLocations []string PolicyConfig string NoRecord bool SkipValidation string SaveRendered bool PermissiveSchema bool Quiet bool }
func NewTestCommandFlags ¶
func NewTestCommandFlags() *TestCommandFlags
TestCommandFlags constructor
func (*TestCommandFlags) AddFlags ¶
func (flags *TestCommandFlags) AddFlags(cmd *cobra.Command)
AddFlags registers flags for a cli
func (*TestCommandFlags) ToMapping ¶
func (flags *TestCommandFlags) ToMapping() map[string]interface{}
func (*TestCommandFlags) Validate ¶
func (flags *TestCommandFlags) Validate() error
type ValidationManager ¶
type ValidationManager struct {
// contains filtered or unexported fields
}
func NewValidationManager ¶
func NewValidationManager() *ValidationManager
func (*ValidationManager) AggregateIgnoredYamlFiles ¶
func (v *ValidationManager) AggregateIgnoredYamlFiles(ignoredFilesChan chan *extractor.FileConfigurations, wg *sync.WaitGroup)
func (*ValidationManager) AggregateInvalidK8sFiles ¶
func (v *ValidationManager) AggregateInvalidK8sFiles(invalidFilesChan chan *extractor.InvalidFile, wg *sync.WaitGroup)
func (*ValidationManager) AggregateInvalidYamlFiles ¶
func (v *ValidationManager) AggregateInvalidYamlFiles(invalidFilesChan chan *extractor.InvalidFile, wg *sync.WaitGroup)
func (*ValidationManager) AggregateK8sValidationWarningsPerValidFile ¶
func (v *ValidationManager) AggregateK8sValidationWarningsPerValidFile(filesWithWarningsChan chan *validation.FileWithWarning, wg *sync.WaitGroup)
func (*ValidationManager) AggregateValidK8sFiles ¶
func (v *ValidationManager) AggregateValidK8sFiles(validK8sFilesConfigurationsChan chan *extractor.FileConfigurations, wg *sync.WaitGroup)
func (*ValidationManager) GetK8sValidationSummaryStr ¶
func (v *ValidationManager) GetK8sValidationSummaryStr(filesCount int) string
func (*ValidationManager) GetK8sValidationWarningPerValidFile ¶
func (v *ValidationManager) GetK8sValidationWarningPerValidFile() validation.K8sValidationWarningPerValidFile
func (*ValidationManager) IgnoredFiles ¶
func (v *ValidationManager) IgnoredFiles() []*extractor.FileConfigurations
func (*ValidationManager) IgnoredFilesCount ¶
func (v *ValidationManager) IgnoredFilesCount() int
func (*ValidationManager) InvalidK8sFiles ¶
func (v *ValidationManager) InvalidK8sFiles() []*extractor.InvalidFile
func (*ValidationManager) InvalidK8sFilesCount ¶
func (v *ValidationManager) InvalidK8sFilesCount() int
func (*ValidationManager) InvalidYamlFiles ¶
func (v *ValidationManager) InvalidYamlFiles() []*extractor.InvalidFile
func (*ValidationManager) InvalidYamlFilesCount ¶
func (v *ValidationManager) InvalidYamlFilesCount() int
func (*ValidationManager) ValidK8sConfigurationsCount ¶
func (v *ValidationManager) ValidK8sConfigurationsCount() int
func (*ValidationManager) ValidK8sFilesConfigurationsCount ¶
func (v *ValidationManager) ValidK8sFilesConfigurationsCount() int
func (*ValidationManager) ValidOrSkippedK8sFilesConfigurations ¶ added in v1.6.32
func (v *ValidationManager) ValidOrSkippedK8sFilesConfigurations() []*extractor.FileConfigurations
Click to show internal directories.
Click to hide internal directories.