alertmanager_webhook_types/
v4.rs1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4use time::OffsetDateTime;
5
6#[derive(Serialize, Deserialize, Debug)]
7#[serde(rename_all = "camelCase")]
8pub struct Webhook {
9 pub alerts: Vec<Alert>,
10 pub group_labels: HashMap<String, String>,
11 pub common_labels: HashMap<String, String>,
12 pub common_annotations: HashMap<String, String>,
13 #[serde(rename = "externalURL")]
14 pub external_url: String,
15 pub group_key: String,
16 pub truncated_alerts: usize,
17}
18
19#[derive(Serialize, Deserialize, Debug)]
20#[serde(rename_all = "camelCase")]
21pub struct Alert {
22 pub status: Status,
23 pub labels: HashMap<String, String>,
24 pub annotations: HashMap<String, String>,
25 #[serde(with = "time::serde::rfc3339")]
26 pub starts_at: OffsetDateTime,
27 #[serde(with = "time::serde::rfc3339")]
28 pub ends_at: OffsetDateTime,
29 #[serde(rename = "generatorURL")]
30 pub generator_url: String,
31 pub fingerprint: String,
32}
33
34#[derive(Serialize, Deserialize, Debug)]
35#[serde(rename_all = "camelCase")]
36pub enum Status {
37 Firing,
38 Resolved,
39}