#[non_exhaustive]
pub struct SyntheticsVariableParser { pub type_: SyntheticsGlobalVariableParserType, pub value: Option<String>, pub additional_properties: BTreeMap<String, Value>, /* private fields */ }
Expand description

Details of the parser to use for the global variable.

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.
§type_: SyntheticsGlobalVariableParserType

Type of parser for a Synthetic global variable from a synthetics test.

§value: Option<String>

Regex or JSON path used for the parser. Not used with type raw.

§additional_properties: BTreeMap<String, Value>

Implementations§

source§

impl SyntheticsVariableParser

source

pub fn new( type_: SyntheticsGlobalVariableParserType, ) -> SyntheticsVariableParser

Examples found in repository?
examples/v1_synthetics_CreateGlobalVariable.rs (line 30)
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
async fn main() {
    let body = SyntheticsGlobalVariableRequest::new(
        "Example description".to_string(),
        "MY_VARIABLE".to_string(),
        vec!["team:front".to_string(), "test:workflow-1".to_string()],
    )
    .attributes(
        SyntheticsGlobalVariableAttributes::new()
            .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()]),
    )
    .parse_test_options(
        SyntheticsGlobalVariableParseTestOptions::new(
            SyntheticsGlobalVariableParseTestOptionsType::HTTP_BODY,
        )
        .field("content-type".to_string())
        .local_variable_name("LOCAL_VARIABLE".to_string())
        .parser(
            SyntheticsVariableParser::new(SyntheticsGlobalVariableParserType::REGEX)
                .value(".*".to_string()),
        ),
    )
    .parse_test_public_id("abc-def-123".to_string())
    .value(
        SyntheticsGlobalVariableValue::new()
            .secure(true)
            .value("value".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api.create_global_variable(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
More examples
Hide additional examples
examples/v1_synthetics_EditGlobalVariable.rs (line 30)
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
async fn main() {
    let body = SyntheticsGlobalVariableRequest::new(
        "Example description".to_string(),
        "MY_VARIABLE".to_string(),
        vec!["team:front".to_string(), "test:workflow-1".to_string()],
    )
    .attributes(
        SyntheticsGlobalVariableAttributes::new()
            .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()]),
    )
    .parse_test_options(
        SyntheticsGlobalVariableParseTestOptions::new(
            SyntheticsGlobalVariableParseTestOptionsType::HTTP_BODY,
        )
        .field("content-type".to_string())
        .local_variable_name("LOCAL_VARIABLE".to_string())
        .parser(
            SyntheticsVariableParser::new(SyntheticsGlobalVariableParserType::REGEX)
                .value(".*".to_string()),
        ),
    )
    .parse_test_public_id("abc-def-123".to_string())
    .value(
        SyntheticsGlobalVariableValue::new()
            .secure(true)
            .value("value".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api
        .edit_global_variable("variable_id".to_string(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs (lines 75-77)
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
async fn main() {
    let body =
        SyntheticsAPITest::new(
            SyntheticsAPITestConfig::new()
                .config_variables(
                    vec![
                        SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT)
                            .example("content-type".to_string())
                            .pattern("content-type".to_string())
                    ],
                )
                .steps(
                    vec![
                        SyntheticsAPIStep::SyntheticsAPITestStep(
                            Box::new(
                                SyntheticsAPITestStep::new(
                                    vec![
                                        SyntheticsAssertion::SyntheticsAssertionTarget(
                                            Box::new(
                                                SyntheticsAssertionTarget::new(
                                                    SyntheticsAssertionOperator::IS,
                                                    Value::from(200),
                                                    SyntheticsAssertionType::STATUS_CODE,
                                                ),
                                            ),
                                        )
                                    ],
                                    "request is sent".to_string(),
                                    SyntheticsTestRequest::new()
                                        .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
                                        .method("GET".to_string())
                                        .timeout(10.0 as f64)
                                        .url("https://datadoghq.com".to_string()),
                                    SyntheticsAPITestStepSubtype::HTTP,
                                )
                                    .allow_failure(true)
                                    .extracted_values(
                                        vec![
                                            SyntheticsParsingOptions::new()
                                                .field("server".to_string())
                                                .name("EXTRACTED_VALUE".to_string())
                                                .parser(
                                                    SyntheticsVariableParser::new(
                                                        SyntheticsGlobalVariableParserType::RAW,
                                                    ),
                                                )
                                                .secure(true)
                                                .type_(SyntheticsLocalVariableParsingOptionsType::HTTP_HEADER)
                                        ],
                                    )
                                    .is_critical(true)
                                    .retry(SyntheticsTestOptionsRetry::new().count(5).interval(1000.0 as f64)),
                            ),
                        ),
                        SyntheticsAPIStep::SyntheticsAPIWaitStep(
                            Box::new(
                                SyntheticsAPIWaitStep::new("Wait".to_string(), SyntheticsAPIWaitStepSubtype::WAIT, 1),
                            ),
                        ),
                        SyntheticsAPIStep::SyntheticsAPITestStep(
                            Box::new(
                                SyntheticsAPITestStep::new(
                                    vec![
                                        SyntheticsAssertion::SyntheticsAssertionTarget(
                                            Box::new(
                                                SyntheticsAssertionTarget::new(
                                                    SyntheticsAssertionOperator::LESS_THAN,
                                                    Value::from(1000),
                                                    SyntheticsAssertionType::RESPONSE_TIME,
                                                ),
                                            ),
                                        )
                                    ],
                                    "GRPC CALL".to_string(),
                                    SyntheticsTestRequest::new()
                                        .call_type(SyntheticsTestCallType::UNARY)
                                        .compressed_json_descriptor(
                                            "eJy1lU1z2yAQhv+Lzj74I3ETH506bQ7OZOSm1w4Wa4epBARQppqM/3v5koCJJdvtxCdW77vPssCO3zMKUgHOFu/ZXvBiS6hZho/f8qe7pftYgXphWJrlA8XwxywEvNba+6PhkC2yVcVVswYp0R6ykRYlZ1SCV21SDrxsssPIeS9FJKqGfK2rqnmmSBwhWa2XlKgtaQPiDcRGCUDVfwGD2sKUqKEtc1cSoOrsMlaMOec1sySYCCgUYRSVLv2zSva2u+FQkB0pVkIw8bFuIudOOn3pOaKYVT3Iy97Pd0AYhOx5QcMsnxvRHlnuLf8ETDd3CNtrv2nejkDpRnANCmGkkFn/hsYzpBKE7jVbufgnKnV9HRM9zRPDDKPttYT61n0TdWkAAjggk9AhuxIeaXd69CYTcsGw7cBTakLVbNpRzGEgyWjkSOpMbZXkhGL6oX30R49qt3GoHrap7i0XdD41WQ+2icCNm5p1hmFqnHNlcla0riKmDZ183crDxChjbnurtxHPRE784sVhWvDfGP+SsTKibU3o5NtWHuZFGZOxP6P5VXqIOvaOSec4eYohyd7NslHuJbd1bewds85xYrNxkr2d+5IhFWF3NvaO684xjE2S5ulY+tu64Pna0fCPJgzw6vF5/WucLcYjt5xoq19O3UDptOg/OamJQRaCcPPnMTQ2QDFn+uhPvUfnCrMc99upyQY4Ui9Dlc/YoG3R/v4Cs9YE+g==".to_string(),
                                        )
                                        .host("grpcbin.test.k6.io".to_string())
                                        .message("{}".to_string())
                                        .metadata(BTreeMap::from([]))
                                        .method("Index".to_string())
                                        .port("9000".to_string())
                                        .service("grpcbin.GRPCBin".to_string()),
                                    SyntheticsAPITestStepSubtype::GRPC,
                                )
                                    .allow_failure(false)
                                    .extracted_values(vec![])
                                    .is_critical(true)
                                    .retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
                            ),
                        )
                    ],
                ),
            vec!["aws:us-east-2".to_string()],
            "BDD test payload: synthetics_api_test_multi_step_payload.json".to_string(),
            "Example-Synthetic".to_string(),
            SyntheticsTestOptions::new()
                .accept_self_signed(false)
                .allow_insecure(true)
                .follow_redirects(true)
                .min_failure_duration(10)
                .min_location_failed(1)
                .monitor_name("Example-Synthetic".to_string())
                .monitor_priority(5)
                .retry(SyntheticsTestOptionsRetry::new().count(3).interval(1000.0 as f64))
                .tick_every(60),
            SyntheticsAPITestType::API,
        )
            .subtype(SyntheticsTestDetailsSubType::MULTI)
            .tags(vec!["testing:api".to_string()]);
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api.create_synthetics_api_test(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
source

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

Examples found in repository?
examples/v1_synthetics_CreateGlobalVariable.rs (line 31)
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
async fn main() {
    let body = SyntheticsGlobalVariableRequest::new(
        "Example description".to_string(),
        "MY_VARIABLE".to_string(),
        vec!["team:front".to_string(), "test:workflow-1".to_string()],
    )
    .attributes(
        SyntheticsGlobalVariableAttributes::new()
            .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()]),
    )
    .parse_test_options(
        SyntheticsGlobalVariableParseTestOptions::new(
            SyntheticsGlobalVariableParseTestOptionsType::HTTP_BODY,
        )
        .field("content-type".to_string())
        .local_variable_name("LOCAL_VARIABLE".to_string())
        .parser(
            SyntheticsVariableParser::new(SyntheticsGlobalVariableParserType::REGEX)
                .value(".*".to_string()),
        ),
    )
    .parse_test_public_id("abc-def-123".to_string())
    .value(
        SyntheticsGlobalVariableValue::new()
            .secure(true)
            .value("value".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api.create_global_variable(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
More examples
Hide additional examples
examples/v1_synthetics_EditGlobalVariable.rs (line 31)
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
async fn main() {
    let body = SyntheticsGlobalVariableRequest::new(
        "Example description".to_string(),
        "MY_VARIABLE".to_string(),
        vec!["team:front".to_string(), "test:workflow-1".to_string()],
    )
    .attributes(
        SyntheticsGlobalVariableAttributes::new()
            .restricted_roles(vec!["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".to_string()]),
    )
    .parse_test_options(
        SyntheticsGlobalVariableParseTestOptions::new(
            SyntheticsGlobalVariableParseTestOptionsType::HTTP_BODY,
        )
        .field("content-type".to_string())
        .local_variable_name("LOCAL_VARIABLE".to_string())
        .parser(
            SyntheticsVariableParser::new(SyntheticsGlobalVariableParserType::REGEX)
                .value(".*".to_string()),
        ),
    )
    .parse_test_public_id("abc-def-123".to_string())
    .value(
        SyntheticsGlobalVariableValue::new()
            .secure(true)
            .value("value".to_string()),
    );
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api
        .edit_global_variable("variable_id".to_string(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
source

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

Trait Implementations§

source§

impl Clone for SyntheticsVariableParser

source§

fn clone(&self) -> SyntheticsVariableParser

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 SyntheticsVariableParser

source§

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

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

impl<'de> Deserialize<'de> for SyntheticsVariableParser

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 SyntheticsVariableParser

source§

fn eq(&self, other: &SyntheticsVariableParser) -> 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 SyntheticsVariableParser

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 SyntheticsVariableParser

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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>,