pub struct WebhookApprovalNotifier { /* private fields */ }Expand description
Delivers ApprovalNotifications as signed webhooks in the Standard Webhooks
format, through the shared WebhookDelivery.
Each delivery is a POST of the notification as JSON with webhook-id (the
notification ID, stable across retries), webhook-timestamp (Unix seconds), and
webhook-signature (adk_core::webhook). Deliveries run in the background with
retries, exponential backoff, and jitter, so a slow receiver never holds up a decision;
the last failure is dead-lettered. The default egress policy allows HTTPS to public
addresses only; with_delivery changes it.
§Example
use adk_server::approvals::WebhookApprovalNotifier;
let notifier = WebhookApprovalNotifier::new(
"https://hooks.example.com/approvals",
"whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw",
)?;Implementations§
Source§impl WebhookApprovalNotifier
impl WebhookApprovalNotifier
Sourcepub fn new(url: impl Into<String>, secret: &str) -> Result<Self, AdkError>
pub fn new(url: impl Into<String>, secret: &str) -> Result<Self, AdkError>
Delivers to url, signing with secret: base64, optionally whsec_-prefixed.
§Errors
Returns approval.webhook_secret when the secret is not base64.
Sourcepub fn with_delivery(self, delivery: WebhookDelivery) -> Self
pub fn with_delivery(self, delivery: WebhookDelivery) -> Self
Delivers through delivery, for a custom retry policy, dead-letter sink, or egress
policy (for example EgressPolicy::allow_private_networks() for an in-cluster receiver).
Trait Implementations§
Source§impl Clone for WebhookApprovalNotifier
impl Clone for WebhookApprovalNotifier
Auto Trait Implementations§
impl !RefUnwindSafe for WebhookApprovalNotifier
impl !UnwindSafe for WebhookApprovalNotifier
impl Forget for WebhookApprovalNotifier
impl Freeze for WebhookApprovalNotifierwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<WebhookSecret>: Freeze,
*const ArcInner<dyn Clock> is !null: Freeze,
PhantomData<ArcInner<dyn Clock>>: Freeze,
*const ArcInner<[u8]> is !null: Freeze,
PhantomData<ArcInner<[u8]>>: Freeze,
*const ArcInner<WebhookDelivery> is !null: Freeze,
PhantomData<ArcInner<WebhookDelivery>>: Freeze,
impl Move for WebhookApprovalNotifier
impl Send for WebhookApprovalNotifier
impl Sync for WebhookApprovalNotifier
impl Unpin for WebhookApprovalNotifier
impl UnsafeUnpin for WebhookApprovalNotifierwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<WebhookSecret>: UnsafeUnpin,
*const ArcInner<dyn Clock> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Clock>>: UnsafeUnpin,
*const ArcInner<[u8]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[u8]>>: UnsafeUnpin,
*const ArcInner<WebhookDelivery> is !null: UnsafeUnpin,
PhantomData<ArcInner<WebhookDelivery>>: UnsafeUnpin,
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
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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