MonitorOptions

Struct MonitorOptions 

Source
#[non_exhaustive]
pub struct MonitorOptions {
Show 32 fields pub aggregation: Option<MonitorOptionsAggregation>, pub device_ids: Option<Vec<MonitorDeviceID>>, pub enable_logs_sample: Option<bool>, pub enable_samples: Option<bool>, pub escalation_message: Option<String>, pub evaluation_delay: Option<Option<i64>>, pub group_retention_duration: Option<String>, pub groupby_simple_monitor: Option<bool>, pub include_tags: Option<bool>, pub locked: Option<bool>, pub min_failure_duration: Option<Option<i64>>, pub min_location_failed: Option<Option<i64>>, pub new_group_delay: Option<Option<i64>>, pub new_host_delay: Option<Option<i64>>, pub no_data_timeframe: Option<Option<i64>>, pub notification_preset_name: Option<MonitorOptionsNotificationPresets>, pub notify_audit: Option<bool>, pub notify_by: Option<Vec<String>>, pub notify_no_data: Option<bool>, pub on_missing_data: Option<OnMissingDataOption>, pub renotify_interval: Option<Option<i64>>, pub renotify_occurrences: Option<Option<i64>>, pub renotify_statuses: Option<Option<Vec<MonitorRenotifyStatusType>>>, pub require_full_window: Option<bool>, pub scheduling_options: Option<MonitorOptionsSchedulingOptions>, pub silenced: Option<BTreeMap<String, Option<i64>>>, pub synthetics_check_id: Option<Option<String>>, pub threshold_windows: Option<MonitorThresholdWindowOptions>, pub thresholds: Option<MonitorThresholds>, pub timeout_h: Option<Option<i64>>, pub variables: Option<Vec<MonitorFormulaAndFunctionQueryDefinition>>, pub additional_properties: BTreeMap<String, Value>, /* private fields */
}
Expand description

List of options associated with your 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.
§aggregation: Option<MonitorOptionsAggregation>

Type of aggregation performed in the monitor query.

§device_ids: Option<Vec<MonitorDeviceID>>
👎Deprecated

IDs of the device the Synthetics monitor is running on.

§enable_logs_sample: Option<bool>

Whether or not to send a log sample when the log monitor triggers.

§enable_samples: Option<bool>

Whether or not to send a list of samples when the monitor triggers. This is only used by CI Test and Pipeline monitors.

§escalation_message: Option<String>

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

§evaluation_delay: Option<Option<i64>>

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

§group_retention_duration: Option<String>

The time span after which groups with missing data are dropped from the monitor state. The minimum value is one hour, and the maximum value is 72 hours. Example values are: “60m”, “1h”, and “2d”. This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors.

§groupby_simple_monitor: Option<bool>
👎Deprecated

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold. Use notify_by instead.

§include_tags: Option<bool>

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title
§locked: Option<bool>
👎Deprecated

Whether or not the monitor is locked (only editable by creator and admins). Use restricted_roles instead.

§min_failure_duration: Option<Option<i64>>

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

§min_location_failed: Option<Option<i64>>

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

§new_group_delay: Option<Option<i64>>

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

§new_host_delay: Option<Option<i64>>
👎Deprecated

Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

§no_data_timeframe: Option<Option<i64>>

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for query alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for query alerts, and 24 hours is used for service checks.

§notification_preset_name: Option<MonitorOptionsNotificationPresets>

Toggles the display of additional content sent in the monitor notification.

§notify_audit: Option<bool>

A Boolean indicating whether tagged users is notified on changes to this monitor.

§notify_by: Option<Vec<String>>

Controls what granularity a monitor alerts on. Only available for monitors with groupings. For instance, a monitor grouped by cluster, namespace, and pod can be configured to only notify on each new cluster violating the alert conditions by setting notify_by to ["cluster"]. Tags mentioned in notify_by must be a subset of the grouping tags in the query. For example, a query grouped by cluster and namespace cannot notify on region. Setting notify_by to ["*"] configures the monitor to notify as a simple-alert.

§notify_no_data: Option<bool>

A Boolean indicating whether this monitor notifies when data stops reporting. Defaults to false.

§on_missing_data: Option<OnMissingDataOption>

Controls how groups or monitors are treated if an evaluation does not return any data points. The default option results in different behavior depending on the monitor query type. For monitors using Count queries, an empty monitor evaluation is treated as 0 and is compared to the threshold conditions. For monitors using any query type other than Count, for example Gauge, Measure, or Rate, the monitor shows the last known status. This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors.

§renotify_interval: Option<Option<i64>>

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

§renotify_occurrences: Option<Option<i64>>

The number of times re-notification messages should be sent on the current status at the provided re-notification interval.

§renotify_statuses: Option<Option<Vec<MonitorRenotifyStatusType>>>

The types of monitor statuses for which re-notification messages are sent. Default: null if renotify_interval is null. If renotify_interval is set, defaults to renotify on Alert and No Data.

§require_full_window: Option<bool>

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false. This setting only applies to metric monitors.

§scheduling_options: Option<MonitorOptionsSchedulingOptions>

Configuration options for scheduling.

§silenced: Option<BTreeMap<String, Option<i64>>>
👎Deprecated

Information about the downtime applied to the monitor. Only shows v1 downtimes.

§synthetics_check_id: Option<Option<String>>
👎Deprecated

ID of the corresponding Synthetic check.

§threshold_windows: Option<MonitorThresholdWindowOptions>

Alerting time window options.

§thresholds: Option<MonitorThresholds>

List of the different monitor threshold available.

§timeout_h: Option<Option<i64>>

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state. The minimum allowed value is 0 hours. The maximum allowed value is 24 hours.

§variables: Option<Vec<MonitorFormulaAndFunctionQueryDefinition>>

List of requests that can be used in the monitor query. This feature is currently in beta.

§additional_properties: BTreeMap<String, Value>

Implementations§

Source§

impl MonitorOptions

Source

pub fn new() -> MonitorOptions

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_UpdateMonitor.rs (line 15)
9async fn main() {
10    // there is a valid "monitor" in the system
11    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
12    let body = MonitorUpdateRequest::new()
13        .name("My monitor-updated".to_string())
14        .options(
15            MonitorOptions::new()
16                .evaluation_delay(None)
17                .new_group_delay(Some(600))
18                .new_host_delay(None)
19                .renotify_interval(None)
20                .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(None))
21                .timeout_h(None),
22        )
23        .priority(None);
24    let configuration = datadog::Configuration::new();
25    let api = MonitorsAPI::with_config(configuration);
26    let resp = api.update_monitor(monitor_id.clone(), body).await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}
examples/v1_monitors_CreateMonitor_2012680290.rs (line 20)
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 24)
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 aggregation(self, value: MonitorOptionsAggregation) -> Self

Source

pub fn device_ids(self, value: Vec<MonitorDeviceID>) -> Self

Source

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

Examples found in repository?
examples/v1_monitors_ValidateMonitor.rs (line 22)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 21)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 24)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Source

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

Examples found in repository?
examples/v1_monitors_ValidateMonitor.rs (line 23)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 22)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 25)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Examples found in repository?
examples/v1_monitors_UpdateMonitor.rs (line 16)
9async fn main() {
10    // there is a valid "monitor" in the system
11    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
12    let body = MonitorUpdateRequest::new()
13        .name("My monitor-updated".to_string())
14        .options(
15            MonitorOptions::new()
16                .evaluation_delay(None)
17                .new_group_delay(Some(600))
18                .new_host_delay(None)
19                .renotify_interval(None)
20                .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(None))
21                .timeout_h(None),
22        )
23        .priority(None);
24    let configuration = datadog::Configuration::new();
25    let api = MonitorsAPI::with_config(configuration);
26    let resp = api.update_monitor(monitor_id.clone(), body).await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor.rs (line 24)
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 23)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 26)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Examples found in repository?
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 24)
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 groupby_simple_monitor(self, value: bool) -> Self

Source

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

Examples found in repository?
examples/v1_monitors_CreateMonitor_1539578087.rs (line 25)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor.rs (line 25)
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 25)
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}
examples/v1_monitors_CreateMonitor_1303514967.rs (line 24)
14async fn main() {
15    let body =
16        Monitor::new(
17            r#"formula("exclude_null(query1)").last("7d").anomaly(direction="above", threshold=10) >= 5"#.to_string(),
18            MonitorType::COST_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .include_tags(true)
25                    .thresholds(MonitorThresholds::new().critical(5.0 as f64).warning(Some(3.0 as f64)))
26                    .variables(
27                        vec![
28                            MonitorFormulaAndFunctionQueryDefinition::MonitorFormulaAndFunctionCostQueryDefinition(
29                                Box::new(
30                                    MonitorFormulaAndFunctionCostQueryDefinition::new(
31                                        MonitorFormulaAndFunctionCostDataSource::CLOUD_COST,
32                                        "query1".to_string(),
33                                        "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)".to_string(),
34                                    ).aggregator(MonitorFormulaAndFunctionCostAggregator::SUM),
35                                ),
36                            )
37                        ],
38                    ),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api.create_monitor(body).await;
45    if let Ok(value) = resp {
46        println!("{:#?}", value);
47    } else {
48        println!("{:#?}", resp.unwrap_err());
49    }
50}
examples/v1_monitors_ValidateExistingMonitor.rs (line 27)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Examples found in repository?
examples/v1_monitors_ValidateMonitor.rs (line 26)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 26)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 28)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Source

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

Source

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

Examples found in repository?
examples/v1_monitors_UpdateMonitor.rs (line 17)
9async fn main() {
10    // there is a valid "monitor" in the system
11    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
12    let body = MonitorUpdateRequest::new()
13        .name("My monitor-updated".to_string())
14        .options(
15            MonitorOptions::new()
16                .evaluation_delay(None)
17                .new_group_delay(Some(600))
18                .new_host_delay(None)
19                .renotify_interval(None)
20                .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(None))
21                .timeout_h(None),
22        )
23        .priority(None);
24    let configuration = datadog::Configuration::new();
25    let api = MonitorsAPI::with_config(configuration);
26    let resp = api.update_monitor(monitor_id.clone(), body).await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}
Source

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

Examples found in repository?
examples/v1_monitors_UpdateMonitor.rs (line 18)
9async fn main() {
10    // there is a valid "monitor" in the system
11    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
12    let body = MonitorUpdateRequest::new()
13        .name("My monitor-updated".to_string())
14        .options(
15            MonitorOptions::new()
16                .evaluation_delay(None)
17                .new_group_delay(Some(600))
18                .new_host_delay(None)
19                .renotify_interval(None)
20                .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(None))
21                .timeout_h(None),
22        )
23        .priority(None);
24    let configuration = datadog::Configuration::new();
25    let api = MonitorsAPI::with_config(configuration);
26    let resp = api.update_monitor(monitor_id.clone(), body).await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor.rs (line 27)
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 27)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 29)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Examples found in repository?
examples/v1_monitors_ValidateMonitor.rs (line 28)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 28)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 30)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub fn notification_preset_name( self, value: MonitorOptionsNotificationPresets, ) -> Self

Examples found in repository?
examples/v1_monitors_ValidateMonitor.rs (line 29)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateExistingMonitor.rs (line 31)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Examples found in repository?
examples/v1_monitors_CreateMonitor_1539578087.rs (line 26)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor.rs (line 30)
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 29)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 32)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Examples found in repository?
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 30)
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 notify_no_data(self, value: bool) -> Self

Examples found in repository?
examples/v1_monitors_ValidateMonitor.rs (line 31)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 31)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 33)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub fn on_missing_data(self, value: OnMissingDataOption) -> Self

Examples found in repository?
examples/v1_monitors_ValidateMonitor.rs (line 32)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 32)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 34)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Examples found in repository?
examples/v1_monitors_UpdateMonitor.rs (line 19)
9async fn main() {
10    // there is a valid "monitor" in the system
11    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
12    let body = MonitorUpdateRequest::new()
13        .name("My monitor-updated".to_string())
14        .options(
15            MonitorOptions::new()
16                .evaluation_delay(None)
17                .new_group_delay(Some(600))
18                .new_host_delay(None)
19                .renotify_interval(None)
20                .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(None))
21                .timeout_h(None),
22        )
23        .priority(None);
24    let configuration = datadog::Configuration::new();
25    let api = MonitorsAPI::with_config(configuration);
26    let resp = api.update_monitor(monitor_id.clone(), body).await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor.rs (line 33)
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 33)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 35)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

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

Source

pub fn renotify_statuses( self, value: Option<Vec<MonitorRenotifyStatusType>>, ) -> Self

Source

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

Examples found in repository?
examples/v1_monitors_ValidateMonitor.rs (line 34)
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}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor_4247196452.rs (line 34)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 36)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub fn scheduling_options(self, value: MonitorOptionsSchedulingOptions) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor_2012680290.rs (lines 21-27)
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}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_1539578087.rs (lines 27-40)
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 silenced(self, value: BTreeMap<String, Option<i64>>) -> Self

Source

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

Source

pub fn threshold_windows(self, value: MonitorThresholdWindowOptions) -> Self

Source

pub fn thresholds(self, value: MonitorThresholds) -> 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_UpdateMonitor.rs (line 20)
9async fn main() {
10    // there is a valid "monitor" in the system
11    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
12    let body = MonitorUpdateRequest::new()
13        .name("My monitor-updated".to_string())
14        .options(
15            MonitorOptions::new()
16                .evaluation_delay(None)
17                .new_group_delay(Some(600))
18                .new_host_delay(None)
19                .renotify_interval(None)
20                .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(None))
21                .timeout_h(None),
22        )
23        .priority(None);
24    let configuration = datadog::Configuration::new();
25    let api = MonitorsAPI::with_config(configuration);
26    let resp = api.update_monitor(monitor_id.clone(), body).await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}
examples/v1_monitors_CreateMonitor_2012680290.rs (line 28)
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 41)
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 timeout_h(self, value: Option<i64>) -> Self

Examples found in repository?
examples/v1_monitors_UpdateMonitor.rs (line 21)
9async fn main() {
10    // there is a valid "monitor" in the system
11    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
12    let body = MonitorUpdateRequest::new()
13        .name("My monitor-updated".to_string())
14        .options(
15            MonitorOptions::new()
16                .evaluation_delay(None)
17                .new_group_delay(Some(600))
18                .new_host_delay(None)
19                .renotify_interval(None)
20                .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(None))
21                .timeout_h(None),
22        )
23        .priority(None);
24    let configuration = datadog::Configuration::new();
25    let api = MonitorsAPI::with_config(configuration);
26    let resp = api.update_monitor(monitor_id.clone(), body).await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}
More examples
Hide additional examples
examples/v1_monitors_ValidateMonitor.rs (line 36)
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 36)
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}
examples/v1_monitors_ValidateExistingMonitor.rs (line 38)
12async fn main() {
13    // there is a valid "monitor" in the system
14    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
15    let body =
16        Monitor::new(
17            r#"logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2"#.to_string(),
18            MonitorType::LOG_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example-Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .enable_logs_sample(true)
25                    .escalation_message("the situation has escalated".to_string())
26                    .evaluation_delay(Some(700))
27                    .include_tags(true)
28                    .locked(false)
29                    .new_host_delay(Some(600))
30                    .no_data_timeframe(None)
31                    .notification_preset_name(MonitorOptionsNotificationPresets::HIDE_HANDLES)
32                    .notify_audit(false)
33                    .notify_no_data(false)
34                    .on_missing_data(OnMissingDataOption::SHOW_AND_NOTIFY_NO_DATA)
35                    .renotify_interval(Some(60))
36                    .require_full_window(true)
37                    .thresholds(MonitorThresholds::new().critical(2.0 as f64).warning(Some(1.0 as f64)))
38                    .timeout_h(Some(24)),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api
45        .validate_existing_monitor(monitor_id.clone(), body)
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub fn variables( self, value: Vec<MonitorFormulaAndFunctionQueryDefinition>, ) -> Self

Examples found in repository?
examples/v1_monitors_CreateMonitor_1303514967.rs (lines 26-38)
14async fn main() {
15    let body =
16        Monitor::new(
17            r#"formula("exclude_null(query1)").last("7d").anomaly(direction="above", threshold=10) >= 5"#.to_string(),
18            MonitorType::COST_ALERT,
19        )
20            .message("some message Notify: @hipchat-channel".to_string())
21            .name("Example Monitor".to_string())
22            .options(
23                MonitorOptions::new()
24                    .include_tags(true)
25                    .thresholds(MonitorThresholds::new().critical(5.0 as f64).warning(Some(3.0 as f64)))
26                    .variables(
27                        vec![
28                            MonitorFormulaAndFunctionQueryDefinition::MonitorFormulaAndFunctionCostQueryDefinition(
29                                Box::new(
30                                    MonitorFormulaAndFunctionCostQueryDefinition::new(
31                                        MonitorFormulaAndFunctionCostDataSource::CLOUD_COST,
32                                        "query1".to_string(),
33                                        "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)".to_string(),
34                                    ).aggregator(MonitorFormulaAndFunctionCostAggregator::SUM),
35                                ),
36                            )
37                        ],
38                    ),
39            )
40            .priority(Some(3))
41            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
42    let configuration = datadog::Configuration::new();
43    let api = MonitorsAPI::with_config(configuration);
44    let resp = api.create_monitor(body).await;
45    if let Ok(value) = resp {
46        println!("{:#?}", value);
47    } else {
48        println!("{:#?}", resp.unwrap_err());
49    }
50}
More examples
Hide additional examples
examples/v1_monitors_CreateMonitor_3883669300.rs (lines 24-61)
16async fn main() {
17    let body =
18        Monitor::new(r#"formula("query2 / query1 * 100").last("15m") >= 0.8"#.to_string(), MonitorType::RUM_ALERT)
19            .message("some message Notify: @hipchat-channel".to_string())
20            .name("Example-Monitor".to_string())
21            .options(
22                MonitorOptions::new()
23                    .thresholds(MonitorThresholds::new().critical(0.8 as f64))
24                    .variables(
25                        vec![
26                            MonitorFormulaAndFunctionQueryDefinition::MonitorFormulaAndFunctionEventQueryDefinition(
27                                Box::new(
28                                    MonitorFormulaAndFunctionEventQueryDefinition::new(
29                                        MonitorFormulaAndFunctionEventQueryDefinitionCompute::new(
30                                            MonitorFormulaAndFunctionEventAggregation::COUNT,
31                                        ),
32                                        MonitorFormulaAndFunctionEventsDataSource::RUM,
33                                        "query2".to_string(),
34                                    )
35                                        .group_by(vec![])
36                                        .indexes(vec!["*".to_string()])
37                                        .search(
38                                            MonitorFormulaAndFunctionEventQueryDefinitionSearch::new("".to_string()),
39                                        ),
40                                ),
41                            ),
42                            MonitorFormulaAndFunctionQueryDefinition::MonitorFormulaAndFunctionEventQueryDefinition(
43                                Box::new(
44                                    MonitorFormulaAndFunctionEventQueryDefinition::new(
45                                        MonitorFormulaAndFunctionEventQueryDefinitionCompute::new(
46                                            MonitorFormulaAndFunctionEventAggregation::COUNT,
47                                        ),
48                                        MonitorFormulaAndFunctionEventsDataSource::RUM,
49                                        "query1".to_string(),
50                                    )
51                                        .group_by(vec![])
52                                        .indexes(vec!["*".to_string()])
53                                        .search(
54                                            MonitorFormulaAndFunctionEventQueryDefinitionSearch::new(
55                                                "status:error".to_string(),
56                                            ),
57                                        ),
58                                ),
59                            )
60                        ],
61                    ),
62            )
63            .priority(Some(3))
64            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
65    let configuration = datadog::Configuration::new();
66    let api = MonitorsAPI::with_config(configuration);
67    let resp = api.create_monitor(body).await;
68    if let Ok(value) = resp {
69        println!("{:#?}", value);
70    } else {
71        println!("{:#?}", resp.unwrap_err());
72    }
73}
examples/v1_monitors_CreateMonitor_1969035628.rs (lines 27-64)
16async fn main() {
17    let body =
18        Monitor::new(
19            r#"formula("query1 / query2 * 100").last("15m") >= 0.8"#.to_string(),
20            MonitorType::CI_TESTS_ALERT,
21        )
22            .message("some message Notify: @hipchat-channel".to_string())
23            .name("Example-Monitor".to_string())
24            .options(
25                MonitorOptions::new()
26                    .thresholds(MonitorThresholds::new().critical(0.8 as f64))
27                    .variables(
28                        vec![
29                            MonitorFormulaAndFunctionQueryDefinition::MonitorFormulaAndFunctionEventQueryDefinition(
30                                Box::new(
31                                    MonitorFormulaAndFunctionEventQueryDefinition::new(
32                                        MonitorFormulaAndFunctionEventQueryDefinitionCompute::new(
33                                            MonitorFormulaAndFunctionEventAggregation::COUNT,
34                                        ),
35                                        MonitorFormulaAndFunctionEventsDataSource::CI_TESTS,
36                                        "query1".to_string(),
37                                    )
38                                        .group_by(vec![])
39                                        .indexes(vec!["*".to_string()])
40                                        .search(
41                                            MonitorFormulaAndFunctionEventQueryDefinitionSearch::new(
42                                                "@test.status:fail".to_string(),
43                                            ),
44                                        ),
45                                ),
46                            ),
47                            MonitorFormulaAndFunctionQueryDefinition::MonitorFormulaAndFunctionEventQueryDefinition(
48                                Box::new(
49                                    MonitorFormulaAndFunctionEventQueryDefinition::new(
50                                        MonitorFormulaAndFunctionEventQueryDefinitionCompute::new(
51                                            MonitorFormulaAndFunctionEventAggregation::COUNT,
52                                        ),
53                                        MonitorFormulaAndFunctionEventsDataSource::CI_TESTS,
54                                        "query2".to_string(),
55                                    )
56                                        .group_by(vec![])
57                                        .indexes(vec!["*".to_string()])
58                                        .search(
59                                            MonitorFormulaAndFunctionEventQueryDefinitionSearch::new("".to_string()),
60                                        ),
61                                ),
62                            )
63                        ],
64                    ),
65            )
66            .priority(Some(3))
67            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
68    let configuration = datadog::Configuration::new();
69    let api = MonitorsAPI::with_config(configuration);
70    let resp = api.create_monitor(body).await;
71    if let Ok(value) = resp {
72        println!("{:#?}", value);
73    } else {
74        println!("{:#?}", resp.unwrap_err());
75    }
76}
examples/v1_monitors_CreateMonitor_3824294658.rs (lines 27-64)
16async fn main() {
17    let body =
18        Monitor::new(
19            r#"formula("query1 / query2 * 100").last("15m") >= 0.8"#.to_string(),
20            MonitorType::CI_PIPELINES_ALERT,
21        )
22            .message("some message Notify: @hipchat-channel".to_string())
23            .name("Example-Monitor".to_string())
24            .options(
25                MonitorOptions::new()
26                    .thresholds(MonitorThresholds::new().critical(0.8 as f64))
27                    .variables(
28                        vec![
29                            MonitorFormulaAndFunctionQueryDefinition::MonitorFormulaAndFunctionEventQueryDefinition(
30                                Box::new(
31                                    MonitorFormulaAndFunctionEventQueryDefinition::new(
32                                        MonitorFormulaAndFunctionEventQueryDefinitionCompute::new(
33                                            MonitorFormulaAndFunctionEventAggregation::COUNT,
34                                        ),
35                                        MonitorFormulaAndFunctionEventsDataSource::CI_PIPELINES,
36                                        "query1".to_string(),
37                                    )
38                                        .group_by(vec![])
39                                        .indexes(vec!["*".to_string()])
40                                        .search(
41                                            MonitorFormulaAndFunctionEventQueryDefinitionSearch::new(
42                                                "@ci.status:error".to_string(),
43                                            ),
44                                        ),
45                                ),
46                            ),
47                            MonitorFormulaAndFunctionQueryDefinition::MonitorFormulaAndFunctionEventQueryDefinition(
48                                Box::new(
49                                    MonitorFormulaAndFunctionEventQueryDefinition::new(
50                                        MonitorFormulaAndFunctionEventQueryDefinitionCompute::new(
51                                            MonitorFormulaAndFunctionEventAggregation::COUNT,
52                                        ),
53                                        MonitorFormulaAndFunctionEventsDataSource::CI_PIPELINES,
54                                        "query2".to_string(),
55                                    )
56                                        .group_by(vec![])
57                                        .indexes(vec!["*".to_string()])
58                                        .search(
59                                            MonitorFormulaAndFunctionEventQueryDefinitionSearch::new("".to_string()),
60                                        ),
61                                ),
62                            )
63                        ],
64                    ),
65            )
66            .priority(Some(3))
67            .tags(vec!["test:examplemonitor".to_string(), "env:ci".to_string()]);
68    let configuration = datadog::Configuration::new();
69    let api = MonitorsAPI::with_config(configuration);
70    let resp = api.create_monitor(body).await;
71    if let Ok(value) = resp {
72        println!("{:#?}", value);
73    } else {
74        println!("{:#?}", resp.unwrap_err());
75    }
76}
Source

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

Trait Implementations§

Source§

impl Clone for MonitorOptions

Source§

fn clone(&self) -> MonitorOptions

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 MonitorOptions

Source§

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

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

impl Default for MonitorOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for MonitorOptions

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 MonitorOptions

Source§

fn eq(&self, other: &MonitorOptions) -> 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 MonitorOptions

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 MonitorOptions

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,