Documentation ¶
Overview ¶
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var OPACmd = &cobra.Command{ Use: "opa {-r <policy file> -k <Kube manifest file> | -b <directory of policies and manifests>} [flags]", Short: "Validate the syntax and output of a V2 Insights OPA policy", Long: `opa runs V2 format Insights OPA policies with a Kubernetes manifest as input, validating rego syntax and proper Insights action item output.`, Example: ` To validate a single policy: insights-cli validate opa -r policy.rego -k input-manifest.yaml To validate a directory of policies and Kubernetes manifests, with a policy and its corresponding Kubernetes manifest sharing the same base filename: insights-cli validate opa -b ./all_policies`, Run: func(cmd *cobra.Command, args []string) { if !checkValidateOPAFlags() { err := cmd.Help() if err != nil { logrus.Error(err) } os.Exit(1) } if regoFileName != "" { _, err := opavalidation.Run(regoFileName, objectFileName, expectActionItem, fwrego.InsightsInfo{InsightsContext: insightsInfoContext, Cluster: insightsInfoCluster}, objectNamespaceOverride) if err != nil { fmt.Printf("OPA policy failed validation: %v\n", err) os.Exit(1) } fmt.Println("OPA policy validated successfully.") } if batchDir != "" { _, failedPolicies, err := opavalidation.RunBatch(batchDir, expectActionItem, fwrego.InsightsInfo{InsightsContext: insightsInfoContext, Cluster: insightsInfoCluster}, objectNamespaceOverride) fmt.Println() if err != nil { fmt.Printf("OPA policies failed validation: %v\n", err) fmt.Printf("Please check the above output for details about the %s\n", opavalidation.HumanizeStringsOutput(failedPolicies, "failure")) os.Exit(1) } fmt.Println("OPA policies validated successfully.") } }, }
OPACmd represents the validate opa command
Functions ¶
Types ¶
This section is empty.
Source Files ¶
- disable.go
- download.go
- download_app_groups.go
- download_policy_mappings.go
- enable.go
- generate.go
- generate_opa.go
- generate_opa_openai.go
- list.go
- list_all.go
- list_app_groups.go
- list_opa.go
- list_policy_mappings.go
- list_rules.go
- push.go
- push_all.go
- push_app_groups.go
- push_opa.go
- push_policy_mappings.go
- push_rules.go
- push_settings.go
- root.go
- validate.go
- validate_opa.go
- validate_rule.go
- version.go
Click to show internal directories.
Click to hide internal directories.