pub struct WebhookConfig {
pub url: String,
pub headers: HashMap<String, String>,
pub timeout_seconds: u64,
pub alert_levels: Vec<AlertLevel>,
}Expand description
Webhook configuration for alert delivery
Fields§
§url: StringWebhook endpoint URL
headers: HashMap<String, String>HTTP headers to include in webhook requests
timeout_seconds: u64Timeout for webhook requests in seconds
alert_levels: Vec<AlertLevel>Filter: only send alerts matching these levels (empty = all levels)
Implementations§
Source§impl WebhookConfig
impl WebhookConfig
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a custom HTTP header
Sourcepub fn with_timeout(self, timeout_seconds: u64) -> Self
pub fn with_timeout(self, timeout_seconds: u64) -> Self
Set the timeout for webhook requests
Sourcepub fn with_alert_levels(self, levels: Vec<AlertLevel>) -> Self
pub fn with_alert_levels(self, levels: Vec<AlertLevel>) -> Self
Filter alerts by level (empty = send all alerts)
Sourcepub fn should_send(&self, alert: &Alert) -> bool
pub fn should_send(&self, alert: &Alert) -> bool
Check if this webhook should receive the given alert
Sourcepub fn create_payload(&self, alert: &Alert) -> Value
pub fn create_payload(&self, alert: &Alert) -> Value
Create a JSON payload for the webhook
Trait Implementations§
Source§impl Clone for WebhookConfig
impl Clone for WebhookConfig
Source§impl Debug for WebhookConfig
impl Debug for WebhookConfig
Source§impl<'de> Deserialize<'de> for WebhookConfig
impl<'de> Deserialize<'de> for WebhookConfig
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
Auto Trait Implementations§
impl Freeze for WebhookConfig
impl RefUnwindSafe for WebhookConfig
impl Send for WebhookConfig
impl Sync for WebhookConfig
impl Unpin for WebhookConfig
impl UnsafeUnpin for WebhookConfig
impl UnwindSafe for WebhookConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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