Documentation
¶
Overview ¶
Package resource provides models used in the k8s-object commend
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PolicyViolation ¶
type PolicyViolation struct {
Rule string `json:"rule"`
Risk string `json:"risk"`
Violation map[string]interface{} `json:"violation"`
}
PolicyViolation represent a violation of a policy.
type Scope ¶
type Scope struct {
Cluster string `json:"-"`
Namespace string `json:"namespace"`
Kind string `json:"kind"`
Name string `json:"name"`
Labels map[string]string `json:"labels"`
}
Scope represents a resource scope/id.
type ValidatedResource ¶
type ValidatedResource struct {
Scope `json:",inline"`
FilePath string `json:"file_path"`
Policy string `json:"policy"`
PolicyViolations []PolicyViolation `json:"policy_violations"`
}
ValidatedResource represents a result of one resource validation.
type ValidatedResourceResponse ¶
type ValidatedResourceResponse struct {
Scope `json:",inline"`
Policy string `json:"policy"`
PolicyViolations []PolicyViolation `json:"policy_violations"`
}
ValidatedResourceResponse represent a resource validation response from the backend.
type ValidatedResources ¶
type ValidatedResources struct {
Errors []string
ViolatedResources []ValidatedResource
}
ValidatedResources response model for the validate resource command.
func (ValidatedResources) GetErrors ¶
func (v ValidatedResources) GetErrors() error
GetErrors return a multi-error constructed from all the errors.
func (ValidatedResources) ToValidatedResourcesByPolicy ¶
func (v ValidatedResources) ToValidatedResourcesByPolicy() ValidatedResourcesByPolicy
ToValidatedResourcesByPolicy converts the ValidatedResources to ValidatedResourcesByPolicy.
type ValidatedResourcesByPolicy ¶
type ValidatedResourcesByPolicy map[string]*ViolatedResources
ValidatedResourcesByPolicy represents a result of resources validation aggregated by policy.
func (ValidatedResourcesByPolicy) PolicyViolationsCount ¶
func (v ValidatedResourcesByPolicy) PolicyViolationsCount() int
PolicyViolationsCount get the count of violated policies.
func (ValidatedResourcesByPolicy) Title ¶
func (v ValidatedResourcesByPolicy) Title() string
Title is the title of result.
type ViolatedResources ¶
type ViolatedResources struct {
Policy string `json:"-"`
Resources []ValidatedResource `json:"objects"`
}
ViolatedResources represents a group of violating resources.
func (ViolatedResources) Footer ¶
func (v ViolatedResources) Footer() string
Footer is the footer of the ViolatedResources result.
func (ViolatedResources) Header ¶
func (v ViolatedResources) Header() []string
Header is the header columns of the ViolatedResources result.
func (ViolatedResources) PolicyViolationsCount ¶
func (v ViolatedResources) PolicyViolationsCount() int
PolicyViolationsCount get the count of violated policies.
func (ViolatedResources) Rows ¶
func (v ViolatedResources) Rows() [][]string
Rows returns all the violations of the ViolatedResources result as list of rows.
func (ViolatedResources) Title ¶
func (v ViolatedResources) Title() string
Title is the title of the ViolatedResources result.