pub struct Policy {Show 22 fields
pub path: String,
pub version: u64,
pub situation: String,
pub situation_selector: Selector,
pub allow: Vec<AuthorizedAction>,
pub deny: Vec<AuthorizedAction>,
pub require_approval: Vec<ApprovalRule>,
pub procedure: Option<Vec<ProcedureStep>>,
pub triggers: Vec<String>,
pub required_fields: Vec<String>,
pub severity: Severity,
pub proposed_by: String,
pub proposed_at: DateTime<Utc>,
pub ratified_by: Option<String>,
pub ratified_at: Option<DateTime<Utc>>,
pub ratification_reasoning: Option<String>,
pub active_from: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
pub supersedes: Option<String>,
pub signature: Option<PolicySignature>,
pub tenant_id: Option<String>,
pub external_evaluator: Option<ExternalEvaluatorRef>,
}Expand description
The unit of authorization + procedure.
Fields§
§path: StringNormalized path under the store prefix, e.g. "infra/k8s/pod-failing".
version: u64Monotonically increasing version, starting at 1 for a fresh
propose, incremented by supersede.
situation: StringHuman-readable situation description.
situation_selector: SelectorMachine-evaluable situation matcher.
allow: Vec<AuthorizedAction>§deny: Vec<AuthorizedAction>§require_approval: Vec<ApprovalRule>§procedure: Option<Vec<ProcedureStep>>§triggers: Vec<String>Opaque tokens used to match this policy against a ChangeProposal.
See §22.2 — if any proposal token appears in triggers, this
policy is consulted.
required_fields: Vec<String>Fields that a ChangeProposal must carry to be promoted under
this policy. Missing any required field short-circuits to
RequireApproval.
severity: SeverityAdvisory severity for sorting/rendering. Does not change decision semantics.
proposed_by: String§proposed_at: DateTime<Utc>§ratified_by: Option<String>§ratified_at: Option<DateTime<Utc>>§ratification_reasoning: Option<String>Ratifier’s reasoning (free-form text captured at ratification).
active_from: DateTime<Utc>§expires_at: Option<DateTime<Utc>>§supersedes: Option<String>Prior path@version string if this policy supersedes another.
signature: Option<PolicySignature>Detached signature over the canonical-JSON bytes of this policy
(with the signature field itself excluded from canonicalization).
Optional on every policy — unsigned policies remain valid unless
the server sets require_signed_policies (§2c) and a verifier
has been registered on the PolicyStore.
tenant_id: Option<String>Tenant identifier for namespace isolation (0.7.5 §3). None
means the policy is a “global” policy that applies to every
tenant; Some(id) means the policy only applies to callers
that pass a matching tenant_filter into evaluate /
evaluate_change. See POLICY_V1.md §17 and ROADMAP D3 for
the cheap-namespace-discriminator rationale.
external_evaluator: Option<ExternalEvaluatorRef>External evaluator escape-hatch (0.7.5 §4). When Some(_) and
the PolicyStore has a matching runner registered via
with_external_evaluators, the dispatcher routes the policy to
the external rule engine (Rego / Cedar / WASM) instead of the
local evaluator. Policies referencing a runner kind that is not
registered are treated as not-matching. See POLICY_V1.md §18
and ROADMAP D4.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn is_ratified(&self) -> bool
pub fn is_ratified(&self) -> bool
true when this policy has been ratified (live).
Sourcepub fn is_currently_active(&self, now: DateTime<Utc>) -> bool
pub fn is_currently_active(&self, now: DateTime<Utc>) -> bool
true when this policy is currently active against the given
clock: ratified AND active_from <= now AND the policy has not
expired (expires_at.is_none() || expires_at > now).
expires_at is an exclusive upper bound — a policy whose
expires_at == now is already expired.