Documentation ¶
Index ¶
- type CompositeResult
- type Indent
- type Reason
- type Result
- type RuleApplicationResult
- func (e *RuleApplicationResult) AddMessagef(message string, a ...interface{})
- func (e *RuleApplicationResult) FailWithMessagef(message string, a ...interface{})
- func (e *RuleApplicationResult) GetReason() Reason
- func (e *RuleApplicationResult) MergeWith(other *RuleApplicationResult)
- func (e *RuleApplicationResult) String() string
- func (e *RuleApplicationResult) StringWithIndent(indent string) string
- func (e *RuleApplicationResult) ToError() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompositeResult ¶
CompositeResult is used for result hierarchy
func (*CompositeResult) GetReason ¶
func (e *CompositeResult) GetReason() Reason
GetReason returns reason
func (*CompositeResult) String ¶
func (e *CompositeResult) String() string
String makes result string for writing it to logs
func (*CompositeResult) StringWithIndent ¶
func (e *CompositeResult) StringWithIndent(indent string) string
StringWithIndent makes result string where each line is prepended with specified indent
func (*CompositeResult) ToError ¶
func (e *CompositeResult) ToError() error
ToError returns error if reason is not success
type Result ¶
type Result interface { String() string StringWithIndent(indent string) string GetReason() Reason ToError() error }
Result is an interface that is used for result polymorphic behavior
func Append ¶
Append returns CompositeResult with target and source Or appends source to target if it is composite result If the source reason is more important than target reason, target takes the reason of the source.
func NewAdmissionResult ¶
NewAdmissionResult creates a new admission result
func NewPolicyApplicationResult ¶
NewPolicyApplicationResult creates a new policy application result
type RuleApplicationResult ¶
RuleApplicationResult represents elementary result that is produced by PolicyEngine TODO: It can be used to create Kubernetes Results, so make method for this
func NewRuleApplicationResult ¶
func NewRuleApplicationResult(ruleName string) RuleApplicationResult
NewRuleApplicationResult creates a new rule application result
func (*RuleApplicationResult) AddMessagef ¶
func (e *RuleApplicationResult) AddMessagef(message string, a ...interface{})
AddMessagef Adds formatted message to this result
func (*RuleApplicationResult) FailWithMessagef ¶
func (e *RuleApplicationResult) FailWithMessagef(message string, a ...interface{})
FailWithMessagef Sets the Reason Failed and adds formatted message to this result
func (*RuleApplicationResult) GetReason ¶
func (e *RuleApplicationResult) GetReason() Reason
GetReason returns reason
func (*RuleApplicationResult) MergeWith ¶
func (e *RuleApplicationResult) MergeWith(other *RuleApplicationResult)
MergeWith Takes messages and higher reason from another RuleApplicationResult
func (*RuleApplicationResult) String ¶
func (e *RuleApplicationResult) String() string
String makes result string for writing it to logs
func (*RuleApplicationResult) StringWithIndent ¶
func (e *RuleApplicationResult) StringWithIndent(indent string) string
StringWithIndent makes result string where each line is prepended with specified indent
func (*RuleApplicationResult) ToError ¶
func (e *RuleApplicationResult) ToError() error
ToError returns the error if reason is not success