Skip to content

Commit 154f848

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

File tree

6 files changed

+44
-10
lines changed

6 files changed

+44
-10
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.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ public static void main(String[] args) {
116116
.name("file name")
117117
.originalFileName("image.png")
118118
.content("file content")
119-
.type("file type")))
119+
.type("file type")
120+
.encoding("base64")))
120121
.basicAuth(
121122
new SyntheticsBasicAuth(
122123
new SyntheticsBasicAuthOauthClient()

src/main/java/com/datadog/api/client/v1/model/SyntheticsTestRequestBodyFile.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
@JsonPropertyOrder({
2121
SyntheticsTestRequestBodyFile.JSON_PROPERTY_BUCKET_KEY,
2222
SyntheticsTestRequestBodyFile.JSON_PROPERTY_CONTENT,
23+
SyntheticsTestRequestBodyFile.JSON_PROPERTY_ENCODING,
2324
SyntheticsTestRequestBodyFile.JSON_PROPERTY_NAME,
2425
SyntheticsTestRequestBodyFile.JSON_PROPERTY_ORIGINAL_FILE_NAME,
2526
SyntheticsTestRequestBodyFile.JSON_PROPERTY_SIZE,
@@ -35,6 +36,9 @@ public class SyntheticsTestRequestBodyFile {
3536
public static final String JSON_PROPERTY_CONTENT = "content";
3637
private String content;
3738

39+
public static final String JSON_PROPERTY_ENCODING = "encoding";
40+
private String encoding;
41+
3842
public static final String JSON_PROPERTY_NAME = "name";
3943
private String name;
4044

@@ -89,6 +93,28 @@ public void setContent(String content) {
8993
this.content = content;
9094
}
9195

96+
public SyntheticsTestRequestBodyFile encoding(String encoding) {
97+
this.encoding = encoding;
98+
return this;
99+
}
100+
101+
/**
102+
* Encoding of the file content. The only supported value is <code>base64</code>, indicating the
103+
* <code>content</code> field contains base64-encoded data.
104+
*
105+
* @return encoding
106+
*/
107+
@jakarta.annotation.Nullable
108+
@JsonProperty(JSON_PROPERTY_ENCODING)
109+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
110+
public String getEncoding() {
111+
return encoding;
112+
}
113+
114+
public void setEncoding(String encoding) {
115+
this.encoding = encoding;
116+
}
117+
92118
public SyntheticsTestRequestBodyFile name(String name) {
93119
this.name = name;
94120
return this;
@@ -231,6 +257,7 @@ public boolean equals(Object o) {
231257
SyntheticsTestRequestBodyFile syntheticsTestRequestBodyFile = (SyntheticsTestRequestBodyFile) o;
232258
return Objects.equals(this.bucketKey, syntheticsTestRequestBodyFile.bucketKey)
233259
&& Objects.equals(this.content, syntheticsTestRequestBodyFile.content)
260+
&& Objects.equals(this.encoding, syntheticsTestRequestBodyFile.encoding)
234261
&& Objects.equals(this.name, syntheticsTestRequestBodyFile.name)
235262
&& Objects.equals(this.originalFileName, syntheticsTestRequestBodyFile.originalFileName)
236263
&& Objects.equals(this.size, syntheticsTestRequestBodyFile.size)
@@ -242,7 +269,7 @@ public boolean equals(Object o) {
242269
@Override
243270
public int hashCode() {
244271
return Objects.hash(
245-
bucketKey, content, name, originalFileName, size, type, additionalProperties);
272+
bucketKey, content, encoding, name, originalFileName, size, type, additionalProperties);
246273
}
247274

248275
@Override
@@ -251,6 +278,7 @@ public String toString() {
251278
sb.append("class SyntheticsTestRequestBodyFile {\n");
252279
sb.append(" bucketKey: ").append(toIndentedString(bucketKey)).append("\n");
253280
sb.append(" content: ").append(toIndentedString(content)).append("\n");
281+
sb.append(" encoding: ").append(toIndentedString(encoding)).append("\n");
254282
sb.append(" name: ").append(toIndentedString(name)).append("\n");
255283
sb.append(" originalFileName: ").append(toIndentedString(originalFileName)).append("\n");
256284
sb.append(" size: ").append(toIndentedString(size)).append("\n");
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-12-09T11:18:08.137Z
1+
2026-03-03T11:12:53.062Z

src/test/resources/cassettes/features/v1/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
"httpRequest": {
44
"body": {
55
"type": "JSON",
6-
"json": "{\"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+
"json": "{\"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
},
88
"headers": {},
99
"method": "POST",
@@ -12,7 +12,7 @@
1212
"secure": true
1313
},
1414
"httpResponse": {
15-
"body": "{\"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\"}}",
15+
"body": "{\"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\"}}",
1616
"headers": {
1717
"Content-Type": [
1818
"application/json"
@@ -27,13 +27,13 @@
2727
"timeToLive": {
2828
"unlimited": true
2929
},
30-
"id": "775e3cb8-0e68-31f4-0122-b5501d328e3d"
30+
"id": "e639d1e3-5610-b828-89e1-74523f7328d4"
3131
},
3232
{
3333
"httpRequest": {
3434
"body": {
3535
"type": "JSON",
36-
"json": "{\"public_ids\":[\"pbm-cwk-hzr\"]}"
36+
"json": "{\"public_ids\":[\"x96-ukc-pvk\"]}"
3737
},
3838
"headers": {},
3939
"method": "POST",
@@ -42,7 +42,7 @@
4242
"secure": true
4343
},
4444
"httpResponse": {
45-
"body": "{\"deleted_tests\":[{\"public_id\":\"pbm-cwk-hzr\",\"deleted_at\":\"2024-12-09T11:18:09.927667+00:00\"}]}\n",
45+
"body": "{\"deleted_tests\":[{\"public_id\":\"x96-ukc-pvk\",\"deleted_at\":\"2026-03-03T11:12:54.336119+00:00\"}]}\n",
4646
"headers": {
4747
"Content-Type": [
4848
"application/json"
@@ -57,6 +57,6 @@
5757
"timeToLive": {
5858
"unlimited": true
5959
},
60-
"id": "f8a3f039-59e9-8d4a-79a5-b3902d97f300"
60+
"id": "3002cecd-3dbc-3efb-a2f8-01efe3b6daa3"
6161
}
6262
]

src/test/resources/com/datadog/api/client/v1/api/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)