#[non_exhaustive]pub struct SyntheticsBrowserVariable {
pub example: Option<String>,
pub id: Option<String>,
pub name: String,
pub pattern: Option<String>,
pub secure: Option<bool>,
pub type_: SyntheticsBrowserVariableType,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Object defining a variable that can be used in your browser test. See the Recording Steps documentation.
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 for the variable. Global variables require an ID.
name: String
Name of the variable.
pattern: Option<String>
Pattern of the variable.
secure: Option<bool>
Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text
.
type_: SyntheticsBrowserVariableType
Type of browser test variable.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl SyntheticsBrowserVariable
impl SyntheticsBrowserVariable
Sourcepub fn new(
name: String,
type_: SyntheticsBrowserVariableType,
) -> SyntheticsBrowserVariable
pub fn new( name: String, type_: SyntheticsBrowserVariableType, ) -> SyntheticsBrowserVariable
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (lines 35-38)
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 (lines 66-69)
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("PaSSw0RD!".to_string(), "my_username".to_string())
43 .type_(SyntheticsBasicAuthWebType::WEB),
44 )))
45 .body_type(SyntheticsTestRequestBodyType::TEXT_PLAIN)
46 .call_type(SyntheticsTestCallType::UNARY)
47 .certificate(
48 SyntheticsTestRequestCertificate::new()
49 .cert(SyntheticsTestRequestCertificateItem::new())
50 .key(SyntheticsTestRequestCertificateItem::new()),
51 )
52 .certificate_domains(vec![])
53 .files(vec![SyntheticsTestRequestBodyFile::new()])
54 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP1)
55 .proxy(SyntheticsTestRequestProxy::new(
56 "https://example.com".to_string(),
57 ))
58 .service("Greeter".to_string())
59 .url("https://example.com".to_string()),
60 )
61 .config_variables(vec![SyntheticsConfigVariable::new(
62 "VARIABLE_NAME".to_string(),
63 SyntheticsConfigVariableType::TEXT,
64 )
65 .secure(false)])
66 .variables(vec![SyntheticsBrowserVariable::new(
67 "VARIABLE_NAME".to_string(),
68 SyntheticsBrowserVariableType::TEXT,
69 )]),
70 vec!["aws:eu-west-3".to_string()],
71 "".to_string(),
72 "Example test name".to_string(),
73 SyntheticsTestOptions::new()
74 .ci(SyntheticsTestCiOptions::new(
75 SyntheticsTestExecutionRule::BLOCKING,
76 ))
77 .device_ids(vec!["chrome.laptop_large".to_string()])
78 .http_version(SyntheticsTestOptionsHTTPVersion::HTTP1)
79 .monitor_options(
80 SyntheticsTestOptionsMonitorOptions::new().notification_preset_name(
81 SyntheticsTestOptionsMonitorOptionsNotificationPresetName::SHOW_ALL,
82 ),
83 )
84 .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()])
85 .retry(SyntheticsTestOptionsRetry::new())
86 .rum_settings(
87 SyntheticsBrowserTestRumSettings::new(true)
88 .application_id("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string())
89 .client_token_id(12345),
90 )
91 .scheduling(SyntheticsTestOptionsScheduling::new(
92 vec![
93 SyntheticsTestOptionsSchedulingTimeframe::new(
94 1,
95 "07:00".to_string(),
96 "16:00".to_string(),
97 ),
98 SyntheticsTestOptionsSchedulingTimeframe::new(
99 3,
100 "07:00".to_string(),
101 "16:00".to_string(),
102 ),
103 ],
104 "America/New_York".to_string(),
105 )),
106 SyntheticsBrowserTestType::BROWSER,
107 )
108 .status(SyntheticsTestPauseStatus::LIVE)
109 .steps(vec![
110 SyntheticsStep::new().type_(SyntheticsStepType::ASSERT_ELEMENT_CONTENT)
111 ])
112 .tags(vec!["env:prod".to_string()]);
113 let configuration = datadog::Configuration::new();
114 let api = SyntheticsAPI::with_config(configuration);
115 let resp = api.update_browser_test("public_id".to_string(), body).await;
116 if let Ok(value) = resp {
117 println!("{:#?}", value);
118 } else {
119 println!("{:#?}", resp.unwrap_err());
120 }
121}
Sourcepub fn example(self, value: String) -> Self
pub fn example(self, value: String) -> Self
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (line 39)
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}
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 40)
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}
Sourcepub fn secure(self, value: bool) -> Self
pub fn secure(self, value: bool) -> Self
Examples found in repository?
examples/v1_synthetics_CreateSyntheticsBrowserTest.rs (line 41)
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}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for SyntheticsBrowserVariable
impl Clone for SyntheticsBrowserVariable
Source§fn clone(&self) -> SyntheticsBrowserVariable
fn clone(&self) -> SyntheticsBrowserVariable
Returns a copy 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 SyntheticsBrowserVariable
impl Debug for SyntheticsBrowserVariable
Source§impl<'de> Deserialize<'de> for SyntheticsBrowserVariable
impl<'de> Deserialize<'de> for SyntheticsBrowserVariable
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
impl StructuralPartialEq for SyntheticsBrowserVariable
Auto Trait Implementations§
impl Freeze for SyntheticsBrowserVariable
impl RefUnwindSafe for SyntheticsBrowserVariable
impl Send for SyntheticsBrowserVariable
impl Sync for SyntheticsBrowserVariable
impl Unpin for SyntheticsBrowserVariable
impl UnwindSafe for SyntheticsBrowserVariable
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