Skip to content

Commit 12e86b2

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Uncomment edit dataset block, add dataset limitations into endpoint descriptions (#2563)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent c9e4420 commit 12e86b2

File tree

13 files changed

+357
-8
lines changed

13 files changed

+357
-8
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "d51e9a8",
3-
"generated": "2025-07-25 13:23:06.075"
2+
"spec_repo_commit": "e4f653f",
3+
"generated": "2025-07-25 14:06:59.037"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12478,7 +12478,14 @@ components:
1247812478
- type
1247912479
type: object
1248012480
Dataset:
12481-
description: Dataset object.
12481+
description: "Dataset object.\n\n### Datasets Constraints\n- **Tag Limit per
12482+
Dataset**:\n - Each restricted dataset supports a maximum of 10 key:value
12483+
pairs per product.\n\n- **Tag Key Rules per Telemetry Type**:\n - Only one
12484+
tag key or attribute may be used to define access within a single telemetry
12485+
type.\n - The same or different tag key may be used across different telemetry
12486+
types.\n\n- **Tag Value Uniqueness**:\n - Tag values must be unique within
12487+
a single dataset.\n - A tag value used in one dataset cannot be reused in
12488+
another dataset of the same telemetry type."
1248212489
properties:
1248312490
attributes:
1248412491
$ref: '#/components/schemas/DatasetAttributes'
@@ -12556,6 +12563,14 @@ components:
1255612563
required:
1255712564
- data
1255812565
type: object
12566+
DatasetUpdateRequest:
12567+
description: Edit request for a dataset.
12568+
properties:
12569+
data:
12570+
$ref: '#/components/schemas/Dataset'
12571+
required:
12572+
- data
12573+
type: object
1255912574
Date:
1256012575
description: Date as Unix timestamp in milliseconds.
1256112576
example: 1722439510282
@@ -16083,10 +16098,9 @@ components:
1608316098
type: array
1608416099
product:
1608516100
description: 'Name of the product the dataset is for. Possible values are
16086-
''apm'', ''rum'', ''synthetics'',
16101+
''apm'', ''rum'',
1608716102

16088-
''metrics'', ''logs'', ''sd_repoinfo'', ''error_tracking'', ''cloud_cost'',
16089-
and ''ml_obs''.'
16103+
''metrics'', ''logs'', ''error_tracking'', and ''cloud_cost''.'
1609016104
example: logs
1609116105
type: string
1609216106
required:
@@ -48282,6 +48296,44 @@ paths:
4828248296
x-permission:
4828348297
operator: OPEN
4828448298
permissions: []
48299+
put:
48300+
description: Edits the dataset associated with the ID.
48301+
operationId: UpdateDataset
48302+
parameters:
48303+
- $ref: '#/components/parameters/DatasetID'
48304+
requestBody:
48305+
content:
48306+
application/json:
48307+
schema:
48308+
$ref: '#/components/schemas/DatasetUpdateRequest'
48309+
description: Dataset payload
48310+
required: true
48311+
responses:
48312+
'200':
48313+
content:
48314+
application/json:
48315+
schema:
48316+
$ref: '#/components/schemas/DatasetResponseSingle'
48317+
description: OK
48318+
'400':
48319+
$ref: '#/components/responses/BadRequestResponse'
48320+
'403':
48321+
$ref: '#/components/responses/NotAuthorizedResponse'
48322+
'404':
48323+
$ref: '#/components/responses/NotFoundResponse'
48324+
'429':
48325+
$ref: '#/components/responses/TooManyRequestsResponse'
48326+
security:
48327+
- apiKeyAuth: []
48328+
appKeyAuth: []
48329+
- AuthZ: []
48330+
summary: Edit a dataset
48331+
tags:
48332+
- Datasets
48333+
x-codegen-request-body-name: body
48334+
x-permission:
48335+
operator: OPEN
48336+
permissions: []
4828548337
/api/v2/deletion/data/{product}:
4828648338
post:
4828748339
description: Creates a data deletion request by providing a query and a timeframe

features/v2/datasets.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,30 @@ Feature: Datasets
5353
When the request is sent
5454
Then the response status is 404 Not Found
5555

56+
@generated @skip @team:DataDog/aaa-granular-access
57+
Scenario: Edit a dataset returns "Bad Request" response
58+
Given new "UpdateDataset" request
59+
And request contains "dataset_id" parameter from "REPLACE.ME"
60+
And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}}
61+
When the request is sent
62+
Then the response status is 400 Bad Request
63+
64+
@generated @skip @team:DataDog/aaa-granular-access
65+
Scenario: Edit a dataset returns "Not Found" response
66+
Given new "UpdateDataset" request
67+
And request contains "dataset_id" parameter from "REPLACE.ME"
68+
And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}}
69+
When the request is sent
70+
Then the response status is 404 Not Found
71+
72+
@generated @skip @team:DataDog/aaa-granular-access
73+
Scenario: Edit a dataset returns "OK" response
74+
Given new "UpdateDataset" request
75+
And request contains "dataset_id" parameter from "REPLACE.ME"
76+
And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}}
77+
When the request is sent
78+
Then the response status is 200 OK
79+
5680
@generated @skip @team:DataDog/aaa-granular-access
5781
Scenario: Get a single dataset by ID returns "Bad Request" response
5882
Given new "GetDataset" request

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,12 @@
888888
"type": "safe"
889889
}
890890
},
891+
"UpdateDataset": {
892+
"tag": "Datasets",
893+
"undo": {
894+
"type": "idempotent"
895+
}
896+
},
891897
"CreateDataDeletionRequest": {
892898
"tag": "Data Deletion",
893899
"undo": {

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4590,6 +4590,17 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
45904590
},
45914591
operationResponseType: "DatasetResponseSingle",
45924592
},
4593+
"DatasetsApi.V2.UpdateDataset": {
4594+
datasetId: {
4595+
type: "string",
4596+
format: "",
4597+
},
4598+
body: {
4599+
type: "DatasetUpdateRequest",
4600+
format: "",
4601+
},
4602+
operationResponseType: "DatasetResponseSingle",
4603+
},
45934604
"DatasetsApi.V2.DeleteDataset": {
45944605
datasetId: {
45954606
type: "string",

services/datasets/src/v2/DatasetsApi.ts

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { APIErrorResponse } from "./models/APIErrorResponse";
2626
import { DatasetCreateRequest } from "./models/DatasetCreateRequest";
2727
import { DatasetResponseMulti } from "./models/DatasetResponseMulti";
2828
import { DatasetResponseSingle } from "./models/DatasetResponseSingle";
29+
import { DatasetUpdateRequest } from "./models/DatasetUpdateRequest";
2930
import { version } from "../version";
3031

3132
export class DatasetsApiRequestFactory extends BaseAPIRequestFactory {
@@ -213,6 +214,66 @@ export class DatasetsApiRequestFactory extends BaseAPIRequestFactory {
213214

214215
return requestContext;
215216
}
217+
218+
public async updateDataset(
219+
datasetId: string,
220+
body: DatasetUpdateRequest,
221+
_options?: Configuration,
222+
): Promise<RequestContext> {
223+
const _config = _options || this.configuration;
224+
225+
// verify required parameter 'datasetId' is not null or undefined
226+
if (datasetId === null || datasetId === undefined) {
227+
throw new RequiredError("datasetId", "updateDataset");
228+
}
229+
230+
// verify required parameter 'body' is not null or undefined
231+
if (body === null || body === undefined) {
232+
throw new RequiredError("body", "updateDataset");
233+
}
234+
235+
// Path Params
236+
const localVarPath = "/api/v2/datasets/{dataset_id}".replace(
237+
"{dataset_id}",
238+
encodeURIComponent(String(datasetId)),
239+
);
240+
241+
// Make Request Context
242+
const { server, overrides } = _config.getServerAndOverrides(
243+
"DatasetsApi.v2.updateDataset",
244+
DatasetsApi.operationServers,
245+
);
246+
const requestContext = server.makeRequestContext(
247+
localVarPath,
248+
HttpMethod.PUT,
249+
overrides,
250+
);
251+
requestContext.setHeaderParam("Accept", "application/json");
252+
requestContext.setHttpConfig(_config.httpConfig);
253+
254+
// Set User-Agent
255+
if (this.userAgent) {
256+
requestContext.setHeaderParam("User-Agent", this.userAgent);
257+
}
258+
259+
// Body Params
260+
const contentType = getPreferredMediaType(["application/json"]);
261+
requestContext.setHeaderParam("Content-Type", contentType);
262+
const serializedBody = stringify(
263+
serialize(body, TypingInfo, "DatasetUpdateRequest", ""),
264+
contentType,
265+
);
266+
requestContext.setBody(serializedBody);
267+
268+
// Apply auth methods
269+
applySecurityAuthentication(_config, requestContext, [
270+
"apiKeyAuth",
271+
"appKeyAuth",
272+
"AuthZ",
273+
]);
274+
275+
return requestContext;
276+
}
216277
}
217278

218279
export class DatasetsApiResponseProcessor {
@@ -441,6 +502,67 @@ export class DatasetsApiResponseProcessor {
441502
'Unknown API Status Code!\nBody: "' + body + '"',
442503
);
443504
}
505+
506+
/**
507+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
508+
* to the expected objects
509+
*
510+
* @params response Response returned by the server for a request to updateDataset
511+
* @throws ApiException if the response code was not in [200, 299]
512+
*/
513+
public async updateDataset(
514+
response: ResponseContext,
515+
): Promise<DatasetResponseSingle> {
516+
const contentType = normalizeMediaType(response.headers["content-type"]);
517+
if (response.httpStatusCode === 200) {
518+
const body: DatasetResponseSingle = deserialize(
519+
parse(await response.body.text(), contentType),
520+
TypingInfo,
521+
"DatasetResponseSingle",
522+
) as DatasetResponseSingle;
523+
return body;
524+
}
525+
if (
526+
response.httpStatusCode === 400 ||
527+
response.httpStatusCode === 403 ||
528+
response.httpStatusCode === 404 ||
529+
response.httpStatusCode === 429
530+
) {
531+
const bodyText = parse(await response.body.text(), contentType);
532+
let body: APIErrorResponse;
533+
try {
534+
body = deserialize(
535+
bodyText,
536+
TypingInfo,
537+
"APIErrorResponse",
538+
) as APIErrorResponse;
539+
} catch (error) {
540+
logger.debug(`Got error deserializing error: ${error}`);
541+
throw new ApiException<APIErrorResponse>(
542+
response.httpStatusCode,
543+
bodyText,
544+
);
545+
}
546+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
547+
}
548+
549+
// Work around for missing responses in specification, e.g. for petstore.yaml
550+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
551+
const body: DatasetResponseSingle = deserialize(
552+
parse(await response.body.text(), contentType),
553+
TypingInfo,
554+
"DatasetResponseSingle",
555+
"",
556+
) as DatasetResponseSingle;
557+
return body;
558+
}
559+
560+
const body = (await response.body.text()) || "";
561+
throw new ApiException<string>(
562+
response.httpStatusCode,
563+
'Unknown API Status Code!\nBody: "' + body + '"',
564+
);
565+
}
444566
}
445567

446568
export interface DatasetsApiCreateDatasetRequest {
@@ -467,6 +589,19 @@ export interface DatasetsApiGetDatasetRequest {
467589
datasetId: string;
468590
}
469591

592+
export interface DatasetsApiUpdateDatasetRequest {
593+
/**
594+
* The ID of a defined dataset.
595+
* @type string
596+
*/
597+
datasetId: string;
598+
/**
599+
* Dataset payload
600+
* @type DatasetUpdateRequest
601+
*/
602+
body: DatasetUpdateRequest;
603+
}
604+
470605
export class DatasetsApi {
471606
private requestFactory: DatasetsApiRequestFactory;
472607
private responseProcessor: DatasetsApiResponseProcessor;
@@ -565,4 +700,26 @@ export class DatasetsApi {
565700
});
566701
});
567702
}
703+
704+
/**
705+
* Edits the dataset associated with the ID.
706+
* @param param The request object
707+
*/
708+
public updateDataset(
709+
param: DatasetsApiUpdateDatasetRequest,
710+
options?: Configuration,
711+
): Promise<DatasetResponseSingle> {
712+
const requestContextPromise = this.requestFactory.updateDataset(
713+
param.datasetId,
714+
param.body,
715+
options,
716+
);
717+
return requestContextPromise.then((requestContext) => {
718+
return this.configuration.httpApi
719+
.send(requestContext)
720+
.then((responseContext) => {
721+
return this.responseProcessor.updateDataset(responseContext);
722+
});
723+
});
724+
}
568725
}

services/datasets/src/v2/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export {
22
DatasetsApiCreateDatasetRequest,
33
DatasetsApiDeleteDatasetRequest,
44
DatasetsApiGetDatasetRequest,
5+
DatasetsApiUpdateDatasetRequest,
56
DatasetsApi,
67
} from "./DatasetsApi";
78

@@ -11,4 +12,5 @@ export { DatasetAttributes } from "./models/DatasetAttributes";
1112
export { DatasetCreateRequest } from "./models/DatasetCreateRequest";
1213
export { DatasetResponseMulti } from "./models/DatasetResponseMulti";
1314
export { DatasetResponseSingle } from "./models/DatasetResponseSingle";
15+
export { DatasetUpdateRequest } from "./models/DatasetUpdateRequest";
1416
export { FiltersPerProduct } from "./models/FiltersPerProduct";

services/datasets/src/v2/models/Dataset.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ import { DatasetAttributes } from "./DatasetAttributes";
44

55
/**
66
* Dataset object.
7+
*
8+
* ### Datasets Constraints
9+
* - **Tag Limit per Dataset**:
10+
* - Each restricted dataset supports a maximum of 10 key:value pairs per product.
11+
*
12+
* - **Tag Key Rules per Telemetry Type**:
13+
* - Only one tag key or attribute may be used to define access within a single telemetry type.
14+
* - The same or different tag key may be used across different telemetry types.
15+
*
16+
* - **Tag Value Uniqueness**:
17+
* - Tag values must be unique within a single dataset.
18+
* - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
719
*/
820
export class Dataset {
921
/**

services/datasets/src/v2/models/DatasetCreateRequest.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ import { Dataset } from "./Dataset";
88
export class DatasetCreateRequest {
99
/**
1010
* Dataset object.
11+
*
12+
* ### Datasets Constraints
13+
* - **Tag Limit per Dataset**:
14+
* - Each restricted dataset supports a maximum of 10 key:value pairs per product.
15+
*
16+
* - **Tag Key Rules per Telemetry Type**:
17+
* - Only one tag key or attribute may be used to define access within a single telemetry type.
18+
* - The same or different tag key may be used across different telemetry types.
19+
*
20+
* - **Tag Value Uniqueness**:
21+
* - Tag values must be unique within a single dataset.
22+
* - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
1123
*/
1224
"data": Dataset;
1325
/**

0 commit comments

Comments
 (0)