Skip to content

Commit 25fb4bd

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add encoding to file request (#1303)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent bc90cab commit 25fb4bd

6 files changed

+31
-8
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18642,6 +18642,10 @@ components:
1864218642
description: Content of the file.
1864318643
maxLength: 3145728
1864418644
type: string
18645+
encoding:
18646+
description: Encoding of the file content. The only supported value is `base64`,
18647+
indicating the `content` field contains base64-encoded data.
18648+
type: string
1864518649
name:
1864618650
description: Name of the file.
1864718651
maxLength: 1500

examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ async fn main() {
145145
vec![
146146
SyntheticsTestRequestBodyFile::new()
147147
.content("file content".to_string())
148+
.encoding("base64".to_string())
148149
.name("file name".to_string())
149150
.original_file_name("image.png".to_string())
150151
.type_("file type".to_string())

src/datadogV1/model/model_synthetics_test_request_body_file.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ pub struct SyntheticsTestRequestBodyFile {
1717
/// Content of the file.
1818
#[serde(rename = "content")]
1919
pub content: Option<String>,
20+
/// Encoding of the file content. The only supported value is `base64`, indicating the `content` field contains base64-encoded data.
21+
#[serde(rename = "encoding")]
22+
pub encoding: Option<String>,
2023
/// Name of the file.
2124
#[serde(rename = "name")]
2225
pub name: Option<String>,
@@ -41,6 +44,7 @@ impl SyntheticsTestRequestBodyFile {
4144
SyntheticsTestRequestBodyFile {
4245
bucket_key: None,
4346
content: None,
47+
encoding: None,
4448
name: None,
4549
original_file_name: None,
4650
size: None,
@@ -60,6 +64,11 @@ impl SyntheticsTestRequestBodyFile {
6064
self
6165
}
6266

67+
pub fn encoding(mut self, value: String) -> Self {
68+
self.encoding = Some(value);
69+
self
70+
}
71+
6372
pub fn name(mut self, value: String) -> Self {
6473
self.name = Some(value);
6574
self
@@ -114,6 +123,7 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequestBodyFile {
114123
{
115124
let mut bucket_key: Option<String> = None;
116125
let mut content: Option<String> = None;
126+
let mut encoding: Option<String> = None;
117127
let mut name: Option<String> = None;
118128
let mut original_file_name: Option<String> = None;
119129
let mut size: Option<i64> = None;
@@ -138,6 +148,12 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequestBodyFile {
138148
}
139149
content = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
140150
}
151+
"encoding" => {
152+
if v.is_null() {
153+
continue;
154+
}
155+
encoding = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
156+
}
141157
"name" => {
142158
if v.is_null() {
143159
continue;
@@ -174,6 +190,7 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequestBodyFile {
174190
let content = SyntheticsTestRequestBodyFile {
175191
bucket_key,
176192
content,
193+
encoding,
177194
name,
178195
original_file_name,
179196
size,
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-12-09T11:18:08.137Z
1+
2026-03-03T11:12:53.062Z

tests/scenarios/cassettes/v1/synthetics/Create-an-API-test-with-a-file-payload-returns-OK-Returns-the-created-test-details-response.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"request": {
55
"body": {
6-
"string": "{\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"timingsScope\":\"withoutDNS\",\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"bodyType\":\"application/octet-stream\",\"certificate\":{\"cert\":{\"content\":\"cert-content\",\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"content\":\"key-content\",\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"files\":[{\"content\":\"file content\",\"name\":\"file name\",\"originalFileName\":\"image.png\",\"type\":\"file type\"}],\"headers\":{\"unique\":\"testcreateanapitestwithafilepayloadreturnsokreturnsthecreatedtestdetailsresponse1733743088\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1733743088\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1733743088\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}",
6+
"string": "{\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"timingsScope\":\"withoutDNS\",\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"bodyType\":\"application/octet-stream\",\"certificate\":{\"cert\":{\"content\":\"cert-content\",\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"content\":\"key-content\",\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"files\":[{\"content\":\"file content\",\"encoding\":\"base64\",\"name\":\"file name\",\"originalFileName\":\"image.png\",\"type\":\"file type\"}],\"headers\":{\"unique\":\"testcreateanapitestwithafilepayloadreturnsokreturnsthecreatedtestdetailsresponse1772536373\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1772536373\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1772536373\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}",
77
"encoding": null
88
},
99
"headers": {
@@ -19,7 +19,7 @@
1919
},
2020
"response": {
2121
"body": {
22-
"string": "{\"public_id\":\"pbm-cwk-hzr\",\"name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1733743088\",\"status\":\"live\",\"type\":\"api\",\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"created_at\":\"2024-12-09T11:18:08.979546+00:00\",\"modified_at\":\"2024-12-09T11:18:08.979546+00:00\",\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"timingsScope\":\"withoutDNS\",\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"bodyType\":\"application/octet-stream\",\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"files\":[{\"name\":\"file name\",\"originalFileName\":\"image.png\",\"type\":\"file type\",\"bucketKey\":\"api-upload-file/pbm-cwk-hzr/2024-12-09T11:18:08.684149_ee770695-2a7a-48ef-aa76-148a8425ce69.json\"}],\"headers\":{\"unique\":\"testcreateanapitestwithafilepayloadreturnsokreturnsthecreatedtestdetailsresponse1733743088\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1733743088\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"locations\":[\"aws:us-east-2\"],\"created_by\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"deleted_at\":null,\"monitor_id\":159881040,\"org_id\":321813,\"modified_by\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"}}",
22+
"string": "{\"public_id\":\"x96-ukc-pvk\",\"name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1772536373\",\"status\":\"live\",\"type\":\"api\",\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"created_at\":\"2026-03-03T11:12:53.933929+00:00\",\"modified_at\":\"2026-03-03T11:12:53.933929+00:00\",\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"timingsScope\":\"withoutDNS\",\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"header\",\"type\":\"oauth-client\"},\"bodyType\":\"application/octet-stream\",\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"files\":[{\"encoding\":\"base64\",\"name\":\"file name\",\"originalFileName\":\"image.png\",\"type\":\"file type\",\"bucketKey\":\"api-upload-file/x96-ukc-pvk/2026-03-03T11:12:53.730968_6541a914-12d5-43ca-8dc6-387726057eb6.json\"}],\"headers\":{\"unique\":\"testcreateanapitestwithafilepayloadreturnsokreturnsthecreatedtestdetailsresponse1772536373\"},\"method\":\"GET\",\"persistCookies\":true,\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"httpVersion\":\"http2\",\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Create_an_API_test_with_a_file_payload_returns_OK_Returns_the_created_test_details_response-1772536373\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"locations\":[\"aws:us-east-2\"],\"created_by\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"deleted_at\":null,\"monitor_id\":263059097,\"org_id\":321813,\"modified_by\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"}}",
2323
"encoding": null
2424
},
2525
"headers": {
@@ -32,12 +32,12 @@
3232
"message": "OK"
3333
}
3434
},
35-
"recorded_at": "Mon, 09 Dec 2024 11:18:08 GMT"
35+
"recorded_at": "Tue, 03 Mar 2026 11:12:53 GMT"
3636
},
3737
{
3838
"request": {
3939
"body": {
40-
"string": "{\"public_ids\":[\"pbm-cwk-hzr\"]}",
40+
"string": "{\"public_ids\":[\"x96-ukc-pvk\"]}",
4141
"encoding": null
4242
},
4343
"headers": {
@@ -53,7 +53,7 @@
5353
},
5454
"response": {
5555
"body": {
56-
"string": "{\"deleted_tests\":[{\"public_id\":\"pbm-cwk-hzr\",\"deleted_at\":\"2024-12-09T11:18:09.927667+00:00\"}]}\n",
56+
"string": "{\"deleted_tests\":[{\"public_id\":\"x96-ukc-pvk\",\"deleted_at\":\"2026-03-03T11:12:54.336119+00:00\"}]}\n",
5757
"encoding": null
5858
},
5959
"headers": {
@@ -66,7 +66,7 @@
6666
"message": "OK"
6767
}
6868
},
69-
"recorded_at": "Mon, 09 Dec 2024 11:18:08 GMT"
69+
"recorded_at": "Tue, 03 Mar 2026 11:12:53 GMT"
7070
}
7171
],
7272
"recorded_with": "VCR 6.0.0"

tests/scenarios/features/v1/synthetics_api_http_test_with_file_payload.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
"name": "file name",
6262
"originalFileName": "image.png",
6363
"content": "file content",
64-
"type": "file type"
64+
"type": "file type",
65+
"encoding": "base64"
6566
}],
6667
"basicAuth": {
6768
"accessTokenUrl": "https://datadog-token.com",

0 commit comments

Comments
 (0)