#[non_exhaustive]pub struct SyntheticsConfigVariable {
pub example: Option<String>,
pub id: Option<String>,
pub name: String,
pub pattern: Option<String>,
pub secure: Option<bool>,
pub type_: SyntheticsConfigVariableType,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Object defining a variable that can be used in your test configuration.
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.example: Option<String>
Example for the variable.
id: Option<String>
ID of the variable for global variables.
name: String
Name of the variable.
pattern: Option<String>
Pattern of the variable.
secure: Option<bool>
Whether the value of this variable will be obfuscated in test results. Only for config variables of type text
.
type_: SyntheticsConfigVariableType
Type of the configuration variable.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl SyntheticsConfigVariable
impl SyntheticsConfigVariable
Sourcepub fn new(
name: String,
type_: SyntheticsConfigVariableType,
) -> SyntheticsConfigVariable
pub fn new( name: String, type_: SyntheticsConfigVariableType, ) -> SyntheticsConfigVariable
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (lines 27-30)
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 29-32)
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 28-31)
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 63-66)
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/v1_synthetics_UpdateAPITest.rs (line 96)
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}
examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs (line 105)
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 fn example(self, value: String) -> Self
pub fn example(self, value: String) -> Self
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (line 31)
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 33)
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 32)
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_UpdateAPITest.rs (line 97)
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}
examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs (line 106)
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}
examples/v1_synthetics_CreateSyntheticsAPITest_960766374.rs (line 120)
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 ),
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::SyntheticsAssertionJSONSchemaTarget(
85 Box::new(
86 SyntheticsAssertionJSONSchemaTarget::new(
87 SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
88 SyntheticsAssertionType::BODY,
89 ).target(
90 SyntheticsAssertionJSONSchemaTargetTarget::new()
91 .json_schema(
92 r#"{"type": "object", "properties":{"slideshow":{"type":"object"}}}"#.to_string(),
93 )
94 .meta_schema(SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07),
95 ),
96 ),
97 ),
98 SyntheticsAssertion::SyntheticsAssertionXPathTarget(
99 Box::new(
100 SyntheticsAssertionXPathTarget::new(
101 SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
102 SyntheticsAssertionType::BODY,
103 ).target(
104 SyntheticsAssertionXPathTargetTarget::new()
105 .operator("contains".to_string())
106 .target_value(
107 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
108 "0".to_string(),
109 ),
110 )
111 .x_path("target-xpath".to_string()),
112 ),
113 ),
114 )
115 ],
116 )
117 .config_variables(
118 vec![
119 SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
120 .example("content-type".to_string())
121 .pattern("content-type".to_string())
122 ],
123 )
124 .request(
125 SyntheticsTestRequest::new()
126 .basic_auth(
127 SyntheticsBasicAuth::SyntheticsBasicAuthOauthROP(
128 Box::new(
129 SyntheticsBasicAuthOauthROP::new(
130 "https://datadog-token.com".to_string(),
131 "oauth-password".to_string(),
132 SyntheticsBasicAuthOauthTokenApiAuthentication::BODY,
133 SyntheticsBasicAuthOauthROPType::OAUTH_ROP,
134 "oauth-usermame".to_string(),
135 )
136 .audience("audience".to_string())
137 .client_id("client-id".to_string())
138 .client_secret("client-secret".to_string())
139 .resource("resource".to_string())
140 .scope("yoyo".to_string()),
141 ),
142 ),
143 )
144 .certificate(
145 SyntheticsTestRequestCertificate::new()
146 .cert(
147 SyntheticsTestRequestCertificateItem::new()
148 .content("cert-content".to_string())
149 .filename("cert-filename".to_string())
150 .updated_at("2020-10-16T09:23:24.857Z".to_string()),
151 )
152 .key(
153 SyntheticsTestRequestCertificateItem::new()
154 .content("key-content".to_string())
155 .filename("key-filename".to_string())
156 .updated_at("2020-10-16T09:23:24.857Z".to_string()),
157 ),
158 )
159 .headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())]))
160 .method("GET".to_string())
161 .proxy(
162 SyntheticsTestRequestProxy::new(
163 "https://datadoghq.com".to_string(),
164 ).headers(BTreeMap::from([])),
165 )
166 .timeout(10.0 as f64)
167 .url("https://datadoghq.com".to_string()),
168 ),
169 vec!["aws:us-east-2".to_string()],
170 "BDD test payload: synthetics_api_http_test_payload.json".to_string(),
171 "Example-Synthetic".to_string(),
172 SyntheticsTestOptions::new()
173 .accept_self_signed(false)
174 .allow_insecure(true)
175 .follow_redirects(true)
176 .min_failure_duration(10)
177 .min_location_failed(1)
178 .monitor_name("Example-Synthetic".to_string())
179 .monitor_priority(5)
180 .retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64))
181 .tick_every(60),
182 SyntheticsAPITestType::API,
183 )
184 .subtype(SyntheticsTestDetailsSubType::HTTP)
185 .tags(vec!["testing:api".to_string()]);
186 let configuration = datadog::Configuration::new();
187 let api = SyntheticsAPI::with_config(configuration);
188 let resp = api.create_synthetics_api_test(body).await;
189 if let Ok(value) = resp {
190 println!("{:#?}", value);
191 } else {
192 println!("{:#?}", resp.unwrap_err());
193 }
194}
pub fn id(self, value: String) -> Self
Sourcepub fn pattern(self, value: String) -> Self
pub fn pattern(self, value: String) -> Self
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (line 32)
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 34)
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 33)
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_UpdateAPITest.rs (line 98)
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}
examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs (line 107)
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}
examples/v1_synthetics_CreateSyntheticsAPITest_960766374.rs (line 121)
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 ),
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::SyntheticsAssertionJSONSchemaTarget(
85 Box::new(
86 SyntheticsAssertionJSONSchemaTarget::new(
87 SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
88 SyntheticsAssertionType::BODY,
89 ).target(
90 SyntheticsAssertionJSONSchemaTargetTarget::new()
91 .json_schema(
92 r#"{"type": "object", "properties":{"slideshow":{"type":"object"}}}"#.to_string(),
93 )
94 .meta_schema(SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07),
95 ),
96 ),
97 ),
98 SyntheticsAssertion::SyntheticsAssertionXPathTarget(
99 Box::new(
100 SyntheticsAssertionXPathTarget::new(
101 SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
102 SyntheticsAssertionType::BODY,
103 ).target(
104 SyntheticsAssertionXPathTargetTarget::new()
105 .operator("contains".to_string())
106 .target_value(
107 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(
108 "0".to_string(),
109 ),
110 )
111 .x_path("target-xpath".to_string()),
112 ),
113 ),
114 )
115 ],
116 )
117 .config_variables(
118 vec![
119 SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
120 .example("content-type".to_string())
121 .pattern("content-type".to_string())
122 ],
123 )
124 .request(
125 SyntheticsTestRequest::new()
126 .basic_auth(
127 SyntheticsBasicAuth::SyntheticsBasicAuthOauthROP(
128 Box::new(
129 SyntheticsBasicAuthOauthROP::new(
130 "https://datadog-token.com".to_string(),
131 "oauth-password".to_string(),
132 SyntheticsBasicAuthOauthTokenApiAuthentication::BODY,
133 SyntheticsBasicAuthOauthROPType::OAUTH_ROP,
134 "oauth-usermame".to_string(),
135 )
136 .audience("audience".to_string())
137 .client_id("client-id".to_string())
138 .client_secret("client-secret".to_string())
139 .resource("resource".to_string())
140 .scope("yoyo".to_string()),
141 ),
142 ),
143 )
144 .certificate(
145 SyntheticsTestRequestCertificate::new()
146 .cert(
147 SyntheticsTestRequestCertificateItem::new()
148 .content("cert-content".to_string())
149 .filename("cert-filename".to_string())
150 .updated_at("2020-10-16T09:23:24.857Z".to_string()),
151 )
152 .key(
153 SyntheticsTestRequestCertificateItem::new()
154 .content("key-content".to_string())
155 .filename("key-filename".to_string())
156 .updated_at("2020-10-16T09:23:24.857Z".to_string()),
157 ),
158 )
159 .headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())]))
160 .method("GET".to_string())
161 .proxy(
162 SyntheticsTestRequestProxy::new(
163 "https://datadoghq.com".to_string(),
164 ).headers(BTreeMap::from([])),
165 )
166 .timeout(10.0 as f64)
167 .url("https://datadoghq.com".to_string()),
168 ),
169 vec!["aws:us-east-2".to_string()],
170 "BDD test payload: synthetics_api_http_test_payload.json".to_string(),
171 "Example-Synthetic".to_string(),
172 SyntheticsTestOptions::new()
173 .accept_self_signed(false)
174 .allow_insecure(true)
175 .follow_redirects(true)
176 .min_failure_duration(10)
177 .min_location_failed(1)
178 .monitor_name("Example-Synthetic".to_string())
179 .monitor_priority(5)
180 .retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64))
181 .tick_every(60),
182 SyntheticsAPITestType::API,
183 )
184 .subtype(SyntheticsTestDetailsSubType::HTTP)
185 .tags(vec!["testing:api".to_string()]);
186 let configuration = datadog::Configuration::new();
187 let api = SyntheticsAPI::with_config(configuration);
188 let resp = api.create_synthetics_api_test(body).await;
189 if let Ok(value) = resp {
190 println!("{:#?}", value);
191 } else {
192 println!("{:#?}", resp.unwrap_err());
193 }
194}
Sourcepub fn secure(self, value: bool) -> Self
pub fn secure(self, value: bool) -> Self
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (line 33)
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_UpdateBrowserTest.rs (line 67)
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 SyntheticsConfigVariable
impl Clone for SyntheticsConfigVariable
Source§fn clone(&self) -> SyntheticsConfigVariable
fn clone(&self) -> SyntheticsConfigVariable
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 SyntheticsConfigVariable
impl Debug for SyntheticsConfigVariable
Source§impl<'de> Deserialize<'de> for SyntheticsConfigVariable
impl<'de> Deserialize<'de> for SyntheticsConfigVariable
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 SyntheticsConfigVariable
impl PartialEq for SyntheticsConfigVariable
Source§impl Serialize for SyntheticsConfigVariable
impl Serialize for SyntheticsConfigVariable
impl StructuralPartialEq for SyntheticsConfigVariable
Auto Trait Implementations§
impl Freeze for SyntheticsConfigVariable
impl RefUnwindSafe for SyntheticsConfigVariable
impl Send for SyntheticsConfigVariable
impl Sync for SyntheticsConfigVariable
impl Unpin for SyntheticsConfigVariable
impl UnwindSafe for SyntheticsConfigVariable
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