#[non_exhaustive]pub struct SyntheticsBasicAuthWeb {
pub password: Option<String>,
pub type_: Option<SyntheticsBasicAuthWebType>,
pub username: Option<String>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Object to handle basic authentication when performing the 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.password: Option<String>
Password to use for the basic authentication.
type_: Option<SyntheticsBasicAuthWebType>
The type of basic authentication to use when performing the test.
username: Option<String>
Username to use for the basic authentication.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl SyntheticsBasicAuthWeb
impl SyntheticsBasicAuthWeb
Sourcepub fn new() -> SyntheticsBasicAuthWeb
pub fn new() -> SyntheticsBasicAuthWeb
Examples found in repository?
examples/v1_synthetics_TriggerCITests.rs (line 21)
17async fn main() {
18 let body =
19 SyntheticsCITestBody::new().tests(vec![SyntheticsCITest::new("aaa-aaa-aaa".to_string())
20 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
21 SyntheticsBasicAuthWeb::new()
22 .password("PaSSw0RD!".to_string())
23 .type_(SyntheticsBasicAuthWebType::WEB)
24 .username("my_username".to_string()),
25 )))
26 .device_ids(vec!["chrome.laptop_large".to_string()])
27 .locations(vec!["aws:eu-west-3".to_string()])
28 .metadata(
29 SyntheticsCIBatchMetadata::new()
30 .ci(SyntheticsCIBatchMetadataCI::new()
31 .pipeline(SyntheticsCIBatchMetadataPipeline::new())
32 .provider(SyntheticsCIBatchMetadataProvider::new()))
33 .git(SyntheticsCIBatchMetadataGit::new()),
34 )
35 .retry(SyntheticsTestOptionsRetry::new())]);
36 let configuration = datadog::Configuration::new();
37 let api = SyntheticsAPI::with_config(configuration);
38 let resp = api.trigger_ci_tests(body).await;
39 if let Ok(value) = resp {
40 println!("{:#?}", value);
41 } else {
42 println!("{:#?}", resp.unwrap_err());
43 }
44}
More examples
examples/v1_synthetics_UpdateBrowserTest.rs (line 42)
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_CreateSyntheticsAPITest_1717840259.rs (line 51)
35async fn main() {
36 let body = SyntheticsAPITest::new(
37 SyntheticsAPITestConfig::new().steps(vec![
38 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
39 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
40 SyntheticsAssertionTarget::new(
41 SyntheticsAssertionOperator::IS,
42 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
43 200.0 as f64,
44 ),
45 SyntheticsAssertionType::STATUS_CODE,
46 ),
47 ))],
48 "request is sent".to_string(),
49 SyntheticsTestRequest::new()
50 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
51 SyntheticsBasicAuthWeb::new()
52 .password("password".to_string())
53 .username("username".to_string()),
54 )))
55 .method("GET".to_string())
56 .url("https://httpbin.org/status/200".to_string()),
57 SyntheticsAPITestStepSubtype::HTTP,
58 ))),
59 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
60 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
61 SyntheticsAssertionTarget::new(
62 SyntheticsAssertionOperator::IS,
63 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
64 200.0 as f64,
65 ),
66 SyntheticsAssertionType::STATUS_CODE,
67 ),
68 ))],
69 "request is sent".to_string(),
70 SyntheticsTestRequest::new()
71 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
72 SyntheticsBasicAuthWeb::new()
73 .password("password".to_string())
74 .type_(SyntheticsBasicAuthWebType::WEB)
75 .username("username".to_string()),
76 )))
77 .method("GET".to_string())
78 .url("https://httpbin.org/status/200".to_string()),
79 SyntheticsAPITestStepSubtype::HTTP,
80 ))),
81 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
82 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
83 SyntheticsAssertionTarget::new(
84 SyntheticsAssertionOperator::IS,
85 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
86 200.0 as f64,
87 ),
88 SyntheticsAssertionType::STATUS_CODE,
89 ),
90 ))],
91 "request is sent".to_string(),
92 SyntheticsTestRequest::new()
93 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthSigv4(Box::new(
94 SyntheticsBasicAuthSigv4::new(
95 "accessKey".to_string(),
96 "secretKey".to_string(),
97 SyntheticsBasicAuthSigv4Type::SIGV4,
98 ),
99 )))
100 .method("GET".to_string())
101 .url("https://httpbin.org/status/200".to_string()),
102 SyntheticsAPITestStepSubtype::HTTP,
103 ))),
104 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
105 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
106 SyntheticsAssertionTarget::new(
107 SyntheticsAssertionOperator::IS,
108 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
109 200.0 as f64,
110 ),
111 SyntheticsAssertionType::STATUS_CODE,
112 ),
113 ))],
114 "request is sent".to_string(),
115 SyntheticsTestRequest::new()
116 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthNTLM(Box::new(
117 SyntheticsBasicAuthNTLM::new(SyntheticsBasicAuthNTLMType::NTLM),
118 )))
119 .method("GET".to_string())
120 .url("https://httpbin.org/status/200".to_string()),
121 SyntheticsAPITestStepSubtype::HTTP,
122 ))),
123 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
124 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
125 SyntheticsAssertionTarget::new(
126 SyntheticsAssertionOperator::IS,
127 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
128 200.0 as f64,
129 ),
130 SyntheticsAssertionType::STATUS_CODE,
131 ),
132 ))],
133 "request is sent".to_string(),
134 SyntheticsTestRequest::new()
135 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthDigest(Box::new(
136 SyntheticsBasicAuthDigest::new(
137 "password".to_string(),
138 SyntheticsBasicAuthDigestType::DIGEST,
139 "username".to_string(),
140 ),
141 )))
142 .method("GET".to_string())
143 .url("https://httpbin.org/status/200".to_string()),
144 SyntheticsAPITestStepSubtype::HTTP,
145 ))),
146 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
147 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
148 SyntheticsAssertionTarget::new(
149 SyntheticsAssertionOperator::IS,
150 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
151 200.0 as f64,
152 ),
153 SyntheticsAssertionType::STATUS_CODE,
154 ),
155 ))],
156 "request is sent".to_string(),
157 SyntheticsTestRequest::new()
158 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
159 Box::new(SyntheticsBasicAuthOauthClient::new(
160 "accessTokenUrl".to_string(),
161 "clientId".to_string(),
162 "clientSecret".to_string(),
163 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
164 SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
165 )),
166 ))
167 .method("GET".to_string())
168 .url("https://httpbin.org/status/200".to_string()),
169 SyntheticsAPITestStepSubtype::HTTP,
170 ))),
171 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
172 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
173 SyntheticsAssertionTarget::new(
174 SyntheticsAssertionOperator::IS,
175 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
176 200.0 as f64,
177 ),
178 SyntheticsAssertionType::STATUS_CODE,
179 ),
180 ))],
181 "request is sent".to_string(),
182 SyntheticsTestRequest::new()
183 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthROP(Box::new(
184 SyntheticsBasicAuthOauthROP::new(
185 "accessTokenUrl".to_string(),
186 "password".to_string(),
187 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
188 SyntheticsBasicAuthOauthROPType::OAUTH_ROP,
189 "username".to_string(),
190 ),
191 )))
192 .method("GET".to_string())
193 .url("https://httpbin.org/status/200".to_string()),
194 SyntheticsAPITestStepSubtype::HTTP,
195 ))),
196 ]),
197 vec!["aws:us-east-2".to_string()],
198 "BDD test payload: synthetics_api_test_multi_step_with_every_type_of_basic_auth.json"
199 .to_string(),
200 "Example-Synthetic".to_string(),
201 SyntheticsTestOptions::new().tick_every(60),
202 SyntheticsAPITestType::API,
203 )
204 .subtype(SyntheticsTestDetailsSubType::MULTI);
205 let configuration = datadog::Configuration::new();
206 let api = SyntheticsAPI::with_config(configuration);
207 let resp = api.create_synthetics_api_test(body).await;
208 if let Ok(value) = resp {
209 println!("{:#?}", value);
210 } else {
211 println!("{:#?}", resp.unwrap_err());
212 }
213}
examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs (line 287)
38async fn main() {
39 let body =
40 SyntheticsAPITest::new(
41 SyntheticsAPITestConfig::new()
42 .config_variables(
43 vec![
44 SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
45 .example("content-type".to_string())
46 .pattern("content-type".to_string())
47 ],
48 )
49 .steps(
50 vec![
51 SyntheticsAPIStep::SyntheticsAPITestStep(
52 Box::new(
53 SyntheticsAPITestStep::new(
54 vec![
55 SyntheticsAssertion::SyntheticsAssertionTarget(
56 Box::new(
57 SyntheticsAssertionTarget::new(
58 SyntheticsAssertionOperator::IS,
59 SyntheticsAssertionTargetValue
60 ::SyntheticsAssertionTargetValueNumber(
61 200.0 as f64,
62 ),
63 SyntheticsAssertionType::STATUS_CODE,
64 ),
65 ),
66 )
67 ],
68 "request is sent".to_string(),
69 SyntheticsTestRequest::new()
70 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
71 .method("GET".to_string())
72 .timeout(10.0 as f64)
73 .url("https://datadoghq.com".to_string()),
74 SyntheticsAPITestStepSubtype::HTTP,
75 )
76 .allow_failure(true)
77 .exit_if_succeed(true)
78 .extracted_values(
79 vec![
80 SyntheticsParsingOptions::new()
81 .field("server".to_string())
82 .name("EXTRACTED_VALUE".to_string())
83 .parser(
84 SyntheticsVariableParser::new(
85 SyntheticsGlobalVariableParserType::RAW,
86 ),
87 )
88 .secure(true)
89 .type_(SyntheticsLocalVariableParsingOptionsType::HTTP_HEADER)
90 ],
91 )
92 .extracted_values_from_script(
93 "dd.variable.set('STATUS_CODE', dd.response.statusCode);".to_string(),
94 )
95 .is_critical(true)
96 .retry(SyntheticsTestOptionsRetry::new().count(5).interval(1000.0 as f64)),
97 ),
98 ),
99 SyntheticsAPIStep::SyntheticsAPIWaitStep(
100 Box::new(
101 SyntheticsAPIWaitStep::new("Wait".to_string(), SyntheticsAPIWaitStepSubtype::WAIT, 1),
102 ),
103 ),
104 SyntheticsAPIStep::SyntheticsAPITestStep(
105 Box::new(
106 SyntheticsAPITestStep::new(
107 vec![
108 SyntheticsAssertion::SyntheticsAssertionTarget(
109 Box::new(
110 SyntheticsAssertionTarget::new(
111 SyntheticsAssertionOperator::LESS_THAN,
112 SyntheticsAssertionTargetValue
113 ::SyntheticsAssertionTargetValueNumber(
114 1000.0 as f64,
115 ),
116 SyntheticsAssertionType::RESPONSE_TIME,
117 ),
118 ),
119 )
120 ],
121 "GRPC CALL".to_string(),
122 SyntheticsTestRequest::new()
123 .call_type(SyntheticsTestCallType::UNARY)
124 .compressed_json_descriptor(
125 "eJy1lU1z2yAQhv+Lzj74I3ETH506bQ7OZOSm1w4Wa4epBARQppqM/3v5koCJJdvtxCdW77vPssCO3zMKUgHOFu/ZXvBiS6hZho/f8qe7pftYgXphWJrlA8XwxywEvNba+6PhkC2yVcVVswYp0R6ykRYlZ1SCV21SDrxsssPIeS9FJKqGfK2rqnmmSBwhWa2XlKgtaQPiDcRGCUDVfwGD2sKUqKEtc1cSoOrsMlaMOec1sySYCCgUYRSVLv2zSva2u+FQkB0pVkIw8bFuIudOOn3pOaKYVT3Iy97Pd0AYhOx5QcMsnxvRHlnuLf8ETDd3CNtrv2nejkDpRnANCmGkkFn/hsYzpBKE7jVbufgnKnV9HRM9zRPDDKPttYT61n0TdWkAAjggk9AhuxIeaXd69CYTcsGw7cBTakLVbNpRzGEgyWjkSOpMbZXkhGL6oX30R49qt3GoHrap7i0XdD41WQ+2icCNm5p1hmFqnHNlcla0riKmDZ183crDxChjbnurtxHPRE784sVhWvDfGP+SsTKibU3o5NtWHuZFGZOxP6P5VXqIOvaOSec4eYohyd7NslHuJbd1bewds85xYrNxkr2d+5IhFWF3NvaO684xjE2S5ulY+tu64Pna0fCPJgzw6vF5/WucLcYjt5xoq19O3UDptOg/OamJQRaCcPPnMTQ2QDFn+uhPvUfnCrMc99upyQY4Ui9Dlc/YoG3R/v4Cs9YE+g==".to_string(),
126 )
127 .host("grpcbin.test.k6.io".to_string())
128 .message("{}".to_string())
129 .metadata(BTreeMap::from([]))
130 .method("Index".to_string())
131 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(9000))
132 .service("grpcbin.GRPCBin".to_string()),
133 SyntheticsAPITestStepSubtype::GRPC,
134 )
135 .allow_failure(false)
136 .extracted_values(vec![])
137 .is_critical(true)
138 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
139 ),
140 ),
141 SyntheticsAPIStep::SyntheticsAPITestStep(
142 Box::new(
143 SyntheticsAPITestStep::new(
144 vec![
145 SyntheticsAssertion::SyntheticsAssertionTarget(
146 Box::new(
147 SyntheticsAssertionTarget::new(
148 SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,
149 SyntheticsAssertionTargetValue
150 ::SyntheticsAssertionTargetValueNumber(
151 10.0 as f64,
152 ),
153 SyntheticsAssertionType::CERTIFICATE,
154 ),
155 ),
156 )
157 ],
158 "SSL step".to_string(),
159 SyntheticsTestRequest::new()
160 .check_certificate_revocation(true)
161 .disable_aia_intermediate_fetching(true)
162 .host("example.org".to_string())
163 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(443)),
164 SyntheticsAPITestStepSubtype::SSL,
165 )
166 .allow_failure(false)
167 .is_critical(true)
168 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
169 ),
170 ),
171 SyntheticsAPIStep::SyntheticsAPITestStep(
172 Box::new(
173 SyntheticsAPITestStep::new(
174 vec![
175 SyntheticsAssertion::SyntheticsAssertionTarget(
176 Box::new(
177 SyntheticsAssertionTarget::new(
178 SyntheticsAssertionOperator::LESS_THAN,
179 SyntheticsAssertionTargetValue
180 ::SyntheticsAssertionTargetValueNumber(
181 1000.0 as f64,
182 ),
183 SyntheticsAssertionType::RESPONSE_TIME,
184 ),
185 ),
186 )
187 ],
188 "DNS step".to_string(),
189 SyntheticsTestRequest::new()
190 .dns_server("8.8.8.8".to_string())
191 .dns_server_port(
192 SyntheticsTestRequestDNSServerPort
193 ::SyntheticsTestRequestVariableDNSServerPort(
194 "53".to_string(),
195 ),
196 )
197 .host("troisdizaines.com".to_string()),
198 SyntheticsAPITestStepSubtype::DNS,
199 )
200 .allow_failure(false)
201 .is_critical(true)
202 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
203 ),
204 ),
205 SyntheticsAPIStep::SyntheticsAPITestStep(
206 Box::new(
207 SyntheticsAPITestStep::new(
208 vec![
209 SyntheticsAssertion::SyntheticsAssertionTarget(
210 Box::new(
211 SyntheticsAssertionTarget::new(
212 SyntheticsAssertionOperator::LESS_THAN,
213 SyntheticsAssertionTargetValue
214 ::SyntheticsAssertionTargetValueNumber(
215 1000.0 as f64,
216 ),
217 SyntheticsAssertionType::RESPONSE_TIME,
218 ),
219 ),
220 )
221 ],
222 "TCP step".to_string(),
223 SyntheticsTestRequest::new()
224 .host("34.95.79.70".to_string())
225 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(80))
226 .should_track_hops(true)
227 .timeout(32.0 as f64),
228 SyntheticsAPITestStepSubtype::TCP,
229 )
230 .allow_failure(false)
231 .is_critical(true)
232 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
233 ),
234 ),
235 SyntheticsAPIStep::SyntheticsAPITestStep(
236 Box::new(
237 SyntheticsAPITestStep::new(
238 vec![
239 SyntheticsAssertion::SyntheticsAssertionTarget(
240 Box::new(
241 SyntheticsAssertionTarget::new(
242 SyntheticsAssertionOperator::IS,
243 SyntheticsAssertionTargetValue
244 ::SyntheticsAssertionTargetValueNumber(
245 0.0 as f64,
246 ),
247 SyntheticsAssertionType::PACKET_LOSS_PERCENTAGE,
248 ),
249 ),
250 )
251 ],
252 "ICMP step".to_string(),
253 SyntheticsTestRequest::new()
254 .host("34.95.79.70".to_string())
255 .number_of_packets(4)
256 .should_track_hops(true)
257 .timeout(38.0 as f64),
258 SyntheticsAPITestStepSubtype::ICMP,
259 )
260 .allow_failure(false)
261 .is_critical(true)
262 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
263 ),
264 ),
265 SyntheticsAPIStep::SyntheticsAPITestStep(
266 Box::new(
267 SyntheticsAPITestStep::new(
268 vec![
269 SyntheticsAssertion::SyntheticsAssertionTarget(
270 Box::new(
271 SyntheticsAssertionTarget::new(
272 SyntheticsAssertionOperator::LESS_THAN,
273 SyntheticsAssertionTargetValue
274 ::SyntheticsAssertionTargetValueNumber(
275 1000.0 as f64,
276 ),
277 SyntheticsAssertionType::RESPONSE_TIME,
278 ),
279 ),
280 )
281 ],
282 "Websocket step".to_string(),
283 SyntheticsTestRequest::new()
284 .basic_auth(
285 SyntheticsBasicAuth::SyntheticsBasicAuthWeb(
286 Box::new(
287 SyntheticsBasicAuthWeb::new()
288 .password("password".to_string())
289 .type_(SyntheticsBasicAuthWebType::WEB)
290 .username("user".to_string()),
291 ),
292 ),
293 )
294 .headers(BTreeMap::from([("f".to_string(), "g".to_string())]))
295 .is_message_base64_encoded(true)
296 .message("My message".to_string())
297 .url("ws://34.95.79.70/web-socket".to_string()),
298 SyntheticsAPITestStepSubtype::WEBSOCKET,
299 )
300 .allow_failure(false)
301 .is_critical(true)
302 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
303 ),
304 ),
305 SyntheticsAPIStep::SyntheticsAPITestStep(
306 Box::new(
307 SyntheticsAPITestStep::new(
308 vec![
309 SyntheticsAssertion::SyntheticsAssertionTarget(
310 Box::new(
311 SyntheticsAssertionTarget::new(
312 SyntheticsAssertionOperator::LESS_THAN,
313 SyntheticsAssertionTargetValue
314 ::SyntheticsAssertionTargetValueNumber(
315 1000.0 as f64,
316 ),
317 SyntheticsAssertionType::RESPONSE_TIME,
318 ),
319 ),
320 )
321 ],
322 "UDP step".to_string(),
323 SyntheticsTestRequest::new()
324 .host("8.8.8.8".to_string())
325 .message("A image.google.com".to_string())
326 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(53)),
327 SyntheticsAPITestStepSubtype::UDP,
328 )
329 .allow_failure(false)
330 .is_critical(true)
331 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
332 ),
333 )
334 ],
335 ),
336 vec!["aws:us-east-2".to_string()],
337 "BDD test payload: synthetics_api_test_multi_step_payload.json".to_string(),
338 "Example-Synthetic".to_string(),
339 SyntheticsTestOptions::new()
340 .accept_self_signed(false)
341 .allow_insecure(true)
342 .follow_redirects(true)
343 .min_failure_duration(10)
344 .min_location_failed(1)
345 .monitor_name("Example-Synthetic".to_string())
346 .monitor_priority(5)
347 .retry(SyntheticsTestOptionsRetry::new().count(3).interval(1000.0 as f64))
348 .tick_every(60),
349 SyntheticsAPITestType::API,
350 )
351 .subtype(SyntheticsTestDetailsSubType::MULTI)
352 .tags(vec!["testing:api".to_string()]);
353 let configuration = datadog::Configuration::new();
354 let api = SyntheticsAPI::with_config(configuration);
355 let resp = api.create_synthetics_api_test(body).await;
356 if let Ok(value) = resp {
357 println!("{:#?}", value);
358 } else {
359 println!("{:#?}", resp.unwrap_err());
360 }
361}
Sourcepub fn password(self, value: String) -> Self
pub fn password(self, value: String) -> Self
Examples found in repository?
examples/v1_synthetics_TriggerCITests.rs (line 22)
17async fn main() {
18 let body =
19 SyntheticsCITestBody::new().tests(vec![SyntheticsCITest::new("aaa-aaa-aaa".to_string())
20 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
21 SyntheticsBasicAuthWeb::new()
22 .password("PaSSw0RD!".to_string())
23 .type_(SyntheticsBasicAuthWebType::WEB)
24 .username("my_username".to_string()),
25 )))
26 .device_ids(vec!["chrome.laptop_large".to_string()])
27 .locations(vec!["aws:eu-west-3".to_string()])
28 .metadata(
29 SyntheticsCIBatchMetadata::new()
30 .ci(SyntheticsCIBatchMetadataCI::new()
31 .pipeline(SyntheticsCIBatchMetadataPipeline::new())
32 .provider(SyntheticsCIBatchMetadataProvider::new()))
33 .git(SyntheticsCIBatchMetadataGit::new()),
34 )
35 .retry(SyntheticsTestOptionsRetry::new())]);
36 let configuration = datadog::Configuration::new();
37 let api = SyntheticsAPI::with_config(configuration);
38 let resp = api.trigger_ci_tests(body).await;
39 if let Ok(value) = resp {
40 println!("{:#?}", value);
41 } else {
42 println!("{:#?}", resp.unwrap_err());
43 }
44}
More examples
examples/v1_synthetics_UpdateBrowserTest.rs (line 43)
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_CreateSyntheticsAPITest_1717840259.rs (line 52)
35async fn main() {
36 let body = SyntheticsAPITest::new(
37 SyntheticsAPITestConfig::new().steps(vec![
38 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
39 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
40 SyntheticsAssertionTarget::new(
41 SyntheticsAssertionOperator::IS,
42 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
43 200.0 as f64,
44 ),
45 SyntheticsAssertionType::STATUS_CODE,
46 ),
47 ))],
48 "request is sent".to_string(),
49 SyntheticsTestRequest::new()
50 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
51 SyntheticsBasicAuthWeb::new()
52 .password("password".to_string())
53 .username("username".to_string()),
54 )))
55 .method("GET".to_string())
56 .url("https://httpbin.org/status/200".to_string()),
57 SyntheticsAPITestStepSubtype::HTTP,
58 ))),
59 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
60 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
61 SyntheticsAssertionTarget::new(
62 SyntheticsAssertionOperator::IS,
63 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
64 200.0 as f64,
65 ),
66 SyntheticsAssertionType::STATUS_CODE,
67 ),
68 ))],
69 "request is sent".to_string(),
70 SyntheticsTestRequest::new()
71 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
72 SyntheticsBasicAuthWeb::new()
73 .password("password".to_string())
74 .type_(SyntheticsBasicAuthWebType::WEB)
75 .username("username".to_string()),
76 )))
77 .method("GET".to_string())
78 .url("https://httpbin.org/status/200".to_string()),
79 SyntheticsAPITestStepSubtype::HTTP,
80 ))),
81 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
82 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
83 SyntheticsAssertionTarget::new(
84 SyntheticsAssertionOperator::IS,
85 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
86 200.0 as f64,
87 ),
88 SyntheticsAssertionType::STATUS_CODE,
89 ),
90 ))],
91 "request is sent".to_string(),
92 SyntheticsTestRequest::new()
93 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthSigv4(Box::new(
94 SyntheticsBasicAuthSigv4::new(
95 "accessKey".to_string(),
96 "secretKey".to_string(),
97 SyntheticsBasicAuthSigv4Type::SIGV4,
98 ),
99 )))
100 .method("GET".to_string())
101 .url("https://httpbin.org/status/200".to_string()),
102 SyntheticsAPITestStepSubtype::HTTP,
103 ))),
104 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
105 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
106 SyntheticsAssertionTarget::new(
107 SyntheticsAssertionOperator::IS,
108 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
109 200.0 as f64,
110 ),
111 SyntheticsAssertionType::STATUS_CODE,
112 ),
113 ))],
114 "request is sent".to_string(),
115 SyntheticsTestRequest::new()
116 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthNTLM(Box::new(
117 SyntheticsBasicAuthNTLM::new(SyntheticsBasicAuthNTLMType::NTLM),
118 )))
119 .method("GET".to_string())
120 .url("https://httpbin.org/status/200".to_string()),
121 SyntheticsAPITestStepSubtype::HTTP,
122 ))),
123 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
124 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
125 SyntheticsAssertionTarget::new(
126 SyntheticsAssertionOperator::IS,
127 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
128 200.0 as f64,
129 ),
130 SyntheticsAssertionType::STATUS_CODE,
131 ),
132 ))],
133 "request is sent".to_string(),
134 SyntheticsTestRequest::new()
135 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthDigest(Box::new(
136 SyntheticsBasicAuthDigest::new(
137 "password".to_string(),
138 SyntheticsBasicAuthDigestType::DIGEST,
139 "username".to_string(),
140 ),
141 )))
142 .method("GET".to_string())
143 .url("https://httpbin.org/status/200".to_string()),
144 SyntheticsAPITestStepSubtype::HTTP,
145 ))),
146 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
147 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
148 SyntheticsAssertionTarget::new(
149 SyntheticsAssertionOperator::IS,
150 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
151 200.0 as f64,
152 ),
153 SyntheticsAssertionType::STATUS_CODE,
154 ),
155 ))],
156 "request is sent".to_string(),
157 SyntheticsTestRequest::new()
158 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
159 Box::new(SyntheticsBasicAuthOauthClient::new(
160 "accessTokenUrl".to_string(),
161 "clientId".to_string(),
162 "clientSecret".to_string(),
163 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
164 SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
165 )),
166 ))
167 .method("GET".to_string())
168 .url("https://httpbin.org/status/200".to_string()),
169 SyntheticsAPITestStepSubtype::HTTP,
170 ))),
171 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
172 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
173 SyntheticsAssertionTarget::new(
174 SyntheticsAssertionOperator::IS,
175 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
176 200.0 as f64,
177 ),
178 SyntheticsAssertionType::STATUS_CODE,
179 ),
180 ))],
181 "request is sent".to_string(),
182 SyntheticsTestRequest::new()
183 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthROP(Box::new(
184 SyntheticsBasicAuthOauthROP::new(
185 "accessTokenUrl".to_string(),
186 "password".to_string(),
187 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
188 SyntheticsBasicAuthOauthROPType::OAUTH_ROP,
189 "username".to_string(),
190 ),
191 )))
192 .method("GET".to_string())
193 .url("https://httpbin.org/status/200".to_string()),
194 SyntheticsAPITestStepSubtype::HTTP,
195 ))),
196 ]),
197 vec!["aws:us-east-2".to_string()],
198 "BDD test payload: synthetics_api_test_multi_step_with_every_type_of_basic_auth.json"
199 .to_string(),
200 "Example-Synthetic".to_string(),
201 SyntheticsTestOptions::new().tick_every(60),
202 SyntheticsAPITestType::API,
203 )
204 .subtype(SyntheticsTestDetailsSubType::MULTI);
205 let configuration = datadog::Configuration::new();
206 let api = SyntheticsAPI::with_config(configuration);
207 let resp = api.create_synthetics_api_test(body).await;
208 if let Ok(value) = resp {
209 println!("{:#?}", value);
210 } else {
211 println!("{:#?}", resp.unwrap_err());
212 }
213}
examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs (line 288)
38async fn main() {
39 let body =
40 SyntheticsAPITest::new(
41 SyntheticsAPITestConfig::new()
42 .config_variables(
43 vec![
44 SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
45 .example("content-type".to_string())
46 .pattern("content-type".to_string())
47 ],
48 )
49 .steps(
50 vec![
51 SyntheticsAPIStep::SyntheticsAPITestStep(
52 Box::new(
53 SyntheticsAPITestStep::new(
54 vec![
55 SyntheticsAssertion::SyntheticsAssertionTarget(
56 Box::new(
57 SyntheticsAssertionTarget::new(
58 SyntheticsAssertionOperator::IS,
59 SyntheticsAssertionTargetValue
60 ::SyntheticsAssertionTargetValueNumber(
61 200.0 as f64,
62 ),
63 SyntheticsAssertionType::STATUS_CODE,
64 ),
65 ),
66 )
67 ],
68 "request is sent".to_string(),
69 SyntheticsTestRequest::new()
70 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
71 .method("GET".to_string())
72 .timeout(10.0 as f64)
73 .url("https://datadoghq.com".to_string()),
74 SyntheticsAPITestStepSubtype::HTTP,
75 )
76 .allow_failure(true)
77 .exit_if_succeed(true)
78 .extracted_values(
79 vec![
80 SyntheticsParsingOptions::new()
81 .field("server".to_string())
82 .name("EXTRACTED_VALUE".to_string())
83 .parser(
84 SyntheticsVariableParser::new(
85 SyntheticsGlobalVariableParserType::RAW,
86 ),
87 )
88 .secure(true)
89 .type_(SyntheticsLocalVariableParsingOptionsType::HTTP_HEADER)
90 ],
91 )
92 .extracted_values_from_script(
93 "dd.variable.set('STATUS_CODE', dd.response.statusCode);".to_string(),
94 )
95 .is_critical(true)
96 .retry(SyntheticsTestOptionsRetry::new().count(5).interval(1000.0 as f64)),
97 ),
98 ),
99 SyntheticsAPIStep::SyntheticsAPIWaitStep(
100 Box::new(
101 SyntheticsAPIWaitStep::new("Wait".to_string(), SyntheticsAPIWaitStepSubtype::WAIT, 1),
102 ),
103 ),
104 SyntheticsAPIStep::SyntheticsAPITestStep(
105 Box::new(
106 SyntheticsAPITestStep::new(
107 vec![
108 SyntheticsAssertion::SyntheticsAssertionTarget(
109 Box::new(
110 SyntheticsAssertionTarget::new(
111 SyntheticsAssertionOperator::LESS_THAN,
112 SyntheticsAssertionTargetValue
113 ::SyntheticsAssertionTargetValueNumber(
114 1000.0 as f64,
115 ),
116 SyntheticsAssertionType::RESPONSE_TIME,
117 ),
118 ),
119 )
120 ],
121 "GRPC CALL".to_string(),
122 SyntheticsTestRequest::new()
123 .call_type(SyntheticsTestCallType::UNARY)
124 .compressed_json_descriptor(
125 "eJy1lU1z2yAQhv+Lzj74I3ETH506bQ7OZOSm1w4Wa4epBARQppqM/3v5koCJJdvtxCdW77vPssCO3zMKUgHOFu/ZXvBiS6hZho/f8qe7pftYgXphWJrlA8XwxywEvNba+6PhkC2yVcVVswYp0R6ykRYlZ1SCV21SDrxsssPIeS9FJKqGfK2rqnmmSBwhWa2XlKgtaQPiDcRGCUDVfwGD2sKUqKEtc1cSoOrsMlaMOec1sySYCCgUYRSVLv2zSva2u+FQkB0pVkIw8bFuIudOOn3pOaKYVT3Iy97Pd0AYhOx5QcMsnxvRHlnuLf8ETDd3CNtrv2nejkDpRnANCmGkkFn/hsYzpBKE7jVbufgnKnV9HRM9zRPDDKPttYT61n0TdWkAAjggk9AhuxIeaXd69CYTcsGw7cBTakLVbNpRzGEgyWjkSOpMbZXkhGL6oX30R49qt3GoHrap7i0XdD41WQ+2icCNm5p1hmFqnHNlcla0riKmDZ183crDxChjbnurtxHPRE784sVhWvDfGP+SsTKibU3o5NtWHuZFGZOxP6P5VXqIOvaOSec4eYohyd7NslHuJbd1bewds85xYrNxkr2d+5IhFWF3NvaO684xjE2S5ulY+tu64Pna0fCPJgzw6vF5/WucLcYjt5xoq19O3UDptOg/OamJQRaCcPPnMTQ2QDFn+uhPvUfnCrMc99upyQY4Ui9Dlc/YoG3R/v4Cs9YE+g==".to_string(),
126 )
127 .host("grpcbin.test.k6.io".to_string())
128 .message("{}".to_string())
129 .metadata(BTreeMap::from([]))
130 .method("Index".to_string())
131 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(9000))
132 .service("grpcbin.GRPCBin".to_string()),
133 SyntheticsAPITestStepSubtype::GRPC,
134 )
135 .allow_failure(false)
136 .extracted_values(vec![])
137 .is_critical(true)
138 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
139 ),
140 ),
141 SyntheticsAPIStep::SyntheticsAPITestStep(
142 Box::new(
143 SyntheticsAPITestStep::new(
144 vec![
145 SyntheticsAssertion::SyntheticsAssertionTarget(
146 Box::new(
147 SyntheticsAssertionTarget::new(
148 SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,
149 SyntheticsAssertionTargetValue
150 ::SyntheticsAssertionTargetValueNumber(
151 10.0 as f64,
152 ),
153 SyntheticsAssertionType::CERTIFICATE,
154 ),
155 ),
156 )
157 ],
158 "SSL step".to_string(),
159 SyntheticsTestRequest::new()
160 .check_certificate_revocation(true)
161 .disable_aia_intermediate_fetching(true)
162 .host("example.org".to_string())
163 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(443)),
164 SyntheticsAPITestStepSubtype::SSL,
165 )
166 .allow_failure(false)
167 .is_critical(true)
168 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
169 ),
170 ),
171 SyntheticsAPIStep::SyntheticsAPITestStep(
172 Box::new(
173 SyntheticsAPITestStep::new(
174 vec![
175 SyntheticsAssertion::SyntheticsAssertionTarget(
176 Box::new(
177 SyntheticsAssertionTarget::new(
178 SyntheticsAssertionOperator::LESS_THAN,
179 SyntheticsAssertionTargetValue
180 ::SyntheticsAssertionTargetValueNumber(
181 1000.0 as f64,
182 ),
183 SyntheticsAssertionType::RESPONSE_TIME,
184 ),
185 ),
186 )
187 ],
188 "DNS step".to_string(),
189 SyntheticsTestRequest::new()
190 .dns_server("8.8.8.8".to_string())
191 .dns_server_port(
192 SyntheticsTestRequestDNSServerPort
193 ::SyntheticsTestRequestVariableDNSServerPort(
194 "53".to_string(),
195 ),
196 )
197 .host("troisdizaines.com".to_string()),
198 SyntheticsAPITestStepSubtype::DNS,
199 )
200 .allow_failure(false)
201 .is_critical(true)
202 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
203 ),
204 ),
205 SyntheticsAPIStep::SyntheticsAPITestStep(
206 Box::new(
207 SyntheticsAPITestStep::new(
208 vec![
209 SyntheticsAssertion::SyntheticsAssertionTarget(
210 Box::new(
211 SyntheticsAssertionTarget::new(
212 SyntheticsAssertionOperator::LESS_THAN,
213 SyntheticsAssertionTargetValue
214 ::SyntheticsAssertionTargetValueNumber(
215 1000.0 as f64,
216 ),
217 SyntheticsAssertionType::RESPONSE_TIME,
218 ),
219 ),
220 )
221 ],
222 "TCP step".to_string(),
223 SyntheticsTestRequest::new()
224 .host("34.95.79.70".to_string())
225 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(80))
226 .should_track_hops(true)
227 .timeout(32.0 as f64),
228 SyntheticsAPITestStepSubtype::TCP,
229 )
230 .allow_failure(false)
231 .is_critical(true)
232 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
233 ),
234 ),
235 SyntheticsAPIStep::SyntheticsAPITestStep(
236 Box::new(
237 SyntheticsAPITestStep::new(
238 vec![
239 SyntheticsAssertion::SyntheticsAssertionTarget(
240 Box::new(
241 SyntheticsAssertionTarget::new(
242 SyntheticsAssertionOperator::IS,
243 SyntheticsAssertionTargetValue
244 ::SyntheticsAssertionTargetValueNumber(
245 0.0 as f64,
246 ),
247 SyntheticsAssertionType::PACKET_LOSS_PERCENTAGE,
248 ),
249 ),
250 )
251 ],
252 "ICMP step".to_string(),
253 SyntheticsTestRequest::new()
254 .host("34.95.79.70".to_string())
255 .number_of_packets(4)
256 .should_track_hops(true)
257 .timeout(38.0 as f64),
258 SyntheticsAPITestStepSubtype::ICMP,
259 )
260 .allow_failure(false)
261 .is_critical(true)
262 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
263 ),
264 ),
265 SyntheticsAPIStep::SyntheticsAPITestStep(
266 Box::new(
267 SyntheticsAPITestStep::new(
268 vec![
269 SyntheticsAssertion::SyntheticsAssertionTarget(
270 Box::new(
271 SyntheticsAssertionTarget::new(
272 SyntheticsAssertionOperator::LESS_THAN,
273 SyntheticsAssertionTargetValue
274 ::SyntheticsAssertionTargetValueNumber(
275 1000.0 as f64,
276 ),
277 SyntheticsAssertionType::RESPONSE_TIME,
278 ),
279 ),
280 )
281 ],
282 "Websocket step".to_string(),
283 SyntheticsTestRequest::new()
284 .basic_auth(
285 SyntheticsBasicAuth::SyntheticsBasicAuthWeb(
286 Box::new(
287 SyntheticsBasicAuthWeb::new()
288 .password("password".to_string())
289 .type_(SyntheticsBasicAuthWebType::WEB)
290 .username("user".to_string()),
291 ),
292 ),
293 )
294 .headers(BTreeMap::from([("f".to_string(), "g".to_string())]))
295 .is_message_base64_encoded(true)
296 .message("My message".to_string())
297 .url("ws://34.95.79.70/web-socket".to_string()),
298 SyntheticsAPITestStepSubtype::WEBSOCKET,
299 )
300 .allow_failure(false)
301 .is_critical(true)
302 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
303 ),
304 ),
305 SyntheticsAPIStep::SyntheticsAPITestStep(
306 Box::new(
307 SyntheticsAPITestStep::new(
308 vec![
309 SyntheticsAssertion::SyntheticsAssertionTarget(
310 Box::new(
311 SyntheticsAssertionTarget::new(
312 SyntheticsAssertionOperator::LESS_THAN,
313 SyntheticsAssertionTargetValue
314 ::SyntheticsAssertionTargetValueNumber(
315 1000.0 as f64,
316 ),
317 SyntheticsAssertionType::RESPONSE_TIME,
318 ),
319 ),
320 )
321 ],
322 "UDP step".to_string(),
323 SyntheticsTestRequest::new()
324 .host("8.8.8.8".to_string())
325 .message("A image.google.com".to_string())
326 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(53)),
327 SyntheticsAPITestStepSubtype::UDP,
328 )
329 .allow_failure(false)
330 .is_critical(true)
331 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
332 ),
333 )
334 ],
335 ),
336 vec!["aws:us-east-2".to_string()],
337 "BDD test payload: synthetics_api_test_multi_step_payload.json".to_string(),
338 "Example-Synthetic".to_string(),
339 SyntheticsTestOptions::new()
340 .accept_self_signed(false)
341 .allow_insecure(true)
342 .follow_redirects(true)
343 .min_failure_duration(10)
344 .min_location_failed(1)
345 .monitor_name("Example-Synthetic".to_string())
346 .monitor_priority(5)
347 .retry(SyntheticsTestOptionsRetry::new().count(3).interval(1000.0 as f64))
348 .tick_every(60),
349 SyntheticsAPITestType::API,
350 )
351 .subtype(SyntheticsTestDetailsSubType::MULTI)
352 .tags(vec!["testing:api".to_string()]);
353 let configuration = datadog::Configuration::new();
354 let api = SyntheticsAPI::with_config(configuration);
355 let resp = api.create_synthetics_api_test(body).await;
356 if let Ok(value) = resp {
357 println!("{:#?}", value);
358 } else {
359 println!("{:#?}", resp.unwrap_err());
360 }
361}
Sourcepub fn type_(self, value: SyntheticsBasicAuthWebType) -> Self
pub fn type_(self, value: SyntheticsBasicAuthWebType) -> Self
Examples found in repository?
examples/v1_synthetics_TriggerCITests.rs (line 23)
17async fn main() {
18 let body =
19 SyntheticsCITestBody::new().tests(vec![SyntheticsCITest::new("aaa-aaa-aaa".to_string())
20 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
21 SyntheticsBasicAuthWeb::new()
22 .password("PaSSw0RD!".to_string())
23 .type_(SyntheticsBasicAuthWebType::WEB)
24 .username("my_username".to_string()),
25 )))
26 .device_ids(vec!["chrome.laptop_large".to_string()])
27 .locations(vec!["aws:eu-west-3".to_string()])
28 .metadata(
29 SyntheticsCIBatchMetadata::new()
30 .ci(SyntheticsCIBatchMetadataCI::new()
31 .pipeline(SyntheticsCIBatchMetadataPipeline::new())
32 .provider(SyntheticsCIBatchMetadataProvider::new()))
33 .git(SyntheticsCIBatchMetadataGit::new()),
34 )
35 .retry(SyntheticsTestOptionsRetry::new())]);
36 let configuration = datadog::Configuration::new();
37 let api = SyntheticsAPI::with_config(configuration);
38 let resp = api.trigger_ci_tests(body).await;
39 if let Ok(value) = resp {
40 println!("{:#?}", value);
41 } else {
42 println!("{:#?}", resp.unwrap_err());
43 }
44}
More examples
examples/v1_synthetics_UpdateBrowserTest.rs (line 44)
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_CreateSyntheticsAPITest_1717840259.rs (line 74)
35async fn main() {
36 let body = SyntheticsAPITest::new(
37 SyntheticsAPITestConfig::new().steps(vec![
38 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
39 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
40 SyntheticsAssertionTarget::new(
41 SyntheticsAssertionOperator::IS,
42 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
43 200.0 as f64,
44 ),
45 SyntheticsAssertionType::STATUS_CODE,
46 ),
47 ))],
48 "request is sent".to_string(),
49 SyntheticsTestRequest::new()
50 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
51 SyntheticsBasicAuthWeb::new()
52 .password("password".to_string())
53 .username("username".to_string()),
54 )))
55 .method("GET".to_string())
56 .url("https://httpbin.org/status/200".to_string()),
57 SyntheticsAPITestStepSubtype::HTTP,
58 ))),
59 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
60 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
61 SyntheticsAssertionTarget::new(
62 SyntheticsAssertionOperator::IS,
63 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
64 200.0 as f64,
65 ),
66 SyntheticsAssertionType::STATUS_CODE,
67 ),
68 ))],
69 "request is sent".to_string(),
70 SyntheticsTestRequest::new()
71 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
72 SyntheticsBasicAuthWeb::new()
73 .password("password".to_string())
74 .type_(SyntheticsBasicAuthWebType::WEB)
75 .username("username".to_string()),
76 )))
77 .method("GET".to_string())
78 .url("https://httpbin.org/status/200".to_string()),
79 SyntheticsAPITestStepSubtype::HTTP,
80 ))),
81 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
82 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
83 SyntheticsAssertionTarget::new(
84 SyntheticsAssertionOperator::IS,
85 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
86 200.0 as f64,
87 ),
88 SyntheticsAssertionType::STATUS_CODE,
89 ),
90 ))],
91 "request is sent".to_string(),
92 SyntheticsTestRequest::new()
93 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthSigv4(Box::new(
94 SyntheticsBasicAuthSigv4::new(
95 "accessKey".to_string(),
96 "secretKey".to_string(),
97 SyntheticsBasicAuthSigv4Type::SIGV4,
98 ),
99 )))
100 .method("GET".to_string())
101 .url("https://httpbin.org/status/200".to_string()),
102 SyntheticsAPITestStepSubtype::HTTP,
103 ))),
104 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
105 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
106 SyntheticsAssertionTarget::new(
107 SyntheticsAssertionOperator::IS,
108 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
109 200.0 as f64,
110 ),
111 SyntheticsAssertionType::STATUS_CODE,
112 ),
113 ))],
114 "request is sent".to_string(),
115 SyntheticsTestRequest::new()
116 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthNTLM(Box::new(
117 SyntheticsBasicAuthNTLM::new(SyntheticsBasicAuthNTLMType::NTLM),
118 )))
119 .method("GET".to_string())
120 .url("https://httpbin.org/status/200".to_string()),
121 SyntheticsAPITestStepSubtype::HTTP,
122 ))),
123 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
124 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
125 SyntheticsAssertionTarget::new(
126 SyntheticsAssertionOperator::IS,
127 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
128 200.0 as f64,
129 ),
130 SyntheticsAssertionType::STATUS_CODE,
131 ),
132 ))],
133 "request is sent".to_string(),
134 SyntheticsTestRequest::new()
135 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthDigest(Box::new(
136 SyntheticsBasicAuthDigest::new(
137 "password".to_string(),
138 SyntheticsBasicAuthDigestType::DIGEST,
139 "username".to_string(),
140 ),
141 )))
142 .method("GET".to_string())
143 .url("https://httpbin.org/status/200".to_string()),
144 SyntheticsAPITestStepSubtype::HTTP,
145 ))),
146 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
147 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
148 SyntheticsAssertionTarget::new(
149 SyntheticsAssertionOperator::IS,
150 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
151 200.0 as f64,
152 ),
153 SyntheticsAssertionType::STATUS_CODE,
154 ),
155 ))],
156 "request is sent".to_string(),
157 SyntheticsTestRequest::new()
158 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
159 Box::new(SyntheticsBasicAuthOauthClient::new(
160 "accessTokenUrl".to_string(),
161 "clientId".to_string(),
162 "clientSecret".to_string(),
163 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
164 SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
165 )),
166 ))
167 .method("GET".to_string())
168 .url("https://httpbin.org/status/200".to_string()),
169 SyntheticsAPITestStepSubtype::HTTP,
170 ))),
171 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
172 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
173 SyntheticsAssertionTarget::new(
174 SyntheticsAssertionOperator::IS,
175 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
176 200.0 as f64,
177 ),
178 SyntheticsAssertionType::STATUS_CODE,
179 ),
180 ))],
181 "request is sent".to_string(),
182 SyntheticsTestRequest::new()
183 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthROP(Box::new(
184 SyntheticsBasicAuthOauthROP::new(
185 "accessTokenUrl".to_string(),
186 "password".to_string(),
187 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
188 SyntheticsBasicAuthOauthROPType::OAUTH_ROP,
189 "username".to_string(),
190 ),
191 )))
192 .method("GET".to_string())
193 .url("https://httpbin.org/status/200".to_string()),
194 SyntheticsAPITestStepSubtype::HTTP,
195 ))),
196 ]),
197 vec!["aws:us-east-2".to_string()],
198 "BDD test payload: synthetics_api_test_multi_step_with_every_type_of_basic_auth.json"
199 .to_string(),
200 "Example-Synthetic".to_string(),
201 SyntheticsTestOptions::new().tick_every(60),
202 SyntheticsAPITestType::API,
203 )
204 .subtype(SyntheticsTestDetailsSubType::MULTI);
205 let configuration = datadog::Configuration::new();
206 let api = SyntheticsAPI::with_config(configuration);
207 let resp = api.create_synthetics_api_test(body).await;
208 if let Ok(value) = resp {
209 println!("{:#?}", value);
210 } else {
211 println!("{:#?}", resp.unwrap_err());
212 }
213}
examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs (line 289)
38async fn main() {
39 let body =
40 SyntheticsAPITest::new(
41 SyntheticsAPITestConfig::new()
42 .config_variables(
43 vec![
44 SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
45 .example("content-type".to_string())
46 .pattern("content-type".to_string())
47 ],
48 )
49 .steps(
50 vec![
51 SyntheticsAPIStep::SyntheticsAPITestStep(
52 Box::new(
53 SyntheticsAPITestStep::new(
54 vec![
55 SyntheticsAssertion::SyntheticsAssertionTarget(
56 Box::new(
57 SyntheticsAssertionTarget::new(
58 SyntheticsAssertionOperator::IS,
59 SyntheticsAssertionTargetValue
60 ::SyntheticsAssertionTargetValueNumber(
61 200.0 as f64,
62 ),
63 SyntheticsAssertionType::STATUS_CODE,
64 ),
65 ),
66 )
67 ],
68 "request is sent".to_string(),
69 SyntheticsTestRequest::new()
70 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
71 .method("GET".to_string())
72 .timeout(10.0 as f64)
73 .url("https://datadoghq.com".to_string()),
74 SyntheticsAPITestStepSubtype::HTTP,
75 )
76 .allow_failure(true)
77 .exit_if_succeed(true)
78 .extracted_values(
79 vec![
80 SyntheticsParsingOptions::new()
81 .field("server".to_string())
82 .name("EXTRACTED_VALUE".to_string())
83 .parser(
84 SyntheticsVariableParser::new(
85 SyntheticsGlobalVariableParserType::RAW,
86 ),
87 )
88 .secure(true)
89 .type_(SyntheticsLocalVariableParsingOptionsType::HTTP_HEADER)
90 ],
91 )
92 .extracted_values_from_script(
93 "dd.variable.set('STATUS_CODE', dd.response.statusCode);".to_string(),
94 )
95 .is_critical(true)
96 .retry(SyntheticsTestOptionsRetry::new().count(5).interval(1000.0 as f64)),
97 ),
98 ),
99 SyntheticsAPIStep::SyntheticsAPIWaitStep(
100 Box::new(
101 SyntheticsAPIWaitStep::new("Wait".to_string(), SyntheticsAPIWaitStepSubtype::WAIT, 1),
102 ),
103 ),
104 SyntheticsAPIStep::SyntheticsAPITestStep(
105 Box::new(
106 SyntheticsAPITestStep::new(
107 vec![
108 SyntheticsAssertion::SyntheticsAssertionTarget(
109 Box::new(
110 SyntheticsAssertionTarget::new(
111 SyntheticsAssertionOperator::LESS_THAN,
112 SyntheticsAssertionTargetValue
113 ::SyntheticsAssertionTargetValueNumber(
114 1000.0 as f64,
115 ),
116 SyntheticsAssertionType::RESPONSE_TIME,
117 ),
118 ),
119 )
120 ],
121 "GRPC CALL".to_string(),
122 SyntheticsTestRequest::new()
123 .call_type(SyntheticsTestCallType::UNARY)
124 .compressed_json_descriptor(
125 "eJy1lU1z2yAQhv+Lzj74I3ETH506bQ7OZOSm1w4Wa4epBARQppqM/3v5koCJJdvtxCdW77vPssCO3zMKUgHOFu/ZXvBiS6hZho/f8qe7pftYgXphWJrlA8XwxywEvNba+6PhkC2yVcVVswYp0R6ykRYlZ1SCV21SDrxsssPIeS9FJKqGfK2rqnmmSBwhWa2XlKgtaQPiDcRGCUDVfwGD2sKUqKEtc1cSoOrsMlaMOec1sySYCCgUYRSVLv2zSva2u+FQkB0pVkIw8bFuIudOOn3pOaKYVT3Iy97Pd0AYhOx5QcMsnxvRHlnuLf8ETDd3CNtrv2nejkDpRnANCmGkkFn/hsYzpBKE7jVbufgnKnV9HRM9zRPDDKPttYT61n0TdWkAAjggk9AhuxIeaXd69CYTcsGw7cBTakLVbNpRzGEgyWjkSOpMbZXkhGL6oX30R49qt3GoHrap7i0XdD41WQ+2icCNm5p1hmFqnHNlcla0riKmDZ183crDxChjbnurtxHPRE784sVhWvDfGP+SsTKibU3o5NtWHuZFGZOxP6P5VXqIOvaOSec4eYohyd7NslHuJbd1bewds85xYrNxkr2d+5IhFWF3NvaO684xjE2S5ulY+tu64Pna0fCPJgzw6vF5/WucLcYjt5xoq19O3UDptOg/OamJQRaCcPPnMTQ2QDFn+uhPvUfnCrMc99upyQY4Ui9Dlc/YoG3R/v4Cs9YE+g==".to_string(),
126 )
127 .host("grpcbin.test.k6.io".to_string())
128 .message("{}".to_string())
129 .metadata(BTreeMap::from([]))
130 .method("Index".to_string())
131 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(9000))
132 .service("grpcbin.GRPCBin".to_string()),
133 SyntheticsAPITestStepSubtype::GRPC,
134 )
135 .allow_failure(false)
136 .extracted_values(vec![])
137 .is_critical(true)
138 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
139 ),
140 ),
141 SyntheticsAPIStep::SyntheticsAPITestStep(
142 Box::new(
143 SyntheticsAPITestStep::new(
144 vec![
145 SyntheticsAssertion::SyntheticsAssertionTarget(
146 Box::new(
147 SyntheticsAssertionTarget::new(
148 SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,
149 SyntheticsAssertionTargetValue
150 ::SyntheticsAssertionTargetValueNumber(
151 10.0 as f64,
152 ),
153 SyntheticsAssertionType::CERTIFICATE,
154 ),
155 ),
156 )
157 ],
158 "SSL step".to_string(),
159 SyntheticsTestRequest::new()
160 .check_certificate_revocation(true)
161 .disable_aia_intermediate_fetching(true)
162 .host("example.org".to_string())
163 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(443)),
164 SyntheticsAPITestStepSubtype::SSL,
165 )
166 .allow_failure(false)
167 .is_critical(true)
168 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
169 ),
170 ),
171 SyntheticsAPIStep::SyntheticsAPITestStep(
172 Box::new(
173 SyntheticsAPITestStep::new(
174 vec![
175 SyntheticsAssertion::SyntheticsAssertionTarget(
176 Box::new(
177 SyntheticsAssertionTarget::new(
178 SyntheticsAssertionOperator::LESS_THAN,
179 SyntheticsAssertionTargetValue
180 ::SyntheticsAssertionTargetValueNumber(
181 1000.0 as f64,
182 ),
183 SyntheticsAssertionType::RESPONSE_TIME,
184 ),
185 ),
186 )
187 ],
188 "DNS step".to_string(),
189 SyntheticsTestRequest::new()
190 .dns_server("8.8.8.8".to_string())
191 .dns_server_port(
192 SyntheticsTestRequestDNSServerPort
193 ::SyntheticsTestRequestVariableDNSServerPort(
194 "53".to_string(),
195 ),
196 )
197 .host("troisdizaines.com".to_string()),
198 SyntheticsAPITestStepSubtype::DNS,
199 )
200 .allow_failure(false)
201 .is_critical(true)
202 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
203 ),
204 ),
205 SyntheticsAPIStep::SyntheticsAPITestStep(
206 Box::new(
207 SyntheticsAPITestStep::new(
208 vec![
209 SyntheticsAssertion::SyntheticsAssertionTarget(
210 Box::new(
211 SyntheticsAssertionTarget::new(
212 SyntheticsAssertionOperator::LESS_THAN,
213 SyntheticsAssertionTargetValue
214 ::SyntheticsAssertionTargetValueNumber(
215 1000.0 as f64,
216 ),
217 SyntheticsAssertionType::RESPONSE_TIME,
218 ),
219 ),
220 )
221 ],
222 "TCP step".to_string(),
223 SyntheticsTestRequest::new()
224 .host("34.95.79.70".to_string())
225 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(80))
226 .should_track_hops(true)
227 .timeout(32.0 as f64),
228 SyntheticsAPITestStepSubtype::TCP,
229 )
230 .allow_failure(false)
231 .is_critical(true)
232 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
233 ),
234 ),
235 SyntheticsAPIStep::SyntheticsAPITestStep(
236 Box::new(
237 SyntheticsAPITestStep::new(
238 vec![
239 SyntheticsAssertion::SyntheticsAssertionTarget(
240 Box::new(
241 SyntheticsAssertionTarget::new(
242 SyntheticsAssertionOperator::IS,
243 SyntheticsAssertionTargetValue
244 ::SyntheticsAssertionTargetValueNumber(
245 0.0 as f64,
246 ),
247 SyntheticsAssertionType::PACKET_LOSS_PERCENTAGE,
248 ),
249 ),
250 )
251 ],
252 "ICMP step".to_string(),
253 SyntheticsTestRequest::new()
254 .host("34.95.79.70".to_string())
255 .number_of_packets(4)
256 .should_track_hops(true)
257 .timeout(38.0 as f64),
258 SyntheticsAPITestStepSubtype::ICMP,
259 )
260 .allow_failure(false)
261 .is_critical(true)
262 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
263 ),
264 ),
265 SyntheticsAPIStep::SyntheticsAPITestStep(
266 Box::new(
267 SyntheticsAPITestStep::new(
268 vec![
269 SyntheticsAssertion::SyntheticsAssertionTarget(
270 Box::new(
271 SyntheticsAssertionTarget::new(
272 SyntheticsAssertionOperator::LESS_THAN,
273 SyntheticsAssertionTargetValue
274 ::SyntheticsAssertionTargetValueNumber(
275 1000.0 as f64,
276 ),
277 SyntheticsAssertionType::RESPONSE_TIME,
278 ),
279 ),
280 )
281 ],
282 "Websocket step".to_string(),
283 SyntheticsTestRequest::new()
284 .basic_auth(
285 SyntheticsBasicAuth::SyntheticsBasicAuthWeb(
286 Box::new(
287 SyntheticsBasicAuthWeb::new()
288 .password("password".to_string())
289 .type_(SyntheticsBasicAuthWebType::WEB)
290 .username("user".to_string()),
291 ),
292 ),
293 )
294 .headers(BTreeMap::from([("f".to_string(), "g".to_string())]))
295 .is_message_base64_encoded(true)
296 .message("My message".to_string())
297 .url("ws://34.95.79.70/web-socket".to_string()),
298 SyntheticsAPITestStepSubtype::WEBSOCKET,
299 )
300 .allow_failure(false)
301 .is_critical(true)
302 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
303 ),
304 ),
305 SyntheticsAPIStep::SyntheticsAPITestStep(
306 Box::new(
307 SyntheticsAPITestStep::new(
308 vec![
309 SyntheticsAssertion::SyntheticsAssertionTarget(
310 Box::new(
311 SyntheticsAssertionTarget::new(
312 SyntheticsAssertionOperator::LESS_THAN,
313 SyntheticsAssertionTargetValue
314 ::SyntheticsAssertionTargetValueNumber(
315 1000.0 as f64,
316 ),
317 SyntheticsAssertionType::RESPONSE_TIME,
318 ),
319 ),
320 )
321 ],
322 "UDP step".to_string(),
323 SyntheticsTestRequest::new()
324 .host("8.8.8.8".to_string())
325 .message("A image.google.com".to_string())
326 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(53)),
327 SyntheticsAPITestStepSubtype::UDP,
328 )
329 .allow_failure(false)
330 .is_critical(true)
331 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
332 ),
333 )
334 ],
335 ),
336 vec!["aws:us-east-2".to_string()],
337 "BDD test payload: synthetics_api_test_multi_step_payload.json".to_string(),
338 "Example-Synthetic".to_string(),
339 SyntheticsTestOptions::new()
340 .accept_self_signed(false)
341 .allow_insecure(true)
342 .follow_redirects(true)
343 .min_failure_duration(10)
344 .min_location_failed(1)
345 .monitor_name("Example-Synthetic".to_string())
346 .monitor_priority(5)
347 .retry(SyntheticsTestOptionsRetry::new().count(3).interval(1000.0 as f64))
348 .tick_every(60),
349 SyntheticsAPITestType::API,
350 )
351 .subtype(SyntheticsTestDetailsSubType::MULTI)
352 .tags(vec!["testing:api".to_string()]);
353 let configuration = datadog::Configuration::new();
354 let api = SyntheticsAPI::with_config(configuration);
355 let resp = api.create_synthetics_api_test(body).await;
356 if let Ok(value) = resp {
357 println!("{:#?}", value);
358 } else {
359 println!("{:#?}", resp.unwrap_err());
360 }
361}
Sourcepub fn username(self, value: String) -> Self
pub fn username(self, value: String) -> Self
Examples found in repository?
examples/v1_synthetics_TriggerCITests.rs (line 24)
17async fn main() {
18 let body =
19 SyntheticsCITestBody::new().tests(vec![SyntheticsCITest::new("aaa-aaa-aaa".to_string())
20 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
21 SyntheticsBasicAuthWeb::new()
22 .password("PaSSw0RD!".to_string())
23 .type_(SyntheticsBasicAuthWebType::WEB)
24 .username("my_username".to_string()),
25 )))
26 .device_ids(vec!["chrome.laptop_large".to_string()])
27 .locations(vec!["aws:eu-west-3".to_string()])
28 .metadata(
29 SyntheticsCIBatchMetadata::new()
30 .ci(SyntheticsCIBatchMetadataCI::new()
31 .pipeline(SyntheticsCIBatchMetadataPipeline::new())
32 .provider(SyntheticsCIBatchMetadataProvider::new()))
33 .git(SyntheticsCIBatchMetadataGit::new()),
34 )
35 .retry(SyntheticsTestOptionsRetry::new())]);
36 let configuration = datadog::Configuration::new();
37 let api = SyntheticsAPI::with_config(configuration);
38 let resp = api.trigger_ci_tests(body).await;
39 if let Ok(value) = resp {
40 println!("{:#?}", value);
41 } else {
42 println!("{:#?}", resp.unwrap_err());
43 }
44}
More examples
examples/v1_synthetics_UpdateBrowserTest.rs (line 45)
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_CreateSyntheticsAPITest_1717840259.rs (line 53)
35async fn main() {
36 let body = SyntheticsAPITest::new(
37 SyntheticsAPITestConfig::new().steps(vec![
38 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
39 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
40 SyntheticsAssertionTarget::new(
41 SyntheticsAssertionOperator::IS,
42 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
43 200.0 as f64,
44 ),
45 SyntheticsAssertionType::STATUS_CODE,
46 ),
47 ))],
48 "request is sent".to_string(),
49 SyntheticsTestRequest::new()
50 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
51 SyntheticsBasicAuthWeb::new()
52 .password("password".to_string())
53 .username("username".to_string()),
54 )))
55 .method("GET".to_string())
56 .url("https://httpbin.org/status/200".to_string()),
57 SyntheticsAPITestStepSubtype::HTTP,
58 ))),
59 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
60 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
61 SyntheticsAssertionTarget::new(
62 SyntheticsAssertionOperator::IS,
63 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
64 200.0 as f64,
65 ),
66 SyntheticsAssertionType::STATUS_CODE,
67 ),
68 ))],
69 "request is sent".to_string(),
70 SyntheticsTestRequest::new()
71 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
72 SyntheticsBasicAuthWeb::new()
73 .password("password".to_string())
74 .type_(SyntheticsBasicAuthWebType::WEB)
75 .username("username".to_string()),
76 )))
77 .method("GET".to_string())
78 .url("https://httpbin.org/status/200".to_string()),
79 SyntheticsAPITestStepSubtype::HTTP,
80 ))),
81 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
82 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
83 SyntheticsAssertionTarget::new(
84 SyntheticsAssertionOperator::IS,
85 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
86 200.0 as f64,
87 ),
88 SyntheticsAssertionType::STATUS_CODE,
89 ),
90 ))],
91 "request is sent".to_string(),
92 SyntheticsTestRequest::new()
93 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthSigv4(Box::new(
94 SyntheticsBasicAuthSigv4::new(
95 "accessKey".to_string(),
96 "secretKey".to_string(),
97 SyntheticsBasicAuthSigv4Type::SIGV4,
98 ),
99 )))
100 .method("GET".to_string())
101 .url("https://httpbin.org/status/200".to_string()),
102 SyntheticsAPITestStepSubtype::HTTP,
103 ))),
104 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
105 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
106 SyntheticsAssertionTarget::new(
107 SyntheticsAssertionOperator::IS,
108 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
109 200.0 as f64,
110 ),
111 SyntheticsAssertionType::STATUS_CODE,
112 ),
113 ))],
114 "request is sent".to_string(),
115 SyntheticsTestRequest::new()
116 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthNTLM(Box::new(
117 SyntheticsBasicAuthNTLM::new(SyntheticsBasicAuthNTLMType::NTLM),
118 )))
119 .method("GET".to_string())
120 .url("https://httpbin.org/status/200".to_string()),
121 SyntheticsAPITestStepSubtype::HTTP,
122 ))),
123 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
124 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
125 SyntheticsAssertionTarget::new(
126 SyntheticsAssertionOperator::IS,
127 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
128 200.0 as f64,
129 ),
130 SyntheticsAssertionType::STATUS_CODE,
131 ),
132 ))],
133 "request is sent".to_string(),
134 SyntheticsTestRequest::new()
135 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthDigest(Box::new(
136 SyntheticsBasicAuthDigest::new(
137 "password".to_string(),
138 SyntheticsBasicAuthDigestType::DIGEST,
139 "username".to_string(),
140 ),
141 )))
142 .method("GET".to_string())
143 .url("https://httpbin.org/status/200".to_string()),
144 SyntheticsAPITestStepSubtype::HTTP,
145 ))),
146 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
147 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
148 SyntheticsAssertionTarget::new(
149 SyntheticsAssertionOperator::IS,
150 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
151 200.0 as f64,
152 ),
153 SyntheticsAssertionType::STATUS_CODE,
154 ),
155 ))],
156 "request is sent".to_string(),
157 SyntheticsTestRequest::new()
158 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
159 Box::new(SyntheticsBasicAuthOauthClient::new(
160 "accessTokenUrl".to_string(),
161 "clientId".to_string(),
162 "clientSecret".to_string(),
163 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
164 SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
165 )),
166 ))
167 .method("GET".to_string())
168 .url("https://httpbin.org/status/200".to_string()),
169 SyntheticsAPITestStepSubtype::HTTP,
170 ))),
171 SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
172 vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
173 SyntheticsAssertionTarget::new(
174 SyntheticsAssertionOperator::IS,
175 SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
176 200.0 as f64,
177 ),
178 SyntheticsAssertionType::STATUS_CODE,
179 ),
180 ))],
181 "request is sent".to_string(),
182 SyntheticsTestRequest::new()
183 .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthROP(Box::new(
184 SyntheticsBasicAuthOauthROP::new(
185 "accessTokenUrl".to_string(),
186 "password".to_string(),
187 SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
188 SyntheticsBasicAuthOauthROPType::OAUTH_ROP,
189 "username".to_string(),
190 ),
191 )))
192 .method("GET".to_string())
193 .url("https://httpbin.org/status/200".to_string()),
194 SyntheticsAPITestStepSubtype::HTTP,
195 ))),
196 ]),
197 vec!["aws:us-east-2".to_string()],
198 "BDD test payload: synthetics_api_test_multi_step_with_every_type_of_basic_auth.json"
199 .to_string(),
200 "Example-Synthetic".to_string(),
201 SyntheticsTestOptions::new().tick_every(60),
202 SyntheticsAPITestType::API,
203 )
204 .subtype(SyntheticsTestDetailsSubType::MULTI);
205 let configuration = datadog::Configuration::new();
206 let api = SyntheticsAPI::with_config(configuration);
207 let resp = api.create_synthetics_api_test(body).await;
208 if let Ok(value) = resp {
209 println!("{:#?}", value);
210 } else {
211 println!("{:#?}", resp.unwrap_err());
212 }
213}
examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs (line 290)
38async fn main() {
39 let body =
40 SyntheticsAPITest::new(
41 SyntheticsAPITestConfig::new()
42 .config_variables(
43 vec![
44 SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
45 .example("content-type".to_string())
46 .pattern("content-type".to_string())
47 ],
48 )
49 .steps(
50 vec![
51 SyntheticsAPIStep::SyntheticsAPITestStep(
52 Box::new(
53 SyntheticsAPITestStep::new(
54 vec![
55 SyntheticsAssertion::SyntheticsAssertionTarget(
56 Box::new(
57 SyntheticsAssertionTarget::new(
58 SyntheticsAssertionOperator::IS,
59 SyntheticsAssertionTargetValue
60 ::SyntheticsAssertionTargetValueNumber(
61 200.0 as f64,
62 ),
63 SyntheticsAssertionType::STATUS_CODE,
64 ),
65 ),
66 )
67 ],
68 "request is sent".to_string(),
69 SyntheticsTestRequest::new()
70 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
71 .method("GET".to_string())
72 .timeout(10.0 as f64)
73 .url("https://datadoghq.com".to_string()),
74 SyntheticsAPITestStepSubtype::HTTP,
75 )
76 .allow_failure(true)
77 .exit_if_succeed(true)
78 .extracted_values(
79 vec![
80 SyntheticsParsingOptions::new()
81 .field("server".to_string())
82 .name("EXTRACTED_VALUE".to_string())
83 .parser(
84 SyntheticsVariableParser::new(
85 SyntheticsGlobalVariableParserType::RAW,
86 ),
87 )
88 .secure(true)
89 .type_(SyntheticsLocalVariableParsingOptionsType::HTTP_HEADER)
90 ],
91 )
92 .extracted_values_from_script(
93 "dd.variable.set('STATUS_CODE', dd.response.statusCode);".to_string(),
94 )
95 .is_critical(true)
96 .retry(SyntheticsTestOptionsRetry::new().count(5).interval(1000.0 as f64)),
97 ),
98 ),
99 SyntheticsAPIStep::SyntheticsAPIWaitStep(
100 Box::new(
101 SyntheticsAPIWaitStep::new("Wait".to_string(), SyntheticsAPIWaitStepSubtype::WAIT, 1),
102 ),
103 ),
104 SyntheticsAPIStep::SyntheticsAPITestStep(
105 Box::new(
106 SyntheticsAPITestStep::new(
107 vec![
108 SyntheticsAssertion::SyntheticsAssertionTarget(
109 Box::new(
110 SyntheticsAssertionTarget::new(
111 SyntheticsAssertionOperator::LESS_THAN,
112 SyntheticsAssertionTargetValue
113 ::SyntheticsAssertionTargetValueNumber(
114 1000.0 as f64,
115 ),
116 SyntheticsAssertionType::RESPONSE_TIME,
117 ),
118 ),
119 )
120 ],
121 "GRPC CALL".to_string(),
122 SyntheticsTestRequest::new()
123 .call_type(SyntheticsTestCallType::UNARY)
124 .compressed_json_descriptor(
125 "eJy1lU1z2yAQhv+Lzj74I3ETH506bQ7OZOSm1w4Wa4epBARQppqM/3v5koCJJdvtxCdW77vPssCO3zMKUgHOFu/ZXvBiS6hZho/f8qe7pftYgXphWJrlA8XwxywEvNba+6PhkC2yVcVVswYp0R6ykRYlZ1SCV21SDrxsssPIeS9FJKqGfK2rqnmmSBwhWa2XlKgtaQPiDcRGCUDVfwGD2sKUqKEtc1cSoOrsMlaMOec1sySYCCgUYRSVLv2zSva2u+FQkB0pVkIw8bFuIudOOn3pOaKYVT3Iy97Pd0AYhOx5QcMsnxvRHlnuLf8ETDd3CNtrv2nejkDpRnANCmGkkFn/hsYzpBKE7jVbufgnKnV9HRM9zRPDDKPttYT61n0TdWkAAjggk9AhuxIeaXd69CYTcsGw7cBTakLVbNpRzGEgyWjkSOpMbZXkhGL6oX30R49qt3GoHrap7i0XdD41WQ+2icCNm5p1hmFqnHNlcla0riKmDZ183crDxChjbnurtxHPRE784sVhWvDfGP+SsTKibU3o5NtWHuZFGZOxP6P5VXqIOvaOSec4eYohyd7NslHuJbd1bewds85xYrNxkr2d+5IhFWF3NvaO684xjE2S5ulY+tu64Pna0fCPJgzw6vF5/WucLcYjt5xoq19O3UDptOg/OamJQRaCcPPnMTQ2QDFn+uhPvUfnCrMc99upyQY4Ui9Dlc/YoG3R/v4Cs9YE+g==".to_string(),
126 )
127 .host("grpcbin.test.k6.io".to_string())
128 .message("{}".to_string())
129 .metadata(BTreeMap::from([]))
130 .method("Index".to_string())
131 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(9000))
132 .service("grpcbin.GRPCBin".to_string()),
133 SyntheticsAPITestStepSubtype::GRPC,
134 )
135 .allow_failure(false)
136 .extracted_values(vec![])
137 .is_critical(true)
138 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
139 ),
140 ),
141 SyntheticsAPIStep::SyntheticsAPITestStep(
142 Box::new(
143 SyntheticsAPITestStep::new(
144 vec![
145 SyntheticsAssertion::SyntheticsAssertionTarget(
146 Box::new(
147 SyntheticsAssertionTarget::new(
148 SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,
149 SyntheticsAssertionTargetValue
150 ::SyntheticsAssertionTargetValueNumber(
151 10.0 as f64,
152 ),
153 SyntheticsAssertionType::CERTIFICATE,
154 ),
155 ),
156 )
157 ],
158 "SSL step".to_string(),
159 SyntheticsTestRequest::new()
160 .check_certificate_revocation(true)
161 .disable_aia_intermediate_fetching(true)
162 .host("example.org".to_string())
163 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(443)),
164 SyntheticsAPITestStepSubtype::SSL,
165 )
166 .allow_failure(false)
167 .is_critical(true)
168 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
169 ),
170 ),
171 SyntheticsAPIStep::SyntheticsAPITestStep(
172 Box::new(
173 SyntheticsAPITestStep::new(
174 vec![
175 SyntheticsAssertion::SyntheticsAssertionTarget(
176 Box::new(
177 SyntheticsAssertionTarget::new(
178 SyntheticsAssertionOperator::LESS_THAN,
179 SyntheticsAssertionTargetValue
180 ::SyntheticsAssertionTargetValueNumber(
181 1000.0 as f64,
182 ),
183 SyntheticsAssertionType::RESPONSE_TIME,
184 ),
185 ),
186 )
187 ],
188 "DNS step".to_string(),
189 SyntheticsTestRequest::new()
190 .dns_server("8.8.8.8".to_string())
191 .dns_server_port(
192 SyntheticsTestRequestDNSServerPort
193 ::SyntheticsTestRequestVariableDNSServerPort(
194 "53".to_string(),
195 ),
196 )
197 .host("troisdizaines.com".to_string()),
198 SyntheticsAPITestStepSubtype::DNS,
199 )
200 .allow_failure(false)
201 .is_critical(true)
202 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
203 ),
204 ),
205 SyntheticsAPIStep::SyntheticsAPITestStep(
206 Box::new(
207 SyntheticsAPITestStep::new(
208 vec![
209 SyntheticsAssertion::SyntheticsAssertionTarget(
210 Box::new(
211 SyntheticsAssertionTarget::new(
212 SyntheticsAssertionOperator::LESS_THAN,
213 SyntheticsAssertionTargetValue
214 ::SyntheticsAssertionTargetValueNumber(
215 1000.0 as f64,
216 ),
217 SyntheticsAssertionType::RESPONSE_TIME,
218 ),
219 ),
220 )
221 ],
222 "TCP step".to_string(),
223 SyntheticsTestRequest::new()
224 .host("34.95.79.70".to_string())
225 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(80))
226 .should_track_hops(true)
227 .timeout(32.0 as f64),
228 SyntheticsAPITestStepSubtype::TCP,
229 )
230 .allow_failure(false)
231 .is_critical(true)
232 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
233 ),
234 ),
235 SyntheticsAPIStep::SyntheticsAPITestStep(
236 Box::new(
237 SyntheticsAPITestStep::new(
238 vec![
239 SyntheticsAssertion::SyntheticsAssertionTarget(
240 Box::new(
241 SyntheticsAssertionTarget::new(
242 SyntheticsAssertionOperator::IS,
243 SyntheticsAssertionTargetValue
244 ::SyntheticsAssertionTargetValueNumber(
245 0.0 as f64,
246 ),
247 SyntheticsAssertionType::PACKET_LOSS_PERCENTAGE,
248 ),
249 ),
250 )
251 ],
252 "ICMP step".to_string(),
253 SyntheticsTestRequest::new()
254 .host("34.95.79.70".to_string())
255 .number_of_packets(4)
256 .should_track_hops(true)
257 .timeout(38.0 as f64),
258 SyntheticsAPITestStepSubtype::ICMP,
259 )
260 .allow_failure(false)
261 .is_critical(true)
262 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
263 ),
264 ),
265 SyntheticsAPIStep::SyntheticsAPITestStep(
266 Box::new(
267 SyntheticsAPITestStep::new(
268 vec![
269 SyntheticsAssertion::SyntheticsAssertionTarget(
270 Box::new(
271 SyntheticsAssertionTarget::new(
272 SyntheticsAssertionOperator::LESS_THAN,
273 SyntheticsAssertionTargetValue
274 ::SyntheticsAssertionTargetValueNumber(
275 1000.0 as f64,
276 ),
277 SyntheticsAssertionType::RESPONSE_TIME,
278 ),
279 ),
280 )
281 ],
282 "Websocket step".to_string(),
283 SyntheticsTestRequest::new()
284 .basic_auth(
285 SyntheticsBasicAuth::SyntheticsBasicAuthWeb(
286 Box::new(
287 SyntheticsBasicAuthWeb::new()
288 .password("password".to_string())
289 .type_(SyntheticsBasicAuthWebType::WEB)
290 .username("user".to_string()),
291 ),
292 ),
293 )
294 .headers(BTreeMap::from([("f".to_string(), "g".to_string())]))
295 .is_message_base64_encoded(true)
296 .message("My message".to_string())
297 .url("ws://34.95.79.70/web-socket".to_string()),
298 SyntheticsAPITestStepSubtype::WEBSOCKET,
299 )
300 .allow_failure(false)
301 .is_critical(true)
302 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
303 ),
304 ),
305 SyntheticsAPIStep::SyntheticsAPITestStep(
306 Box::new(
307 SyntheticsAPITestStep::new(
308 vec![
309 SyntheticsAssertion::SyntheticsAssertionTarget(
310 Box::new(
311 SyntheticsAssertionTarget::new(
312 SyntheticsAssertionOperator::LESS_THAN,
313 SyntheticsAssertionTargetValue
314 ::SyntheticsAssertionTargetValueNumber(
315 1000.0 as f64,
316 ),
317 SyntheticsAssertionType::RESPONSE_TIME,
318 ),
319 ),
320 )
321 ],
322 "UDP step".to_string(),
323 SyntheticsTestRequest::new()
324 .host("8.8.8.8".to_string())
325 .message("A image.google.com".to_string())
326 .port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(53)),
327 SyntheticsAPITestStepSubtype::UDP,
328 )
329 .allow_failure(false)
330 .is_critical(true)
331 .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
332 ),
333 )
334 ],
335 ),
336 vec!["aws:us-east-2".to_string()],
337 "BDD test payload: synthetics_api_test_multi_step_payload.json".to_string(),
338 "Example-Synthetic".to_string(),
339 SyntheticsTestOptions::new()
340 .accept_self_signed(false)
341 .allow_insecure(true)
342 .follow_redirects(true)
343 .min_failure_duration(10)
344 .min_location_failed(1)
345 .monitor_name("Example-Synthetic".to_string())
346 .monitor_priority(5)
347 .retry(SyntheticsTestOptionsRetry::new().count(3).interval(1000.0 as f64))
348 .tick_every(60),
349 SyntheticsAPITestType::API,
350 )
351 .subtype(SyntheticsTestDetailsSubType::MULTI)
352 .tags(vec!["testing:api".to_string()]);
353 let configuration = datadog::Configuration::new();
354 let api = SyntheticsAPI::with_config(configuration);
355 let resp = api.create_synthetics_api_test(body).await;
356 if let Ok(value) = resp {
357 println!("{:#?}", value);
358 } else {
359 println!("{:#?}", resp.unwrap_err());
360 }
361}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for SyntheticsBasicAuthWeb
impl Clone for SyntheticsBasicAuthWeb
Source§fn clone(&self) -> SyntheticsBasicAuthWeb
fn clone(&self) -> SyntheticsBasicAuthWeb
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 SyntheticsBasicAuthWeb
impl Debug for SyntheticsBasicAuthWeb
Source§impl Default for SyntheticsBasicAuthWeb
impl Default for SyntheticsBasicAuthWeb
Source§impl<'de> Deserialize<'de> for SyntheticsBasicAuthWeb
impl<'de> Deserialize<'de> for SyntheticsBasicAuthWeb
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 SyntheticsBasicAuthWeb
impl PartialEq for SyntheticsBasicAuthWeb
Source§impl Serialize for SyntheticsBasicAuthWeb
impl Serialize for SyntheticsBasicAuthWeb
impl StructuralPartialEq for SyntheticsBasicAuthWeb
Auto Trait Implementations§
impl Freeze for SyntheticsBasicAuthWeb
impl RefUnwindSafe for SyntheticsBasicAuthWeb
impl Send for SyntheticsBasicAuthWeb
impl Sync for SyntheticsBasicAuthWeb
impl Unpin for SyntheticsBasicAuthWeb
impl UnwindSafe for SyntheticsBasicAuthWeb
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