pub struct WebhookTrigger { /* private fields */ }Expand description
HTTP webhook trigger.
Listens on a specified host:port for incoming HTTP requests. Converts request body to a trigger event.
§Configuration
triggers:
- id: webhook_orders
type: trigger::webhook
params:
host: "0.0.0.0"
port: 8080
path: "/orders"
method: "POST"§Parameters
host- Host to bind to (default: “0.0.0.0”)port- Port to listen on (default: 8080)path- URL path to match (default: “/”)method- HTTP method to accept (default: “POST”)
Implementations§
Source§impl WebhookTrigger
impl WebhookTrigger
Sourcepub fn new(id: impl Into<String>, host: impl Into<String>, port: u16) -> Self
pub fn new(id: impl Into<String>, host: impl Into<String>, port: u16) -> Self
Create a new webhook trigger.
Sourcepub fn from_config(config: &TriggerConfig) -> Result<Self>
pub fn from_config(config: &TriggerConfig) -> Result<Self>
Create from configuration.
Sourcepub fn with_method(self, method: Method) -> Self
pub fn with_method(self, method: Method) -> Self
Set the HTTP method.
Trait Implementations§
Source§impl Trigger for WebhookTrigger
impl Trigger for WebhookTrigger
Source§fn trigger_type(&self) -> TriggerType
fn trigger_type(&self) -> TriggerType
Get the trigger type.
Source§fn start<'a>(
&'a self,
callback: Box<dyn Fn(TriggerEvent) + Send + Sync + 'static>,
) -> TriggerFuture<'a, ()>
fn start<'a>( &'a self, callback: Box<dyn Fn(TriggerEvent) + Send + Sync + 'static>, ) -> TriggerFuture<'a, ()>
Start the trigger. Read more
Source§fn stop<'a>(&'a self) -> TriggerFuture<'a, ()>
fn stop<'a>(&'a self) -> TriggerFuture<'a, ()>
Stop the trigger.
Source§fn pause<'a>(&'a self) -> TriggerFuture<'a, ()>
fn pause<'a>(&'a self) -> TriggerFuture<'a, ()>
Pause the trigger (stop accepting new events).
Source§fn resume<'a>(&'a self) -> TriggerFuture<'a, ()>
fn resume<'a>(&'a self) -> TriggerFuture<'a, ()>
Resume the trigger.
Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Check if the trigger is running.
Auto Trait Implementations§
impl Freeze for WebhookTrigger
impl !RefUnwindSafe for WebhookTrigger
impl Send for WebhookTrigger
impl Sync for WebhookTrigger
impl Unpin for WebhookTrigger
impl !UnwindSafe for WebhookTrigger
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.