SyntheticsAPITest

Struct SyntheticsAPITest 

Source
#[non_exhaustive]
pub struct SyntheticsAPITest { pub config: SyntheticsAPITestConfig, pub locations: Vec<String>, pub message: String, pub monitor_id: Option<i64>, pub name: String, pub options: SyntheticsTestOptions, pub public_id: Option<String>, pub status: Option<SyntheticsTestPauseStatus>, pub subtype: Option<SyntheticsTestDetailsSubType>, pub tags: Option<Vec<String>>, pub type_: SyntheticsAPITestType, pub additional_properties: BTreeMap<String, Value>, /* private fields */ }
Expand description

Object containing details about a Synthetic API test.

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.
§config: SyntheticsAPITestConfig

Configuration object for a Synthetic API test.

§locations: Vec<String>

Array of locations used to run the test.

§message: String

Notification message associated with the test.

§monitor_id: Option<i64>

The associated monitor ID.

§name: String

Name of the test.

§options: SyntheticsTestOptions

Object describing the extra options for a Synthetic test.

§public_id: Option<String>

The public ID for the test.

§status: Option<SyntheticsTestPauseStatus>

Define whether you want to start (live) or pause (paused) a Synthetic test.

§subtype: Option<SyntheticsTestDetailsSubType>

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi.

§tags: Option<Vec<String>>

Array of tags attached to the test.

§type_: SyntheticsAPITestType

Type of the Synthetic test, api.

§additional_properties: BTreeMap<String, Value>

Implementations§

Source§

impl SyntheticsAPITest

Source

pub fn new( config: SyntheticsAPITestConfig, locations: Vec<String>, message: String, name: String, options: SyntheticsTestOptions, type_: SyntheticsAPITestType, ) -> SyntheticsAPITest

Examples found in repository?
examples/v1_synthetics_CreateSyntheticsAPITest_1072503741.rs (lines 19-48)
18async fn main() {
19    let body = SyntheticsAPITest::new(
20        SyntheticsAPITestConfig::new()
21            .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget(
22                Box::new(SyntheticsAssertionTarget::new(
23                    SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,
24                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
25                        10.0 as f64,
26                    ),
27                    SyntheticsAssertionType::CERTIFICATE,
28                )),
29            )])
30            .request(
31                SyntheticsTestRequest::new()
32                    .host("datadoghq.com".to_string())
33                    .port(
34                        SyntheticsTestRequestPort::SyntheticsTestRequestVariablePort(
35                            "{{ DATADOG_PORT }}".to_string(),
36                        ),
37                    ),
38            ),
39        vec!["aws:us-east-2".to_string()],
40        "BDD test payload: synthetics_api_ssl_test_payload.json".to_string(),
41        "Example-Synthetic".to_string(),
42        SyntheticsTestOptions::new()
43            .accept_self_signed(true)
44            .check_certificate_revocation(true)
45            .disable_aia_intermediate_fetching(true)
46            .tick_every(60),
47        SyntheticsAPITestType::API,
48    )
49    .subtype(SyntheticsTestDetailsSubType::SSL)
50    .tags(vec!["testing:api".to_string()]);
51    let configuration = datadog::Configuration::new();
52    let api = SyntheticsAPI::with_config(configuration);
53    let resp = api.create_synthetics_api_test(body).await;
54    if let Ok(value) = resp {
55        println!("{:#?}", value);
56    } else {
57        println!("{:#?}", resp.unwrap_err());
58    }
59}
More examples
Hide additional examples
examples/v1_synthetics_CreateSyntheticsAPITest_2472747642.rs (lines 20-66)
19async fn main() {
20    let body = SyntheticsAPITest::new(
21        SyntheticsAPITestConfig::new()
22            .assertions(vec![
23                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
24                    SyntheticsAssertionTarget::new(
25                        SyntheticsAssertionOperator::IS,
26                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
27                            "message".to_string(),
28                        ),
29                        SyntheticsAssertionType::RECEIVED_MESSAGE,
30                    ),
31                )),
32                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
33                    SyntheticsAssertionTarget::new(
34                        SyntheticsAssertionOperator::LESS_THAN,
35                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
36                            2000.0 as f64,
37                        ),
38                        SyntheticsAssertionType::RESPONSE_TIME,
39                    ),
40                )),
41            ])
42            .config_variables(vec![])
43            .request(
44                SyntheticsTestRequest::new()
45                    .message("message".to_string())
46                    .url("ws://datadoghq.com".to_string()),
47            ),
48        vec!["aws:us-east-2".to_string()],
49        "BDD test payload: synthetics_api_test_websocket_payload.json".to_string(),
50        "Example-Synthetic".to_string(),
51        SyntheticsTestOptions::new()
52            .accept_self_signed(false)
53            .allow_insecure(true)
54            .follow_redirects(true)
55            .min_failure_duration(10)
56            .min_location_failed(1)
57            .monitor_name("Example-Synthetic".to_string())
58            .monitor_priority(5)
59            .retry(
60                SyntheticsTestOptionsRetry::new()
61                    .count(3)
62                    .interval(10.0 as f64),
63            )
64            .tick_every(60),
65        SyntheticsAPITestType::API,
66    )
67    .subtype(SyntheticsTestDetailsSubType::WEBSOCKET)
68    .tags(vec!["testing:api".to_string()]);
69    let configuration = datadog::Configuration::new();
70    let api = SyntheticsAPI::with_config(configuration);
71    let resp = api.create_synthetics_api_test(body).await;
72    if let Ok(value) = resp {
73        println!("{:#?}", value);
74    } else {
75        println!("{:#?}", resp.unwrap_err());
76    }
77}
examples/v1_synthetics_CreateSyntheticsAPITest_3829801148.rs (lines 21-68)
20async fn main() {
21    let body = SyntheticsAPITest::new(
22        SyntheticsAPITestConfig::new()
23            .assertions(vec![
24                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
25                    SyntheticsAssertionTarget::new(
26                        SyntheticsAssertionOperator::IS,
27                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
28                            "message".to_string(),
29                        ),
30                        SyntheticsAssertionType::RECEIVED_MESSAGE,
31                    ),
32                )),
33                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
34                    SyntheticsAssertionTarget::new(
35                        SyntheticsAssertionOperator::LESS_THAN,
36                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
37                            2000.0 as f64,
38                        ),
39                        SyntheticsAssertionType::RESPONSE_TIME,
40                    ),
41                )),
42            ])
43            .config_variables(vec![])
44            .request(
45                SyntheticsTestRequest::new()
46                    .host("https://datadoghq.com".to_string())
47                    .message("message".to_string())
48                    .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(443)),
49            ),
50        vec!["aws:us-east-2".to_string()],
51        "BDD test payload: synthetics_api_test_udp_payload.json".to_string(),
52        "Example-Synthetic".to_string(),
53        SyntheticsTestOptions::new()
54            .accept_self_signed(false)
55            .allow_insecure(true)
56            .follow_redirects(true)
57            .min_failure_duration(10)
58            .min_location_failed(1)
59            .monitor_name("Example-Synthetic".to_string())
60            .monitor_priority(5)
61            .retry(
62                SyntheticsTestOptionsRetry::new()
63                    .count(3)
64                    .interval(10.0 as f64),
65            )
66            .tick_every(60),
67        SyntheticsAPITestType::API,
68    )
69    .subtype(SyntheticsTestDetailsSubType::UDP)
70    .tags(vec!["testing:api".to_string()]);
71    let configuration = datadog::Configuration::new();
72    let api = SyntheticsAPI::with_config(configuration);
73    let resp = api.create_synthetics_api_test(body).await;
74    if let Ok(value) = resp {
75        println!("{:#?}", value);
76    } else {
77        println!("{:#?}", resp.unwrap_err());
78    }
79}
examples/v1_synthetics_CreateSyntheticsAPITest.rs (lines 28-81)
27async fn main() {
28    let body = SyntheticsAPITest::new(
29        SyntheticsAPITestConfig::new()
30            .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget(
31                Box::new(SyntheticsAssertionTarget::new(
32                    SyntheticsAssertionOperator::LESS_THAN,
33                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
34                        1000.0 as f64,
35                    ),
36                    SyntheticsAssertionType::RESPONSE_TIME,
37                )),
38            )])
39            .request(
40                SyntheticsTestRequest::new()
41                    .method("GET".to_string())
42                    .url("https://example.com".to_string()),
43            ),
44        vec!["aws:eu-west-3".to_string()],
45        "Notification message".to_string(),
46        "Example test name".to_string(),
47        SyntheticsTestOptions::new()
48            .ci(SyntheticsTestCiOptions::new(
49                SyntheticsTestExecutionRule::BLOCKING,
50            ))
51            .device_ids(vec!["chrome.laptop_large".to_string()])
52            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP1)
53            .monitor_options(
54                SyntheticsTestOptionsMonitorOptions::new().notification_preset_name(
55                    SyntheticsTestOptionsMonitorOptionsNotificationPresetName::SHOW_ALL,
56                ),
57            )
58            .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()])
59            .retry(SyntheticsTestOptionsRetry::new())
60            .rum_settings(
61                SyntheticsBrowserTestRumSettings::new(true)
62                    .application_id("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string())
63                    .client_token_id(12345),
64            )
65            .scheduling(SyntheticsTestOptionsScheduling::new(
66                vec![
67                    SyntheticsTestOptionsSchedulingTimeframe::new(
68                        1,
69                        "07:00".to_string(),
70                        "16:00".to_string(),
71                    ),
72                    SyntheticsTestOptionsSchedulingTimeframe::new(
73                        3,
74                        "07:00".to_string(),
75                        "16:00".to_string(),
76                    ),
77                ],
78                "America/New_York".to_string(),
79            )),
80        SyntheticsAPITestType::API,
81    )
82    .status(SyntheticsTestPauseStatus::LIVE)
83    .subtype(SyntheticsTestDetailsSubType::HTTP)
84    .tags(vec!["env:production".to_string()]);
85    let configuration = datadog::Configuration::new();
86    let api = SyntheticsAPI::with_config(configuration);
87    let resp = api.create_synthetics_api_test(body).await;
88    if let Ok(value) = resp {
89        println!("{:#?}", value);
90    } else {
91        println!("{:#?}", resp.unwrap_err());
92    }
93}
examples/v1_synthetics_CreateSyntheticsAPITest_1402674167.rs (lines 22-73)
21async fn main() {
22    let body = SyntheticsAPITest::new(
23        SyntheticsAPITestConfig::new()
24            .assertions(vec![
25                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
26                    SyntheticsAssertionTarget::new(
27                        SyntheticsAssertionOperator::IS,
28                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
29                            1.0 as f64,
30                        ),
31                        SyntheticsAssertionType::GRPC_HEALTHCHECK_STATUS,
32                    ),
33                )),
34                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
35                    SyntheticsAssertionTarget::new(
36                        SyntheticsAssertionOperator::IS,
37                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
38                            "proto target".to_string(),
39                        ),
40                        SyntheticsAssertionType::GRPC_PROTO,
41                    ),
42                )),
43                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
44                    SyntheticsAssertionTarget::new(
45                        SyntheticsAssertionOperator::IS,
46                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
47                            "123".to_string(),
48                        ),
49                        SyntheticsAssertionType::GRPC_METADATA,
50                    )
51                    .property("property".to_string()),
52                )),
53            ])
54            .request(
55                SyntheticsTestRequest::new()
56                    .host("localhost".to_string())
57                    .message("".to_string())
58                    .metadata(BTreeMap::from([]))
59                    .method("GET".to_string())
60                    .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(50051))
61                    .service("Hello".to_string()),
62            ),
63        vec!["aws:us-east-2".to_string()],
64        "BDD test payload: synthetics_api_grpc_test_payload.json".to_string(),
65        "Example-Synthetic".to_string(),
66        SyntheticsTestOptions::new()
67            .min_failure_duration(0)
68            .min_location_failed(1)
69            .monitor_name("Example-Synthetic".to_string())
70            .monitor_options(SyntheticsTestOptionsMonitorOptions::new().renotify_interval(0))
71            .tick_every(60),
72        SyntheticsAPITestType::API,
73    )
74    .subtype(SyntheticsTestDetailsSubType::GRPC)
75    .tags(vec!["testing:api".to_string()]);
76    let configuration = datadog::Configuration::new();
77    let api = SyntheticsAPI::with_config(configuration);
78    let resp = api.create_synthetics_api_test(body).await;
79    if let Ok(value) = resp {
80        println!("{:#?}", value);
81    } else {
82        println!("{:#?}", resp.unwrap_err());
83    }
84}
examples/v1_synthetics_UpdateAPITest.rs (lines 35-135)
31async fn main() {
32    // there is a valid "synthetics_api_test" in the system
33    let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
34    let body =
35        SyntheticsAPITest::new(
36            SyntheticsAPITestConfig::new()
37                .assertions(
38                    vec![
39                        SyntheticsAssertion::SyntheticsAssertionTarget(
40                            Box::new(
41                                SyntheticsAssertionTarget::new(
42                                    SyntheticsAssertionOperator::IS,
43                                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
44                                        "text/html".to_string(),
45                                    ),
46                                    SyntheticsAssertionType::HEADER,
47                                ).property("{{ PROPERTY }}".to_string()),
48                            ),
49                        ),
50                        SyntheticsAssertion::SyntheticsAssertionTarget(
51                            Box::new(
52                                SyntheticsAssertionTarget::new(
53                                    SyntheticsAssertionOperator::LESS_THAN,
54                                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
55                                        2000.0 as f64,
56                                    ),
57                                    SyntheticsAssertionType::RESPONSE_TIME,
58                                ),
59                            ),
60                        ),
61                        SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(
62                            Box::new(
63                                SyntheticsAssertionJSONPathTarget::new(
64                                    SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
65                                    SyntheticsAssertionType::BODY,
66                                ).target(
67                                    SyntheticsAssertionJSONPathTargetTarget::new()
68                                        .json_path("topKey".to_string())
69                                        .operator("isNot".to_string())
70                                        .target_value(
71                                            SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
72                                                "0".to_string(),
73                                            ),
74                                        ),
75                                ),
76                            ),
77                        ),
78                        SyntheticsAssertion::SyntheticsAssertionJSONSchemaTarget(
79                            Box::new(
80                                SyntheticsAssertionJSONSchemaTarget::new(
81                                    SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
82                                    SyntheticsAssertionType::BODY,
83                                ).target(
84                                    SyntheticsAssertionJSONSchemaTargetTarget::new()
85                                        .json_schema(
86                                            r#"{"type": "object", "properties":{"slideshow":{"type":"object"}}}"#.to_string(),
87                                        )
88                                        .meta_schema(SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07),
89                                ),
90                            ),
91                        )
92                    ],
93                )
94                .config_variables(
95                    vec![
96                        SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
97                            .example("content-type".to_string())
98                            .pattern("content-type".to_string())
99                    ],
100                )
101                .request(
102                    SyntheticsTestRequest::new()
103                        .certificate(
104                            SyntheticsTestRequestCertificate::new()
105                                .cert(
106                                    SyntheticsTestRequestCertificateItem::new()
107                                        .filename("cert-filename".to_string())
108                                        .updated_at("2020-10-16T09:23:24.857Z".to_string()),
109                                )
110                                .key(
111                                    SyntheticsTestRequestCertificateItem::new()
112                                        .filename("key-filename".to_string())
113                                        .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                                ),
115                        )
116                        .headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())]))
117                        .method("GET".to_string())
118                        .timeout(10.0 as f64)
119                        .url("https://datadoghq.com".to_string()),
120                ),
121            vec!["aws:us-east-2".to_string()],
122            "BDD test payload: synthetics_api_test_payload.json".to_string(),
123            "Example-Synthetic-updated".to_string(),
124            SyntheticsTestOptions::new()
125                .accept_self_signed(false)
126                .allow_insecure(true)
127                .follow_redirects(true)
128                .min_failure_duration(10)
129                .min_location_failed(1)
130                .monitor_name("Test-TestSyntheticsAPITestLifecycle-1623076664".to_string())
131                .monitor_priority(5)
132                .retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64))
133                .tick_every(60),
134            SyntheticsAPITestType::API,
135        )
136            .status(SyntheticsTestPauseStatus::LIVE)
137            .subtype(SyntheticsTestDetailsSubType::HTTP)
138            .tags(vec!["testing:api".to_string()]);
139    let configuration = datadog::Configuration::new();
140    let api = SyntheticsAPI::with_config(configuration);
141    let resp = api
142        .update_api_test(synthetics_api_test_public_id.clone(), body)
143        .await;
144    if let Ok(value) = resp {
145        println!("{:#?}", value);
146    } else {
147        println!("{:#?}", resp.unwrap_err());
148    }
149}
Source

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

Source

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

Source

pub fn status(self, value: SyntheticsTestPauseStatus) -> Self

Examples found in repository?
examples/v1_synthetics_CreateSyntheticsAPITest.rs (line 82)
27async fn main() {
28    let body = SyntheticsAPITest::new(
29        SyntheticsAPITestConfig::new()
30            .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget(
31                Box::new(SyntheticsAssertionTarget::new(
32                    SyntheticsAssertionOperator::LESS_THAN,
33                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
34                        1000.0 as f64,
35                    ),
36                    SyntheticsAssertionType::RESPONSE_TIME,
37                )),
38            )])
39            .request(
40                SyntheticsTestRequest::new()
41                    .method("GET".to_string())
42                    .url("https://example.com".to_string()),
43            ),
44        vec!["aws:eu-west-3".to_string()],
45        "Notification message".to_string(),
46        "Example test name".to_string(),
47        SyntheticsTestOptions::new()
48            .ci(SyntheticsTestCiOptions::new(
49                SyntheticsTestExecutionRule::BLOCKING,
50            ))
51            .device_ids(vec!["chrome.laptop_large".to_string()])
52            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP1)
53            .monitor_options(
54                SyntheticsTestOptionsMonitorOptions::new().notification_preset_name(
55                    SyntheticsTestOptionsMonitorOptionsNotificationPresetName::SHOW_ALL,
56                ),
57            )
58            .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()])
59            .retry(SyntheticsTestOptionsRetry::new())
60            .rum_settings(
61                SyntheticsBrowserTestRumSettings::new(true)
62                    .application_id("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string())
63                    .client_token_id(12345),
64            )
65            .scheduling(SyntheticsTestOptionsScheduling::new(
66                vec![
67                    SyntheticsTestOptionsSchedulingTimeframe::new(
68                        1,
69                        "07:00".to_string(),
70                        "16:00".to_string(),
71                    ),
72                    SyntheticsTestOptionsSchedulingTimeframe::new(
73                        3,
74                        "07:00".to_string(),
75                        "16:00".to_string(),
76                    ),
77                ],
78                "America/New_York".to_string(),
79            )),
80        SyntheticsAPITestType::API,
81    )
82    .status(SyntheticsTestPauseStatus::LIVE)
83    .subtype(SyntheticsTestDetailsSubType::HTTP)
84    .tags(vec!["env:production".to_string()]);
85    let configuration = datadog::Configuration::new();
86    let api = SyntheticsAPI::with_config(configuration);
87    let resp = api.create_synthetics_api_test(body).await;
88    if let Ok(value) = resp {
89        println!("{:#?}", value);
90    } else {
91        println!("{:#?}", resp.unwrap_err());
92    }
93}
More examples
Hide additional examples
examples/v1_synthetics_UpdateAPITest.rs (line 136)
31async fn main() {
32    // there is a valid "synthetics_api_test" in the system
33    let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
34    let body =
35        SyntheticsAPITest::new(
36            SyntheticsAPITestConfig::new()
37                .assertions(
38                    vec![
39                        SyntheticsAssertion::SyntheticsAssertionTarget(
40                            Box::new(
41                                SyntheticsAssertionTarget::new(
42                                    SyntheticsAssertionOperator::IS,
43                                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
44                                        "text/html".to_string(),
45                                    ),
46                                    SyntheticsAssertionType::HEADER,
47                                ).property("{{ PROPERTY }}".to_string()),
48                            ),
49                        ),
50                        SyntheticsAssertion::SyntheticsAssertionTarget(
51                            Box::new(
52                                SyntheticsAssertionTarget::new(
53                                    SyntheticsAssertionOperator::LESS_THAN,
54                                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
55                                        2000.0 as f64,
56                                    ),
57                                    SyntheticsAssertionType::RESPONSE_TIME,
58                                ),
59                            ),
60                        ),
61                        SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(
62                            Box::new(
63                                SyntheticsAssertionJSONPathTarget::new(
64                                    SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
65                                    SyntheticsAssertionType::BODY,
66                                ).target(
67                                    SyntheticsAssertionJSONPathTargetTarget::new()
68                                        .json_path("topKey".to_string())
69                                        .operator("isNot".to_string())
70                                        .target_value(
71                                            SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
72                                                "0".to_string(),
73                                            ),
74                                        ),
75                                ),
76                            ),
77                        ),
78                        SyntheticsAssertion::SyntheticsAssertionJSONSchemaTarget(
79                            Box::new(
80                                SyntheticsAssertionJSONSchemaTarget::new(
81                                    SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
82                                    SyntheticsAssertionType::BODY,
83                                ).target(
84                                    SyntheticsAssertionJSONSchemaTargetTarget::new()
85                                        .json_schema(
86                                            r#"{"type": "object", "properties":{"slideshow":{"type":"object"}}}"#.to_string(),
87                                        )
88                                        .meta_schema(SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07),
89                                ),
90                            ),
91                        )
92                    ],
93                )
94                .config_variables(
95                    vec![
96                        SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
97                            .example("content-type".to_string())
98                            .pattern("content-type".to_string())
99                    ],
100                )
101                .request(
102                    SyntheticsTestRequest::new()
103                        .certificate(
104                            SyntheticsTestRequestCertificate::new()
105                                .cert(
106                                    SyntheticsTestRequestCertificateItem::new()
107                                        .filename("cert-filename".to_string())
108                                        .updated_at("2020-10-16T09:23:24.857Z".to_string()),
109                                )
110                                .key(
111                                    SyntheticsTestRequestCertificateItem::new()
112                                        .filename("key-filename".to_string())
113                                        .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                                ),
115                        )
116                        .headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())]))
117                        .method("GET".to_string())
118                        .timeout(10.0 as f64)
119                        .url("https://datadoghq.com".to_string()),
120                ),
121            vec!["aws:us-east-2".to_string()],
122            "BDD test payload: synthetics_api_test_payload.json".to_string(),
123            "Example-Synthetic-updated".to_string(),
124            SyntheticsTestOptions::new()
125                .accept_self_signed(false)
126                .allow_insecure(true)
127                .follow_redirects(true)
128                .min_failure_duration(10)
129                .min_location_failed(1)
130                .monitor_name("Test-TestSyntheticsAPITestLifecycle-1623076664".to_string())
131                .monitor_priority(5)
132                .retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64))
133                .tick_every(60),
134            SyntheticsAPITestType::API,
135        )
136            .status(SyntheticsTestPauseStatus::LIVE)
137            .subtype(SyntheticsTestDetailsSubType::HTTP)
138            .tags(vec!["testing:api".to_string()]);
139    let configuration = datadog::Configuration::new();
140    let api = SyntheticsAPI::with_config(configuration);
141    let resp = api
142        .update_api_test(synthetics_api_test_public_id.clone(), body)
143        .await;
144    if let Ok(value) = resp {
145        println!("{:#?}", value);
146    } else {
147        println!("{:#?}", resp.unwrap_err());
148    }
149}
Source

pub fn subtype(self, value: SyntheticsTestDetailsSubType) -> Self

Examples found in repository?
examples/v1_synthetics_CreateSyntheticsAPITest_1072503741.rs (line 49)
18async fn main() {
19    let body = SyntheticsAPITest::new(
20        SyntheticsAPITestConfig::new()
21            .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget(
22                Box::new(SyntheticsAssertionTarget::new(
23                    SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,
24                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
25                        10.0 as f64,
26                    ),
27                    SyntheticsAssertionType::CERTIFICATE,
28                )),
29            )])
30            .request(
31                SyntheticsTestRequest::new()
32                    .host("datadoghq.com".to_string())
33                    .port(
34                        SyntheticsTestRequestPort::SyntheticsTestRequestVariablePort(
35                            "{{ DATADOG_PORT }}".to_string(),
36                        ),
37                    ),
38            ),
39        vec!["aws:us-east-2".to_string()],
40        "BDD test payload: synthetics_api_ssl_test_payload.json".to_string(),
41        "Example-Synthetic".to_string(),
42        SyntheticsTestOptions::new()
43            .accept_self_signed(true)
44            .check_certificate_revocation(true)
45            .disable_aia_intermediate_fetching(true)
46            .tick_every(60),
47        SyntheticsAPITestType::API,
48    )
49    .subtype(SyntheticsTestDetailsSubType::SSL)
50    .tags(vec!["testing:api".to_string()]);
51    let configuration = datadog::Configuration::new();
52    let api = SyntheticsAPI::with_config(configuration);
53    let resp = api.create_synthetics_api_test(body).await;
54    if let Ok(value) = resp {
55        println!("{:#?}", value);
56    } else {
57        println!("{:#?}", resp.unwrap_err());
58    }
59}
More examples
Hide additional examples
examples/v1_synthetics_CreateSyntheticsAPITest_2472747642.rs (line 67)
19async fn main() {
20    let body = SyntheticsAPITest::new(
21        SyntheticsAPITestConfig::new()
22            .assertions(vec![
23                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
24                    SyntheticsAssertionTarget::new(
25                        SyntheticsAssertionOperator::IS,
26                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
27                            "message".to_string(),
28                        ),
29                        SyntheticsAssertionType::RECEIVED_MESSAGE,
30                    ),
31                )),
32                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
33                    SyntheticsAssertionTarget::new(
34                        SyntheticsAssertionOperator::LESS_THAN,
35                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
36                            2000.0 as f64,
37                        ),
38                        SyntheticsAssertionType::RESPONSE_TIME,
39                    ),
40                )),
41            ])
42            .config_variables(vec![])
43            .request(
44                SyntheticsTestRequest::new()
45                    .message("message".to_string())
46                    .url("ws://datadoghq.com".to_string()),
47            ),
48        vec!["aws:us-east-2".to_string()],
49        "BDD test payload: synthetics_api_test_websocket_payload.json".to_string(),
50        "Example-Synthetic".to_string(),
51        SyntheticsTestOptions::new()
52            .accept_self_signed(false)
53            .allow_insecure(true)
54            .follow_redirects(true)
55            .min_failure_duration(10)
56            .min_location_failed(1)
57            .monitor_name("Example-Synthetic".to_string())
58            .monitor_priority(5)
59            .retry(
60                SyntheticsTestOptionsRetry::new()
61                    .count(3)
62                    .interval(10.0 as f64),
63            )
64            .tick_every(60),
65        SyntheticsAPITestType::API,
66    )
67    .subtype(SyntheticsTestDetailsSubType::WEBSOCKET)
68    .tags(vec!["testing:api".to_string()]);
69    let configuration = datadog::Configuration::new();
70    let api = SyntheticsAPI::with_config(configuration);
71    let resp = api.create_synthetics_api_test(body).await;
72    if let Ok(value) = resp {
73        println!("{:#?}", value);
74    } else {
75        println!("{:#?}", resp.unwrap_err());
76    }
77}
examples/v1_synthetics_CreateSyntheticsAPITest_3829801148.rs (line 69)
20async fn main() {
21    let body = SyntheticsAPITest::new(
22        SyntheticsAPITestConfig::new()
23            .assertions(vec![
24                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
25                    SyntheticsAssertionTarget::new(
26                        SyntheticsAssertionOperator::IS,
27                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
28                            "message".to_string(),
29                        ),
30                        SyntheticsAssertionType::RECEIVED_MESSAGE,
31                    ),
32                )),
33                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
34                    SyntheticsAssertionTarget::new(
35                        SyntheticsAssertionOperator::LESS_THAN,
36                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
37                            2000.0 as f64,
38                        ),
39                        SyntheticsAssertionType::RESPONSE_TIME,
40                    ),
41                )),
42            ])
43            .config_variables(vec![])
44            .request(
45                SyntheticsTestRequest::new()
46                    .host("https://datadoghq.com".to_string())
47                    .message("message".to_string())
48                    .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(443)),
49            ),
50        vec!["aws:us-east-2".to_string()],
51        "BDD test payload: synthetics_api_test_udp_payload.json".to_string(),
52        "Example-Synthetic".to_string(),
53        SyntheticsTestOptions::new()
54            .accept_self_signed(false)
55            .allow_insecure(true)
56            .follow_redirects(true)
57            .min_failure_duration(10)
58            .min_location_failed(1)
59            .monitor_name("Example-Synthetic".to_string())
60            .monitor_priority(5)
61            .retry(
62                SyntheticsTestOptionsRetry::new()
63                    .count(3)
64                    .interval(10.0 as f64),
65            )
66            .tick_every(60),
67        SyntheticsAPITestType::API,
68    )
69    .subtype(SyntheticsTestDetailsSubType::UDP)
70    .tags(vec!["testing:api".to_string()]);
71    let configuration = datadog::Configuration::new();
72    let api = SyntheticsAPI::with_config(configuration);
73    let resp = api.create_synthetics_api_test(body).await;
74    if let Ok(value) = resp {
75        println!("{:#?}", value);
76    } else {
77        println!("{:#?}", resp.unwrap_err());
78    }
79}
examples/v1_synthetics_CreateSyntheticsAPITest.rs (line 83)
27async fn main() {
28    let body = SyntheticsAPITest::new(
29        SyntheticsAPITestConfig::new()
30            .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget(
31                Box::new(SyntheticsAssertionTarget::new(
32                    SyntheticsAssertionOperator::LESS_THAN,
33                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
34                        1000.0 as f64,
35                    ),
36                    SyntheticsAssertionType::RESPONSE_TIME,
37                )),
38            )])
39            .request(
40                SyntheticsTestRequest::new()
41                    .method("GET".to_string())
42                    .url("https://example.com".to_string()),
43            ),
44        vec!["aws:eu-west-3".to_string()],
45        "Notification message".to_string(),
46        "Example test name".to_string(),
47        SyntheticsTestOptions::new()
48            .ci(SyntheticsTestCiOptions::new(
49                SyntheticsTestExecutionRule::BLOCKING,
50            ))
51            .device_ids(vec!["chrome.laptop_large".to_string()])
52            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP1)
53            .monitor_options(
54                SyntheticsTestOptionsMonitorOptions::new().notification_preset_name(
55                    SyntheticsTestOptionsMonitorOptionsNotificationPresetName::SHOW_ALL,
56                ),
57            )
58            .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()])
59            .retry(SyntheticsTestOptionsRetry::new())
60            .rum_settings(
61                SyntheticsBrowserTestRumSettings::new(true)
62                    .application_id("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string())
63                    .client_token_id(12345),
64            )
65            .scheduling(SyntheticsTestOptionsScheduling::new(
66                vec![
67                    SyntheticsTestOptionsSchedulingTimeframe::new(
68                        1,
69                        "07:00".to_string(),
70                        "16:00".to_string(),
71                    ),
72                    SyntheticsTestOptionsSchedulingTimeframe::new(
73                        3,
74                        "07:00".to_string(),
75                        "16:00".to_string(),
76                    ),
77                ],
78                "America/New_York".to_string(),
79            )),
80        SyntheticsAPITestType::API,
81    )
82    .status(SyntheticsTestPauseStatus::LIVE)
83    .subtype(SyntheticsTestDetailsSubType::HTTP)
84    .tags(vec!["env:production".to_string()]);
85    let configuration = datadog::Configuration::new();
86    let api = SyntheticsAPI::with_config(configuration);
87    let resp = api.create_synthetics_api_test(body).await;
88    if let Ok(value) = resp {
89        println!("{:#?}", value);
90    } else {
91        println!("{:#?}", resp.unwrap_err());
92    }
93}
examples/v1_synthetics_CreateSyntheticsAPITest_1402674167.rs (line 74)
21async fn main() {
22    let body = SyntheticsAPITest::new(
23        SyntheticsAPITestConfig::new()
24            .assertions(vec![
25                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
26                    SyntheticsAssertionTarget::new(
27                        SyntheticsAssertionOperator::IS,
28                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
29                            1.0 as f64,
30                        ),
31                        SyntheticsAssertionType::GRPC_HEALTHCHECK_STATUS,
32                    ),
33                )),
34                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
35                    SyntheticsAssertionTarget::new(
36                        SyntheticsAssertionOperator::IS,
37                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
38                            "proto target".to_string(),
39                        ),
40                        SyntheticsAssertionType::GRPC_PROTO,
41                    ),
42                )),
43                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
44                    SyntheticsAssertionTarget::new(
45                        SyntheticsAssertionOperator::IS,
46                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
47                            "123".to_string(),
48                        ),
49                        SyntheticsAssertionType::GRPC_METADATA,
50                    )
51                    .property("property".to_string()),
52                )),
53            ])
54            .request(
55                SyntheticsTestRequest::new()
56                    .host("localhost".to_string())
57                    .message("".to_string())
58                    .metadata(BTreeMap::from([]))
59                    .method("GET".to_string())
60                    .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(50051))
61                    .service("Hello".to_string()),
62            ),
63        vec!["aws:us-east-2".to_string()],
64        "BDD test payload: synthetics_api_grpc_test_payload.json".to_string(),
65        "Example-Synthetic".to_string(),
66        SyntheticsTestOptions::new()
67            .min_failure_duration(0)
68            .min_location_failed(1)
69            .monitor_name("Example-Synthetic".to_string())
70            .monitor_options(SyntheticsTestOptionsMonitorOptions::new().renotify_interval(0))
71            .tick_every(60),
72        SyntheticsAPITestType::API,
73    )
74    .subtype(SyntheticsTestDetailsSubType::GRPC)
75    .tags(vec!["testing:api".to_string()]);
76    let configuration = datadog::Configuration::new();
77    let api = SyntheticsAPI::with_config(configuration);
78    let resp = api.create_synthetics_api_test(body).await;
79    if let Ok(value) = resp {
80        println!("{:#?}", value);
81    } else {
82        println!("{:#?}", resp.unwrap_err());
83    }
84}
examples/v1_synthetics_UpdateAPITest.rs (line 137)
31async fn main() {
32    // there is a valid "synthetics_api_test" in the system
33    let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
34    let body =
35        SyntheticsAPITest::new(
36            SyntheticsAPITestConfig::new()
37                .assertions(
38                    vec![
39                        SyntheticsAssertion::SyntheticsAssertionTarget(
40                            Box::new(
41                                SyntheticsAssertionTarget::new(
42                                    SyntheticsAssertionOperator::IS,
43                                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
44                                        "text/html".to_string(),
45                                    ),
46                                    SyntheticsAssertionType::HEADER,
47                                ).property("{{ PROPERTY }}".to_string()),
48                            ),
49                        ),
50                        SyntheticsAssertion::SyntheticsAssertionTarget(
51                            Box::new(
52                                SyntheticsAssertionTarget::new(
53                                    SyntheticsAssertionOperator::LESS_THAN,
54                                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
55                                        2000.0 as f64,
56                                    ),
57                                    SyntheticsAssertionType::RESPONSE_TIME,
58                                ),
59                            ),
60                        ),
61                        SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(
62                            Box::new(
63                                SyntheticsAssertionJSONPathTarget::new(
64                                    SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
65                                    SyntheticsAssertionType::BODY,
66                                ).target(
67                                    SyntheticsAssertionJSONPathTargetTarget::new()
68                                        .json_path("topKey".to_string())
69                                        .operator("isNot".to_string())
70                                        .target_value(
71                                            SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
72                                                "0".to_string(),
73                                            ),
74                                        ),
75                                ),
76                            ),
77                        ),
78                        SyntheticsAssertion::SyntheticsAssertionJSONSchemaTarget(
79                            Box::new(
80                                SyntheticsAssertionJSONSchemaTarget::new(
81                                    SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
82                                    SyntheticsAssertionType::BODY,
83                                ).target(
84                                    SyntheticsAssertionJSONSchemaTargetTarget::new()
85                                        .json_schema(
86                                            r#"{"type": "object", "properties":{"slideshow":{"type":"object"}}}"#.to_string(),
87                                        )
88                                        .meta_schema(SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07),
89                                ),
90                            ),
91                        )
92                    ],
93                )
94                .config_variables(
95                    vec![
96                        SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
97                            .example("content-type".to_string())
98                            .pattern("content-type".to_string())
99                    ],
100                )
101                .request(
102                    SyntheticsTestRequest::new()
103                        .certificate(
104                            SyntheticsTestRequestCertificate::new()
105                                .cert(
106                                    SyntheticsTestRequestCertificateItem::new()
107                                        .filename("cert-filename".to_string())
108                                        .updated_at("2020-10-16T09:23:24.857Z".to_string()),
109                                )
110                                .key(
111                                    SyntheticsTestRequestCertificateItem::new()
112                                        .filename("key-filename".to_string())
113                                        .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                                ),
115                        )
116                        .headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())]))
117                        .method("GET".to_string())
118                        .timeout(10.0 as f64)
119                        .url("https://datadoghq.com".to_string()),
120                ),
121            vec!["aws:us-east-2".to_string()],
122            "BDD test payload: synthetics_api_test_payload.json".to_string(),
123            "Example-Synthetic-updated".to_string(),
124            SyntheticsTestOptions::new()
125                .accept_self_signed(false)
126                .allow_insecure(true)
127                .follow_redirects(true)
128                .min_failure_duration(10)
129                .min_location_failed(1)
130                .monitor_name("Test-TestSyntheticsAPITestLifecycle-1623076664".to_string())
131                .monitor_priority(5)
132                .retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64))
133                .tick_every(60),
134            SyntheticsAPITestType::API,
135        )
136            .status(SyntheticsTestPauseStatus::LIVE)
137            .subtype(SyntheticsTestDetailsSubType::HTTP)
138            .tags(vec!["testing:api".to_string()]);
139    let configuration = datadog::Configuration::new();
140    let api = SyntheticsAPI::with_config(configuration);
141    let resp = api
142        .update_api_test(synthetics_api_test_public_id.clone(), body)
143        .await;
144    if let Ok(value) = resp {
145        println!("{:#?}", value);
146    } else {
147        println!("{:#?}", resp.unwrap_err());
148    }
149}
Source

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

Examples found in repository?
examples/v1_synthetics_CreateSyntheticsAPITest_1072503741.rs (line 50)
18async fn main() {
19    let body = SyntheticsAPITest::new(
20        SyntheticsAPITestConfig::new()
21            .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget(
22                Box::new(SyntheticsAssertionTarget::new(
23                    SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,
24                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
25                        10.0 as f64,
26                    ),
27                    SyntheticsAssertionType::CERTIFICATE,
28                )),
29            )])
30            .request(
31                SyntheticsTestRequest::new()
32                    .host("datadoghq.com".to_string())
33                    .port(
34                        SyntheticsTestRequestPort::SyntheticsTestRequestVariablePort(
35                            "{{ DATADOG_PORT }}".to_string(),
36                        ),
37                    ),
38            ),
39        vec!["aws:us-east-2".to_string()],
40        "BDD test payload: synthetics_api_ssl_test_payload.json".to_string(),
41        "Example-Synthetic".to_string(),
42        SyntheticsTestOptions::new()
43            .accept_self_signed(true)
44            .check_certificate_revocation(true)
45            .disable_aia_intermediate_fetching(true)
46            .tick_every(60),
47        SyntheticsAPITestType::API,
48    )
49    .subtype(SyntheticsTestDetailsSubType::SSL)
50    .tags(vec!["testing:api".to_string()]);
51    let configuration = datadog::Configuration::new();
52    let api = SyntheticsAPI::with_config(configuration);
53    let resp = api.create_synthetics_api_test(body).await;
54    if let Ok(value) = resp {
55        println!("{:#?}", value);
56    } else {
57        println!("{:#?}", resp.unwrap_err());
58    }
59}
More examples
Hide additional examples
examples/v1_synthetics_CreateSyntheticsAPITest_2472747642.rs (line 68)
19async fn main() {
20    let body = SyntheticsAPITest::new(
21        SyntheticsAPITestConfig::new()
22            .assertions(vec![
23                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
24                    SyntheticsAssertionTarget::new(
25                        SyntheticsAssertionOperator::IS,
26                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
27                            "message".to_string(),
28                        ),
29                        SyntheticsAssertionType::RECEIVED_MESSAGE,
30                    ),
31                )),
32                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
33                    SyntheticsAssertionTarget::new(
34                        SyntheticsAssertionOperator::LESS_THAN,
35                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
36                            2000.0 as f64,
37                        ),
38                        SyntheticsAssertionType::RESPONSE_TIME,
39                    ),
40                )),
41            ])
42            .config_variables(vec![])
43            .request(
44                SyntheticsTestRequest::new()
45                    .message("message".to_string())
46                    .url("ws://datadoghq.com".to_string()),
47            ),
48        vec!["aws:us-east-2".to_string()],
49        "BDD test payload: synthetics_api_test_websocket_payload.json".to_string(),
50        "Example-Synthetic".to_string(),
51        SyntheticsTestOptions::new()
52            .accept_self_signed(false)
53            .allow_insecure(true)
54            .follow_redirects(true)
55            .min_failure_duration(10)
56            .min_location_failed(1)
57            .monitor_name("Example-Synthetic".to_string())
58            .monitor_priority(5)
59            .retry(
60                SyntheticsTestOptionsRetry::new()
61                    .count(3)
62                    .interval(10.0 as f64),
63            )
64            .tick_every(60),
65        SyntheticsAPITestType::API,
66    )
67    .subtype(SyntheticsTestDetailsSubType::WEBSOCKET)
68    .tags(vec!["testing:api".to_string()]);
69    let configuration = datadog::Configuration::new();
70    let api = SyntheticsAPI::with_config(configuration);
71    let resp = api.create_synthetics_api_test(body).await;
72    if let Ok(value) = resp {
73        println!("{:#?}", value);
74    } else {
75        println!("{:#?}", resp.unwrap_err());
76    }
77}
examples/v1_synthetics_CreateSyntheticsAPITest_3829801148.rs (line 70)
20async fn main() {
21    let body = SyntheticsAPITest::new(
22        SyntheticsAPITestConfig::new()
23            .assertions(vec![
24                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
25                    SyntheticsAssertionTarget::new(
26                        SyntheticsAssertionOperator::IS,
27                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
28                            "message".to_string(),
29                        ),
30                        SyntheticsAssertionType::RECEIVED_MESSAGE,
31                    ),
32                )),
33                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
34                    SyntheticsAssertionTarget::new(
35                        SyntheticsAssertionOperator::LESS_THAN,
36                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
37                            2000.0 as f64,
38                        ),
39                        SyntheticsAssertionType::RESPONSE_TIME,
40                    ),
41                )),
42            ])
43            .config_variables(vec![])
44            .request(
45                SyntheticsTestRequest::new()
46                    .host("https://datadoghq.com".to_string())
47                    .message("message".to_string())
48                    .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(443)),
49            ),
50        vec!["aws:us-east-2".to_string()],
51        "BDD test payload: synthetics_api_test_udp_payload.json".to_string(),
52        "Example-Synthetic".to_string(),
53        SyntheticsTestOptions::new()
54            .accept_self_signed(false)
55            .allow_insecure(true)
56            .follow_redirects(true)
57            .min_failure_duration(10)
58            .min_location_failed(1)
59            .monitor_name("Example-Synthetic".to_string())
60            .monitor_priority(5)
61            .retry(
62                SyntheticsTestOptionsRetry::new()
63                    .count(3)
64                    .interval(10.0 as f64),
65            )
66            .tick_every(60),
67        SyntheticsAPITestType::API,
68    )
69    .subtype(SyntheticsTestDetailsSubType::UDP)
70    .tags(vec!["testing:api".to_string()]);
71    let configuration = datadog::Configuration::new();
72    let api = SyntheticsAPI::with_config(configuration);
73    let resp = api.create_synthetics_api_test(body).await;
74    if let Ok(value) = resp {
75        println!("{:#?}", value);
76    } else {
77        println!("{:#?}", resp.unwrap_err());
78    }
79}
examples/v1_synthetics_CreateSyntheticsAPITest.rs (line 84)
27async fn main() {
28    let body = SyntheticsAPITest::new(
29        SyntheticsAPITestConfig::new()
30            .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget(
31                Box::new(SyntheticsAssertionTarget::new(
32                    SyntheticsAssertionOperator::LESS_THAN,
33                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
34                        1000.0 as f64,
35                    ),
36                    SyntheticsAssertionType::RESPONSE_TIME,
37                )),
38            )])
39            .request(
40                SyntheticsTestRequest::new()
41                    .method("GET".to_string())
42                    .url("https://example.com".to_string()),
43            ),
44        vec!["aws:eu-west-3".to_string()],
45        "Notification message".to_string(),
46        "Example test name".to_string(),
47        SyntheticsTestOptions::new()
48            .ci(SyntheticsTestCiOptions::new(
49                SyntheticsTestExecutionRule::BLOCKING,
50            ))
51            .device_ids(vec!["chrome.laptop_large".to_string()])
52            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP1)
53            .monitor_options(
54                SyntheticsTestOptionsMonitorOptions::new().notification_preset_name(
55                    SyntheticsTestOptionsMonitorOptionsNotificationPresetName::SHOW_ALL,
56                ),
57            )
58            .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()])
59            .retry(SyntheticsTestOptionsRetry::new())
60            .rum_settings(
61                SyntheticsBrowserTestRumSettings::new(true)
62                    .application_id("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string())
63                    .client_token_id(12345),
64            )
65            .scheduling(SyntheticsTestOptionsScheduling::new(
66                vec![
67                    SyntheticsTestOptionsSchedulingTimeframe::new(
68                        1,
69                        "07:00".to_string(),
70                        "16:00".to_string(),
71                    ),
72                    SyntheticsTestOptionsSchedulingTimeframe::new(
73                        3,
74                        "07:00".to_string(),
75                        "16:00".to_string(),
76                    ),
77                ],
78                "America/New_York".to_string(),
79            )),
80        SyntheticsAPITestType::API,
81    )
82    .status(SyntheticsTestPauseStatus::LIVE)
83    .subtype(SyntheticsTestDetailsSubType::HTTP)
84    .tags(vec!["env:production".to_string()]);
85    let configuration = datadog::Configuration::new();
86    let api = SyntheticsAPI::with_config(configuration);
87    let resp = api.create_synthetics_api_test(body).await;
88    if let Ok(value) = resp {
89        println!("{:#?}", value);
90    } else {
91        println!("{:#?}", resp.unwrap_err());
92    }
93}
examples/v1_synthetics_CreateSyntheticsAPITest_1402674167.rs (line 75)
21async fn main() {
22    let body = SyntheticsAPITest::new(
23        SyntheticsAPITestConfig::new()
24            .assertions(vec![
25                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
26                    SyntheticsAssertionTarget::new(
27                        SyntheticsAssertionOperator::IS,
28                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
29                            1.0 as f64,
30                        ),
31                        SyntheticsAssertionType::GRPC_HEALTHCHECK_STATUS,
32                    ),
33                )),
34                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
35                    SyntheticsAssertionTarget::new(
36                        SyntheticsAssertionOperator::IS,
37                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
38                            "proto target".to_string(),
39                        ),
40                        SyntheticsAssertionType::GRPC_PROTO,
41                    ),
42                )),
43                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
44                    SyntheticsAssertionTarget::new(
45                        SyntheticsAssertionOperator::IS,
46                        SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
47                            "123".to_string(),
48                        ),
49                        SyntheticsAssertionType::GRPC_METADATA,
50                    )
51                    .property("property".to_string()),
52                )),
53            ])
54            .request(
55                SyntheticsTestRequest::new()
56                    .host("localhost".to_string())
57                    .message("".to_string())
58                    .metadata(BTreeMap::from([]))
59                    .method("GET".to_string())
60                    .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(50051))
61                    .service("Hello".to_string()),
62            ),
63        vec!["aws:us-east-2".to_string()],
64        "BDD test payload: synthetics_api_grpc_test_payload.json".to_string(),
65        "Example-Synthetic".to_string(),
66        SyntheticsTestOptions::new()
67            .min_failure_duration(0)
68            .min_location_failed(1)
69            .monitor_name("Example-Synthetic".to_string())
70            .monitor_options(SyntheticsTestOptionsMonitorOptions::new().renotify_interval(0))
71            .tick_every(60),
72        SyntheticsAPITestType::API,
73    )
74    .subtype(SyntheticsTestDetailsSubType::GRPC)
75    .tags(vec!["testing:api".to_string()]);
76    let configuration = datadog::Configuration::new();
77    let api = SyntheticsAPI::with_config(configuration);
78    let resp = api.create_synthetics_api_test(body).await;
79    if let Ok(value) = resp {
80        println!("{:#?}", value);
81    } else {
82        println!("{:#?}", resp.unwrap_err());
83    }
84}
examples/v1_synthetics_UpdateAPITest.rs (line 138)
31async fn main() {
32    // there is a valid "synthetics_api_test" in the system
33    let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
34    let body =
35        SyntheticsAPITest::new(
36            SyntheticsAPITestConfig::new()
37                .assertions(
38                    vec![
39                        SyntheticsAssertion::SyntheticsAssertionTarget(
40                            Box::new(
41                                SyntheticsAssertionTarget::new(
42                                    SyntheticsAssertionOperator::IS,
43                                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
44                                        "text/html".to_string(),
45                                    ),
46                                    SyntheticsAssertionType::HEADER,
47                                ).property("{{ PROPERTY }}".to_string()),
48                            ),
49                        ),
50                        SyntheticsAssertion::SyntheticsAssertionTarget(
51                            Box::new(
52                                SyntheticsAssertionTarget::new(
53                                    SyntheticsAssertionOperator::LESS_THAN,
54                                    SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
55                                        2000.0 as f64,
56                                    ),
57                                    SyntheticsAssertionType::RESPONSE_TIME,
58                                ),
59                            ),
60                        ),
61                        SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(
62                            Box::new(
63                                SyntheticsAssertionJSONPathTarget::new(
64                                    SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
65                                    SyntheticsAssertionType::BODY,
66                                ).target(
67                                    SyntheticsAssertionJSONPathTargetTarget::new()
68                                        .json_path("topKey".to_string())
69                                        .operator("isNot".to_string())
70                                        .target_value(
71                                            SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
72                                                "0".to_string(),
73                                            ),
74                                        ),
75                                ),
76                            ),
77                        ),
78                        SyntheticsAssertion::SyntheticsAssertionJSONSchemaTarget(
79                            Box::new(
80                                SyntheticsAssertionJSONSchemaTarget::new(
81                                    SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
82                                    SyntheticsAssertionType::BODY,
83                                ).target(
84                                    SyntheticsAssertionJSONSchemaTargetTarget::new()
85                                        .json_schema(
86                                            r#"{"type": "object", "properties":{"slideshow":{"type":"object"}}}"#.to_string(),
87                                        )
88                                        .meta_schema(SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07),
89                                ),
90                            ),
91                        )
92                    ],
93                )
94                .config_variables(
95                    vec![
96                        SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
97                            .example("content-type".to_string())
98                            .pattern("content-type".to_string())
99                    ],
100                )
101                .request(
102                    SyntheticsTestRequest::new()
103                        .certificate(
104                            SyntheticsTestRequestCertificate::new()
105                                .cert(
106                                    SyntheticsTestRequestCertificateItem::new()
107                                        .filename("cert-filename".to_string())
108                                        .updated_at("2020-10-16T09:23:24.857Z".to_string()),
109                                )
110                                .key(
111                                    SyntheticsTestRequestCertificateItem::new()
112                                        .filename("key-filename".to_string())
113                                        .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                                ),
115                        )
116                        .headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())]))
117                        .method("GET".to_string())
118                        .timeout(10.0 as f64)
119                        .url("https://datadoghq.com".to_string()),
120                ),
121            vec!["aws:us-east-2".to_string()],
122            "BDD test payload: synthetics_api_test_payload.json".to_string(),
123            "Example-Synthetic-updated".to_string(),
124            SyntheticsTestOptions::new()
125                .accept_self_signed(false)
126                .allow_insecure(true)
127                .follow_redirects(true)
128                .min_failure_duration(10)
129                .min_location_failed(1)
130                .monitor_name("Test-TestSyntheticsAPITestLifecycle-1623076664".to_string())
131                .monitor_priority(5)
132                .retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64))
133                .tick_every(60),
134            SyntheticsAPITestType::API,
135        )
136            .status(SyntheticsTestPauseStatus::LIVE)
137            .subtype(SyntheticsTestDetailsSubType::HTTP)
138            .tags(vec!["testing:api".to_string()]);
139    let configuration = datadog::Configuration::new();
140    let api = SyntheticsAPI::with_config(configuration);
141    let resp = api
142        .update_api_test(synthetics_api_test_public_id.clone(), body)
143        .await;
144    if let Ok(value) = resp {
145        println!("{:#?}", value);
146    } else {
147        println!("{:#?}", resp.unwrap_err());
148    }
149}
Source

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

Trait Implementations§

Source§

impl Clone for SyntheticsAPITest

Source§

fn clone(&self) -> SyntheticsAPITest

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 SyntheticsAPITest

Source§

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

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

impl<'de> Deserialize<'de> for SyntheticsAPITest

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 SyntheticsAPITest

Source§

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

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 SyntheticsAPITest

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,