Skip to main content

Policy

Struct Policy 

Source
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: String

Normalized path under the store prefix, e.g. "infra/k8s/pod-failing".

§version: u64

Monotonically increasing version, starting at 1 for a fresh propose, incremented by supersede.

§situation: String

Human-readable situation description.

§situation_selector: Selector

Machine-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: Severity

Advisory 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

Source

pub fn is_ratified(&self) -> bool

true when this policy has been ratified (live).

Source

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.

Source

pub fn handle(&self) -> String

Canonical path@version identifier.

Trait Implementations§

Source§

impl Clone for Policy

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Policy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Policy

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Policy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Policy

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Policy

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more