Documentation ¶
Index ¶
- Constants
- Variables
- func GetResultsText(resultsData *PrintResultsData) (string, error)
- func GetWarningExtraMessages(invalidFile *extractor.InvalidFile) []printer.ExtraMessage
- func GetjsonResult(resultsData *PrintResultsData) (string, error)
- func IsFormattedOutputOption(option string) bool
- func IsHelmFile(filePath string) bool
- func IsKustomizationFile(filePath string) bool
- func IsValidOutputOption(option string) bool
- func OutputFormats() string
- func PrintResults(resultsData *PrintResultsData) error
- func SaveLastResultToJson(resultsData *PrintResultsData)
- type AdditionalJUnitData
- type CLIClient
- type EvaluationRequestData
- type EvaluationResults
- type EvaluationResultsSummery
- type Evaluator
- type FailedRulesByFiles
- type FileNameRuleMapper
- type FormattedEvaluationResults
- type FormattedOutput
- type FormattedResults
- type JUnitOutput
- type NonInteractiveEvaluationResults
- type NonInteractiveEvaluationSummary
- type OccurrenceDetails
- type OutputTitle
- type PolicyCheckData
- type PolicyCheckResultData
- type PolicySummary
- type PrintResultsData
- type Printer
- type Result
- type Rule
- type RuleResult
Constants ¶
View Source
const (
SKIP_RULE_PREFIX string = "datree.skip/"
)
Variables ¶
View Source
var ExplicitOutputOptions = []string{"simple", "yaml", "json", "xml", "JUnit"}
View Source
var FormattedOutputOptions = []string{"yaml", "json", "xml", "JUnit"}
View Source
var InteractiveOutputOptions = []string{"", "simple"}
View Source
var OSInfoFn = utils.NewOSInfo
View Source
var ValidOutputOptions = append(FormattedOutputOptions, InteractiveOutputOptions...)
Functions ¶
func GetResultsText ¶ added in v1.5.0
func GetResultsText(resultsData *PrintResultsData) (string, error)
func GetWarningExtraMessages ¶
func GetWarningExtraMessages(invalidFile *extractor.InvalidFile) []printer.ExtraMessage
func GetjsonResult ¶ added in v1.6.12
func GetjsonResult(resultsData *PrintResultsData) (string, error)
func IsFormattedOutputOption ¶
func IsHelmFile ¶
func IsKustomizationFile ¶
func IsValidOutputOption ¶
func OutputFormats ¶
func OutputFormats() string
func PrintResults ¶
func PrintResults(resultsData *PrintResultsData) error
func SaveLastResultToJson ¶ added in v1.6.12
func SaveLastResultToJson(resultsData *PrintResultsData)
Types ¶
type AdditionalJUnitData ¶
type CLIClient ¶
type CLIClient interface {
SendEvaluationResult(request *cliClient.EvaluationResultRequest) (*cliClient.SendEvaluationResultsResponse, error)
}
type EvaluationRequestData ¶
type EvaluationRequestData struct { Token string ClientId string CliVersion string K8sVersion string PolicyName string CiContext *ciContext.CIContext RulesData []cliClient.RuleData FilesData []cliClient.FileData FailedYamlFiles []string FailedK8sFiles []string PolicyCheckResults FailedRulesByFiles EvaluationDurationSeconds float64 }
type EvaluationResults ¶
type EvaluationResults struct { FileNameRuleMapper FileNameRuleMapper Summary EvaluationResultsSummery }
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
func (*Evaluator) Evaluate ¶
func (e *Evaluator) Evaluate(policyCheckData PolicyCheckData) (PolicyCheckResultData, error)
func (*Evaluator) SendEvaluationResult ¶
func (e *Evaluator) SendEvaluationResult(evaluationRequestData EvaluationRequestData) (*cliClient.SendEvaluationResultsResponse, error)
type FailedRulesByFiles ¶
type FailedRulesByFiles map[string]map[string]*cliClient.FailedRule
type FileNameRuleMapper ¶
type FormattedEvaluationResults ¶
type FormattedEvaluationResults struct { FileName string `yaml:"fileName" json:"fileName" xml:"fileName"` RuleResults []*RuleResult `yaml:"ruleResults" json:"ruleResults" xml:"ruleResults"` }
type FormattedOutput ¶
type FormattedOutput struct { PolicyValidationResults []*FormattedEvaluationResults `yaml:"policyValidationResults" json:"policyValidationResults" xml:"policyValidationResults"` PolicySummary *PolicySummary `yaml:"policySummary" json:"policySummary" xml:"policySummary"` EvaluationSummary NonInteractiveEvaluationSummary `yaml:"evaluationSummary" json:"evaluationSummary" xml:"evaluationSummary"` YamlValidationResults []*extractor.InvalidFile `yaml:"yamlValidationResults" json:"yamlValidationResults" xml:"yamlValidationResults"` K8sValidationResults []*extractor.InvalidFile `yaml:"k8sValidationResults" json:"k8sValidationResults" xml:"k8sValidationResults"` }
type FormattedResults ¶
type FormattedResults struct { EvaluationResults *EvaluationResults NonInteractiveEvaluationResults *NonInteractiveEvaluationResults }
type JUnitOutput ¶
type JUnitOutput struct { XMLName xml.Name `xml:"testsuites"` Name string `xml:"name,attr"` Tests int `xml:"tests,attr"` Failures int `xml:"failures,attr"` Skipped int `xml:"skipped,attr"` TestSuites []testSuite `xml:"testsuite"` }
func FormattedOutputToJUnitOutput ¶
func FormattedOutputToJUnitOutput(formattedOutput FormattedOutput, additionalJUnitData AdditionalJUnitData) JUnitOutput
type NonInteractiveEvaluationResults ¶
type NonInteractiveEvaluationResults struct { FormattedEvaluationResults []*FormattedEvaluationResults PolicySummary *PolicySummary }
type NonInteractiveEvaluationSummary ¶
type NonInteractiveEvaluationSummary struct { ConfigsCount int `yaml:"configsCount" json:"configsCount" xml:"configsCount"` FilesCount int `yaml:"filesCount" json:"filesCount" xml:"filesCount"` PassedYamlValidationCount int `yaml:"passedYamlValidationCount" json:"passedYamlValidationCount" xml:"passedYamlValidationCount"` K8sValidation string `yaml:"k8sValidation" json:"k8sValidation" xml:"k8sValidation"` PassedPolicyValidationCount int `yaml:"passedPolicyValidationCount" json:"passedPolicyValidationCount" xml:"passedPolicyValidationCount"` }
type OccurrenceDetails ¶
type OccurrenceDetails struct { MetadataName string `yaml:"metadataName" json:"metadataName" xml:"metadataName"` Kind string `yaml:"kind" json:"kind" xml:"kind"` SkipMessage string `yaml:"skipMessage" json:"skipMessage" xml:"skipMessage"` Occurrences int `yaml:"occurrences" json:"occurrences" xml:"occurrences"` IsSkipped bool `yaml:"isSkipped" json:"isSkipped" xml:"isSkipped"` }
type OutputTitle ¶
type OutputTitle int
const ( EvaluatedConfigurations OutputTitle = iota TotalRulesEvaluated SeeAll TotalRulesPassed TotalSkippedRules TotalRulesFailed )
func (OutputTitle) String ¶
func (t OutputTitle) String() string
type PolicyCheckData ¶
type PolicyCheckData struct { FilesConfigurations []*extractor.FileConfigurations IsInteractiveMode bool PolicyName string Policy policy_factory.Policy }
type PolicyCheckResultData ¶
type PolicyCheckResultData struct { FormattedResults FormattedResults RulesData []cliClient.RuleData FilesData []cliClient.FileData RawResults FailedRulesByFiles RulesCount int }
type PolicySummary ¶
type PolicySummary struct { PolicyName string `yaml:"policyName" json:"policyName" xml:"policyName"` TotalRulesInPolicy int `yaml:"totalRulesInPolicy" json:"totalRulesInPolicy" xml:"totalRulesInPolicy"` TotalSkippedRules int `yaml:"totalSkippedRules" json:"totalSkippedRules" xml:"totalSkippedRules"` TotalRulesFailed int `yaml:"totalRulesFailed" json:"totalRulesFailed" xml:"totalRulesFailed"` TotalPassedCount int `yaml:"totalPassedCount" json:"totalPassedCount" xml:"totalPassedCount"` }
type PrintResultsData ¶
type PrintResultsData struct { Results FormattedResults AdditionalJUnitData AdditionalJUnitData InvalidYamlFiles []*extractor.InvalidFile InvalidK8sFiles []*extractor.InvalidFile EvaluationSummary printer.EvaluationSummary LoginURL string OutputFormat string Printer Printer K8sVersion string Verbose bool PolicyName string K8sValidationWarnings validation.K8sValidationWarningPerValidFile IsCI bool }
type Result ¶
type Result = gojsonschema.Result
type Rule ¶
type Rule struct { Identifier string Name string MessageOnFailure string DocumentationUrl string OccurrencesDetails []OccurrenceDetails }
func (*Rule) GetFailedOccurrencesCount ¶
type RuleResult ¶
type RuleResult struct { Identifier string `yaml:"identifier" json:"identifier" xml:"identifier"` Name string `yaml:"name" json:"name" xml:"name"` MessageOnFailure string `yaml:"messageOnFailure" json:"messageOnFailure" xml:"messageOnFailure"` OccurrencesDetails []OccurrenceDetails `yaml:"occurrencesDetails" json:"occurrencesDetails" xml:"occurrencesDetails"` }
Click to show internal directories.
Click to hide internal directories.