datadog_api_client/datadogV1/model/
model_synthetics_test_options.rs1use serde::de::{Error, MapAccess, Visitor};
5use serde::{Deserialize, Deserializer, Serialize};
6use serde_with::skip_serializing_none;
7use std::fmt::{self, Formatter};
8
9#[non_exhaustive]
11#[skip_serializing_none]
12#[derive(Clone, Debug, PartialEq, Serialize)]
13pub struct SyntheticsTestOptions {
14 #[serde(rename = "accept_self_signed")]
17 pub accept_self_signed: Option<bool>,
18 #[serde(rename = "allow_insecure")]
20 pub allow_insecure: Option<bool>,
21 #[serde(rename = "blockedRequestPatterns")]
23 pub blocked_request_patterns: Option<Vec<String>>,
24 #[serde(rename = "checkCertificateRevocation")]
26 pub check_certificate_revocation: Option<bool>,
27 #[serde(rename = "ci")]
29 pub ci: Option<crate::datadogV1::model::SyntheticsTestCiOptions>,
30 #[serde(rename = "device_ids")]
32 pub device_ids: Option<Vec<String>>,
33 #[serde(rename = "disableAiaIntermediateFetching")]
35 pub disable_aia_intermediate_fetching: Option<bool>,
36 #[serde(rename = "disableCors")]
38 pub disable_cors: Option<bool>,
39 #[serde(rename = "disableCsp")]
41 pub disable_csp: Option<bool>,
42 #[serde(rename = "enableProfiling")]
44 pub enable_profiling: Option<bool>,
45 #[deprecated]
47 #[serde(rename = "enableSecurityTesting")]
48 pub enable_security_testing: Option<bool>,
49 #[serde(rename = "follow_redirects")]
51 pub follow_redirects: Option<bool>,
52 #[serde(rename = "httpVersion")]
54 pub http_version: Option<crate::datadogV1::model::SyntheticsTestOptionsHTTPVersion>,
55 #[serde(rename = "ignoreServerCertificateError")]
57 pub ignore_server_certificate_error: Option<bool>,
58 #[serde(rename = "initialNavigationTimeout")]
60 pub initial_navigation_timeout: Option<i64>,
61 #[serde(rename = "min_failure_duration")]
63 pub min_failure_duration: Option<i64>,
64 #[serde(rename = "min_location_failed")]
67 pub min_location_failed: Option<i64>,
68 #[serde(rename = "monitor_name")]
70 pub monitor_name: Option<String>,
71 #[serde(rename = "monitor_options")]
74 pub monitor_options: Option<crate::datadogV1::model::SyntheticsTestOptionsMonitorOptions>,
75 #[serde(rename = "monitor_priority")]
77 pub monitor_priority: Option<i32>,
78 #[serde(rename = "noScreenshot")]
80 pub no_screenshot: Option<bool>,
81 #[serde(rename = "restricted_roles")]
83 pub restricted_roles: Option<Vec<String>>,
84 #[serde(rename = "retry")]
86 pub retry: Option<crate::datadogV1::model::SyntheticsTestOptionsRetry>,
87 #[serde(rename = "rumSettings")]
99 pub rum_settings: Option<crate::datadogV1::model::SyntheticsBrowserTestRumSettings>,
100 #[serde(rename = "scheduling")]
102 pub scheduling: Option<crate::datadogV1::model::SyntheticsTestOptionsScheduling>,
103 #[serde(rename = "tick_every")]
105 pub tick_every: Option<i64>,
106 #[serde(flatten)]
107 pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
108 #[serde(skip)]
109 #[serde(default)]
110 pub(crate) _unparsed: bool,
111}
112
113impl SyntheticsTestOptions {
114 pub fn new() -> SyntheticsTestOptions {
115 #[allow(deprecated)]
116 SyntheticsTestOptions {
117 accept_self_signed: None,
118 allow_insecure: None,
119 blocked_request_patterns: None,
120 check_certificate_revocation: None,
121 ci: None,
122 device_ids: None,
123 disable_aia_intermediate_fetching: None,
124 disable_cors: None,
125 disable_csp: None,
126 enable_profiling: None,
127 enable_security_testing: None,
128 follow_redirects: None,
129 http_version: None,
130 ignore_server_certificate_error: None,
131 initial_navigation_timeout: None,
132 min_failure_duration: None,
133 min_location_failed: None,
134 monitor_name: None,
135 monitor_options: None,
136 monitor_priority: None,
137 no_screenshot: None,
138 restricted_roles: None,
139 retry: None,
140 rum_settings: None,
141 scheduling: None,
142 tick_every: None,
143 additional_properties: std::collections::BTreeMap::new(),
144 _unparsed: false,
145 }
146 }
147
148 #[allow(deprecated)]
149 pub fn accept_self_signed(mut self, value: bool) -> Self {
150 self.accept_self_signed = Some(value);
151 self
152 }
153
154 #[allow(deprecated)]
155 pub fn allow_insecure(mut self, value: bool) -> Self {
156 self.allow_insecure = Some(value);
157 self
158 }
159
160 #[allow(deprecated)]
161 pub fn blocked_request_patterns(mut self, value: Vec<String>) -> Self {
162 self.blocked_request_patterns = Some(value);
163 self
164 }
165
166 #[allow(deprecated)]
167 pub fn check_certificate_revocation(mut self, value: bool) -> Self {
168 self.check_certificate_revocation = Some(value);
169 self
170 }
171
172 #[allow(deprecated)]
173 pub fn ci(mut self, value: crate::datadogV1::model::SyntheticsTestCiOptions) -> Self {
174 self.ci = Some(value);
175 self
176 }
177
178 #[allow(deprecated)]
179 pub fn device_ids(mut self, value: Vec<String>) -> Self {
180 self.device_ids = Some(value);
181 self
182 }
183
184 #[allow(deprecated)]
185 pub fn disable_aia_intermediate_fetching(mut self, value: bool) -> Self {
186 self.disable_aia_intermediate_fetching = Some(value);
187 self
188 }
189
190 #[allow(deprecated)]
191 pub fn disable_cors(mut self, value: bool) -> Self {
192 self.disable_cors = Some(value);
193 self
194 }
195
196 #[allow(deprecated)]
197 pub fn disable_csp(mut self, value: bool) -> Self {
198 self.disable_csp = Some(value);
199 self
200 }
201
202 #[allow(deprecated)]
203 pub fn enable_profiling(mut self, value: bool) -> Self {
204 self.enable_profiling = Some(value);
205 self
206 }
207
208 #[allow(deprecated)]
209 pub fn enable_security_testing(mut self, value: bool) -> Self {
210 self.enable_security_testing = Some(value);
211 self
212 }
213
214 #[allow(deprecated)]
215 pub fn follow_redirects(mut self, value: bool) -> Self {
216 self.follow_redirects = Some(value);
217 self
218 }
219
220 #[allow(deprecated)]
221 pub fn http_version(
222 mut self,
223 value: crate::datadogV1::model::SyntheticsTestOptionsHTTPVersion,
224 ) -> Self {
225 self.http_version = Some(value);
226 self
227 }
228
229 #[allow(deprecated)]
230 pub fn ignore_server_certificate_error(mut self, value: bool) -> Self {
231 self.ignore_server_certificate_error = Some(value);
232 self
233 }
234
235 #[allow(deprecated)]
236 pub fn initial_navigation_timeout(mut self, value: i64) -> Self {
237 self.initial_navigation_timeout = Some(value);
238 self
239 }
240
241 #[allow(deprecated)]
242 pub fn min_failure_duration(mut self, value: i64) -> Self {
243 self.min_failure_duration = Some(value);
244 self
245 }
246
247 #[allow(deprecated)]
248 pub fn min_location_failed(mut self, value: i64) -> Self {
249 self.min_location_failed = Some(value);
250 self
251 }
252
253 #[allow(deprecated)]
254 pub fn monitor_name(mut self, value: String) -> Self {
255 self.monitor_name = Some(value);
256 self
257 }
258
259 #[allow(deprecated)]
260 pub fn monitor_options(
261 mut self,
262 value: crate::datadogV1::model::SyntheticsTestOptionsMonitorOptions,
263 ) -> Self {
264 self.monitor_options = Some(value);
265 self
266 }
267
268 #[allow(deprecated)]
269 pub fn monitor_priority(mut self, value: i32) -> Self {
270 self.monitor_priority = Some(value);
271 self
272 }
273
274 #[allow(deprecated)]
275 pub fn no_screenshot(mut self, value: bool) -> Self {
276 self.no_screenshot = Some(value);
277 self
278 }
279
280 #[allow(deprecated)]
281 pub fn restricted_roles(mut self, value: Vec<String>) -> Self {
282 self.restricted_roles = Some(value);
283 self
284 }
285
286 #[allow(deprecated)]
287 pub fn retry(mut self, value: crate::datadogV1::model::SyntheticsTestOptionsRetry) -> Self {
288 self.retry = Some(value);
289 self
290 }
291
292 #[allow(deprecated)]
293 pub fn rum_settings(
294 mut self,
295 value: crate::datadogV1::model::SyntheticsBrowserTestRumSettings,
296 ) -> Self {
297 self.rum_settings = Some(value);
298 self
299 }
300
301 #[allow(deprecated)]
302 pub fn scheduling(
303 mut self,
304 value: crate::datadogV1::model::SyntheticsTestOptionsScheduling,
305 ) -> Self {
306 self.scheduling = Some(value);
307 self
308 }
309
310 #[allow(deprecated)]
311 pub fn tick_every(mut self, value: i64) -> Self {
312 self.tick_every = Some(value);
313 self
314 }
315
316 pub fn additional_properties(
317 mut self,
318 value: std::collections::BTreeMap<String, serde_json::Value>,
319 ) -> Self {
320 self.additional_properties = value;
321 self
322 }
323}
324
325impl Default for SyntheticsTestOptions {
326 fn default() -> Self {
327 Self::new()
328 }
329}
330
331impl<'de> Deserialize<'de> for SyntheticsTestOptions {
332 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
333 where
334 D: Deserializer<'de>,
335 {
336 struct SyntheticsTestOptionsVisitor;
337 impl<'a> Visitor<'a> for SyntheticsTestOptionsVisitor {
338 type Value = SyntheticsTestOptions;
339
340 fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
341 f.write_str("a mapping")
342 }
343
344 fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
345 where
346 M: MapAccess<'a>,
347 {
348 let mut accept_self_signed: Option<bool> = None;
349 let mut allow_insecure: Option<bool> = None;
350 let mut blocked_request_patterns: Option<Vec<String>> = None;
351 let mut check_certificate_revocation: Option<bool> = None;
352 let mut ci: Option<crate::datadogV1::model::SyntheticsTestCiOptions> = None;
353 let mut device_ids: Option<Vec<String>> = None;
354 let mut disable_aia_intermediate_fetching: Option<bool> = None;
355 let mut disable_cors: Option<bool> = None;
356 let mut disable_csp: Option<bool> = None;
357 let mut enable_profiling: Option<bool> = None;
358 let mut enable_security_testing: Option<bool> = None;
359 let mut follow_redirects: Option<bool> = None;
360 let mut http_version: Option<
361 crate::datadogV1::model::SyntheticsTestOptionsHTTPVersion,
362 > = None;
363 let mut ignore_server_certificate_error: Option<bool> = None;
364 let mut initial_navigation_timeout: Option<i64> = None;
365 let mut min_failure_duration: Option<i64> = None;
366 let mut min_location_failed: Option<i64> = None;
367 let mut monitor_name: Option<String> = None;
368 let mut monitor_options: Option<
369 crate::datadogV1::model::SyntheticsTestOptionsMonitorOptions,
370 > = None;
371 let mut monitor_priority: Option<i32> = None;
372 let mut no_screenshot: Option<bool> = None;
373 let mut restricted_roles: Option<Vec<String>> = None;
374 let mut retry: Option<crate::datadogV1::model::SyntheticsTestOptionsRetry> = None;
375 let mut rum_settings: Option<
376 crate::datadogV1::model::SyntheticsBrowserTestRumSettings,
377 > = None;
378 let mut scheduling: Option<
379 crate::datadogV1::model::SyntheticsTestOptionsScheduling,
380 > = None;
381 let mut tick_every: Option<i64> = None;
382 let mut additional_properties: std::collections::BTreeMap<
383 String,
384 serde_json::Value,
385 > = std::collections::BTreeMap::new();
386 let mut _unparsed = false;
387
388 while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
389 match k.as_str() {
390 "accept_self_signed" => {
391 if v.is_null() {
392 continue;
393 }
394 accept_self_signed =
395 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
396 }
397 "allow_insecure" => {
398 if v.is_null() {
399 continue;
400 }
401 allow_insecure =
402 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
403 }
404 "blockedRequestPatterns" => {
405 if v.is_null() {
406 continue;
407 }
408 blocked_request_patterns =
409 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
410 }
411 "checkCertificateRevocation" => {
412 if v.is_null() {
413 continue;
414 }
415 check_certificate_revocation =
416 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
417 }
418 "ci" => {
419 if v.is_null() {
420 continue;
421 }
422 ci = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
423 }
424 "device_ids" => {
425 if v.is_null() {
426 continue;
427 }
428 device_ids = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
429 }
430 "disableAiaIntermediateFetching" => {
431 if v.is_null() {
432 continue;
433 }
434 disable_aia_intermediate_fetching =
435 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
436 }
437 "disableCors" => {
438 if v.is_null() {
439 continue;
440 }
441 disable_cors =
442 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
443 }
444 "disableCsp" => {
445 if v.is_null() {
446 continue;
447 }
448 disable_csp =
449 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
450 }
451 "enableProfiling" => {
452 if v.is_null() {
453 continue;
454 }
455 enable_profiling =
456 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
457 }
458 "enableSecurityTesting" => {
459 if v.is_null() {
460 continue;
461 }
462 enable_security_testing =
463 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
464 }
465 "follow_redirects" => {
466 if v.is_null() {
467 continue;
468 }
469 follow_redirects =
470 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
471 }
472 "httpVersion" => {
473 if v.is_null() {
474 continue;
475 }
476 http_version =
477 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
478 if let Some(ref _http_version) = http_version {
479 match _http_version {
480 crate::datadogV1::model::SyntheticsTestOptionsHTTPVersion::UnparsedObject(_http_version) => {
481 _unparsed = true;
482 },
483 _ => {}
484 }
485 }
486 }
487 "ignoreServerCertificateError" => {
488 if v.is_null() {
489 continue;
490 }
491 ignore_server_certificate_error =
492 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
493 }
494 "initialNavigationTimeout" => {
495 if v.is_null() {
496 continue;
497 }
498 initial_navigation_timeout =
499 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
500 }
501 "min_failure_duration" => {
502 if v.is_null() {
503 continue;
504 }
505 min_failure_duration =
506 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
507 }
508 "min_location_failed" => {
509 if v.is_null() {
510 continue;
511 }
512 min_location_failed =
513 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
514 }
515 "monitor_name" => {
516 if v.is_null() {
517 continue;
518 }
519 monitor_name =
520 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
521 }
522 "monitor_options" => {
523 if v.is_null() {
524 continue;
525 }
526 monitor_options =
527 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
528 }
529 "monitor_priority" => {
530 if v.is_null() {
531 continue;
532 }
533 monitor_priority =
534 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
535 }
536 "noScreenshot" => {
537 if v.is_null() {
538 continue;
539 }
540 no_screenshot =
541 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
542 }
543 "restricted_roles" => {
544 if v.is_null() {
545 continue;
546 }
547 restricted_roles =
548 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
549 }
550 "retry" => {
551 if v.is_null() {
552 continue;
553 }
554 retry = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
555 }
556 "rumSettings" => {
557 if v.is_null() {
558 continue;
559 }
560 rum_settings =
561 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
562 }
563 "scheduling" => {
564 if v.is_null() {
565 continue;
566 }
567 scheduling = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
568 }
569 "tick_every" => {
570 if v.is_null() {
571 continue;
572 }
573 tick_every = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
574 }
575 &_ => {
576 if let Ok(value) = serde_json::from_value(v.clone()) {
577 additional_properties.insert(k, value);
578 }
579 }
580 }
581 }
582
583 #[allow(deprecated)]
584 let content = SyntheticsTestOptions {
585 accept_self_signed,
586 allow_insecure,
587 blocked_request_patterns,
588 check_certificate_revocation,
589 ci,
590 device_ids,
591 disable_aia_intermediate_fetching,
592 disable_cors,
593 disable_csp,
594 enable_profiling,
595 enable_security_testing,
596 follow_redirects,
597 http_version,
598 ignore_server_certificate_error,
599 initial_navigation_timeout,
600 min_failure_duration,
601 min_location_failed,
602 monitor_name,
603 monitor_options,
604 monitor_priority,
605 no_screenshot,
606 restricted_roles,
607 retry,
608 rum_settings,
609 scheduling,
610 tick_every,
611 additional_properties,
612 _unparsed,
613 };
614
615 Ok(content)
616 }
617 }
618
619 deserializer.deserialize_any(SyntheticsTestOptionsVisitor)
620 }
621}