pub enum Obligation {
Audit {
tag: String,
},
RateLimit {
window_secs: u64,
max: u32,
},
Custom {
value: Value,
},
}Expand description
Policy instructions attached to an allow; only Audit has v0 runtime handling.
RateLimit requires positive values but is not enforced in v0. See
crates/khive-gate/docs/api/policy-types.md.
Variants§
Audit
RateLimit
Custom
Policy-specific arbitrary JSON; the struct form preserves internally tagged scalar values.
Implementations§
Source§impl Obligation
impl Obligation
Sourcepub fn try_rate_limit(
window_secs: u64,
max: u32,
) -> Result<Obligation, GateValidationError>
pub fn try_rate_limit( window_secs: u64, max: u32, ) -> Result<Obligation, GateValidationError>
Create a validated RateLimit obligation.
Returns Err if window_secs or max is zero.
Sourcepub fn rate_limit(window_secs: u64, max: u32) -> Obligation
pub fn rate_limit(window_secs: u64, max: u32) -> Obligation
Create a validated RateLimit obligation. Panics if window_secs or max is zero.
Trait Implementations§
Source§impl Clone for Obligation
impl Clone for Obligation
Source§fn clone(&self) -> Obligation
fn clone(&self) -> Obligation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Obligation
impl Debug for Obligation
Source§impl<'de> Deserialize<'de> for Obligation
impl<'de> Deserialize<'de> for Obligation
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Obligation, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Obligation, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Obligation
impl Serialize for Obligation
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl TryFrom<RawObligation> for Obligation
impl TryFrom<RawObligation> for Obligation
Source§type Error = GateValidationError
type Error = GateValidationError
The type returned in the event of a conversion error.
Source§fn try_from(
raw: RawObligation,
) -> Result<Obligation, <Obligation as TryFrom<RawObligation>>::Error>
fn try_from( raw: RawObligation, ) -> Result<Obligation, <Obligation as TryFrom<RawObligation>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl Forget for Obligation
impl Freeze for Obligationwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
impl Move for Obligation
impl RefUnwindSafe for Obligation
impl Send for Obligation
impl Sync for Obligation
impl Unpin for Obligation
impl UnsafeUnpin for Obligationwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
impl UnwindSafe for Obligation
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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