Struct Monitor

Source
#[non_exhaustive]
pub struct Monitor {
Show 19 fields pub created: Option<DateTime<Utc>>, pub creator: Option<Creator>, pub deleted: Option<Option<DateTime<Utc>>>, pub draft_status: Option<MonitorDraftStatus>, pub id: Option<i64>, pub matching_downtimes: Option<Vec<MatchingDowntime>>, pub message: Option<String>, pub modified: Option<DateTime<Utc>>, pub multi: Option<bool>, pub name: Option<String>, pub options: Option<MonitorOptions>, pub overall_state: Option<MonitorOverallStates>, pub priority: Option<Option<i64>>, pub query: String, pub restricted_roles: Option<Option<Vec<String>>>, pub state: Option<MonitorState>, pub tags: Option<Vec<String>>, pub type_: MonitorType, pub additional_properties: BTreeMap<String, Value>, /* private fields */
}
Expand description

Object describing a monitor.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§created: Option<DateTime<Utc>>

Timestamp of the monitor creation.

§creator: Option<Creator>

Object describing the creator of the shared element.

§deleted: Option<Option<DateTime<Utc>>>

Whether or not the monitor is deleted. (Always null)

§draft_status: Option<MonitorDraftStatus>

Indicates whether the monitor is in a draft or published state.

draft: The monitor appears as Draft and does not send notifications. published: The monitor is active and evaluates conditions and notify as configured.

This field is in preview. The draft value is only available to customers with the feature enabled.

§id: Option<i64>

ID of this monitor.

§matching_downtimes: Option<Vec<MatchingDowntime>>

A list of active v1 downtimes that match this monitor.

§message: Option<String>

A message to include with notifications for this monitor.

§modified: Option<DateTime<Utc>>

Last timestamp when the monitor was edited.

§multi: Option<bool>

Whether or not the monitor is broken down on different groups.

§name: Option<String>

The monitor name.

§options: Option<MonitorOptions>

List of options associated with your monitor.

§overall_state: Option<MonitorOverallStates>

The different states your monitor can be in.

§priority: Option<Option<i64>>

Integer from 1 (high) to 5 (low) indicating alert severity.

§query: String

The monitor query.

§restricted_roles: Option<Option<Vec<String>>>

A list of unique role identifiers to define which roles are allowed to edit the monitor. The unique identifiers for all roles can be pulled from the Roles API and are located in the data.id field. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. You can use the Restriction Policies API to manage write authorization for individual monitors by teams and users, in addition to roles.

§state: Option<MonitorState>

Wrapper object with the different monitor states.

§tags: Option<Vec<String>>

Tags associated to your monitor.

§type_: MonitorType

The type of the monitor. For more information about type, see the monitor options docs.

§additional_properties: BTreeMap<String, Value>

Implementations§

Source§

impl Monitor

Source

pub fn new(query: String, type_: MonitorType) -> Monitor

Examples found in repository?
examples/v1_monitors_CreateMonitor_2520912138.rs (lines 12-15)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-tests("type:test @git.branch:staging* @test.status:fail").rollup("count").by("@test.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_TESTS_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_440013737.rs (lines 13-16)
11async fn main() {
12    let body =
13        Monitor::new(
14            r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
15            MonitorType::ERROR_TRACKING_ALERT,
16        )
17            .draft_status(MonitorDraftStatus::DRAFT)
18            .message("some message".to_string())
19            .name("Example-Monitor".to_string())
20            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
21            .priority(Some(3))
22            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
23    let configuration = datadog::Configuration::new();
24    let api = MonitorsAPI::with_config(configuration);
25    let resp = api.create_monitor(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
examples/v1_monitors_CreateMonitor_3790803616.rs (lines 12-15)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-pipelines("ci_level:pipeline @git.branch:staging* @ci.status:error").rollup("count").by("@git.branch,@ci.pipeline.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_PIPELINES_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor.rs (lines 12-15)
8async fn main() {
9    // there is a valid "role" in the system
10    let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
11    let body =
12        Monitor::new(
13            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
14            MonitorType::LOG_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .priority(Some(3))
19            .restricted_roles(Some(vec![role_data_id.clone()]))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor_2012680290.rs (lines 13-16)
12async fn main() {
13    let body = Monitor::new(
14        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
15        MonitorType::METRIC_ALERT,
16    )
17    .message("some message Notify: @hipchat-channel".to_string())
18    .name("Example-Monitor".to_string())
19    .options(
20        MonitorOptions::new()
21            .scheduling_options(
22                MonitorOptionsSchedulingOptions::new().evaluation_window(
23                    MonitorOptionsSchedulingOptionsEvaluationWindow::new()
24                        .day_starts("04:00".to_string())
25                        .month_starts(1),
26                ),
27            )
28            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
29    );
30    let configuration = datadog::Configuration::new();
31    let api = MonitorsAPI::with_config(configuration);
32    let resp = api.create_monitor(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_monitors_CreateMonitor_1539578087.rs (lines 16-19)
15async fn main() {
16    let body = Monitor::new(
17        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
18        MonitorType::QUERY_ALERT,
19    )
20    .draft_status(MonitorDraftStatus::PUBLISHED)
21    .message("some message Notify: @hipchat-channel".to_string())
22    .name("Example-Monitor".to_string())
23    .options(
24        MonitorOptions::new()
25            .include_tags(false)
26            .notify_audit(false)
27            .scheduling_options(
28                MonitorOptionsSchedulingOptions::new()
29                    .custom_schedule(MonitorOptionsCustomSchedule::new().recurrences(vec![
30                                        MonitorOptionsCustomScheduleRecurrence::new()
31                                            .rrule("FREQ=DAILY;INTERVAL=1".to_string())
32                                            .start("2024-10-26T09:13:00".to_string())
33                                            .timezone("America/Los_Angeles".to_string())
34                                    ]))
35                    .evaluation_window(
36                        MonitorOptionsSchedulingOptionsEvaluationWindow::new()
37                            .day_starts("04:00".to_string())
38                            .month_starts(1),
39                    ),
40            )
41            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
42    )
43    .tags(vec![]);
44    let configuration = datadog::Configuration::new();
45    let api = MonitorsAPI::with_config(configuration);
46    let resp = api.create_monitor(body).await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub fn created(self, value: DateTime<Utc>) -> Self

Source

pub fn creator(self, value: Creator) -> Self

Source

pub fn deleted(self, value: Option<DateTime<Utc>>) -> Self

Source

pub fn draft_status(self, value: MonitorDraftStatus) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor_440013737.rs (line 17)
11async fn main() {
12    let body =
13        Monitor::new(
14            r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
15            MonitorType::ERROR_TRACKING_ALERT,
16        )
17            .draft_status(MonitorDraftStatus::DRAFT)
18            .message("some message".to_string())
19            .name("Example-Monitor".to_string())
20            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
21            .priority(Some(3))
22            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
23    let configuration = datadog::Configuration::new();
24    let api = MonitorsAPI::with_config(configuration);
25    let resp = api.create_monitor(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_1539578087.rs (line 20)
15async fn main() {
16    let body = Monitor::new(
17        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
18        MonitorType::QUERY_ALERT,
19    )
20    .draft_status(MonitorDraftStatus::PUBLISHED)
21    .message("some message Notify: @hipchat-channel".to_string())
22    .name("Example-Monitor".to_string())
23    .options(
24        MonitorOptions::new()
25            .include_tags(false)
26            .notify_audit(false)
27            .scheduling_options(
28                MonitorOptionsSchedulingOptions::new()
29                    .custom_schedule(MonitorOptionsCustomSchedule::new().recurrences(vec![
30                                        MonitorOptionsCustomScheduleRecurrence::new()
31                                            .rrule("FREQ=DAILY;INTERVAL=1".to_string())
32                                            .start("2024-10-26T09:13:00".to_string())
33                                            .timezone("America/Los_Angeles".to_string())
34                                    ]))
35                    .evaluation_window(
36                        MonitorOptionsSchedulingOptionsEvaluationWindow::new()
37                            .day_starts("04:00".to_string())
38                            .month_starts(1),
39                    ),
40            )
41            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
42    )
43    .tags(vec![]);
44    let configuration = datadog::Configuration::new();
45    let api = MonitorsAPI::with_config(configuration);
46    let resp = api.create_monitor(body).await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub fn id(self, value: i64) -> Self

Source

pub fn matching_downtimes(self, value: Vec<MatchingDowntime>) -> Self

Source

pub fn message(self, value: String) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor_2520912138.rs (line 16)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-tests("type:test @git.branch:staging* @test.status:fail").rollup("count").by("@test.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_TESTS_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_440013737.rs (line 18)
11async fn main() {
12    let body =
13        Monitor::new(
14            r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
15            MonitorType::ERROR_TRACKING_ALERT,
16        )
17            .draft_status(MonitorDraftStatus::DRAFT)
18            .message("some message".to_string())
19            .name("Example-Monitor".to_string())
20            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
21            .priority(Some(3))
22            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
23    let configuration = datadog::Configuration::new();
24    let api = MonitorsAPI::with_config(configuration);
25    let resp = api.create_monitor(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
examples/v1_monitors_CreateMonitor_3790803616.rs (line 16)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-pipelines("ci_level:pipeline @git.branch:staging* @ci.status:error").rollup("count").by("@git.branch,@ci.pipeline.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_PIPELINES_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor.rs (line 16)
8async fn main() {
9    // there is a valid "role" in the system
10    let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
11    let body =
12        Monitor::new(
13            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
14            MonitorType::LOG_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .priority(Some(3))
19            .restricted_roles(Some(vec![role_data_id.clone()]))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor_2012680290.rs (line 17)
12async fn main() {
13    let body = Monitor::new(
14        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
15        MonitorType::METRIC_ALERT,
16    )
17    .message("some message Notify: @hipchat-channel".to_string())
18    .name("Example-Monitor".to_string())
19    .options(
20        MonitorOptions::new()
21            .scheduling_options(
22                MonitorOptionsSchedulingOptions::new().evaluation_window(
23                    MonitorOptionsSchedulingOptionsEvaluationWindow::new()
24                        .day_starts("04:00".to_string())
25                        .month_starts(1),
26                ),
27            )
28            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
29    );
30    let configuration = datadog::Configuration::new();
31    let api = MonitorsAPI::with_config(configuration);
32    let resp = api.create_monitor(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_monitors_CreateMonitor_1539578087.rs (line 21)
15async fn main() {
16    let body = Monitor::new(
17        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
18        MonitorType::QUERY_ALERT,
19    )
20    .draft_status(MonitorDraftStatus::PUBLISHED)
21    .message("some message Notify: @hipchat-channel".to_string())
22    .name("Example-Monitor".to_string())
23    .options(
24        MonitorOptions::new()
25            .include_tags(false)
26            .notify_audit(false)
27            .scheduling_options(
28                MonitorOptionsSchedulingOptions::new()
29                    .custom_schedule(MonitorOptionsCustomSchedule::new().recurrences(vec![
30                                        MonitorOptionsCustomScheduleRecurrence::new()
31                                            .rrule("FREQ=DAILY;INTERVAL=1".to_string())
32                                            .start("2024-10-26T09:13:00".to_string())
33                                            .timezone("America/Los_Angeles".to_string())
34                                    ]))
35                    .evaluation_window(
36                        MonitorOptionsSchedulingOptionsEvaluationWindow::new()
37                            .day_starts("04:00".to_string())
38                            .month_starts(1),
39                    ),
40            )
41            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
42    )
43    .tags(vec![]);
44    let configuration = datadog::Configuration::new();
45    let api = MonitorsAPI::with_config(configuration);
46    let resp = api.create_monitor(body).await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub fn modified(self, value: DateTime<Utc>) -> Self

Source

pub fn multi(self, value: bool) -> Self

Source

pub fn name(self, value: String) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor_2520912138.rs (line 17)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-tests("type:test @git.branch:staging* @test.status:fail").rollup("count").by("@test.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_TESTS_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_440013737.rs (line 19)
11async fn main() {
12    let body =
13        Monitor::new(
14            r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
15            MonitorType::ERROR_TRACKING_ALERT,
16        )
17            .draft_status(MonitorDraftStatus::DRAFT)
18            .message("some message".to_string())
19            .name("Example-Monitor".to_string())
20            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
21            .priority(Some(3))
22            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
23    let configuration = datadog::Configuration::new();
24    let api = MonitorsAPI::with_config(configuration);
25    let resp = api.create_monitor(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
examples/v1_monitors_CreateMonitor_3790803616.rs (line 17)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-pipelines("ci_level:pipeline @git.branch:staging* @ci.status:error").rollup("count").by("@git.branch,@ci.pipeline.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_PIPELINES_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor.rs (line 17)
8async fn main() {
9    // there is a valid "role" in the system
10    let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
11    let body =
12        Monitor::new(
13            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
14            MonitorType::LOG_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .priority(Some(3))
19            .restricted_roles(Some(vec![role_data_id.clone()]))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor_2012680290.rs (line 18)
12async fn main() {
13    let body = Monitor::new(
14        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
15        MonitorType::METRIC_ALERT,
16    )
17    .message("some message Notify: @hipchat-channel".to_string())
18    .name("Example-Monitor".to_string())
19    .options(
20        MonitorOptions::new()
21            .scheduling_options(
22                MonitorOptionsSchedulingOptions::new().evaluation_window(
23                    MonitorOptionsSchedulingOptionsEvaluationWindow::new()
24                        .day_starts("04:00".to_string())
25                        .month_starts(1),
26                ),
27            )
28            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
29    );
30    let configuration = datadog::Configuration::new();
31    let api = MonitorsAPI::with_config(configuration);
32    let resp = api.create_monitor(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_monitors_CreateMonitor_1539578087.rs (line 22)
15async fn main() {
16    let body = Monitor::new(
17        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
18        MonitorType::QUERY_ALERT,
19    )
20    .draft_status(MonitorDraftStatus::PUBLISHED)
21    .message("some message Notify: @hipchat-channel".to_string())
22    .name("Example-Monitor".to_string())
23    .options(
24        MonitorOptions::new()
25            .include_tags(false)
26            .notify_audit(false)
27            .scheduling_options(
28                MonitorOptionsSchedulingOptions::new()
29                    .custom_schedule(MonitorOptionsCustomSchedule::new().recurrences(vec![
30                                        MonitorOptionsCustomScheduleRecurrence::new()
31                                            .rrule("FREQ=DAILY;INTERVAL=1".to_string())
32                                            .start("2024-10-26T09:13:00".to_string())
33                                            .timezone("America/Los_Angeles".to_string())
34                                    ]))
35                    .evaluation_window(
36                        MonitorOptionsSchedulingOptionsEvaluationWindow::new()
37                            .day_starts("04:00".to_string())
38                            .month_starts(1),
39                    ),
40            )
41            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
42    )
43    .tags(vec![]);
44    let configuration = datadog::Configuration::new();
45    let api = MonitorsAPI::with_config(configuration);
46    let resp = api.create_monitor(body).await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub fn options(self, value: MonitorOptions) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor_2520912138.rs (line 18)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-tests("type:test @git.branch:staging* @test.status:fail").rollup("count").by("@test.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_TESTS_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_440013737.rs (line 20)
11async fn main() {
12    let body =
13        Monitor::new(
14            r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
15            MonitorType::ERROR_TRACKING_ALERT,
16        )
17            .draft_status(MonitorDraftStatus::DRAFT)
18            .message("some message".to_string())
19            .name("Example-Monitor".to_string())
20            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
21            .priority(Some(3))
22            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
23    let configuration = datadog::Configuration::new();
24    let api = MonitorsAPI::with_config(configuration);
25    let resp = api.create_monitor(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
examples/v1_monitors_CreateMonitor_3790803616.rs (line 18)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-pipelines("ci_level:pipeline @git.branch:staging* @ci.status:error").rollup("count").by("@git.branch,@ci.pipeline.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_PIPELINES_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor_2012680290.rs (lines 19-29)
12async fn main() {
13    let body = Monitor::new(
14        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
15        MonitorType::METRIC_ALERT,
16    )
17    .message("some message Notify: @hipchat-channel".to_string())
18    .name("Example-Monitor".to_string())
19    .options(
20        MonitorOptions::new()
21            .scheduling_options(
22                MonitorOptionsSchedulingOptions::new().evaluation_window(
23                    MonitorOptionsSchedulingOptionsEvaluationWindow::new()
24                        .day_starts("04:00".to_string())
25                        .month_starts(1),
26                ),
27            )
28            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
29    );
30    let configuration = datadog::Configuration::new();
31    let api = MonitorsAPI::with_config(configuration);
32    let resp = api.create_monitor(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
examples/v1_monitors_CreateMonitor_1539578087.rs (lines 23-42)
15async fn main() {
16    let body = Monitor::new(
17        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
18        MonitorType::QUERY_ALERT,
19    )
20    .draft_status(MonitorDraftStatus::PUBLISHED)
21    .message("some message Notify: @hipchat-channel".to_string())
22    .name("Example-Monitor".to_string())
23    .options(
24        MonitorOptions::new()
25            .include_tags(false)
26            .notify_audit(false)
27            .scheduling_options(
28                MonitorOptionsSchedulingOptions::new()
29                    .custom_schedule(MonitorOptionsCustomSchedule::new().recurrences(vec![
30                                        MonitorOptionsCustomScheduleRecurrence::new()
31                                            .rrule("FREQ=DAILY;INTERVAL=1".to_string())
32                                            .start("2024-10-26T09:13:00".to_string())
33                                            .timezone("America/Los_Angeles".to_string())
34                                    ]))
35                    .evaluation_window(
36                        MonitorOptionsSchedulingOptionsEvaluationWindow::new()
37                            .day_starts("04:00".to_string())
38                            .month_starts(1),
39                    ),
40            )
41            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
42    )
43    .tags(vec![]);
44    let configuration = datadog::Configuration::new();
45    let api = MonitorsAPI::with_config(configuration);
46    let resp = api.create_monitor(body).await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
examples/v1_monitors_ValidateMonitor.rs (lines 20-37)
12async fn main() {
13    let body =
14        Monitor::new(
15            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
16            MonitorType::LOG_ALERT,
17        )
18            .message("some message Notify: @hipchat-channel".to_string())
19            .name("Example-Monitor".to_string())
20            .options(
21                MonitorOptions::new()
22                    .enable_logs_sample(true)
23                    .escalation_message("the situation has escalated".to_string())
24                    .evaluation_delay(Some(700))
25                    .include_tags(true)
26                    .locked(false)
27                    .new_host_delay(Some(600))
28                    .no_data_timeframe(None)
29                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
30                    .notify_audit(false)
31                    .notify_no_data(false)
32                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
33                    .renotify_interval(Some(60))
34                    .require_full_window(true)
35                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
36                    .timeout_h(Some(24)),
37            )
38            .priority(Some(3))
39            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
40    let configuration = datadog::Configuration::new();
41    let api = MonitorsAPI::with_config(configuration);
42    let resp = api.validate_monitor(body).await;
43    if let Ok(value) = resp {
44        println!("{:#?}", value);
45    } else {
46        println!("{:#?}", resp.unwrap_err());
47    }
48}
Source

pub fn overall_state(self, value: MonitorOverallStates) -> Self

Source

pub fn priority(self, value: Option<i64>) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor_2520912138.rs (line 19)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-tests("type:test @git.branch:staging* @test.status:fail").rollup("count").by("@test.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_TESTS_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_440013737.rs (line 21)
11async fn main() {
12    let body =
13        Monitor::new(
14            r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
15            MonitorType::ERROR_TRACKING_ALERT,
16        )
17            .draft_status(MonitorDraftStatus::DRAFT)
18            .message("some message".to_string())
19            .name("Example-Monitor".to_string())
20            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
21            .priority(Some(3))
22            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
23    let configuration = datadog::Configuration::new();
24    let api = MonitorsAPI::with_config(configuration);
25    let resp = api.create_monitor(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
examples/v1_monitors_CreateMonitor_3790803616.rs (line 19)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-pipelines("ci_level:pipeline @git.branch:staging* @ci.status:error").rollup("count").by("@git.branch,@ci.pipeline.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_PIPELINES_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor.rs (line 18)
8async fn main() {
9    // there is a valid "role" in the system
10    let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
11    let body =
12        Monitor::new(
13            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
14            MonitorType::LOG_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .priority(Some(3))
19            .restricted_roles(Some(vec![role_data_id.clone()]))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_ValidateMonitor.rs (line 38)
12async fn main() {
13    let body =
14        Monitor::new(
15            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
16            MonitorType::LOG_ALERT,
17        )
18            .message("some message Notify: @hipchat-channel".to_string())
19            .name("Example-Monitor".to_string())
20            .options(
21                MonitorOptions::new()
22                    .enable_logs_sample(true)
23                    .escalation_message("the situation has escalated".to_string())
24                    .evaluation_delay(Some(700))
25                    .include_tags(true)
26                    .locked(false)
27                    .new_host_delay(Some(600))
28                    .no_data_timeframe(None)
29                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
30                    .notify_audit(false)
31                    .notify_no_data(false)
32                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
33                    .renotify_interval(Some(60))
34                    .require_full_window(true)
35                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
36                    .timeout_h(Some(24)),
37            )
38            .priority(Some(3))
39            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
40    let configuration = datadog::Configuration::new();
41    let api = MonitorsAPI::with_config(configuration);
42    let resp = api.validate_monitor(body).await;
43    if let Ok(value) = resp {
44        println!("{:#?}", value);
45    } else {
46        println!("{:#?}", resp.unwrap_err());
47    }
48}
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 38)
11async fn main() {
12    let body =
13        Monitor::new(
14            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source,status").last("5m") > 2"#.to_string(),
15            MonitorType::LOG_ALERT,
16        )
17            .message("some message Notify: @hipchat-channel".to_string())
18            .name("Example-Monitor".to_string())
19            .options(
20                MonitorOptions::new()
21                    .enable_logs_sample(true)
22                    .escalation_message("the situation has escalated".to_string())
23                    .evaluation_delay(Some(700))
24                    .group_retention_duration("2d".to_string())
25                    .include_tags(true)
26                    .locked(false)
27                    .new_host_delay(Some(600))
28                    .no_data_timeframe(None)
29                    .notify_audit(false)
30                    .notify_by(vec!["status".to_string()])
31                    .notify_no_data(false)
32                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
33                    .renotify_interval(Some(60))
34                    .require_full_window(true)
35                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
36                    .timeout_h(Some(24)),
37            )
38            .priority(Some(3))
39            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
40    let configuration = datadog::Configuration::new();
41    let api = MonitorsAPI::with_config(configuration);
42    let resp = api.validate_monitor(body).await;
43    if let Ok(value) = resp {
44        println!("{:#?}", value);
45    } else {
46        println!("{:#?}", resp.unwrap_err());
47    }
48}
Source

pub fn restricted_roles(self, value: Option<Vec<String>>) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor.rs (line 19)
8async fn main() {
9    // there is a valid "role" in the system
10    let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
11    let body =
12        Monitor::new(
13            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
14            MonitorType::LOG_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .priority(Some(3))
19            .restricted_roles(Some(vec![role_data_id.clone()]))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
Source

pub fn state(self, value: MonitorState) -> Self

Source

pub fn tags(self, value: Vec<String>) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor_2520912138.rs (line 20)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-tests("type:test @git.branch:staging* @test.status:fail").rollup("count").by("@test.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_TESTS_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_440013737.rs (line 22)
11async fn main() {
12    let body =
13        Monitor::new(
14            r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
15            MonitorType::ERROR_TRACKING_ALERT,
16        )
17            .draft_status(MonitorDraftStatus::DRAFT)
18            .message("some message".to_string())
19            .name("Example-Monitor".to_string())
20            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
21            .priority(Some(3))
22            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
23    let configuration = datadog::Configuration::new();
24    let api = MonitorsAPI::with_config(configuration);
25    let resp = api.create_monitor(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
examples/v1_monitors_CreateMonitor_3790803616.rs (line 20)
10async fn main() {
11    let body =
12        Monitor::new(
13            r#"ci-pipelines("ci_level:pipeline @git.branch:staging* @ci.status:error").rollup("count").by("@git.branch,@ci.pipeline.name").last("5m") >= 1"#.to_string(),
14            MonitorType::CI_PIPELINES_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
19            .priority(Some(3))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor.rs (line 20)
8async fn main() {
9    // there is a valid "role" in the system
10    let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
11    let body =
12        Monitor::new(
13            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
14            MonitorType::LOG_ALERT,
15        )
16            .message("some message Notify: @hipchat-channel".to_string())
17            .name("Example-Monitor".to_string())
18            .priority(Some(3))
19            .restricted_roles(Some(vec![role_data_id.clone()]))
20            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
21    let configuration = datadog::Configuration::new();
22    let api = MonitorsAPI::with_config(configuration);
23    let resp = api.create_monitor(body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
examples/v1_monitors_CreateMonitor_1539578087.rs (line 43)
15async fn main() {
16    let body = Monitor::new(
17        "avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
18        MonitorType::QUERY_ALERT,
19    )
20    .draft_status(MonitorDraftStatus::PUBLISHED)
21    .message("some message Notify: @hipchat-channel".to_string())
22    .name("Example-Monitor".to_string())
23    .options(
24        MonitorOptions::new()
25            .include_tags(false)
26            .notify_audit(false)
27            .scheduling_options(
28                MonitorOptionsSchedulingOptions::new()
29                    .custom_schedule(MonitorOptionsCustomSchedule::new().recurrences(vec![
30                                        MonitorOptionsCustomScheduleRecurrence::new()
31                                            .rrule("FREQ=DAILY;INTERVAL=1".to_string())
32                                            .start("2024-10-26T09:13:00".to_string())
33                                            .timezone("America/Los_Angeles".to_string())
34                                    ]))
35                    .evaluation_window(
36                        MonitorOptionsSchedulingOptionsEvaluationWindow::new()
37                            .day_starts("04:00".to_string())
38                            .month_starts(1),
39                    ),
40            )
41            .thresholds(MonitorThresholds::new().critical(0.5 as f64)),
42    )
43    .tags(vec![]);
44    let configuration = datadog::Configuration::new();
45    let api = MonitorsAPI::with_config(configuration);
46    let resp = api.create_monitor(body).await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
examples/v1_monitors_ValidateMonitor.rs (line 39)
12async fn main() {
13    let body =
14        Monitor::new(
15            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
16            MonitorType::LOG_ALERT,
17        )
18            .message("some message Notify: @hipchat-channel".to_string())
19            .name("Example-Monitor".to_string())
20            .options(
21                MonitorOptions::new()
22                    .enable_logs_sample(true)
23                    .escalation_message("the situation has escalated".to_string())
24                    .evaluation_delay(Some(700))
25                    .include_tags(true)
26                    .locked(false)
27                    .new_host_delay(Some(600))
28                    .no_data_timeframe(None)
29                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
30                    .notify_audit(false)
31                    .notify_no_data(false)
32                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
33                    .renotify_interval(Some(60))
34                    .require_full_window(true)
35                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
36                    .timeout_h(Some(24)),
37            )
38            .priority(Some(3))
39            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
40    let configuration = datadog::Configuration::new();
41    let api = MonitorsAPI::with_config(configuration);
42    let resp = api.validate_monitor(body).await;
43    if let Ok(value) = resp {
44        println!("{:#?}", value);
45    } else {
46        println!("{:#?}", resp.unwrap_err());
47    }
48}
Source

pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self

Trait Implementations§

Source§

impl Clone for Monitor

Source§

fn clone(&self) -> Monitor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Monitor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Monitor

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Monitor

Source§

fn eq(&self, other: &Monitor) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Monitor

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Monitor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,