Documentation
¶
Overview ¶
Copyright 2020-2026 Project Capsule Authors SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnforceBodiesFromNamespaceRules ¶
func EnforceBodiesFromNamespaceRules( bodies []*api.NamespaceRuleBodyNamespace, ) []*api.NamespaceRuleEnforceBody
func ValidateRuleStatusBody ¶
func ValidateRuleStatusBody(bodies []*rules.NamespaceRuleBodyNamespace) error
Types ¶
type Decision ¶
type Decision struct {
SetName string
EventReason string
Action api.ActionType
Value Value
MatchedValue any
// MatchedRule is the human-readable rule description returned by Set.RuleDescription.
MatchedRule string
// MatchDetail is the human-readable detail returned by Match.Detail.
MatchDetail string
Message string
}
type DecisionError ¶
type DecisionError struct {
Decision *Decision
}
func (*DecisionError) Error ¶
func (e *DecisionError) Error() string
type Evaluation ¶
type Evaluation struct {
// Final is the last matching allow/deny decision.
Final *Decision
// Blocking is set when the final result blocks admission.
Blocking *Decision
// Audits contains all matching audit decisions.
Audits []*Decision
}
func EvaluateEnforce ¶
func EvaluateEnforce[R any, T any]( obj T, enforceBodies []*api.NamespaceRuleEnforceBody, set Set[R, T], ) (*Evaluation, error)
func (*Evaluation) Append ¶
func (e *Evaluation) Append(other *Evaluation)
func (*Evaluation) BlockingError ¶
func (e *Evaluation) BlockingError() error
type Set ¶
type Set[R any, O any] struct { Name string EventReason string Values func(O) []Value Rules func(*api.NamespaceRuleEnforceBody) []R Matches func(R, Value) (Match, error) // Message can fully override the default message. // Prefer leaving this nil unless a rule requires very specific wording. Message func(api.ActionType, Value, any) string // RuleDescription returns a human-readable representation of one rule. // It is used only for admission/audit messages. RuleDescription func(R) string // AllowedDescription optionally overrides the "Allowed values" label. // Example: "Allowed CIDRs", "Allowed ranges", "Allowed hostnames". AllowedDescription string }
Click to show internal directories.
Click to hide internal directories.