pub struct SyntheticsAPI { /* private fields */ }
Expand description
Datadog Synthetic Monitoring uses simulated user requests and browser rendering to help you ensure uptime, identify regional issues, and track your application performance. Synthetic tests come in two different flavors, API tests and browser tests. You can use Datadog’s API to manage both test types programmatically.
For more information, see the Synthetic Monitoring documentation.
Implementations§
Source§impl SyntheticsAPI
impl SyntheticsAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
More examples
- examples/v1_synthetics_GetBrowserTest.rs
- examples/v1_synthetics_GetGlobalVariable.rs
- examples/v1_synthetics_ListTests.rs
- examples/v1_synthetics_ListTests_2779190961.rs
- examples/v1_synthetics_GetPrivateLocation.rs
- examples/v1_synthetics_GetSyntheticsCIBatch.rs
- examples/v1_synthetics_DeleteGlobalVariable.rs
- examples/v1_synthetics_DeletePrivateLocation.rs
- examples/v1_synthetics_SearchTests.rs
- examples/v1_synthetics_GetAPITestResult.rs
- examples/v1_synthetics_GetBrowserTestResult.rs
- examples/v1_synthetics_FetchUptimes.rs
- examples/v1_synthetics_GetAPITestLatestResults.rs
- examples/v1_synthetics_GetBrowserTestLatestResults.rs
- examples/v1_synthetics_ListTests_1938827783.rs
- examples/v1_synthetics_UpdateTestPauseStatus.rs
- examples/v1_synthetics_CreateGlobalVariable_3298562511.rs
- examples/v1_synthetics_GetMobileTest.rs
- examples/v1_synthetics_DeleteTests.rs
- examples/v1_synthetics_SearchTests_195957771.rs
- examples/v1_synthetics_TriggerTests.rs
- examples/v1_synthetics_UpdatePrivateLocation.rs
- examples/v1_synthetics_CreatePrivateLocation.rs
- examples/v1_synthetics_CreateGlobalVariable_3397718516.rs
- examples/v1_synthetics_GetAPITestResult_1321866518.rs
- examples/v1_synthetics_PatchTest.rs
- examples/v1_synthetics_CreateSyntheticsMobileTest.rs
- examples/v1_synthetics_CreateGlobalVariable_1068962881.rs
- examples/v1_synthetics_UpdateMobileTest.rs
- examples/v1_synthetics_TriggerCITests.rs
- examples/v1_synthetics_CreateGlobalVariable.rs
- examples/v1_synthetics_EditGlobalVariable.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_1072503741.rs
- examples/v1_synthetics_CreateSyntheticsBrowserTest.rs
- examples/v1_synthetics_CreateSyntheticsBrowserTest_2932742688.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_2472747642.rs
- examples/v1_synthetics_CreateSyntheticsBrowserTest_397420811.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_3829801148.rs
- examples/v1_synthetics_CreateSyntheticsAPITest.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_1402674167.rs
- examples/v1_synthetics_UpdateBrowserTest.rs
- examples/v1_synthetics_UpdateAPITest.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_960766374.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_1717840259.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_1487281163.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_1987645492.rs
- examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn create_global_variable(
&self,
body: SyntheticsGlobalVariableRequest,
) -> Result<SyntheticsGlobalVariable, Error<CreateGlobalVariableError>>
pub async fn create_global_variable( &self, body: SyntheticsGlobalVariableRequest, ) -> Result<SyntheticsGlobalVariable, Error<CreateGlobalVariableError>>
Create a Synthetic global variable.
Examples found in repository?
7async fn main() {
8 let body = SyntheticsGlobalVariableRequest::new(
9 "".to_string(),
10 "GLOBAL_VARIABLE_FIDO_PAYLOAD_EXAMPLESYNTHETIC".to_string(),
11 vec![],
12 )
13 .is_fido(true);
14 let configuration = datadog::Configuration::new();
15 let api = SyntheticsAPI::with_config(configuration);
16 let resp = api.create_global_variable(body).await;
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22}
More examples
10async fn main() {
11 let body = SyntheticsGlobalVariableRequest::new(
12 "".to_string(),
13 "GLOBAL_VARIABLE_TOTP_PAYLOAD_EXAMPLESYNTHETIC".to_string(),
14 vec![],
15 )
16 .is_totp(true)
17 .value(
18 SyntheticsGlobalVariableValue::new()
19 .options(
20 SyntheticsGlobalVariableOptions::new().totp_parameters(
21 SyntheticsGlobalVariableTOTPParameters::new()
22 .digits(6)
23 .refresh_interval(30),
24 ),
25 )
26 .secure(false)
27 .value("".to_string()),
28 );
29 let configuration = datadog::Configuration::new();
30 let api = SyntheticsAPI::with_config(configuration);
31 let resp = api.create_global_variable(body).await;
32 if let Ok(value) = resp {
33 println!("{:#?}", value);
34 } else {
35 println!("{:#?}", resp.unwrap_err());
36 }
37}
10async fn main() {
11 // there is a valid "synthetics_api_test_multi_step" in the system
12 let synthetics_api_test_multi_step_public_id =
13 std::env::var("SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID").unwrap();
14 let body = SyntheticsGlobalVariableRequest::new(
15 "".to_string(),
16 "GLOBAL_VARIABLE_FROM_TEST_PAYLOAD_EXAMPLESYNTHETIC".to_string(),
17 vec![],
18 )
19 .parse_test_options(
20 SyntheticsGlobalVariableParseTestOptions::new(
21 SyntheticsGlobalVariableParseTestOptionsType::LOCAL_VARIABLE,
22 )
23 .local_variable_name("EXTRACTED_VALUE".to_string()),
24 )
25 .parse_test_public_id(synthetics_api_test_multi_step_public_id.clone())
26 .value(
27 SyntheticsGlobalVariableValue::new()
28 .secure(false)
29 .value("".to_string()),
30 );
31 let configuration = datadog::Configuration::new();
32 let api = SyntheticsAPI::with_config(configuration);
33 let resp = api.create_global_variable(body).await;
34 if let Ok(value) = resp {
35 println!("{:#?}", value);
36 } else {
37 println!("{:#?}", resp.unwrap_err());
38 }
39}
13async fn main() {
14 let body = SyntheticsGlobalVariableRequest::new(
15 "Example description".to_string(),
16 "MY_VARIABLE".to_string(),
17 vec!["team:front".to_string(), "test:workflow-1".to_string()],
18 )
19 .attributes(
20 SyntheticsGlobalVariableAttributes::new()
21 .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()]),
22 )
23 .parse_test_options(
24 SyntheticsGlobalVariableParseTestOptions::new(
25 SyntheticsGlobalVariableParseTestOptionsType::HTTP_BODY,
26 )
27 .field("content-type".to_string())
28 .local_variable_name("LOCAL_VARIABLE".to_string())
29 .parser(
30 SyntheticsVariableParser::new(SyntheticsGlobalVariableParserType::REGEX)
31 .value(".*".to_string()),
32 ),
33 )
34 .parse_test_public_id("abc-def-123".to_string())
35 .value(
36 SyntheticsGlobalVariableValue::new()
37 .secure(true)
38 .value("value".to_string()),
39 );
40 let configuration = datadog::Configuration::new();
41 let api = SyntheticsAPI::with_config(configuration);
42 let resp = api.create_global_variable(body).await;
43 if let Ok(value) = resp {
44 println!("{:#?}", value);
45 } else {
46 println!("{:#?}", resp.unwrap_err());
47 }
48}
Sourcepub async fn create_global_variable_with_http_info(
&self,
body: SyntheticsGlobalVariableRequest,
) -> Result<ResponseContent<SyntheticsGlobalVariable>, Error<CreateGlobalVariableError>>
pub async fn create_global_variable_with_http_info( &self, body: SyntheticsGlobalVariableRequest, ) -> Result<ResponseContent<SyntheticsGlobalVariable>, Error<CreateGlobalVariableError>>
Create a Synthetic global variable.
Sourcepub async fn create_private_location(
&self,
body: SyntheticsPrivateLocation,
) -> Result<SyntheticsPrivateLocationCreationResponse, Error<CreatePrivateLocationError>>
pub async fn create_private_location( &self, body: SyntheticsPrivateLocation, ) -> Result<SyntheticsPrivateLocationCreationResponse, Error<CreatePrivateLocationError>>
Create a new Synthetic private location.
Examples found in repository?
8async fn main() {
9 // there is a valid "role" in the system
10 let role_data_id = std::env::var("ROLE_DATA_ID").unwrap();
11 let body = SyntheticsPrivateLocation::new(
12 "Test Example-Synthetic description".to_string(),
13 "Example-Synthetic".to_string(),
14 vec!["test:examplesynthetic".to_string()],
15 )
16 .metadata(
17 SyntheticsPrivateLocationMetadata::new().restricted_roles(vec![role_data_id.clone()]),
18 );
19 let configuration = datadog::Configuration::new();
20 let api = SyntheticsAPI::with_config(configuration);
21 let resp = api.create_private_location(body).await;
22 if let Ok(value) = resp {
23 println!("{:#?}", value);
24 } else {
25 println!("{:#?}", resp.unwrap_err());
26 }
27}
Sourcepub async fn create_private_location_with_http_info(
&self,
body: SyntheticsPrivateLocation,
) -> Result<ResponseContent<SyntheticsPrivateLocationCreationResponse>, Error<CreatePrivateLocationError>>
pub async fn create_private_location_with_http_info( &self, body: SyntheticsPrivateLocation, ) -> Result<ResponseContent<SyntheticsPrivateLocationCreationResponse>, Error<CreatePrivateLocationError>>
Create a new Synthetic private location.
Sourcepub async fn create_synthetics_api_test(
&self,
body: SyntheticsAPITest,
) -> Result<SyntheticsAPITest, Error<CreateSyntheticsAPITestError>>
pub async fn create_synthetics_api_test( &self, body: SyntheticsAPITest, ) -> Result<SyntheticsAPITest, Error<CreateSyntheticsAPITestError>>
Create a Synthetic API test.
Examples found in repository?
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 .tick_every(60),
46 SyntheticsAPITestType::API,
47 )
48 .subtype(SyntheticsTestDetailsSubType::SSL)
49 .tags(vec!["testing:api".to_string()]);
50 let configuration = datadog::Configuration::new();
51 let api = SyntheticsAPI::with_config(configuration);
52 let resp = api.create_synthetics_api_test(body).await;
53 if let Ok(value) = resp {
54 println!("{:#?}", value);
55 } else {
56 println!("{:#?}", resp.unwrap_err());
57 }
58}
More examples
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}
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}
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}
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}
39async fn main() {
40 let body =
41 SyntheticsAPITest::new(
42 SyntheticsAPITestConfig::new()
43 .assertions(
44 vec![
45 SyntheticsAssertion::SyntheticsAssertionTarget(
46 Box::new(
47 SyntheticsAssertionTarget::new(
48 SyntheticsAssertionOperator::IS,
49 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
50 "text/html".to_string(),
51 ),
52 SyntheticsAssertionType::HEADER,
53 ).property("{{ PROPERTY }}".to_string()),
54 ),
55 ),
56 SyntheticsAssertion::SyntheticsAssertionTarget(
57 Box::new(
58 SyntheticsAssertionTarget::new(
59 SyntheticsAssertionOperator::LESS_THAN,
60 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
61 2000.0 as f64,
62 ),
63 SyntheticsAssertionType::RESPONSE_TIME,
64 ).timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS),
65 ),
66 ),
67 SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(
68 Box::new(
69 SyntheticsAssertionJSONPathTarget::new(
70 SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
71 SyntheticsAssertionType::BODY,
72 ).target(
73 SyntheticsAssertionJSONPathTargetTarget::new()
74 .json_path("topKey".to_string())
75 .operator("isNot".to_string())
76 .target_value(
77 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
78 "0".to_string(),
79 ),
80 ),
81 ),
82 ),
83 ),
84 SyntheticsAssertion::SyntheticsAssertionXPathTarget(
85 Box::new(
86 SyntheticsAssertionXPathTarget::new(
87 SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
88 SyntheticsAssertionType::BODY,
89 ).target(
90 SyntheticsAssertionXPathTargetTarget::new()
91 .operator("contains".to_string())
92 .target_value(
93 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
94 "0".to_string(),
95 ),
96 )
97 .x_path("target-xpath".to_string()),
98 ),
99 ),
100 )
101 ],
102 )
103 .config_variables(
104 vec![
105 SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
106 .example("content-type".to_string())
107 .pattern("content-type".to_string())
108 ],
109 )
110 .request(
111 SyntheticsTestRequest::new()
112 .basic_auth(
113 SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
114 Box::new(
115 SyntheticsBasicAuthOauthClient::new(
116 "https://datadog-token.com".to_string(),
117 "client-id".to_string(),
118 "client-secret".to_string(),
119 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
120 SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
121 )
122 .audience("audience".to_string())
123 .resource("resource".to_string())
124 .scope("yoyo".to_string()),
125 ),
126 ),
127 )
128 .body_type(SyntheticsTestRequestBodyType::APPLICATION_OCTET_STREAM)
129 .certificate(
130 SyntheticsTestRequestCertificate::new()
131 .cert(
132 SyntheticsTestRequestCertificateItem::new()
133 .content("cert-content".to_string())
134 .filename("cert-filename".to_string())
135 .updated_at("2020-10-16T09:23:24.857Z".to_string()),
136 )
137 .key(
138 SyntheticsTestRequestCertificateItem::new()
139 .content("key-content".to_string())
140 .filename("key-filename".to_string())
141 .updated_at("2020-10-16T09:23:24.857Z".to_string()),
142 ),
143 )
144 .files(
145 vec![
146 SyntheticsTestRequestBodyFile::new()
147 .content("file content".to_string())
148 .name("file name".to_string())
149 .original_file_name("image.png".to_string())
150 .type_("file type".to_string())
151 ],
152 )
153 .headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())]))
154 .method("GET".to_string())
155 .persist_cookies(true)
156 .proxy(
157 SyntheticsTestRequestProxy::new(
158 "https://datadoghq.com".to_string(),
159 ).headers(BTreeMap::from([])),
160 )
161 .timeout(10.0 as f64)
162 .url("https://datadoghq.com".to_string()),
163 ),
164 vec!["aws:us-east-2".to_string()],
165 "BDD test payload: synthetics_api_http_test_payload.json".to_string(),
166 "Example-Synthetic".to_string(),
167 SyntheticsTestOptions::new()
168 .accept_self_signed(false)
169 .allow_insecure(true)
170 .follow_redirects(true)
171 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
172 .min_failure_duration(10)
173 .min_location_failed(1)
174 .monitor_name("Example-Synthetic".to_string())
175 .monitor_priority(5)
176 .retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64))
177 .tick_every(60),
178 SyntheticsAPITestType::API,
179 )
180 .subtype(SyntheticsTestDetailsSubType::HTTP)
181 .tags(vec!["testing:api".to_string()]);
182 let configuration = datadog::Configuration::new();
183 let api = SyntheticsAPI::with_config(configuration);
184 let resp = api.create_synthetics_api_test(body).await;
185 if let Ok(value) = resp {
186 println!("{:#?}", value);
187 } else {
188 println!("{:#?}", resp.unwrap_err());
189 }
190}
Sourcepub async fn create_synthetics_api_test_with_http_info(
&self,
body: SyntheticsAPITest,
) -> Result<ResponseContent<SyntheticsAPITest>, Error<CreateSyntheticsAPITestError>>
pub async fn create_synthetics_api_test_with_http_info( &self, body: SyntheticsAPITest, ) -> Result<ResponseContent<SyntheticsAPITest>, Error<CreateSyntheticsAPITestError>>
Create a Synthetic API test.
Sourcepub async fn create_synthetics_browser_test(
&self,
body: SyntheticsBrowserTest,
) -> Result<SyntheticsBrowserTest, Error<CreateSyntheticsBrowserTestError>>
pub async fn create_synthetics_browser_test( &self, body: SyntheticsBrowserTest, ) -> Result<SyntheticsBrowserTest, Error<CreateSyntheticsBrowserTestError>>
Create a Synthetic browser test.
Examples found in repository?
19async fn main() {
20 let body = SyntheticsBrowserTest::new(
21 SyntheticsBrowserTestConfig::new(
22 vec![],
23 SyntheticsTestRequest::new()
24 .method("GET".to_string())
25 .url("https://datadoghq.com".to_string()),
26 )
27 .config_variables(vec![SyntheticsConfigVariable::new(
28 "PROPERTY".to_string(),
29 SyntheticsConfigVariableType::TEXT,
30 )
31 .example("content-type".to_string())
32 .pattern("content-type".to_string())
33 .secure(true)])
34 .set_cookie("name:test".to_string())
35 .variables(vec![SyntheticsBrowserVariable::new(
36 "TEST_VARIABLE".to_string(),
37 SyntheticsBrowserVariableType::TEXT,
38 )
39 .example("secret".to_string())
40 .pattern("secret".to_string())
41 .secure(true)]),
42 vec!["aws:us-east-2".to_string()],
43 "Test message".to_string(),
44 "Example-Synthetic".to_string(),
45 SyntheticsTestOptions::new()
46 .accept_self_signed(false)
47 .allow_insecure(true)
48 .device_ids(vec!["chrome.laptop_large".to_string()])
49 .disable_cors(true)
50 .enable_profiling(true)
51 .enable_security_testing(true)
52 .follow_redirects(true)
53 .min_failure_duration(10)
54 .min_location_failed(1)
55 .no_screenshot(true)
56 .retry(
57 SyntheticsTestOptionsRetry::new()
58 .count(2)
59 .interval(10.0 as f64),
60 )
61 .tick_every(300),
62 SyntheticsBrowserTestType::BROWSER,
63 )
64 .steps(vec![SyntheticsStep::new()
65 .allow_failure(false)
66 .always_execute(true)
67 .exit_if_succeed(true)
68 .is_critical(true)
69 .name("Refresh page".to_string())
70 .params(BTreeMap::new())
71 .type_(SyntheticsStepType::REFRESH)])
72 .tags(vec!["testing:browser".to_string()]);
73 let configuration = datadog::Configuration::new();
74 let api = SyntheticsAPI::with_config(configuration);
75 let resp = api.create_synthetics_browser_test(body).await;
76 if let Ok(value) = resp {
77 println!("{:#?}", value);
78 } else {
79 println!("{:#?}", resp.unwrap_err());
80 }
81}
More examples
20async fn main() {
21 let body = SyntheticsBrowserTest::new(
22 SyntheticsBrowserTestConfig::new(
23 vec![],
24 SyntheticsTestRequest::new()
25 .certificate_domains(vec!["https://datadoghq.com".to_string()])
26 .method("GET".to_string())
27 .url("https://datadoghq.com".to_string()),
28 )
29 .config_variables(vec![SyntheticsConfigVariable::new(
30 "PROPERTY".to_string(),
31 SyntheticsConfigVariableType::TEXT,
32 )
33 .example("content-type".to_string())
34 .pattern("content-type".to_string())])
35 .set_cookie("name:test".to_string()),
36 vec!["aws:us-east-2".to_string()],
37 "Test message".to_string(),
38 "Example-Synthetic".to_string(),
39 SyntheticsTestOptions::new()
40 .accept_self_signed(false)
41 .allow_insecure(true)
42 .ci(SyntheticsTestCiOptions::new(
43 SyntheticsTestExecutionRule::SKIPPED,
44 ))
45 .device_ids(vec!["tablet".to_string()])
46 .disable_cors(true)
47 .disable_csp(true)
48 .follow_redirects(true)
49 .ignore_server_certificate_error(true)
50 .initial_navigation_timeout(200)
51 .min_failure_duration(10)
52 .min_location_failed(1)
53 .no_screenshot(true)
54 .retry(
55 SyntheticsTestOptionsRetry::new()
56 .count(2)
57 .interval(10.0 as f64),
58 )
59 .rum_settings(
60 SyntheticsBrowserTestRumSettings::new(true)
61 .application_id("mockApplicationId".to_string())
62 .client_token_id(12345),
63 )
64 .tick_every(300),
65 SyntheticsBrowserTestType::BROWSER,
66 )
67 .steps(vec![SyntheticsStep::new()
68 .allow_failure(false)
69 .is_critical(true)
70 .name("Refresh page".to_string())
71 .params(BTreeMap::new())
72 .type_(SyntheticsStepType::REFRESH)])
73 .tags(vec!["testing:browser".to_string()]);
74 let configuration = datadog::Configuration::new();
75 let api = SyntheticsAPI::with_config(configuration);
76 let resp = api.create_synthetics_browser_test(body).await;
77 if let Ok(value) = resp {
78 println!("{:#?}", value);
79 } else {
80 println!("{:#?}", resp.unwrap_err());
81 }
82}
20async fn main() {
21 let body = SyntheticsBrowserTest::new(
22 SyntheticsBrowserTestConfig::new(
23 vec![],
24 SyntheticsTestRequest::new()
25 .method("GET".to_string())
26 .url("https://datadoghq.com".to_string()),
27 )
28 .config_variables(vec![SyntheticsConfigVariable::new(
29 "PROPERTY".to_string(),
30 SyntheticsConfigVariableType::TEXT,
31 )
32 .example("content-type".to_string())
33 .pattern("content-type".to_string())])
34 .set_cookie("name:test".to_string()),
35 vec!["aws:us-east-2".to_string()],
36 "Test message".to_string(),
37 "Example-Synthetic".to_string(),
38 SyntheticsTestOptions::new()
39 .accept_self_signed(false)
40 .allow_insecure(true)
41 .device_ids(vec!["tablet".to_string()])
42 .disable_cors(true)
43 .follow_redirects(true)
44 .min_failure_duration(10)
45 .min_location_failed(1)
46 .no_screenshot(true)
47 .retry(
48 SyntheticsTestOptionsRetry::new()
49 .count(2)
50 .interval(10.0 as f64),
51 )
52 .scheduling(SyntheticsTestOptionsScheduling::new(
53 vec![
54 SyntheticsTestOptionsSchedulingTimeframe::new(
55 1,
56 "07:00".to_string(),
57 "16:00".to_string(),
58 ),
59 SyntheticsTestOptionsSchedulingTimeframe::new(
60 3,
61 "07:00".to_string(),
62 "16:00".to_string(),
63 ),
64 ],
65 "America/New_York".to_string(),
66 ))
67 .tick_every(300),
68 SyntheticsBrowserTestType::BROWSER,
69 )
70 .steps(vec![SyntheticsStep::new()
71 .allow_failure(false)
72 .is_critical(true)
73 .name("Refresh page".to_string())
74 .params(BTreeMap::new())
75 .type_(SyntheticsStepType::REFRESH)])
76 .tags(vec!["testing:browser".to_string()]);
77 let configuration = datadog::Configuration::new();
78 let api = SyntheticsAPI::with_config(configuration);
79 let resp = api.create_synthetics_browser_test(body).await;
80 if let Ok(value) = resp {
81 println!("{:#?}", value);
82 } else {
83 println!("{:#?}", resp.unwrap_err());
84 }
85}
Sourcepub async fn create_synthetics_browser_test_with_http_info(
&self,
body: SyntheticsBrowserTest,
) -> Result<ResponseContent<SyntheticsBrowserTest>, Error<CreateSyntheticsBrowserTestError>>
pub async fn create_synthetics_browser_test_with_http_info( &self, body: SyntheticsBrowserTest, ) -> Result<ResponseContent<SyntheticsBrowserTest>, Error<CreateSyntheticsBrowserTestError>>
Create a Synthetic browser test.
Sourcepub async fn create_synthetics_mobile_test(
&self,
body: SyntheticsMobileTest,
) -> Result<SyntheticsMobileTest, Error<CreateSyntheticsMobileTestError>>
pub async fn create_synthetics_mobile_test( &self, body: SyntheticsMobileTest, ) -> Result<SyntheticsMobileTest, Error<CreateSyntheticsMobileTestError>>
Create a Synthetic mobile test.
Examples found in repository?
13async fn main() {
14 let body = SyntheticsMobileTest::new(
15 SyntheticsMobileTestConfig::new().variables(vec![]),
16 "".to_string(),
17 "Example-Synthetic".to_string(),
18 SyntheticsMobileTestOptions::new(
19 vec!["synthetics:mobile:device:iphone_15_ios_17".to_string()],
20 SyntheticsMobileTestsMobileApplication::new(
21 "ab0e0aed-536d-411a-9a99-5428c27d8f8e".to_string(),
22 "6115922a-5f5d-455e-bc7e-7955a57f3815".to_string(),
23 SyntheticsMobileTestsMobileApplicationReferenceType::VERSION,
24 ),
25 3600,
26 ),
27 SyntheticsMobileTestType::MOBILE,
28 )
29 .status(SyntheticsTestPauseStatus::PAUSED)
30 .steps(vec![]);
31 let configuration = datadog::Configuration::new();
32 let api = SyntheticsAPI::with_config(configuration);
33 let resp = api.create_synthetics_mobile_test(body).await;
34 if let Ok(value) = resp {
35 println!("{:#?}", value);
36 } else {
37 println!("{:#?}", resp.unwrap_err());
38 }
39}
Sourcepub async fn create_synthetics_mobile_test_with_http_info(
&self,
body: SyntheticsMobileTest,
) -> Result<ResponseContent<SyntheticsMobileTest>, Error<CreateSyntheticsMobileTestError>>
pub async fn create_synthetics_mobile_test_with_http_info( &self, body: SyntheticsMobileTest, ) -> Result<ResponseContent<SyntheticsMobileTest>, Error<CreateSyntheticsMobileTestError>>
Create a Synthetic mobile test.
Sourcepub async fn delete_global_variable(
&self,
variable_id: String,
) -> Result<(), Error<DeleteGlobalVariableError>>
pub async fn delete_global_variable( &self, variable_id: String, ) -> Result<(), Error<DeleteGlobalVariableError>>
Delete a Synthetic global variable.
Sourcepub async fn delete_global_variable_with_http_info(
&self,
variable_id: String,
) -> Result<ResponseContent<()>, Error<DeleteGlobalVariableError>>
pub async fn delete_global_variable_with_http_info( &self, variable_id: String, ) -> Result<ResponseContent<()>, Error<DeleteGlobalVariableError>>
Delete a Synthetic global variable.
Sourcepub async fn delete_private_location(
&self,
location_id: String,
) -> Result<(), Error<DeletePrivateLocationError>>
pub async fn delete_private_location( &self, location_id: String, ) -> Result<(), Error<DeletePrivateLocationError>>
Delete a Synthetic private location.
Sourcepub async fn delete_private_location_with_http_info(
&self,
location_id: String,
) -> Result<ResponseContent<()>, Error<DeletePrivateLocationError>>
pub async fn delete_private_location_with_http_info( &self, location_id: String, ) -> Result<ResponseContent<()>, Error<DeletePrivateLocationError>>
Delete a Synthetic private location.
Sourcepub async fn delete_tests(
&self,
body: SyntheticsDeleteTestsPayload,
) -> Result<SyntheticsDeleteTestsResponse, Error<DeleteTestsError>>
pub async fn delete_tests( &self, body: SyntheticsDeleteTestsPayload, ) -> Result<SyntheticsDeleteTestsResponse, Error<DeleteTestsError>>
Delete multiple Synthetic tests by ID.
Examples found in repository?
7async fn main() {
8 // there is a valid "synthetics_api_test" in the system
9 let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
10 let body =
11 SyntheticsDeleteTestsPayload::new().public_ids(vec![synthetics_api_test_public_id.clone()]);
12 let configuration = datadog::Configuration::new();
13 let api = SyntheticsAPI::with_config(configuration);
14 let resp = api.delete_tests(body).await;
15 if let Ok(value) = resp {
16 println!("{:#?}", value);
17 } else {
18 println!("{:#?}", resp.unwrap_err());
19 }
20}
Sourcepub async fn delete_tests_with_http_info(
&self,
body: SyntheticsDeleteTestsPayload,
) -> Result<ResponseContent<SyntheticsDeleteTestsResponse>, Error<DeleteTestsError>>
pub async fn delete_tests_with_http_info( &self, body: SyntheticsDeleteTestsPayload, ) -> Result<ResponseContent<SyntheticsDeleteTestsResponse>, Error<DeleteTestsError>>
Delete multiple Synthetic tests by ID.
Sourcepub async fn edit_global_variable(
&self,
variable_id: String,
body: SyntheticsGlobalVariableRequest,
) -> Result<SyntheticsGlobalVariable, Error<EditGlobalVariableError>>
pub async fn edit_global_variable( &self, variable_id: String, body: SyntheticsGlobalVariableRequest, ) -> Result<SyntheticsGlobalVariable, Error<EditGlobalVariableError>>
Edit a Synthetic global variable.
Examples found in repository?
13async fn main() {
14 let body = SyntheticsGlobalVariableRequest::new(
15 "Example description".to_string(),
16 "MY_VARIABLE".to_string(),
17 vec!["team:front".to_string(), "test:workflow-1".to_string()],
18 )
19 .attributes(
20 SyntheticsGlobalVariableAttributes::new()
21 .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()]),
22 )
23 .parse_test_options(
24 SyntheticsGlobalVariableParseTestOptions::new(
25 SyntheticsGlobalVariableParseTestOptionsType::HTTP_BODY,
26 )
27 .field("content-type".to_string())
28 .local_variable_name("LOCAL_VARIABLE".to_string())
29 .parser(
30 SyntheticsVariableParser::new(SyntheticsGlobalVariableParserType::REGEX)
31 .value(".*".to_string()),
32 ),
33 )
34 .parse_test_public_id("abc-def-123".to_string())
35 .value(
36 SyntheticsGlobalVariableValue::new()
37 .secure(true)
38 .value("value".to_string()),
39 );
40 let configuration = datadog::Configuration::new();
41 let api = SyntheticsAPI::with_config(configuration);
42 let resp = api
43 .edit_global_variable("variable_id".to_string(), body)
44 .await;
45 if let Ok(value) = resp {
46 println!("{:#?}", value);
47 } else {
48 println!("{:#?}", resp.unwrap_err());
49 }
50}
Sourcepub async fn edit_global_variable_with_http_info(
&self,
variable_id: String,
body: SyntheticsGlobalVariableRequest,
) -> Result<ResponseContent<SyntheticsGlobalVariable>, Error<EditGlobalVariableError>>
pub async fn edit_global_variable_with_http_info( &self, variable_id: String, body: SyntheticsGlobalVariableRequest, ) -> Result<ResponseContent<SyntheticsGlobalVariable>, Error<EditGlobalVariableError>>
Edit a Synthetic global variable.
Sourcepub async fn fetch_uptimes(
&self,
body: SyntheticsFetchUptimesPayload,
) -> Result<Vec<SyntheticsTestUptime>, Error<FetchUptimesError>>
pub async fn fetch_uptimes( &self, body: SyntheticsFetchUptimesPayload, ) -> Result<Vec<SyntheticsTestUptime>, Error<FetchUptimesError>>
Fetch uptime for multiple Synthetic tests by ID.
Examples found in repository?
7async fn main() {
8 let body =
9 SyntheticsFetchUptimesPayload::new(1726041488, vec!["p8m-9gw-nte".to_string()], 1726055954);
10 let configuration = datadog::Configuration::new();
11 let api = SyntheticsAPI::with_config(configuration);
12 let resp = api.fetch_uptimes(body).await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
Sourcepub async fn fetch_uptimes_with_http_info(
&self,
body: SyntheticsFetchUptimesPayload,
) -> Result<ResponseContent<Vec<SyntheticsTestUptime>>, Error<FetchUptimesError>>
pub async fn fetch_uptimes_with_http_info( &self, body: SyntheticsFetchUptimesPayload, ) -> Result<ResponseContent<Vec<SyntheticsTestUptime>>, Error<FetchUptimesError>>
Fetch uptime for multiple Synthetic tests by ID.
Sourcepub async fn get_api_test(
&self,
public_id: String,
) -> Result<SyntheticsAPITest, Error<GetAPITestError>>
pub async fn get_api_test( &self, public_id: String, ) -> Result<SyntheticsAPITest, Error<GetAPITestError>>
Get the detailed configuration associated with a Synthetic API test.
Sourcepub async fn get_api_test_with_http_info(
&self,
public_id: String,
) -> Result<ResponseContent<SyntheticsAPITest>, Error<GetAPITestError>>
pub async fn get_api_test_with_http_info( &self, public_id: String, ) -> Result<ResponseContent<SyntheticsAPITest>, Error<GetAPITestError>>
Get the detailed configuration associated with a Synthetic API test.
Sourcepub async fn get_api_test_latest_results(
&self,
public_id: String,
params: GetAPITestLatestResultsOptionalParams,
) -> Result<SyntheticsGetAPITestLatestResultsResponse, Error<GetAPITestLatestResultsError>>
pub async fn get_api_test_latest_results( &self, public_id: String, params: GetAPITestLatestResultsOptionalParams, ) -> Result<SyntheticsGetAPITestLatestResultsResponse, Error<GetAPITestLatestResultsError>>
Get the last 150 test results summaries for a given Synthetic API test.
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = SyntheticsAPI::with_config(configuration);
10 let resp = api
11 .get_api_test_latest_results(
12 "hwb-332-3xe".to_string(),
13 GetAPITestLatestResultsOptionalParams::default(),
14 )
15 .await;
16 if let Ok(value) = resp {
17 println!("{:#?}", value);
18 } else {
19 println!("{:#?}", resp.unwrap_err());
20 }
21}
Sourcepub async fn get_api_test_latest_results_with_http_info(
&self,
public_id: String,
params: GetAPITestLatestResultsOptionalParams,
) -> Result<ResponseContent<SyntheticsGetAPITestLatestResultsResponse>, Error<GetAPITestLatestResultsError>>
pub async fn get_api_test_latest_results_with_http_info( &self, public_id: String, params: GetAPITestLatestResultsOptionalParams, ) -> Result<ResponseContent<SyntheticsGetAPITestLatestResultsResponse>, Error<GetAPITestLatestResultsError>>
Get the last 150 test results summaries for a given Synthetic API test.
Sourcepub async fn get_api_test_result(
&self,
public_id: String,
result_id: String,
) -> Result<SyntheticsAPITestResultFull, Error<GetAPITestResultError>>
pub async fn get_api_test_result( &self, public_id: String, result_id: String, ) -> Result<SyntheticsAPITestResultFull, Error<GetAPITestResultError>>
Get a specific full result from a given Synthetic API test.
Examples found in repository?
6async fn main() {
7 let configuration = datadog::Configuration::new();
8 let api = SyntheticsAPI::with_config(configuration);
9 let resp = api
10 .get_api_test_result("hwb-332-3xe".to_string(), "3420446318379485707".to_string())
11 .await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
More examples
6async fn main() {
7 // there is a "synthetics_api_test_with_wrong_dns" in the system
8 let synthetics_api_test_with_wrong_dns_public_id =
9 std::env::var("SYNTHETICS_API_TEST_WITH_WRONG_DNS_PUBLIC_ID").unwrap();
10
11 // the "synthetics_api_test_with_wrong_dns" is triggered
12 let synthetics_api_test_with_wrong_dns_result_results_0_result_id =
13 std::env::var("SYNTHETICS_API_TEST_WITH_WRONG_DNS_RESULT_RESULTS_0_RESULT_ID").unwrap();
14 let configuration = datadog::Configuration::new();
15 let api = SyntheticsAPI::with_config(configuration);
16 let resp = api
17 .get_api_test_result(
18 synthetics_api_test_with_wrong_dns_public_id.clone(),
19 synthetics_api_test_with_wrong_dns_result_results_0_result_id.clone(),
20 )
21 .await;
22 if let Ok(value) = resp {
23 println!("{:#?}", value);
24 } else {
25 println!("{:#?}", resp.unwrap_err());
26 }
27}
Sourcepub async fn get_api_test_result_with_http_info(
&self,
public_id: String,
result_id: String,
) -> Result<ResponseContent<SyntheticsAPITestResultFull>, Error<GetAPITestResultError>>
pub async fn get_api_test_result_with_http_info( &self, public_id: String, result_id: String, ) -> Result<ResponseContent<SyntheticsAPITestResultFull>, Error<GetAPITestResultError>>
Get a specific full result from a given Synthetic API test.
Sourcepub async fn get_browser_test(
&self,
public_id: String,
) -> Result<SyntheticsBrowserTest, Error<GetBrowserTestError>>
pub async fn get_browser_test( &self, public_id: String, ) -> Result<SyntheticsBrowserTest, Error<GetBrowserTestError>>
Get the detailed configuration (including steps) associated with a Synthetic browser test.
Sourcepub async fn get_browser_test_with_http_info(
&self,
public_id: String,
) -> Result<ResponseContent<SyntheticsBrowserTest>, Error<GetBrowserTestError>>
pub async fn get_browser_test_with_http_info( &self, public_id: String, ) -> Result<ResponseContent<SyntheticsBrowserTest>, Error<GetBrowserTestError>>
Get the detailed configuration (including steps) associated with a Synthetic browser test.
Sourcepub async fn get_browser_test_latest_results(
&self,
public_id: String,
params: GetBrowserTestLatestResultsOptionalParams,
) -> Result<SyntheticsGetBrowserTestLatestResultsResponse, Error<GetBrowserTestLatestResultsError>>
pub async fn get_browser_test_latest_results( &self, public_id: String, params: GetBrowserTestLatestResultsOptionalParams, ) -> Result<SyntheticsGetBrowserTestLatestResultsResponse, Error<GetBrowserTestLatestResultsError>>
Get the last 150 test results summaries for a given Synthetic browser test.
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = SyntheticsAPI::with_config(configuration);
10 let resp = api
11 .get_browser_test_latest_results(
12 "2yy-sem-mjh".to_string(),
13 GetBrowserTestLatestResultsOptionalParams::default(),
14 )
15 .await;
16 if let Ok(value) = resp {
17 println!("{:#?}", value);
18 } else {
19 println!("{:#?}", resp.unwrap_err());
20 }
21}
Sourcepub async fn get_browser_test_latest_results_with_http_info(
&self,
public_id: String,
params: GetBrowserTestLatestResultsOptionalParams,
) -> Result<ResponseContent<SyntheticsGetBrowserTestLatestResultsResponse>, Error<GetBrowserTestLatestResultsError>>
pub async fn get_browser_test_latest_results_with_http_info( &self, public_id: String, params: GetBrowserTestLatestResultsOptionalParams, ) -> Result<ResponseContent<SyntheticsGetBrowserTestLatestResultsResponse>, Error<GetBrowserTestLatestResultsError>>
Get the last 150 test results summaries for a given Synthetic browser test.
Sourcepub async fn get_browser_test_result(
&self,
public_id: String,
result_id: String,
) -> Result<SyntheticsBrowserTestResultFull, Error<GetBrowserTestResultError>>
pub async fn get_browser_test_result( &self, public_id: String, result_id: String, ) -> Result<SyntheticsBrowserTestResultFull, Error<GetBrowserTestResultError>>
Get a specific full result from a given Synthetic browser test.
Examples found in repository?
6async fn main() {
7 let configuration = datadog::Configuration::new();
8 let api = SyntheticsAPI::with_config(configuration);
9 let resp = api
10 .get_browser_test_result("2yy-sem-mjh".to_string(), "5671719892074090418".to_string())
11 .await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
Sourcepub async fn get_browser_test_result_with_http_info(
&self,
public_id: String,
result_id: String,
) -> Result<ResponseContent<SyntheticsBrowserTestResultFull>, Error<GetBrowserTestResultError>>
pub async fn get_browser_test_result_with_http_info( &self, public_id: String, result_id: String, ) -> Result<ResponseContent<SyntheticsBrowserTestResultFull>, Error<GetBrowserTestResultError>>
Get a specific full result from a given Synthetic browser test.
Sourcepub async fn get_global_variable(
&self,
variable_id: String,
) -> Result<SyntheticsGlobalVariable, Error<GetGlobalVariableError>>
pub async fn get_global_variable( &self, variable_id: String, ) -> Result<SyntheticsGlobalVariable, Error<GetGlobalVariableError>>
Get the detailed configuration of a global variable.
Sourcepub async fn get_global_variable_with_http_info(
&self,
variable_id: String,
) -> Result<ResponseContent<SyntheticsGlobalVariable>, Error<GetGlobalVariableError>>
pub async fn get_global_variable_with_http_info( &self, variable_id: String, ) -> Result<ResponseContent<SyntheticsGlobalVariable>, Error<GetGlobalVariableError>>
Get the detailed configuration of a global variable.
Sourcepub async fn get_mobile_test(
&self,
public_id: String,
) -> Result<SyntheticsMobileTest, Error<GetMobileTestError>>
pub async fn get_mobile_test( &self, public_id: String, ) -> Result<SyntheticsMobileTest, Error<GetMobileTestError>>
Get the detailed configuration associated with a Synthetic Mobile test.
Examples found in repository?
6async fn main() {
7 // there is a valid "synthetics_mobile_test" in the system
8 let synthetics_mobile_test_public_id =
9 std::env::var("SYNTHETICS_MOBILE_TEST_PUBLIC_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = SyntheticsAPI::with_config(configuration);
12 let resp = api
13 .get_mobile_test(synthetics_mobile_test_public_id.clone())
14 .await;
15 if let Ok(value) = resp {
16 println!("{:#?}", value);
17 } else {
18 println!("{:#?}", resp.unwrap_err());
19 }
20}
Sourcepub async fn get_mobile_test_with_http_info(
&self,
public_id: String,
) -> Result<ResponseContent<SyntheticsMobileTest>, Error<GetMobileTestError>>
pub async fn get_mobile_test_with_http_info( &self, public_id: String, ) -> Result<ResponseContent<SyntheticsMobileTest>, Error<GetMobileTestError>>
Get the detailed configuration associated with a Synthetic Mobile test.
Sourcepub async fn get_private_location(
&self,
location_id: String,
) -> Result<SyntheticsPrivateLocation, Error<GetPrivateLocationError>>
pub async fn get_private_location( &self, location_id: String, ) -> Result<SyntheticsPrivateLocation, Error<GetPrivateLocationError>>
Get a Synthetic private location.
Sourcepub async fn get_private_location_with_http_info(
&self,
location_id: String,
) -> Result<ResponseContent<SyntheticsPrivateLocation>, Error<GetPrivateLocationError>>
pub async fn get_private_location_with_http_info( &self, location_id: String, ) -> Result<ResponseContent<SyntheticsPrivateLocation>, Error<GetPrivateLocationError>>
Get a Synthetic private location.
Sourcepub async fn get_synthetics_ci_batch(
&self,
batch_id: String,
) -> Result<SyntheticsBatchDetails, Error<GetSyntheticsCIBatchError>>
pub async fn get_synthetics_ci_batch( &self, batch_id: String, ) -> Result<SyntheticsBatchDetails, Error<GetSyntheticsCIBatchError>>
Get a batch’s updated details.
Sourcepub async fn get_synthetics_ci_batch_with_http_info(
&self,
batch_id: String,
) -> Result<ResponseContent<SyntheticsBatchDetails>, Error<GetSyntheticsCIBatchError>>
pub async fn get_synthetics_ci_batch_with_http_info( &self, batch_id: String, ) -> Result<ResponseContent<SyntheticsBatchDetails>, Error<GetSyntheticsCIBatchError>>
Get a batch’s updated details.
Sourcepub async fn get_synthetics_default_locations(
&self,
) -> Result<Vec<String>, Error<GetSyntheticsDefaultLocationsError>>
pub async fn get_synthetics_default_locations( &self, ) -> Result<Vec<String>, Error<GetSyntheticsDefaultLocationsError>>
Get the default locations settings.
Examples found in repository?
More examples
Sourcepub async fn get_synthetics_default_locations_with_http_info(
&self,
) -> Result<ResponseContent<Vec<String>>, Error<GetSyntheticsDefaultLocationsError>>
pub async fn get_synthetics_default_locations_with_http_info( &self, ) -> Result<ResponseContent<Vec<String>>, Error<GetSyntheticsDefaultLocationsError>>
Get the default locations settings.
Sourcepub async fn get_test(
&self,
public_id: String,
) -> Result<SyntheticsTestDetails, Error<GetTestError>>
pub async fn get_test( &self, public_id: String, ) -> Result<SyntheticsTestDetails, Error<GetTestError>>
Get the detailed configuration associated with a Synthetic test.
Sourcepub async fn get_test_with_http_info(
&self,
public_id: String,
) -> Result<ResponseContent<SyntheticsTestDetails>, Error<GetTestError>>
pub async fn get_test_with_http_info( &self, public_id: String, ) -> Result<ResponseContent<SyntheticsTestDetails>, Error<GetTestError>>
Get the detailed configuration associated with a Synthetic test.
Sourcepub async fn list_global_variables(
&self,
) -> Result<SyntheticsListGlobalVariablesResponse, Error<ListGlobalVariablesError>>
pub async fn list_global_variables( &self, ) -> Result<SyntheticsListGlobalVariablesResponse, Error<ListGlobalVariablesError>>
Get the list of all Synthetic global variables.
Sourcepub async fn list_global_variables_with_http_info(
&self,
) -> Result<ResponseContent<SyntheticsListGlobalVariablesResponse>, Error<ListGlobalVariablesError>>
pub async fn list_global_variables_with_http_info( &self, ) -> Result<ResponseContent<SyntheticsListGlobalVariablesResponse>, Error<ListGlobalVariablesError>>
Get the list of all Synthetic global variables.
Sourcepub async fn list_locations(
&self,
) -> Result<SyntheticsLocations, Error<ListLocationsError>>
pub async fn list_locations( &self, ) -> Result<SyntheticsLocations, Error<ListLocationsError>>
Get the list of public and private locations available for Synthetic tests. No arguments required.
Sourcepub async fn list_locations_with_http_info(
&self,
) -> Result<ResponseContent<SyntheticsLocations>, Error<ListLocationsError>>
pub async fn list_locations_with_http_info( &self, ) -> Result<ResponseContent<SyntheticsLocations>, Error<ListLocationsError>>
Get the list of public and private locations available for Synthetic tests. No arguments required.
Sourcepub async fn list_tests(
&self,
params: ListTestsOptionalParams,
) -> Result<SyntheticsListTestsResponse, Error<ListTestsError>>
pub async fn list_tests( &self, params: ListTestsOptionalParams, ) -> Result<SyntheticsListTestsResponse, Error<ListTestsError>>
Get the list of all Synthetic tests.
Examples found in repository?
More examples
Sourcepub fn list_tests_with_pagination(
&self,
params: ListTestsOptionalParams,
) -> impl Stream<Item = Result<SyntheticsTestDetails, Error<ListTestsError>>> + '_
pub fn list_tests_with_pagination( &self, params: ListTestsOptionalParams, ) -> impl Stream<Item = Result<SyntheticsTestDetails, Error<ListTestsError>>> + '_
Examples found in repository?
10async fn main() {
11 let configuration = datadog::Configuration::new();
12 let api = SyntheticsAPI::with_config(configuration);
13 let response = api.list_tests_with_pagination(ListTestsOptionalParams::default().page_size(2));
14 pin_mut!(response);
15 while let Some(resp) = response.next().await {
16 if let Ok(value) = resp {
17 println!("{:#?}", value);
18 } else {
19 println!("{:#?}", resp.unwrap_err());
20 }
21 }
22}
Sourcepub async fn list_tests_with_http_info(
&self,
params: ListTestsOptionalParams,
) -> Result<ResponseContent<SyntheticsListTestsResponse>, Error<ListTestsError>>
pub async fn list_tests_with_http_info( &self, params: ListTestsOptionalParams, ) -> Result<ResponseContent<SyntheticsListTestsResponse>, Error<ListTestsError>>
Get the list of all Synthetic tests.
Sourcepub async fn patch_test(
&self,
public_id: String,
body: SyntheticsPatchTestBody,
) -> Result<SyntheticsTestDetails, Error<PatchTestError>>
pub async fn patch_test( &self, public_id: String, body: SyntheticsPatchTestBody, ) -> Result<SyntheticsTestDetails, Error<PatchTestError>>
Patch the configuration of a Synthetic test with partial data.
Examples found in repository?
10async fn main() {
11 // there is a valid "synthetics_api_test" in the system
12 let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
13 let body = SyntheticsPatchTestBody::new().data(vec![
14 SyntheticsPatchTestOperation::new()
15 .op(SyntheticsPatchTestOperationName::REPLACE)
16 .path("/name".to_string())
17 .value(Value::from("New test name")),
18 SyntheticsPatchTestOperation::new()
19 .op(SyntheticsPatchTestOperationName::REMOVE)
20 .path("/config/assertions/0".to_string()),
21 ]);
22 let configuration = datadog::Configuration::new();
23 let api = SyntheticsAPI::with_config(configuration);
24 let resp = api
25 .patch_test(synthetics_api_test_public_id.clone(), body)
26 .await;
27 if let Ok(value) = resp {
28 println!("{:#?}", value);
29 } else {
30 println!("{:#?}", resp.unwrap_err());
31 }
32}
Sourcepub async fn patch_test_with_http_info(
&self,
public_id: String,
body: SyntheticsPatchTestBody,
) -> Result<ResponseContent<SyntheticsTestDetails>, Error<PatchTestError>>
pub async fn patch_test_with_http_info( &self, public_id: String, body: SyntheticsPatchTestBody, ) -> Result<ResponseContent<SyntheticsTestDetails>, Error<PatchTestError>>
Patch the configuration of a Synthetic test with partial data.
Sourcepub async fn search_tests(
&self,
params: SearchTestsOptionalParams,
) -> Result<SyntheticsListTestsResponse, Error<SearchTestsError>>
pub async fn search_tests( &self, params: SearchTestsOptionalParams, ) -> Result<SyntheticsListTestsResponse, Error<SearchTestsError>>
Search for Synthetic tests and Test Suites.
Examples found in repository?
More examples
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = SyntheticsAPI::with_config(configuration);
10 let resp = api
11 .search_tests(
12 SearchTestsOptionalParams::default()
13 .include_full_config(true)
14 .search_suites(true)
15 .facets_only(true)
16 .start(10)
17 .count(5)
18 .sort("name,desc".to_string()),
19 )
20 .await;
21 if let Ok(value) = resp {
22 println!("{:#?}", value);
23 } else {
24 println!("{:#?}", resp.unwrap_err());
25 }
26}
Sourcepub async fn search_tests_with_http_info(
&self,
params: SearchTestsOptionalParams,
) -> Result<ResponseContent<SyntheticsListTestsResponse>, Error<SearchTestsError>>
pub async fn search_tests_with_http_info( &self, params: SearchTestsOptionalParams, ) -> Result<ResponseContent<SyntheticsListTestsResponse>, Error<SearchTestsError>>
Search for Synthetic tests and Test Suites.
Sourcepub async fn trigger_ci_tests(
&self,
body: SyntheticsCITestBody,
) -> Result<SyntheticsTriggerCITestsResponse, Error<TriggerCITestsError>>
pub async fn trigger_ci_tests( &self, body: SyntheticsCITestBody, ) -> Result<SyntheticsTriggerCITestsResponse, Error<TriggerCITestsError>>
Trigger a set of Synthetic tests for continuous integration.
Examples found in repository?
17async fn main() {
18 let body =
19 SyntheticsCITestBody::new().tests(vec![SyntheticsCITest::new("aaa-aaa-aaa".to_string())
20 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
21 SyntheticsBasicAuthWeb::new()
22 .password("PaSSw0RD!".to_string())
23 .type_(SyntheticsBasicAuthWebType::WEB)
24 .username("my_username".to_string()),
25 )))
26 .device_ids(vec!["chrome.laptop_large".to_string()])
27 .locations(vec!["aws:eu-west-3".to_string()])
28 .metadata(
29 SyntheticsCIBatchMetadata::new()
30 .ci(SyntheticsCIBatchMetadataCI::new()
31 .pipeline(SyntheticsCIBatchMetadataPipeline::new())
32 .provider(SyntheticsCIBatchMetadataProvider::new()))
33 .git(SyntheticsCIBatchMetadataGit::new()),
34 )
35 .retry(SyntheticsTestOptionsRetry::new())]);
36 let configuration = datadog::Configuration::new();
37 let api = SyntheticsAPI::with_config(configuration);
38 let resp = api.trigger_ci_tests(body).await;
39 if let Ok(value) = resp {
40 println!("{:#?}", value);
41 } else {
42 println!("{:#?}", resp.unwrap_err());
43 }
44}
Sourcepub async fn trigger_ci_tests_with_http_info(
&self,
body: SyntheticsCITestBody,
) -> Result<ResponseContent<SyntheticsTriggerCITestsResponse>, Error<TriggerCITestsError>>
pub async fn trigger_ci_tests_with_http_info( &self, body: SyntheticsCITestBody, ) -> Result<ResponseContent<SyntheticsTriggerCITestsResponse>, Error<TriggerCITestsError>>
Trigger a set of Synthetic tests for continuous integration.
Sourcepub async fn trigger_tests(
&self,
body: SyntheticsTriggerBody,
) -> Result<SyntheticsTriggerCITestsResponse, Error<TriggerTestsError>>
pub async fn trigger_tests( &self, body: SyntheticsTriggerBody, ) -> Result<SyntheticsTriggerCITestsResponse, Error<TriggerTestsError>>
Trigger a set of Synthetic tests.
Examples found in repository?
8async fn main() {
9 // there is a valid "synthetics_api_test" in the system
10 let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
11 let body = SyntheticsTriggerBody::new(vec![SyntheticsTriggerTest::new(
12 synthetics_api_test_public_id.clone(),
13 )]);
14 let configuration = datadog::Configuration::new();
15 let api = SyntheticsAPI::with_config(configuration);
16 let resp = api.trigger_tests(body).await;
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22}
Sourcepub async fn trigger_tests_with_http_info(
&self,
body: SyntheticsTriggerBody,
) -> Result<ResponseContent<SyntheticsTriggerCITestsResponse>, Error<TriggerTestsError>>
pub async fn trigger_tests_with_http_info( &self, body: SyntheticsTriggerBody, ) -> Result<ResponseContent<SyntheticsTriggerCITestsResponse>, Error<TriggerTestsError>>
Trigger a set of Synthetic tests.
Sourcepub async fn update_api_test(
&self,
public_id: String,
body: SyntheticsAPITest,
) -> Result<SyntheticsAPITest, Error<UpdateAPITestError>>
pub async fn update_api_test( &self, public_id: String, body: SyntheticsAPITest, ) -> Result<SyntheticsAPITest, Error<UpdateAPITestError>>
Edit the configuration of a Synthetic API test.
Examples found in repository?
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}
Sourcepub async fn update_api_test_with_http_info(
&self,
public_id: String,
body: SyntheticsAPITest,
) -> Result<ResponseContent<SyntheticsAPITest>, Error<UpdateAPITestError>>
pub async fn update_api_test_with_http_info( &self, public_id: String, body: SyntheticsAPITest, ) -> Result<ResponseContent<SyntheticsAPITest>, Error<UpdateAPITestError>>
Edit the configuration of a Synthetic API test.
Sourcepub async fn update_browser_test(
&self,
public_id: String,
body: SyntheticsBrowserTest,
) -> Result<SyntheticsBrowserTest, Error<UpdateBrowserTestError>>
pub async fn update_browser_test( &self, public_id: String, body: SyntheticsBrowserTest, ) -> Result<SyntheticsBrowserTest, Error<UpdateBrowserTestError>>
Edit the configuration of a Synthetic browser test.
Examples found in repository?
36async fn main() {
37 let body = SyntheticsBrowserTest::new(
38 SyntheticsBrowserTestConfig::new(
39 vec![],
40 SyntheticsTestRequest::new()
41 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
42 SyntheticsBasicAuthWeb::new()
43 .password("PaSSw0RD!".to_string())
44 .type_(SyntheticsBasicAuthWebType::WEB)
45 .username("my_username".to_string()),
46 )))
47 .body_type(SyntheticsTestRequestBodyType::TEXT_PLAIN)
48 .call_type(SyntheticsTestCallType::UNARY)
49 .certificate(
50 SyntheticsTestRequestCertificate::new()
51 .cert(SyntheticsTestRequestCertificateItem::new())
52 .key(SyntheticsTestRequestCertificateItem::new()),
53 )
54 .certificate_domains(vec![])
55 .files(vec![SyntheticsTestRequestBodyFile::new()])
56 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP1)
57 .proxy(SyntheticsTestRequestProxy::new(
58 "https://example.com".to_string(),
59 ))
60 .service("Greeter".to_string())
61 .url("https://example.com".to_string()),
62 )
63 .config_variables(vec![SyntheticsConfigVariable::new(
64 "VARIABLE_NAME".to_string(),
65 SyntheticsConfigVariableType::TEXT,
66 )
67 .secure(false)])
68 .variables(vec![SyntheticsBrowserVariable::new(
69 "VARIABLE_NAME".to_string(),
70 SyntheticsBrowserVariableType::TEXT,
71 )]),
72 vec!["aws:eu-west-3".to_string()],
73 "".to_string(),
74 "Example test name".to_string(),
75 SyntheticsTestOptions::new()
76 .ci(SyntheticsTestCiOptions::new(
77 SyntheticsTestExecutionRule::BLOCKING,
78 ))
79 .device_ids(vec!["chrome.laptop_large".to_string()])
80 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP1)
81 .monitor_options(
82 SyntheticsTestOptionsMonitorOptions::new().notification_preset_name(
83 SyntheticsTestOptionsMonitorOptionsNotificationPresetName::SHOW_ALL,
84 ),
85 )
86 .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()])
87 .retry(SyntheticsTestOptionsRetry::new())
88 .rum_settings(
89 SyntheticsBrowserTestRumSettings::new(true)
90 .application_id("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string())
91 .client_token_id(12345),
92 )
93 .scheduling(SyntheticsTestOptionsScheduling::new(
94 vec![
95 SyntheticsTestOptionsSchedulingTimeframe::new(
96 1,
97 "07:00".to_string(),
98 "16:00".to_string(),
99 ),
100 SyntheticsTestOptionsSchedulingTimeframe::new(
101 3,
102 "07:00".to_string(),
103 "16:00".to_string(),
104 ),
105 ],
106 "America/New_York".to_string(),
107 )),
108 SyntheticsBrowserTestType::BROWSER,
109 )
110 .status(SyntheticsTestPauseStatus::LIVE)
111 .steps(vec![
112 SyntheticsStep::new().type_(SyntheticsStepType::ASSERT_ELEMENT_CONTENT)
113 ])
114 .tags(vec!["env:prod".to_string()]);
115 let configuration = datadog::Configuration::new();
116 let api = SyntheticsAPI::with_config(configuration);
117 let resp = api.update_browser_test("public_id".to_string(), body).await;
118 if let Ok(value) = resp {
119 println!("{:#?}", value);
120 } else {
121 println!("{:#?}", resp.unwrap_err());
122 }
123}
Sourcepub async fn update_browser_test_with_http_info(
&self,
public_id: String,
body: SyntheticsBrowserTest,
) -> Result<ResponseContent<SyntheticsBrowserTest>, Error<UpdateBrowserTestError>>
pub async fn update_browser_test_with_http_info( &self, public_id: String, body: SyntheticsBrowserTest, ) -> Result<ResponseContent<SyntheticsBrowserTest>, Error<UpdateBrowserTestError>>
Edit the configuration of a Synthetic browser test.
Sourcepub async fn update_mobile_test(
&self,
public_id: String,
body: SyntheticsMobileTest,
) -> Result<SyntheticsMobileTest, Error<UpdateMobileTestError>>
pub async fn update_mobile_test( &self, public_id: String, body: SyntheticsMobileTest, ) -> Result<SyntheticsMobileTest, Error<UpdateMobileTestError>>
Edit the configuration of a Synthetic Mobile test.
Examples found in repository?
13async fn main() {
14 // there is a valid "synthetics_mobile_test" in the system
15 let synthetics_mobile_test_public_id =
16 std::env::var("SYNTHETICS_MOBILE_TEST_PUBLIC_ID").unwrap();
17 let body = SyntheticsMobileTest::new(
18 SyntheticsMobileTestConfig::new().variables(vec![]),
19 "".to_string(),
20 "Example-Synthetic-updated".to_string(),
21 SyntheticsMobileTestOptions::new(
22 vec!["synthetics:mobile:device:iphone_15_ios_17".to_string()],
23 SyntheticsMobileTestsMobileApplication::new(
24 "ab0e0aed-536d-411a-9a99-5428c27d8f8e".to_string(),
25 "6115922a-5f5d-455e-bc7e-7955a57f3815".to_string(),
26 SyntheticsMobileTestsMobileApplicationReferenceType::VERSION,
27 ),
28 3600,
29 ),
30 SyntheticsMobileTestType::MOBILE,
31 )
32 .status(SyntheticsTestPauseStatus::PAUSED)
33 .steps(vec![]);
34 let configuration = datadog::Configuration::new();
35 let api = SyntheticsAPI::with_config(configuration);
36 let resp = api
37 .update_mobile_test(synthetics_mobile_test_public_id.clone(), body)
38 .await;
39 if let Ok(value) = resp {
40 println!("{:#?}", value);
41 } else {
42 println!("{:#?}", resp.unwrap_err());
43 }
44}
Sourcepub async fn update_mobile_test_with_http_info(
&self,
public_id: String,
body: SyntheticsMobileTest,
) -> Result<ResponseContent<SyntheticsMobileTest>, Error<UpdateMobileTestError>>
pub async fn update_mobile_test_with_http_info( &self, public_id: String, body: SyntheticsMobileTest, ) -> Result<ResponseContent<SyntheticsMobileTest>, Error<UpdateMobileTestError>>
Edit the configuration of a Synthetic Mobile test.
Sourcepub async fn update_private_location(
&self,
location_id: String,
body: SyntheticsPrivateLocation,
) -> Result<SyntheticsPrivateLocation, Error<UpdatePrivateLocationError>>
pub async fn update_private_location( &self, location_id: String, body: SyntheticsPrivateLocation, ) -> Result<SyntheticsPrivateLocation, Error<UpdatePrivateLocationError>>
Edit a Synthetic private location.
Examples found in repository?
8async fn main() {
9 let body = SyntheticsPrivateLocation::new(
10 "Description of private location".to_string(),
11 "New private location".to_string(),
12 vec!["team:front".to_string()],
13 )
14 .metadata(
15 SyntheticsPrivateLocationMetadata::new()
16 .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()]),
17 );
18 let configuration = datadog::Configuration::new();
19 let api = SyntheticsAPI::with_config(configuration);
20 let resp = api
21 .update_private_location("location_id".to_string(), body)
22 .await;
23 if let Ok(value) = resp {
24 println!("{:#?}", value);
25 } else {
26 println!("{:#?}", resp.unwrap_err());
27 }
28}
Sourcepub async fn update_private_location_with_http_info(
&self,
location_id: String,
body: SyntheticsPrivateLocation,
) -> Result<ResponseContent<SyntheticsPrivateLocation>, Error<UpdatePrivateLocationError>>
pub async fn update_private_location_with_http_info( &self, location_id: String, body: SyntheticsPrivateLocation, ) -> Result<ResponseContent<SyntheticsPrivateLocation>, Error<UpdatePrivateLocationError>>
Edit a Synthetic private location.
Sourcepub async fn update_test_pause_status(
&self,
public_id: String,
body: SyntheticsUpdateTestPauseStatusPayload,
) -> Result<bool, Error<UpdateTestPauseStatusError>>
pub async fn update_test_pause_status( &self, public_id: String, body: SyntheticsUpdateTestPauseStatusPayload, ) -> Result<bool, Error<UpdateTestPauseStatusError>>
Pause or start a Synthetic test by changing the status.
Examples found in repository?
9async fn main() {
10 let body =
11 SyntheticsUpdateTestPauseStatusPayload::new().new_status(SyntheticsTestPauseStatus::LIVE);
12 let configuration = datadog::Configuration::new();
13 let api = SyntheticsAPI::with_config(configuration);
14 let resp = api
15 .update_test_pause_status("public_id".to_string(), body)
16 .await;
17 if let Ok(value) = resp {
18 println!("{:#?}", value);
19 } else {
20 println!("{:#?}", resp.unwrap_err());
21 }
22}
Sourcepub async fn update_test_pause_status_with_http_info(
&self,
public_id: String,
body: SyntheticsUpdateTestPauseStatusPayload,
) -> Result<ResponseContent<bool>, Error<UpdateTestPauseStatusError>>
pub async fn update_test_pause_status_with_http_info( &self, public_id: String, body: SyntheticsUpdateTestPauseStatusPayload, ) -> Result<ResponseContent<bool>, Error<UpdateTestPauseStatusError>>
Pause or start a Synthetic test by changing the status.
Trait Implementations§
Source§impl Clone for SyntheticsAPI
impl Clone for SyntheticsAPI
Source§fn clone(&self) -> SyntheticsAPI
fn clone(&self) -> SyntheticsAPI
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more