Struct SyntheticsTestRequestBodyFile

Source
#[non_exhaustive]
pub struct SyntheticsTestRequestBodyFile { pub bucket_key: Option<String>, pub content: Option<String>, pub name: Option<String>, pub original_file_name: Option<String>, pub size: Option<i64>, pub type_: Option<String>, pub additional_properties: BTreeMap<String, Value>, /* private fields */ }
Expand description

Object describing a file to be used as part of the request in 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.
§bucket_key: Option<String>

Bucket key of the file.

§content: Option<String>

Content of the file.

§name: Option<String>

Name of the file.

§original_file_name: Option<String>

Original name of the file.

§size: Option<i64>

Size of the file.

§type_: Option<String>

Type of the file.

§additional_properties: BTreeMap<String, Value>

Implementations§

Source§

impl SyntheticsTestRequestBodyFile

Source

pub fn new() -> SyntheticsTestRequestBodyFile

Examples found in repository?
examples/v1_synthetics_UpdateBrowserTest.rs (line 53)
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}
More examples
Hide additional examples
examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs (line 122)
39async fn main() {
40    let body = SyntheticsAPITest::new(
41        SyntheticsAPITestConfig::new()
42            .assertions(vec![
43                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
44                    SyntheticsAssertionTarget::new(
45                        SyntheticsAssertionOperator::IS,
46                        Value::from("text/html"),
47                        SyntheticsAssertionType::HEADER,
48                    )
49                    .property("{{ PROPERTY }}".to_string()),
50                )),
51                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
52                    SyntheticsAssertionTarget::new(
53                        SyntheticsAssertionOperator::LESS_THAN,
54                        Value::from(2000),
55                        SyntheticsAssertionType::RESPONSE_TIME,
56                    )
57                    .timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS),
58                )),
59                SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(Box::new(
60                    SyntheticsAssertionJSONPathTarget::new(
61                        SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
62                        SyntheticsAssertionType::BODY,
63                    )
64                    .target(
65                        SyntheticsAssertionJSONPathTargetTarget::new()
66                            .json_path("topKey".to_string())
67                            .operator("isNot".to_string())
68                            .target_value(Value::from("0")),
69                    ),
70                )),
71                SyntheticsAssertion::SyntheticsAssertionXPathTarget(Box::new(
72                    SyntheticsAssertionXPathTarget::new(
73                        SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
74                        SyntheticsAssertionType::BODY,
75                    )
76                    .target(
77                        SyntheticsAssertionXPathTargetTarget::new()
78                            .operator("contains".to_string())
79                            .target_value(Value::from("0"))
80                            .x_path("target-xpath".to_string()),
81                    ),
82                )),
83            ])
84            .config_variables(vec![SyntheticsConfigVariable::new(
85                "PROPERTY".to_string(),
86                SyntheticsConfigVariableType::TEXT,
87            )
88            .example("content-type".to_string())
89            .pattern("content-type".to_string())])
90            .request(
91                SyntheticsTestRequest::new()
92                    .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
93                        Box::new(
94                            SyntheticsBasicAuthOauthClient::new(
95                                "https://datadog-token.com".to_string(),
96                                "client-id".to_string(),
97                                "client-secret".to_string(),
98                                SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
99                                SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
100                            )
101                            .audience("audience".to_string())
102                            .resource("resource".to_string())
103                            .scope("yoyo".to_string()),
104                        ),
105                    ))
106                    .body_type(SyntheticsTestRequestBodyType::APPLICATION_OCTET_STREAM)
107                    .certificate(
108                        SyntheticsTestRequestCertificate::new()
109                            .cert(
110                                SyntheticsTestRequestCertificateItem::new()
111                                    .content("cert-content".to_string())
112                                    .filename("cert-filename".to_string())
113                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                            )
115                            .key(
116                                SyntheticsTestRequestCertificateItem::new()
117                                    .content("key-content".to_string())
118                                    .filename("key-filename".to_string())
119                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
120                            ),
121                    )
122                    .files(vec![SyntheticsTestRequestBodyFile::new()
123                        .content("file content".to_string())
124                        .name("file name".to_string())
125                        .original_file_name("image.png".to_string())
126                        .type_("file type".to_string())])
127                    .headers(BTreeMap::from([(
128                        "unique".to_string(),
129                        "examplesynthetic".to_string(),
130                    )]))
131                    .method("GET".to_string())
132                    .persist_cookies(true)
133                    .proxy(
134                        SyntheticsTestRequestProxy::new("https://datadoghq.com".to_string())
135                            .headers(BTreeMap::from([])),
136                    )
137                    .timeout(10.0 as f64)
138                    .url("https://datadoghq.com".to_string()),
139            ),
140        vec!["aws:us-east-2".to_string()],
141        "BDD test payload: synthetics_api_http_test_payload.json".to_string(),
142        "Example-Synthetic".to_string(),
143        SyntheticsTestOptions::new()
144            .accept_self_signed(false)
145            .allow_insecure(true)
146            .follow_redirects(true)
147            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
148            .min_failure_duration(10)
149            .min_location_failed(1)
150            .monitor_name("Example-Synthetic".to_string())
151            .monitor_priority(5)
152            .retry(
153                SyntheticsTestOptionsRetry::new()
154                    .count(3)
155                    .interval(10.0 as f64),
156            )
157            .tick_every(60),
158        SyntheticsAPITestType::API,
159    )
160    .subtype(SyntheticsTestDetailsSubType::HTTP)
161    .tags(vec!["testing:api".to_string()]);
162    let configuration = datadog::Configuration::new();
163    let api = SyntheticsAPI::with_config(configuration);
164    let resp = api.create_synthetics_api_test(body).await;
165    if let Ok(value) = resp {
166        println!("{:#?}", value);
167    } else {
168        println!("{:#?}", resp.unwrap_err());
169    }
170}
Source

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

Source

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

Examples found in repository?
examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs (line 123)
39async fn main() {
40    let body = SyntheticsAPITest::new(
41        SyntheticsAPITestConfig::new()
42            .assertions(vec![
43                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
44                    SyntheticsAssertionTarget::new(
45                        SyntheticsAssertionOperator::IS,
46                        Value::from("text/html"),
47                        SyntheticsAssertionType::HEADER,
48                    )
49                    .property("{{ PROPERTY }}".to_string()),
50                )),
51                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
52                    SyntheticsAssertionTarget::new(
53                        SyntheticsAssertionOperator::LESS_THAN,
54                        Value::from(2000),
55                        SyntheticsAssertionType::RESPONSE_TIME,
56                    )
57                    .timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS),
58                )),
59                SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(Box::new(
60                    SyntheticsAssertionJSONPathTarget::new(
61                        SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
62                        SyntheticsAssertionType::BODY,
63                    )
64                    .target(
65                        SyntheticsAssertionJSONPathTargetTarget::new()
66                            .json_path("topKey".to_string())
67                            .operator("isNot".to_string())
68                            .target_value(Value::from("0")),
69                    ),
70                )),
71                SyntheticsAssertion::SyntheticsAssertionXPathTarget(Box::new(
72                    SyntheticsAssertionXPathTarget::new(
73                        SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
74                        SyntheticsAssertionType::BODY,
75                    )
76                    .target(
77                        SyntheticsAssertionXPathTargetTarget::new()
78                            .operator("contains".to_string())
79                            .target_value(Value::from("0"))
80                            .x_path("target-xpath".to_string()),
81                    ),
82                )),
83            ])
84            .config_variables(vec![SyntheticsConfigVariable::new(
85                "PROPERTY".to_string(),
86                SyntheticsConfigVariableType::TEXT,
87            )
88            .example("content-type".to_string())
89            .pattern("content-type".to_string())])
90            .request(
91                SyntheticsTestRequest::new()
92                    .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
93                        Box::new(
94                            SyntheticsBasicAuthOauthClient::new(
95                                "https://datadog-token.com".to_string(),
96                                "client-id".to_string(),
97                                "client-secret".to_string(),
98                                SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
99                                SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
100                            )
101                            .audience("audience".to_string())
102                            .resource("resource".to_string())
103                            .scope("yoyo".to_string()),
104                        ),
105                    ))
106                    .body_type(SyntheticsTestRequestBodyType::APPLICATION_OCTET_STREAM)
107                    .certificate(
108                        SyntheticsTestRequestCertificate::new()
109                            .cert(
110                                SyntheticsTestRequestCertificateItem::new()
111                                    .content("cert-content".to_string())
112                                    .filename("cert-filename".to_string())
113                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                            )
115                            .key(
116                                SyntheticsTestRequestCertificateItem::new()
117                                    .content("key-content".to_string())
118                                    .filename("key-filename".to_string())
119                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
120                            ),
121                    )
122                    .files(vec![SyntheticsTestRequestBodyFile::new()
123                        .content("file content".to_string())
124                        .name("file name".to_string())
125                        .original_file_name("image.png".to_string())
126                        .type_("file type".to_string())])
127                    .headers(BTreeMap::from([(
128                        "unique".to_string(),
129                        "examplesynthetic".to_string(),
130                    )]))
131                    .method("GET".to_string())
132                    .persist_cookies(true)
133                    .proxy(
134                        SyntheticsTestRequestProxy::new("https://datadoghq.com".to_string())
135                            .headers(BTreeMap::from([])),
136                    )
137                    .timeout(10.0 as f64)
138                    .url("https://datadoghq.com".to_string()),
139            ),
140        vec!["aws:us-east-2".to_string()],
141        "BDD test payload: synthetics_api_http_test_payload.json".to_string(),
142        "Example-Synthetic".to_string(),
143        SyntheticsTestOptions::new()
144            .accept_self_signed(false)
145            .allow_insecure(true)
146            .follow_redirects(true)
147            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
148            .min_failure_duration(10)
149            .min_location_failed(1)
150            .monitor_name("Example-Synthetic".to_string())
151            .monitor_priority(5)
152            .retry(
153                SyntheticsTestOptionsRetry::new()
154                    .count(3)
155                    .interval(10.0 as f64),
156            )
157            .tick_every(60),
158        SyntheticsAPITestType::API,
159    )
160    .subtype(SyntheticsTestDetailsSubType::HTTP)
161    .tags(vec!["testing:api".to_string()]);
162    let configuration = datadog::Configuration::new();
163    let api = SyntheticsAPI::with_config(configuration);
164    let resp = api.create_synthetics_api_test(body).await;
165    if let Ok(value) = resp {
166        println!("{:#?}", value);
167    } else {
168        println!("{:#?}", resp.unwrap_err());
169    }
170}
Source

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

Examples found in repository?
examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs (line 124)
39async fn main() {
40    let body = SyntheticsAPITest::new(
41        SyntheticsAPITestConfig::new()
42            .assertions(vec![
43                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
44                    SyntheticsAssertionTarget::new(
45                        SyntheticsAssertionOperator::IS,
46                        Value::from("text/html"),
47                        SyntheticsAssertionType::HEADER,
48                    )
49                    .property("{{ PROPERTY }}".to_string()),
50                )),
51                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
52                    SyntheticsAssertionTarget::new(
53                        SyntheticsAssertionOperator::LESS_THAN,
54                        Value::from(2000),
55                        SyntheticsAssertionType::RESPONSE_TIME,
56                    )
57                    .timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS),
58                )),
59                SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(Box::new(
60                    SyntheticsAssertionJSONPathTarget::new(
61                        SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
62                        SyntheticsAssertionType::BODY,
63                    )
64                    .target(
65                        SyntheticsAssertionJSONPathTargetTarget::new()
66                            .json_path("topKey".to_string())
67                            .operator("isNot".to_string())
68                            .target_value(Value::from("0")),
69                    ),
70                )),
71                SyntheticsAssertion::SyntheticsAssertionXPathTarget(Box::new(
72                    SyntheticsAssertionXPathTarget::new(
73                        SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
74                        SyntheticsAssertionType::BODY,
75                    )
76                    .target(
77                        SyntheticsAssertionXPathTargetTarget::new()
78                            .operator("contains".to_string())
79                            .target_value(Value::from("0"))
80                            .x_path("target-xpath".to_string()),
81                    ),
82                )),
83            ])
84            .config_variables(vec![SyntheticsConfigVariable::new(
85                "PROPERTY".to_string(),
86                SyntheticsConfigVariableType::TEXT,
87            )
88            .example("content-type".to_string())
89            .pattern("content-type".to_string())])
90            .request(
91                SyntheticsTestRequest::new()
92                    .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
93                        Box::new(
94                            SyntheticsBasicAuthOauthClient::new(
95                                "https://datadog-token.com".to_string(),
96                                "client-id".to_string(),
97                                "client-secret".to_string(),
98                                SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
99                                SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
100                            )
101                            .audience("audience".to_string())
102                            .resource("resource".to_string())
103                            .scope("yoyo".to_string()),
104                        ),
105                    ))
106                    .body_type(SyntheticsTestRequestBodyType::APPLICATION_OCTET_STREAM)
107                    .certificate(
108                        SyntheticsTestRequestCertificate::new()
109                            .cert(
110                                SyntheticsTestRequestCertificateItem::new()
111                                    .content("cert-content".to_string())
112                                    .filename("cert-filename".to_string())
113                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                            )
115                            .key(
116                                SyntheticsTestRequestCertificateItem::new()
117                                    .content("key-content".to_string())
118                                    .filename("key-filename".to_string())
119                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
120                            ),
121                    )
122                    .files(vec![SyntheticsTestRequestBodyFile::new()
123                        .content("file content".to_string())
124                        .name("file name".to_string())
125                        .original_file_name("image.png".to_string())
126                        .type_("file type".to_string())])
127                    .headers(BTreeMap::from([(
128                        "unique".to_string(),
129                        "examplesynthetic".to_string(),
130                    )]))
131                    .method("GET".to_string())
132                    .persist_cookies(true)
133                    .proxy(
134                        SyntheticsTestRequestProxy::new("https://datadoghq.com".to_string())
135                            .headers(BTreeMap::from([])),
136                    )
137                    .timeout(10.0 as f64)
138                    .url("https://datadoghq.com".to_string()),
139            ),
140        vec!["aws:us-east-2".to_string()],
141        "BDD test payload: synthetics_api_http_test_payload.json".to_string(),
142        "Example-Synthetic".to_string(),
143        SyntheticsTestOptions::new()
144            .accept_self_signed(false)
145            .allow_insecure(true)
146            .follow_redirects(true)
147            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
148            .min_failure_duration(10)
149            .min_location_failed(1)
150            .monitor_name("Example-Synthetic".to_string())
151            .monitor_priority(5)
152            .retry(
153                SyntheticsTestOptionsRetry::new()
154                    .count(3)
155                    .interval(10.0 as f64),
156            )
157            .tick_every(60),
158        SyntheticsAPITestType::API,
159    )
160    .subtype(SyntheticsTestDetailsSubType::HTTP)
161    .tags(vec!["testing:api".to_string()]);
162    let configuration = datadog::Configuration::new();
163    let api = SyntheticsAPI::with_config(configuration);
164    let resp = api.create_synthetics_api_test(body).await;
165    if let Ok(value) = resp {
166        println!("{:#?}", value);
167    } else {
168        println!("{:#?}", resp.unwrap_err());
169    }
170}
Source

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

Examples found in repository?
examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs (line 125)
39async fn main() {
40    let body = SyntheticsAPITest::new(
41        SyntheticsAPITestConfig::new()
42            .assertions(vec![
43                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
44                    SyntheticsAssertionTarget::new(
45                        SyntheticsAssertionOperator::IS,
46                        Value::from("text/html"),
47                        SyntheticsAssertionType::HEADER,
48                    )
49                    .property("{{ PROPERTY }}".to_string()),
50                )),
51                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
52                    SyntheticsAssertionTarget::new(
53                        SyntheticsAssertionOperator::LESS_THAN,
54                        Value::from(2000),
55                        SyntheticsAssertionType::RESPONSE_TIME,
56                    )
57                    .timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS),
58                )),
59                SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(Box::new(
60                    SyntheticsAssertionJSONPathTarget::new(
61                        SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
62                        SyntheticsAssertionType::BODY,
63                    )
64                    .target(
65                        SyntheticsAssertionJSONPathTargetTarget::new()
66                            .json_path("topKey".to_string())
67                            .operator("isNot".to_string())
68                            .target_value(Value::from("0")),
69                    ),
70                )),
71                SyntheticsAssertion::SyntheticsAssertionXPathTarget(Box::new(
72                    SyntheticsAssertionXPathTarget::new(
73                        SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
74                        SyntheticsAssertionType::BODY,
75                    )
76                    .target(
77                        SyntheticsAssertionXPathTargetTarget::new()
78                            .operator("contains".to_string())
79                            .target_value(Value::from("0"))
80                            .x_path("target-xpath".to_string()),
81                    ),
82                )),
83            ])
84            .config_variables(vec![SyntheticsConfigVariable::new(
85                "PROPERTY".to_string(),
86                SyntheticsConfigVariableType::TEXT,
87            )
88            .example("content-type".to_string())
89            .pattern("content-type".to_string())])
90            .request(
91                SyntheticsTestRequest::new()
92                    .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
93                        Box::new(
94                            SyntheticsBasicAuthOauthClient::new(
95                                "https://datadog-token.com".to_string(),
96                                "client-id".to_string(),
97                                "client-secret".to_string(),
98                                SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
99                                SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
100                            )
101                            .audience("audience".to_string())
102                            .resource("resource".to_string())
103                            .scope("yoyo".to_string()),
104                        ),
105                    ))
106                    .body_type(SyntheticsTestRequestBodyType::APPLICATION_OCTET_STREAM)
107                    .certificate(
108                        SyntheticsTestRequestCertificate::new()
109                            .cert(
110                                SyntheticsTestRequestCertificateItem::new()
111                                    .content("cert-content".to_string())
112                                    .filename("cert-filename".to_string())
113                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                            )
115                            .key(
116                                SyntheticsTestRequestCertificateItem::new()
117                                    .content("key-content".to_string())
118                                    .filename("key-filename".to_string())
119                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
120                            ),
121                    )
122                    .files(vec![SyntheticsTestRequestBodyFile::new()
123                        .content("file content".to_string())
124                        .name("file name".to_string())
125                        .original_file_name("image.png".to_string())
126                        .type_("file type".to_string())])
127                    .headers(BTreeMap::from([(
128                        "unique".to_string(),
129                        "examplesynthetic".to_string(),
130                    )]))
131                    .method("GET".to_string())
132                    .persist_cookies(true)
133                    .proxy(
134                        SyntheticsTestRequestProxy::new("https://datadoghq.com".to_string())
135                            .headers(BTreeMap::from([])),
136                    )
137                    .timeout(10.0 as f64)
138                    .url("https://datadoghq.com".to_string()),
139            ),
140        vec!["aws:us-east-2".to_string()],
141        "BDD test payload: synthetics_api_http_test_payload.json".to_string(),
142        "Example-Synthetic".to_string(),
143        SyntheticsTestOptions::new()
144            .accept_self_signed(false)
145            .allow_insecure(true)
146            .follow_redirects(true)
147            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
148            .min_failure_duration(10)
149            .min_location_failed(1)
150            .monitor_name("Example-Synthetic".to_string())
151            .monitor_priority(5)
152            .retry(
153                SyntheticsTestOptionsRetry::new()
154                    .count(3)
155                    .interval(10.0 as f64),
156            )
157            .tick_every(60),
158        SyntheticsAPITestType::API,
159    )
160    .subtype(SyntheticsTestDetailsSubType::HTTP)
161    .tags(vec!["testing:api".to_string()]);
162    let configuration = datadog::Configuration::new();
163    let api = SyntheticsAPI::with_config(configuration);
164    let resp = api.create_synthetics_api_test(body).await;
165    if let Ok(value) = resp {
166        println!("{:#?}", value);
167    } else {
168        println!("{:#?}", resp.unwrap_err());
169    }
170}
Source

pub fn size(self, value: i64) -> Self

Source

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

Examples found in repository?
examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs (line 126)
39async fn main() {
40    let body = SyntheticsAPITest::new(
41        SyntheticsAPITestConfig::new()
42            .assertions(vec![
43                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
44                    SyntheticsAssertionTarget::new(
45                        SyntheticsAssertionOperator::IS,
46                        Value::from("text/html"),
47                        SyntheticsAssertionType::HEADER,
48                    )
49                    .property("{{ PROPERTY }}".to_string()),
50                )),
51                SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
52                    SyntheticsAssertionTarget::new(
53                        SyntheticsAssertionOperator::LESS_THAN,
54                        Value::from(2000),
55                        SyntheticsAssertionType::RESPONSE_TIME,
56                    )
57                    .timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS),
58                )),
59                SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(Box::new(
60                    SyntheticsAssertionJSONPathTarget::new(
61                        SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
62                        SyntheticsAssertionType::BODY,
63                    )
64                    .target(
65                        SyntheticsAssertionJSONPathTargetTarget::new()
66                            .json_path("topKey".to_string())
67                            .operator("isNot".to_string())
68                            .target_value(Value::from("0")),
69                    ),
70                )),
71                SyntheticsAssertion::SyntheticsAssertionXPathTarget(Box::new(
72                    SyntheticsAssertionXPathTarget::new(
73                        SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
74                        SyntheticsAssertionType::BODY,
75                    )
76                    .target(
77                        SyntheticsAssertionXPathTargetTarget::new()
78                            .operator("contains".to_string())
79                            .target_value(Value::from("0"))
80                            .x_path("target-xpath".to_string()),
81                    ),
82                )),
83            ])
84            .config_variables(vec![SyntheticsConfigVariable::new(
85                "PROPERTY".to_string(),
86                SyntheticsConfigVariableType::TEXT,
87            )
88            .example("content-type".to_string())
89            .pattern("content-type".to_string())])
90            .request(
91                SyntheticsTestRequest::new()
92                    .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient(
93                        Box::new(
94                            SyntheticsBasicAuthOauthClient::new(
95                                "https://datadog-token.com".to_string(),
96                                "client-id".to_string(),
97                                "client-secret".to_string(),
98                                SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
99                                SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
100                            )
101                            .audience("audience".to_string())
102                            .resource("resource".to_string())
103                            .scope("yoyo".to_string()),
104                        ),
105                    ))
106                    .body_type(SyntheticsTestRequestBodyType::APPLICATION_OCTET_STREAM)
107                    .certificate(
108                        SyntheticsTestRequestCertificate::new()
109                            .cert(
110                                SyntheticsTestRequestCertificateItem::new()
111                                    .content("cert-content".to_string())
112                                    .filename("cert-filename".to_string())
113                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
114                            )
115                            .key(
116                                SyntheticsTestRequestCertificateItem::new()
117                                    .content("key-content".to_string())
118                                    .filename("key-filename".to_string())
119                                    .updated_at("2020-10-16T09:23:24.857Z".to_string()),
120                            ),
121                    )
122                    .files(vec![SyntheticsTestRequestBodyFile::new()
123                        .content("file content".to_string())
124                        .name("file name".to_string())
125                        .original_file_name("image.png".to_string())
126                        .type_("file type".to_string())])
127                    .headers(BTreeMap::from([(
128                        "unique".to_string(),
129                        "examplesynthetic".to_string(),
130                    )]))
131                    .method("GET".to_string())
132                    .persist_cookies(true)
133                    .proxy(
134                        SyntheticsTestRequestProxy::new("https://datadoghq.com".to_string())
135                            .headers(BTreeMap::from([])),
136                    )
137                    .timeout(10.0 as f64)
138                    .url("https://datadoghq.com".to_string()),
139            ),
140        vec!["aws:us-east-2".to_string()],
141        "BDD test payload: synthetics_api_http_test_payload.json".to_string(),
142        "Example-Synthetic".to_string(),
143        SyntheticsTestOptions::new()
144            .accept_self_signed(false)
145            .allow_insecure(true)
146            .follow_redirects(true)
147            .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2)
148            .min_failure_duration(10)
149            .min_location_failed(1)
150            .monitor_name("Example-Synthetic".to_string())
151            .monitor_priority(5)
152            .retry(
153                SyntheticsTestOptionsRetry::new()
154                    .count(3)
155                    .interval(10.0 as f64),
156            )
157            .tick_every(60),
158        SyntheticsAPITestType::API,
159    )
160    .subtype(SyntheticsTestDetailsSubType::HTTP)
161    .tags(vec!["testing:api".to_string()]);
162    let configuration = datadog::Configuration::new();
163    let api = SyntheticsAPI::with_config(configuration);
164    let resp = api.create_synthetics_api_test(body).await;
165    if let Ok(value) = resp {
166        println!("{:#?}", value);
167    } else {
168        println!("{:#?}", resp.unwrap_err());
169    }
170}
Source

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

Trait Implementations§

Source§

impl Clone for SyntheticsTestRequestBodyFile

Source§

fn clone(&self) -> SyntheticsTestRequestBodyFile

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 SyntheticsTestRequestBodyFile

Source§

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

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

impl Default for SyntheticsTestRequestBodyFile

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SyntheticsTestRequestBodyFile

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 SyntheticsTestRequestBodyFile

Source§

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

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 SyntheticsTestRequestBodyFile

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