1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.
use serde::de::{Error, MapAccess, Visitor};
use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};
/// List of options associated with your monitor.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct MonitorOptions {
/// Type of aggregation performed in the monitor query.
#[serde(rename = "aggregation")]
pub aggregation: Option<crate::datadogV1::model::MonitorOptionsAggregation>,
/// IDs of the device the Synthetics monitor is running on.
#[deprecated]
#[serde(rename = "device_ids")]
pub device_ids: Option<Vec<crate::datadogV1::model::MonitorDeviceID>>,
/// Whether or not to send a log sample when the log monitor triggers.
#[serde(rename = "enable_logs_sample")]
pub enable_logs_sample: 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.
#[serde(rename = "enable_samples")]
pub enable_samples: Option<bool>,
/// We recommend using the [is_renotify](<https://docs.datadoghq.com/monitors/notify/?tab=is_alert#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`.
#[serde(rename = "escalation_message")]
pub escalation_message: Option<String>,
/// 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.
#[serde(
rename = "evaluation_delay",
default,
with = "::serde_with::rust::double_option"
)]
pub evaluation_delay: Option<Option<i64>>,
/// 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.
#[serde(rename = "group_retention_duration")]
pub group_retention_duration: Option<String>,
/// Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold. Use `notify_by` instead.
#[deprecated]
#[serde(rename = "groupby_simple_monitor")]
pub groupby_simple_monitor: 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`
#[serde(rename = "include_tags")]
pub include_tags: Option<bool>,
/// Whether or not the monitor is locked (only editable by creator and admins). Use `restricted_roles` instead.
#[deprecated]
#[serde(rename = "locked")]
pub locked: Option<bool>,
/// How long the test should be in failure before alerting (integer, number of seconds, max 7200).
#[serde(
rename = "min_failure_duration",
default,
with = "::serde_with::rust::double_option"
)]
pub min_failure_duration: 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).
#[serde(
rename = "min_location_failed",
default,
with = "::serde_with::rust::double_option"
)]
pub min_location_failed: 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.
#[serde(
rename = "new_group_delay",
default,
with = "::serde_with::rust::double_option"
)]
pub new_group_delay: Option<Option<i64>>,
/// 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.
#[deprecated]
#[serde(
rename = "new_host_delay",
default,
with = "::serde_with::rust::double_option"
)]
pub new_host_delay: 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.
#[serde(
rename = "no_data_timeframe",
default,
with = "::serde_with::rust::double_option"
)]
pub no_data_timeframe: Option<Option<i64>>,
/// Toggles the display of additional content sent in the monitor notification.
#[serde(rename = "notification_preset_name")]
pub notification_preset_name:
Option<crate::datadogV1::model::MonitorOptionsNotificationPresets>,
/// A Boolean indicating whether tagged users is notified on changes to this monitor.
#[serde(rename = "notify_audit")]
pub notify_audit: Option<bool>,
/// 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.
#[serde(rename = "notify_by")]
pub notify_by: Option<Vec<String>>,
/// A Boolean indicating whether this monitor notifies when data stops reporting. Defaults to `false`.
#[serde(rename = "notify_no_data")]
pub notify_no_data: Option<bool>,
/// 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.
#[serde(rename = "on_missing_data")]
pub on_missing_data: Option<crate::datadogV1::model::OnMissingDataOption>,
/// 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.
#[serde(
rename = "renotify_interval",
default,
with = "::serde_with::rust::double_option"
)]
pub renotify_interval: Option<Option<i64>>,
/// The number of times re-notification messages should be sent on the current status at the provided re-notification interval.
#[serde(
rename = "renotify_occurrences",
default,
with = "::serde_with::rust::double_option"
)]
pub renotify_occurrences: Option<Option<i64>>,
/// 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`.
#[serde(
rename = "renotify_statuses",
default,
with = "::serde_with::rust::double_option"
)]
pub renotify_statuses: Option<Option<Vec<crate::datadogV1::model::MonitorRenotifyStatusType>>>,
/// 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.
#[serde(rename = "require_full_window")]
pub require_full_window: Option<bool>,
/// Configuration options for scheduling.
#[serde(rename = "scheduling_options")]
pub scheduling_options: Option<crate::datadogV1::model::MonitorOptionsSchedulingOptions>,
/// Information about the downtime applied to the monitor. Only shows v1 downtimes.
#[deprecated]
#[serde(rename = "silenced")]
pub silenced: Option<std::collections::BTreeMap<String, Option<i64>>>,
/// ID of the corresponding Synthetic check.
#[deprecated]
#[serde(
rename = "synthetics_check_id",
default,
with = "::serde_with::rust::double_option"
)]
pub synthetics_check_id: Option<Option<String>>,
/// Alerting time window options.
#[serde(rename = "threshold_windows")]
pub threshold_windows: Option<crate::datadogV1::model::MonitorThresholdWindowOptions>,
/// List of the different monitor threshold available.
#[serde(rename = "thresholds")]
pub thresholds: Option<crate::datadogV1::model::MonitorThresholds>,
/// 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.
#[serde(
rename = "timeout_h",
default,
with = "::serde_with::rust::double_option"
)]
pub timeout_h: Option<Option<i64>>,
/// List of requests that can be used in the monitor query. **This feature is currently in beta.**
#[serde(rename = "variables")]
pub variables: Option<Vec<crate::datadogV1::model::MonitorFormulaAndFunctionQueryDefinition>>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}
impl MonitorOptions {
pub fn new() -> MonitorOptions {
#[allow(deprecated)]
MonitorOptions {
aggregation: None,
device_ids: None,
enable_logs_sample: None,
enable_samples: None,
escalation_message: None,
evaluation_delay: None,
group_retention_duration: None,
groupby_simple_monitor: None,
include_tags: None,
locked: None,
min_failure_duration: None,
min_location_failed: None,
new_group_delay: None,
new_host_delay: None,
no_data_timeframe: None,
notification_preset_name: None,
notify_audit: None,
notify_by: None,
notify_no_data: None,
on_missing_data: None,
renotify_interval: None,
renotify_occurrences: None,
renotify_statuses: None,
require_full_window: None,
scheduling_options: None,
silenced: None,
synthetics_check_id: None,
threshold_windows: None,
thresholds: None,
timeout_h: None,
variables: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}
#[allow(deprecated)]
pub fn aggregation(
mut self,
value: crate::datadogV1::model::MonitorOptionsAggregation,
) -> Self {
self.aggregation = Some(value);
self
}
#[allow(deprecated)]
pub fn device_ids(mut self, value: Vec<crate::datadogV1::model::MonitorDeviceID>) -> Self {
self.device_ids = Some(value);
self
}
#[allow(deprecated)]
pub fn enable_logs_sample(mut self, value: bool) -> Self {
self.enable_logs_sample = Some(value);
self
}
#[allow(deprecated)]
pub fn enable_samples(mut self, value: bool) -> Self {
self.enable_samples = Some(value);
self
}
#[allow(deprecated)]
pub fn escalation_message(mut self, value: String) -> Self {
self.escalation_message = Some(value);
self
}
#[allow(deprecated)]
pub fn evaluation_delay(mut self, value: Option<i64>) -> Self {
self.evaluation_delay = Some(value);
self
}
#[allow(deprecated)]
pub fn group_retention_duration(mut self, value: String) -> Self {
self.group_retention_duration = Some(value);
self
}
#[allow(deprecated)]
pub fn groupby_simple_monitor(mut self, value: bool) -> Self {
self.groupby_simple_monitor = Some(value);
self
}
#[allow(deprecated)]
pub fn include_tags(mut self, value: bool) -> Self {
self.include_tags = Some(value);
self
}
#[allow(deprecated)]
pub fn locked(mut self, value: bool) -> Self {
self.locked = Some(value);
self
}
#[allow(deprecated)]
pub fn min_failure_duration(mut self, value: Option<i64>) -> Self {
self.min_failure_duration = Some(value);
self
}
#[allow(deprecated)]
pub fn min_location_failed(mut self, value: Option<i64>) -> Self {
self.min_location_failed = Some(value);
self
}
#[allow(deprecated)]
pub fn new_group_delay(mut self, value: Option<i64>) -> Self {
self.new_group_delay = Some(value);
self
}
#[allow(deprecated)]
pub fn new_host_delay(mut self, value: Option<i64>) -> Self {
self.new_host_delay = Some(value);
self
}
#[allow(deprecated)]
pub fn no_data_timeframe(mut self, value: Option<i64>) -> Self {
self.no_data_timeframe = Some(value);
self
}
#[allow(deprecated)]
pub fn notification_preset_name(
mut self,
value: crate::datadogV1::model::MonitorOptionsNotificationPresets,
) -> Self {
self.notification_preset_name = Some(value);
self
}
#[allow(deprecated)]
pub fn notify_audit(mut self, value: bool) -> Self {
self.notify_audit = Some(value);
self
}
#[allow(deprecated)]
pub fn notify_by(mut self, value: Vec<String>) -> Self {
self.notify_by = Some(value);
self
}
#[allow(deprecated)]
pub fn notify_no_data(mut self, value: bool) -> Self {
self.notify_no_data = Some(value);
self
}
#[allow(deprecated)]
pub fn on_missing_data(mut self, value: crate::datadogV1::model::OnMissingDataOption) -> Self {
self.on_missing_data = Some(value);
self
}
#[allow(deprecated)]
pub fn renotify_interval(mut self, value: Option<i64>) -> Self {
self.renotify_interval = Some(value);
self
}
#[allow(deprecated)]
pub fn renotify_occurrences(mut self, value: Option<i64>) -> Self {
self.renotify_occurrences = Some(value);
self
}
#[allow(deprecated)]
pub fn renotify_statuses(
mut self,
value: Option<Vec<crate::datadogV1::model::MonitorRenotifyStatusType>>,
) -> Self {
self.renotify_statuses = Some(value);
self
}
#[allow(deprecated)]
pub fn require_full_window(mut self, value: bool) -> Self {
self.require_full_window = Some(value);
self
}
#[allow(deprecated)]
pub fn scheduling_options(
mut self,
value: crate::datadogV1::model::MonitorOptionsSchedulingOptions,
) -> Self {
self.scheduling_options = Some(value);
self
}
#[allow(deprecated)]
pub fn silenced(mut self, value: std::collections::BTreeMap<String, Option<i64>>) -> Self {
self.silenced = Some(value);
self
}
#[allow(deprecated)]
pub fn synthetics_check_id(mut self, value: Option<String>) -> Self {
self.synthetics_check_id = Some(value);
self
}
#[allow(deprecated)]
pub fn threshold_windows(
mut self,
value: crate::datadogV1::model::MonitorThresholdWindowOptions,
) -> Self {
self.threshold_windows = Some(value);
self
}
#[allow(deprecated)]
pub fn thresholds(mut self, value: crate::datadogV1::model::MonitorThresholds) -> Self {
self.thresholds = Some(value);
self
}
#[allow(deprecated)]
pub fn timeout_h(mut self, value: Option<i64>) -> Self {
self.timeout_h = Some(value);
self
}
#[allow(deprecated)]
pub fn variables(
mut self,
value: Vec<crate::datadogV1::model::MonitorFormulaAndFunctionQueryDefinition>,
) -> Self {
self.variables = Some(value);
self
}
pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
) -> Self {
self.additional_properties = value;
self
}
}
impl Default for MonitorOptions {
fn default() -> Self {
Self::new()
}
}
impl<'de> Deserialize<'de> for MonitorOptions {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct MonitorOptionsVisitor;
impl<'a> Visitor<'a> for MonitorOptionsVisitor {
type Value = MonitorOptions;
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str("a mapping")
}
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'a>,
{
let mut aggregation: Option<crate::datadogV1::model::MonitorOptionsAggregation> =
None;
let mut device_ids: Option<Vec<crate::datadogV1::model::MonitorDeviceID>> = None;
let mut enable_logs_sample: Option<bool> = None;
let mut enable_samples: Option<bool> = None;
let mut escalation_message: Option<String> = None;
let mut evaluation_delay: Option<Option<i64>> = None;
let mut group_retention_duration: Option<String> = None;
let mut groupby_simple_monitor: Option<bool> = None;
let mut include_tags: Option<bool> = None;
let mut locked: Option<bool> = None;
let mut min_failure_duration: Option<Option<i64>> = None;
let mut min_location_failed: Option<Option<i64>> = None;
let mut new_group_delay: Option<Option<i64>> = None;
let mut new_host_delay: Option<Option<i64>> = None;
let mut no_data_timeframe: Option<Option<i64>> = None;
let mut notification_preset_name: Option<
crate::datadogV1::model::MonitorOptionsNotificationPresets,
> = None;
let mut notify_audit: Option<bool> = None;
let mut notify_by: Option<Vec<String>> = None;
let mut notify_no_data: Option<bool> = None;
let mut on_missing_data: Option<crate::datadogV1::model::OnMissingDataOption> =
None;
let mut renotify_interval: Option<Option<i64>> = None;
let mut renotify_occurrences: Option<Option<i64>> = None;
let mut renotify_statuses: Option<
Option<Vec<crate::datadogV1::model::MonitorRenotifyStatusType>>,
> = None;
let mut require_full_window: Option<bool> = None;
let mut scheduling_options: Option<
crate::datadogV1::model::MonitorOptionsSchedulingOptions,
> = None;
let mut silenced: Option<std::collections::BTreeMap<String, Option<i64>>> = None;
let mut synthetics_check_id: Option<Option<String>> = None;
let mut threshold_windows: Option<
crate::datadogV1::model::MonitorThresholdWindowOptions,
> = None;
let mut thresholds: Option<crate::datadogV1::model::MonitorThresholds> = None;
let mut timeout_h: Option<Option<i64>> = None;
let mut variables: Option<
Vec<crate::datadogV1::model::MonitorFormulaAndFunctionQueryDefinition>,
> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
> = std::collections::BTreeMap::new();
let mut _unparsed = false;
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
match k.as_str() {
"aggregation" => {
if v.is_null() {
continue;
}
aggregation =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"device_ids" => {
if v.is_null() {
continue;
}
device_ids = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"enable_logs_sample" => {
if v.is_null() {
continue;
}
enable_logs_sample =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"enable_samples" => {
if v.is_null() {
continue;
}
enable_samples =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"escalation_message" => {
if v.is_null() {
continue;
}
escalation_message =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"evaluation_delay" => {
evaluation_delay =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"group_retention_duration" => {
if v.is_null() {
continue;
}
group_retention_duration =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"groupby_simple_monitor" => {
if v.is_null() {
continue;
}
groupby_simple_monitor =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"include_tags" => {
if v.is_null() {
continue;
}
include_tags =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"locked" => {
if v.is_null() {
continue;
}
locked = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"min_failure_duration" => {
min_failure_duration =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"min_location_failed" => {
min_location_failed =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"new_group_delay" => {
new_group_delay =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"new_host_delay" => {
new_host_delay =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"no_data_timeframe" => {
no_data_timeframe =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"notification_preset_name" => {
if v.is_null() {
continue;
}
notification_preset_name =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _notification_preset_name) = notification_preset_name {
match _notification_preset_name {
crate::datadogV1::model::MonitorOptionsNotificationPresets::UnparsedObject(_notification_preset_name) => {
_unparsed = true;
},
_ => {}
}
}
}
"notify_audit" => {
if v.is_null() {
continue;
}
notify_audit =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"notify_by" => {
if v.is_null() {
continue;
}
notify_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"notify_no_data" => {
if v.is_null() {
continue;
}
notify_no_data =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"on_missing_data" => {
if v.is_null() {
continue;
}
on_missing_data =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _on_missing_data) = on_missing_data {
match _on_missing_data {
crate::datadogV1::model::OnMissingDataOption::UnparsedObject(_on_missing_data) => {
_unparsed = true;
},
_ => {}
}
}
}
"renotify_interval" => {
renotify_interval =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"renotify_occurrences" => {
renotify_occurrences =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"renotify_statuses" => {
renotify_statuses =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"require_full_window" => {
if v.is_null() {
continue;
}
require_full_window =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"scheduling_options" => {
if v.is_null() {
continue;
}
scheduling_options =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"silenced" => {
if v.is_null() {
continue;
}
silenced = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"synthetics_check_id" => {
synthetics_check_id =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"threshold_windows" => {
if v.is_null() {
continue;
}
threshold_windows =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"thresholds" => {
if v.is_null() {
continue;
}
thresholds = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"timeout_h" => {
timeout_h = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"variables" => {
if v.is_null() {
continue;
}
variables = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
}
}
}
}
#[allow(deprecated)]
let content = MonitorOptions {
aggregation,
device_ids,
enable_logs_sample,
enable_samples,
escalation_message,
evaluation_delay,
group_retention_duration,
groupby_simple_monitor,
include_tags,
locked,
min_failure_duration,
min_location_failed,
new_group_delay,
new_host_delay,
no_data_timeframe,
notification_preset_name,
notify_audit,
notify_by,
notify_no_data,
on_missing_data,
renotify_interval,
renotify_occurrences,
renotify_statuses,
require_full_window,
scheduling_options,
silenced,
synthetics_check_id,
threshold_windows,
thresholds,
timeout_h,
variables,
additional_properties,
_unparsed,
};
Ok(content)
}
}
deserializer.deserialize_any(MonitorOptionsVisitor)
}
}