pub struct WorkloadPermitRule {Show 13 fields
pub id: String,
pub description: String,
pub actions: Vec<String>,
pub kinds: Vec<String>,
pub min_package_trust: PackageTrust,
pub min_node_tier: NodeTrustTier,
pub max_network: NetworkPolicy,
pub allow_secrets: bool,
pub allow_emulated: bool,
pub accelerators: Vec<String>,
pub max_resource_cost: f64,
pub projects: Vec<String>,
pub principals: Vec<String>,
}Expand description
An explicit allowance that lifts the workload.* default deny.
Every condition must hold. Defaults are the strict ones from ADR-099 section 8: pinned signer, paired node, LAN at most, no secrets, no emulation, no accelerator.
Fields§
§id: StringUnique id (recorded in the chain event when it matches).
description: StringWhy this permit exists.
actions: Vec<String>Action selectors (workload.place, or workload.*).
kinds: Vec<String>Workload kinds allowed (cog, inference; * for any).
min_package_trust: PackageTrustLeast package trust allowed.
min_node_tier: NodeTrustTierLeast node trust tier allowed.
max_network: NetworkPolicyMost network exposure allowed.
allow_secrets: boolWhether secrets may be delivered.
allow_emulated: boolWhether emulated placement is allowed (operator opt-in).
accelerators: Vec<String>Accelerator id selectors allowed (accel.gpu.*). Empty: none.
max_resource_cost: f64Highest resource cost allowed.
projects: Vec<String>Verified project ids this permit applies to (ADR-103 A6). Empty: any. Matched against the gate’s verified attestation, never against anything the request carries; with a non-empty list and no verified project the rule does not match.
principals: Vec<String>Principals (the gate’s agent_id) this permit applies to. Empty:
any. With a non-empty list a request whose principal is unknown, or
not listed, does not match. The project kind uses it to limit its
permit to SUPERVISOR_PRINCIPAL.
Implementations§
Source§impl WorkloadPermitRule
impl WorkloadPermitRule
Sourcepub fn new(
id: impl Into<String>,
actions: impl IntoIterator<Item = impl Into<String>>,
kinds: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn new( id: impl Into<String>, actions: impl IntoIterator<Item = impl Into<String>>, kinds: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Strict permit for actions on workloads of kinds.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Reject rules that are empty, malformed, or reach outside workload.*.
Sourcepub fn matches(&self, action: &str, effect: &WorkloadEffect) -> bool
pub fn matches(&self, action: &str, effect: &WorkloadEffect) -> bool
Whether this rule permits action with effect.
Sourcepub fn matches_in(
&self,
action: &str,
effect: &WorkloadEffect,
project: Option<&str>,
) -> bool
pub fn matches_in( &self, action: &str, effect: &WorkloadEffect, project: Option<&str>, ) -> bool
matches for a request attributed to project
(the verified project id, or None outside any project).
Sourcepub fn matches_for(
&self,
action: &str,
effect: &WorkloadEffect,
project: Option<&str>,
principal: Option<&str>,
) -> bool
pub fn matches_for( &self, action: &str, effect: &WorkloadEffect, project: Option<&str>, principal: Option<&str>, ) -> bool
matches_in for a request made by principal
(the gate’s agent id; None when unknown, which never satisfies a
rule that lists principals).
Trait Implementations§
Source§impl Clone for WorkloadPermitRule
impl Clone for WorkloadPermitRule
Source§impl Debug for WorkloadPermitRule
impl Debug for WorkloadPermitRule
Source§impl<'de> Deserialize<'de> for WorkloadPermitRule
impl<'de> Deserialize<'de> for WorkloadPermitRule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for WorkloadPermitRule
impl PartialEq for WorkloadPermitRule
Source§impl Serialize for WorkloadPermitRule
impl Serialize for WorkloadPermitRule
impl StructuralPartialEq for WorkloadPermitRule
Auto Trait Implementations§
impl Freeze for WorkloadPermitRule
impl RefUnwindSafe for WorkloadPermitRule
impl Send for WorkloadPermitRule
impl Sync for WorkloadPermitRule
impl Unpin for WorkloadPermitRule
impl UnsafeUnpin for WorkloadPermitRule
impl UnwindSafe for WorkloadPermitRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more