pub enum AccessCondition {
HumanApproval,
IpAllowlist {
cidrs: Vec<String>,
},
Unknown(Value),
}Expand description
A single condition that gates access under an access rule.
Serialized using the server’s wire format: an object tagged by a kind discriminant, e.g.
{"kind":"human_approval"} or {"kind":"ip_allowlist","cidrs":["10.0.0.0/8"]}.
Variants§
HumanApproval
Requires a human approval before access is granted.
IpAllowlist
Restricts access to a set of allow-listed CIDR ranges.
Unknown(Value)
Any kind this SDK version doesn’t model (e.g. the server’s time_of_day condition).
The whole object is preserved verbatim so list + enable/disable round-trips don’t
destroy conditions this SDK can’t interpret.
This also captures a known kind whose payload doesn’t match the shape this SDK
expects (e.g. an ip_allowlist condition missing its cidrs field) - the whole object
is preserved verbatim rather than being rejected as a deserialization error.
Known limitation: preservation applies to whole objects only. When a payload does
match a modeled variant, any extra fields the server may add to that kind in the future
are dropped on a deserialize→reserialize round trip (serde matches the tagged variant
and discards unrecognized fields). Adding fields to a modeled kind therefore requires a
matching SDK update; see the extra_fields_on_known_kind_are_dropped test.
Note for TypeScript consumers: the generated type shows kind: "unknown", but at
runtime kind holds the server’s actual discriminant string (e.g. "time_of_day").
Filter with a known-kind guard instead of matching on "unknown".
Trait Implementations§
Source§impl Clone for AccessCondition
impl Clone for AccessCondition
Source§fn clone(&self) -> AccessCondition
fn clone(&self) -> AccessCondition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccessCondition
impl Debug for AccessCondition
Source§impl<'de> Deserialize<'de> for AccessCondition
impl<'de> Deserialize<'de> for AccessCondition
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 From<AccessCondition> for JsValuewhere
AccessCondition: Serialize,
impl From<AccessCondition> for JsValuewhere
AccessCondition: Serialize,
Source§fn from(value: AccessCondition) -> Self
fn from(value: AccessCondition) -> Self
Source§impl FromWasmAbi for AccessConditionwhere
Self: DeserializeOwned,
impl FromWasmAbi for AccessConditionwhere
Self: DeserializeOwned,
Source§impl IntoWasmAbi for &AccessConditionwhere
AccessCondition: Serialize,
impl IntoWasmAbi for &AccessConditionwhere
AccessCondition: Serialize,
Source§impl IntoWasmAbi for AccessConditionwhere
AccessCondition: Serialize,
impl IntoWasmAbi for AccessConditionwhere
AccessCondition: Serialize,
Source§impl OptionFromWasmAbi for AccessConditionwhere
Self: DeserializeOwned,
impl OptionFromWasmAbi for AccessConditionwhere
Self: DeserializeOwned,
Source§impl OptionIntoWasmAbi for AccessConditionwhere
AccessCondition: Serialize,
impl OptionIntoWasmAbi for AccessConditionwhere
AccessCondition: Serialize,
Source§impl PartialEq for AccessCondition
impl PartialEq for AccessCondition
Source§impl RefFromWasmAbi for AccessConditionwhere
Self: DeserializeOwned,
impl RefFromWasmAbi for AccessConditionwhere
Self: DeserializeOwned,
Source§type Abi = <JsType as RefFromWasmAbi>::Abi
type Abi = <JsType as RefFromWasmAbi>::Abi
Self are recovered from.Source§type Anchor = SelfOwner<AccessCondition>
type Anchor = SelfOwner<AccessCondition>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl Serialize for AccessCondition
impl Serialize for AccessCondition
Source§impl Tsify for AccessCondition
impl Tsify for AccessCondition
const DECL: &'static str = "/**\n * A single condition that gates access under an access rule.\n *\n * Serialized using the server\\\'s wire format: an object tagged by a `kind` discriminant, e.g.\n * `{\\\"kind\\\":\\\"human_approval\\\"}` or `{\\\"kind\\\":\\\"ip_allowlist\\\",\\\"cidrs\\\":[\\\"10.0.0.0/8\\\"]}`.\n */\nexport type AccessCondition = { kind: \"human_approval\" } | { kind: \"ip_allowlist\"; cidrs: string[] } | ({ kind: \"unknown\" } & Record<string, unknown>);"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
Source§impl VectorFromWasmAbi for AccessConditionwhere
Self: DeserializeOwned,
impl VectorFromWasmAbi for AccessConditionwhere
Self: DeserializeOwned,
type Abi = <JsType as VectorFromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>
Source§impl VectorIntoWasmAbi for AccessConditionwhere
AccessCondition: Serialize,
impl VectorIntoWasmAbi for AccessConditionwhere
AccessCondition: Serialize,
type Abi = <JsType as VectorIntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi
Source§impl WasmDescribe for AccessCondition
impl WasmDescribe for AccessCondition
impl StructuralPartialEq for AccessCondition
Auto Trait Implementations§
impl Freeze for AccessCondition
impl RefUnwindSafe for AccessCondition
impl Send for AccessCondition
impl Sync for AccessCondition
impl Unpin for AccessCondition
impl UnsafeUnpin for AccessCondition
impl UnwindSafe for AccessCondition
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.