Documentation ¶
Index ¶
- func RulesSuccesfuly(rules []*RuleInfo) bool
- type PolicyInfo
- func (pi *PolicyInfo) AddRuleInfos(rules []*RuleInfo)
- func (pi *PolicyInfo) ErrorRules() string
- func (pi *PolicyInfo) FailedRules() []string
- func (pi *PolicyInfo) GetFailedRules() []v1alpha1.FailedRule
- func (pi *PolicyInfo) GetRuleNames(onSuccess bool) string
- func (pi *PolicyInfo) IsSuccessful() bool
- func (pi *PolicyInfo) SuccessfulRules() []string
- type RuleInfo
- type RuleType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RulesSuccesfuly ¶
RulesSuccesfuly check if the any rule has failed or not
Types ¶
type PolicyInfo ¶
type PolicyInfo struct { // Name is policy name Name string // RKind represents the resource kind RKind string // RName is resource name RName string // Namespace is the ns of resource // empty on non-namespaced resources RNamespace string //TODO: add check/enum for types ValidationFailureAction string // BlockChanges, ReportViolation Rules []*RuleInfo // contains filtered or unexported fields }
PolicyInfo defines policy information
func NewPolicyInfo ¶
func NewPolicyInfo(policyName, rKind, rName, rNamespace, validationFailureAction string) *PolicyInfo
NewPolicyInfo returns a new policy info
func (*PolicyInfo) AddRuleInfos ¶
func (pi *PolicyInfo) AddRuleInfos(rules []*RuleInfo)
AddRuleInfos sets the rule information
func (*PolicyInfo) ErrorRules ¶
func (pi *PolicyInfo) ErrorRules() string
ErrorRules returns error msgs from all rule
func (*PolicyInfo) FailedRules ¶ added in v0.6.0
func (pi *PolicyInfo) FailedRules() []string
FailedRules returns list of failed rule names
func (*PolicyInfo) GetFailedRules ¶ added in v0.6.0
func (pi *PolicyInfo) GetFailedRules() []v1alpha1.FailedRule
GetFailedRules returns the failed rules with rule type
func (*PolicyInfo) GetRuleNames ¶ added in v0.6.0
func (pi *PolicyInfo) GetRuleNames(onSuccess bool) string
GetRuleNames gets the name of successful rules
func (*PolicyInfo) IsSuccessful ¶
func (pi *PolicyInfo) IsSuccessful() bool
IsSuccessful checks if policy is succesful the policy is set to fail, if any of the rules have failed
func (*PolicyInfo) SuccessfulRules ¶ added in v0.6.0
func (pi *PolicyInfo) SuccessfulRules() []string
SuccessfulRules returns list of successful rule names
type RuleInfo ¶
type RuleInfo struct { Name string Msgs []string RuleType RuleType // contains filtered or unexported fields }
RuleInfo defines rule struct
func NewRuleInfo ¶
NewRuleInfo creates a new RuleInfo
func (*RuleInfo) GetErrorString ¶ added in v0.6.0
GetErrorString returns the error message for a rule
func (*RuleInfo) IsSuccessful ¶
IsSuccessful checks if rule is succesful