mongodb_atlas_admin/api/alert_configurations/
mod.rs

1use chrono::{DateTime, Utc};
2use serde::Deserialize;
3
4pub mod routes;
5
6#[derive(Debug, Deserialize)]
7#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
8pub enum AlertConfigurationMatchersFieldNames {
9    TypeName,
10    Hostname,
11    Port,
12    HostnameAndPort,
13    ReplicaSetName,
14    ShardName,
15    ClusterName,
16    ApplicationId,
17}
18
19/// TODO: None of these types have been _confirmed_, a bunch could probably be
20/// enums; this is just the example object provided.
21///
22/// The same goes for all the child types below.
23#[derive(Debug, Deserialize)]
24#[serde(rename_all = "camelCase")]
25pub struct ApiAlertConfigView {
26    pub id: String,
27    pub group_id: String,
28    pub event_type_name: String,
29    pub created: DateTime<Utc>,
30    pub updated: DateTime<Utc>,
31    pub enabled: bool,
32    pub type_name: String,
33    pub matchers: Vec<ApiAlertConfigViewMatcher>,
34    pub metric_threshold: Option<ApiAlertConfigViewMetricThreshold>,
35    pub notifications: Vec<ApiAlertConfigViewNotification>,
36    pub threshold: Option<ApiAlertConfigViewThreshold>,
37}
38
39#[derive(Debug, Deserialize)]
40#[serde(rename_all = "camelCase")]
41pub struct ApiAlertConfigViewMatcher {
42    pub field_name: AlertConfigurationMatchersFieldNames,
43    pub operator: String,
44    pub value: String,
45}
46
47#[derive(Debug, Deserialize)]
48#[serde(rename_all = "camelCase")]
49pub struct ApiAlertConfigViewMetricThreshold {
50    pub metric_name: String,
51    pub mode: String,
52    pub operator: String,
53    pub threshold: f64,
54    pub units: String,
55}
56
57#[derive(Debug, Deserialize)]
58#[serde(rename_all = "camelCase")]
59pub struct ApiAlertConfigViewNotification {
60    pub api_token: Option<String>,
61    pub channel_name: Option<String>,
62    pub datadog_api_key: Option<String>,
63    pub datadog_region: Option<String>,
64    pub delay_min: usize,
65    pub email_address: Option<String>,
66    pub email_enabled: bool,
67    pub flow_name: Option<String>,
68    pub flowdock_api_token: Option<String>,
69    pub interval_min: usize,
70    pub microsoft_teams_webhook_url: Option<String>,
71    pub mobile_number: Option<String>,
72    pub notification_token: Option<String>,
73    pub ops_genie_api_key: Option<String>,
74    pub ops_genie_region: Option<String>,
75    pub org_name: Option<String>,
76    pub roles: Option<Vec<String>>,
77    pub room_name: Option<String>,
78    pub service_key: Option<String>,
79    pub severity: Option<String>,
80    pub ssm_enabled: Option<bool>,
81    pub team_id: Option<String>,
82    pub team_name: Option<String>,
83    pub type_name: String,
84    pub username: Option<String>,
85    pub victor_ops_api_key: Option<String>,
86    pub victor_ops_routing_key: Option<String>,
87    pub webhook_secret: Option<String>,
88    pub webhook_url: Option<String>,
89}
90
91#[derive(Debug, Deserialize)]
92#[serde(rename_all = "camelCase")]
93pub struct ApiAlertConfigViewThreshold {
94    pub operator: String,
95    pub threshold: usize,
96    pub units: String,
97}