#[non_exhaustive]pub struct HookMetadata {
pub kind: String,
pub subject: Option<String>,
pub callback: Option<HookCallbackRoute>,
pub labels: BTreeMap<String, String>,
pub data: BTreeMap<String, JsonValue>,
}Expand description
Typed helper for common hook metadata fields.
Hook metadata is still persisted as JSON in flow.hook.created events. This
type only gives Rust workflow authors a stable shape for audit and callback
routing fields.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: StringApplication-defined hook kind used for routing and audit.
subject: Option<String>Optional human-readable subject.
callback: Option<HookCallbackRoute>Optional callback route exposed by the host.
labels: BTreeMap<String, String>Searchable string labels.
data: BTreeMap<String, JsonValue>Application-defined structured metadata.
Implementations§
Source§impl HookMetadata
impl HookMetadata
Sourcepub fn new(kind: impl Into<String>) -> Self
pub fn new(kind: impl Into<String>) -> Self
Creates metadata for an application-defined hook kind.
Sourcepub fn human_approval(subject: impl Into<String>) -> Self
pub fn human_approval(subject: impl Into<String>) -> Self
Creates metadata for a human-approval hook.
Sourcepub fn with_subject(self, subject: impl Into<String>) -> Self
pub fn with_subject(self, subject: impl Into<String>) -> Self
Sets the human-readable subject.
Sourcepub fn with_callback_route(self, callback: HookCallbackRoute) -> Self
pub fn with_callback_route(self, callback: HookCallbackRoute) -> Self
Sets the host callback route.
Sourcepub fn with_label(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_label( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Adds or replaces one searchable label.
Trait Implementations§
Source§impl Clone for HookMetadata
impl Clone for HookMetadata
Source§fn clone(&self) -> HookMetadata
fn clone(&self) -> HookMetadata
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 HookMetadata
impl Debug for HookMetadata
Source§impl<'de> Deserialize<'de> for HookMetadata
impl<'de> Deserialize<'de> for HookMetadata
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for HookMetadata
impl PartialEq for HookMetadata
Source§impl Serialize for HookMetadata
impl Serialize for HookMetadata
impl StructuralPartialEq for HookMetadata
Auto Trait Implementations§
impl Freeze for HookMetadata
impl RefUnwindSafe for HookMetadata
impl Send for HookMetadata
impl Sync for HookMetadata
impl Unpin for HookMetadata
impl UnsafeUnpin for HookMetadata
impl UnwindSafe for HookMetadata
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