Struct SyntheticsBrowserVariable

Source
#[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

Source

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
Hide additional 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}
Source

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}
Source

pub fn id(self, value: String) -> Self

Source

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}
Source

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}
Source

pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self

Trait Implementations§

Source§

impl Clone for SyntheticsBrowserVariable

Source§

fn clone(&self) -> SyntheticsBrowserVariable

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SyntheticsBrowserVariable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SyntheticsBrowserVariable

Source§

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 SyntheticsBrowserVariable

Source§

fn eq(&self, other: &SyntheticsBrowserVariable) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SyntheticsBrowserVariable

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SyntheticsBrowserVariable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T