#[non_exhaustive]pub struct SyntheticsBrowserTest {
pub config: SyntheticsBrowserTestConfig,
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 steps: Option<Vec<SyntheticsStep>>,
pub tags: Option<Vec<String>>,
pub type_: SyntheticsBrowserTestType,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Object containing details about a Synthetic browser 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: SyntheticsBrowserTestConfig
Configuration object for a Synthetic browser test.
locations: Vec<String>
Array of locations used to run the test.
message: String
Notification message associated with the test. Message can either be text or an empty string.
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 of the test.
status: Option<SyntheticsTestPauseStatus>
Define whether you want to start (live
) or pause (paused
) a
Synthetic test.
steps: Option<Vec<SyntheticsStep>>
Array of steps for the test.
Array of tags attached to the test.
type_: SyntheticsBrowserTestType
Type of the Synthetic test, browser
.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl SyntheticsBrowserTest
impl SyntheticsBrowserTest
Sourcepub fn new(
config: SyntheticsBrowserTestConfig,
locations: Vec<String>,
message: String,
name: String,
options: SyntheticsTestOptions,
type_: SyntheticsBrowserTestType,
) -> SyntheticsBrowserTest
pub fn new( config: SyntheticsBrowserTestConfig, locations: Vec<String>, message: String, name: String, options: SyntheticsTestOptions, type_: SyntheticsBrowserTestType, ) -> SyntheticsBrowserTest
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (lines 20-63)
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
examples/v1_synthetics_CreateSyntheticsBrowserTest_2932742688.rs (lines 21-66)
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}
examples/v1_synthetics_CreateSyntheticsBrowserTest_397420811.rs (lines 21-69)
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}
examples/v1_synthetics_UpdateBrowserTest.rs (lines 37-109)
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}
pub fn monitor_id(self, value: i64) -> Self
pub fn public_id(self, value: String) -> Self
Sourcepub fn status(self, value: SyntheticsTestPauseStatus) -> Self
pub fn status(self, value: SyntheticsTestPauseStatus) -> Self
Examples found in repository?
examples/v1_synthetics_UpdateBrowserTest.rs (line 110)
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 fn steps(self, value: Vec<SyntheticsStep>) -> Self
pub fn steps(self, value: Vec<SyntheticsStep>) -> Self
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (lines 64-71)
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
examples/v1_synthetics_CreateSyntheticsBrowserTest_2932742688.rs (lines 67-72)
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}
examples/v1_synthetics_CreateSyntheticsBrowserTest_397420811.rs (lines 70-75)
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}
examples/v1_synthetics_UpdateBrowserTest.rs (lines 111-113)
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}
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (line 72)
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
examples/v1_synthetics_CreateSyntheticsBrowserTest_2932742688.rs (line 73)
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}
examples/v1_synthetics_CreateSyntheticsBrowserTest_397420811.rs (line 76)
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}
examples/v1_synthetics_UpdateBrowserTest.rs (line 114)
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}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for SyntheticsBrowserTest
impl Clone for SyntheticsBrowserTest
Source§fn clone(&self) -> SyntheticsBrowserTest
fn clone(&self) -> SyntheticsBrowserTest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SyntheticsBrowserTest
impl Debug for SyntheticsBrowserTest
Source§impl<'de> Deserialize<'de> for SyntheticsBrowserTest
impl<'de> Deserialize<'de> for SyntheticsBrowserTest
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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 SyntheticsBrowserTest
impl PartialEq for SyntheticsBrowserTest
Source§impl Serialize for SyntheticsBrowserTest
impl Serialize for SyntheticsBrowserTest
impl StructuralPartialEq for SyntheticsBrowserTest
Auto Trait Implementations§
impl Freeze for SyntheticsBrowserTest
impl RefUnwindSafe for SyntheticsBrowserTest
impl Send for SyntheticsBrowserTest
impl Sync for SyntheticsBrowserTest
impl Unpin for SyntheticsBrowserTest
impl UnwindSafe for SyntheticsBrowserTest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more