Skip to content

Commit aebad8f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Uncomment edit dataset block, add dataset limitations into endpoint descriptions (DataDog#3240)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 092607b commit aebad8f

12 files changed

Lines changed: 380 additions & 8 deletions

File tree

.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:24:47.988"
2+
"spec_repo_commit": "e4f653f",
3+
"generated": "2025-07-25 14:08:41.556"
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

api/datadogV2/api_datasets.go

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,87 @@ func (a *DatasetsApi) GetDataset(ctx _context.Context, datasetId string) (Datase
318318
return localVarReturnValue, localVarHTTPResponse, nil
319319
}
320320

321+
// UpdateDataset Edit a dataset.
322+
// Edits the dataset associated with the ID.
323+
func (a *DatasetsApi) UpdateDataset(ctx _context.Context, datasetId string, body DatasetUpdateRequest) (DatasetResponseSingle, *_nethttp.Response, error) {
324+
var (
325+
localVarHTTPMethod = _nethttp.MethodPut
326+
localVarPostBody interface{}
327+
localVarReturnValue DatasetResponseSingle
328+
)
329+
330+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DatasetsApi.UpdateDataset")
331+
if err != nil {
332+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
333+
}
334+
335+
localVarPath := localBasePath + "/api/v2/datasets/{dataset_id}"
336+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{dataset_id}", _neturl.PathEscape(datadog.ParameterToString(datasetId, "")))
337+
338+
localVarHeaderParams := make(map[string]string)
339+
localVarQueryParams := _neturl.Values{}
340+
localVarFormParams := _neturl.Values{}
341+
localVarHeaderParams["Content-Type"] = "application/json"
342+
localVarHeaderParams["Accept"] = "application/json"
343+
344+
// body params
345+
localVarPostBody = &body
346+
if a.Client.Cfg.DelegatedTokenConfig != nil {
347+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
348+
if err != nil {
349+
return localVarReturnValue, nil, err
350+
}
351+
} else {
352+
datadog.SetAuthKeys(
353+
ctx,
354+
&localVarHeaderParams,
355+
[2]string{"apiKeyAuth", "DD-API-KEY"},
356+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
357+
)
358+
}
359+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
360+
if err != nil {
361+
return localVarReturnValue, nil, err
362+
}
363+
364+
localVarHTTPResponse, err := a.Client.CallAPI(req)
365+
if err != nil || localVarHTTPResponse == nil {
366+
return localVarReturnValue, localVarHTTPResponse, err
367+
}
368+
369+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
370+
if err != nil {
371+
return localVarReturnValue, localVarHTTPResponse, err
372+
}
373+
374+
if localVarHTTPResponse.StatusCode >= 300 {
375+
newErr := datadog.GenericOpenAPIError{
376+
ErrorBody: localVarBody,
377+
ErrorMessage: localVarHTTPResponse.Status,
378+
}
379+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
380+
var v APIErrorResponse
381+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
382+
if err != nil {
383+
return localVarReturnValue, localVarHTTPResponse, newErr
384+
}
385+
newErr.ErrorModel = v
386+
}
387+
return localVarReturnValue, localVarHTTPResponse, newErr
388+
}
389+
390+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
391+
if err != nil {
392+
newErr := datadog.GenericOpenAPIError{
393+
ErrorBody: localVarBody,
394+
ErrorMessage: err.Error(),
395+
}
396+
return localVarReturnValue, localVarHTTPResponse, newErr
397+
}
398+
399+
return localVarReturnValue, localVarHTTPResponse, nil
400+
}
401+
321402
// NewDatasetsApi Returns NewDatasetsApi.
322403
func NewDatasetsApi(client *datadog.APIClient) *DatasetsApi {
323404
return &DatasetsApi{

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
// - [DatasetsApi.DeleteDataset]
162162
// - [DatasetsApi.GetAllDatasets]
163163
// - [DatasetsApi.GetDataset]
164+
// - [DatasetsApi.UpdateDataset]
164165
// - [DomainAllowlistApi.GetDomainAllowlist]
165166
// - [DomainAllowlistApi.PatchDomainAllowlist]
166167
// - [DowntimesApi.CancelDowntime]

api/datadogV2/model_dataset.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ import (
1111
)
1212

1313
// Dataset Dataset object.
14+
//
15+
// ### Datasets Constraints
16+
// - **Tag Limit per Dataset**:
17+
// - Each restricted dataset supports a maximum of 10 key:value pairs per product.
18+
//
19+
// - **Tag Key Rules per Telemetry Type**:
20+
// - Only one tag key or attribute may be used to define access within a single telemetry type.
21+
// - The same or different tag key may be used across different telemetry types.
22+
//
23+
// - **Tag Value Uniqueness**:
24+
// - Tag values must be unique within a single dataset.
25+
// - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
1426
type Dataset struct {
1527
// Dataset metadata and configuration(s).
1628
Attributes DatasetAttributes `json:"attributes"`

api/datadogV2/model_dataset_create_request.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ import (
1313
// DatasetCreateRequest Create request for a dataset.
1414
type DatasetCreateRequest struct {
1515
// Dataset object.
16+
//
17+
// ### Datasets Constraints
18+
// - **Tag Limit per Dataset**:
19+
// - Each restricted dataset supports a maximum of 10 key:value pairs per product.
20+
//
21+
// - **Tag Key Rules per Telemetry Type**:
22+
// - Only one tag key or attribute may be used to define access within a single telemetry type.
23+
// - The same or different tag key may be used across different telemetry types.
24+
//
25+
// - **Tag Value Uniqueness**:
26+
// - Tag values must be unique within a single dataset.
27+
// - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
1628
Data Dataset `json:"data"`
1729
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1830
UnparsedObject map[string]interface{} `json:"-"`

api/datadogV2/model_dataset_response_single.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ import (
1313
// DatasetResponseSingle Response containing a single dataset object.
1414
type DatasetResponseSingle struct {
1515
// Dataset object.
16+
//
17+
// ### Datasets Constraints
18+
// - **Tag Limit per Dataset**:
19+
// - Each restricted dataset supports a maximum of 10 key:value pairs per product.
20+
//
21+
// - **Tag Key Rules per Telemetry Type**:
22+
// - Only one tag key or attribute may be used to define access within a single telemetry type.
23+
// - The same or different tag key may be used across different telemetry types.
24+
//
25+
// - **Tag Value Uniqueness**:
26+
// - Tag values must be unique within a single dataset.
27+
// - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
1628
Data Dataset `json:"data"`
1729
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1830
UnparsedObject map[string]interface{} `json:"-"`
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// DatasetUpdateRequest Edit request for a dataset.
14+
type DatasetUpdateRequest struct {
15+
// Dataset object.
16+
//
17+
// ### Datasets Constraints
18+
// - **Tag Limit per Dataset**:
19+
// - Each restricted dataset supports a maximum of 10 key:value pairs per product.
20+
//
21+
// - **Tag Key Rules per Telemetry Type**:
22+
// - Only one tag key or attribute may be used to define access within a single telemetry type.
23+
// - The same or different tag key may be used across different telemetry types.
24+
//
25+
// - **Tag Value Uniqueness**:
26+
// - Tag values must be unique within a single dataset.
27+
// - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
28+
Data Dataset `json:"data"`
29+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
30+
UnparsedObject map[string]interface{} `json:"-"`
31+
AdditionalProperties map[string]interface{} `json:"-"`
32+
}
33+
34+
// NewDatasetUpdateRequest instantiates a new DatasetUpdateRequest object.
35+
// This constructor will assign default values to properties that have it defined,
36+
// and makes sure properties required by API are set, but the set of arguments
37+
// will change when the set of required properties is changed.
38+
func NewDatasetUpdateRequest(data Dataset) *DatasetUpdateRequest {
39+
this := DatasetUpdateRequest{}
40+
this.Data = data
41+
return &this
42+
}
43+
44+
// NewDatasetUpdateRequestWithDefaults instantiates a new DatasetUpdateRequest object.
45+
// This constructor will only assign default values to properties that have it defined,
46+
// but it doesn't guarantee that properties required by API are set.
47+
func NewDatasetUpdateRequestWithDefaults() *DatasetUpdateRequest {
48+
this := DatasetUpdateRequest{}
49+
return &this
50+
}
51+
52+
// GetData returns the Data field value.
53+
func (o *DatasetUpdateRequest) GetData() Dataset {
54+
if o == nil {
55+
var ret Dataset
56+
return ret
57+
}
58+
return o.Data
59+
}
60+
61+
// GetDataOk returns a tuple with the Data field value
62+
// and a boolean to check if the value has been set.
63+
func (o *DatasetUpdateRequest) GetDataOk() (*Dataset, bool) {
64+
if o == nil {
65+
return nil, false
66+
}
67+
return &o.Data, true
68+
}
69+
70+
// SetData sets field value.
71+
func (o *DatasetUpdateRequest) SetData(v Dataset) {
72+
o.Data = v
73+
}
74+
75+
// MarshalJSON serializes the struct using spec logic.
76+
func (o DatasetUpdateRequest) MarshalJSON() ([]byte, error) {
77+
toSerialize := map[string]interface{}{}
78+
if o.UnparsedObject != nil {
79+
return datadog.Marshal(o.UnparsedObject)
80+
}
81+
toSerialize["data"] = o.Data
82+
83+
for key, value := range o.AdditionalProperties {
84+
toSerialize[key] = value
85+
}
86+
return datadog.Marshal(toSerialize)
87+
}
88+
89+
// UnmarshalJSON deserializes the given payload.
90+
func (o *DatasetUpdateRequest) UnmarshalJSON(bytes []byte) (err error) {
91+
all := struct {
92+
Data *Dataset `json:"data"`
93+
}{}
94+
if err = datadog.Unmarshal(bytes, &all); err != nil {
95+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
96+
}
97+
if all.Data == nil {
98+
return fmt.Errorf("required field data missing")
99+
}
100+
additionalProperties := make(map[string]interface{})
101+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
102+
datadog.DeleteKeys(additionalProperties, &[]string{"data"})
103+
} else {
104+
return err
105+
}
106+
107+
hasInvalidField := false
108+
if all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
109+
hasInvalidField = true
110+
}
111+
o.Data = *all.Data
112+
113+
if len(additionalProperties) > 0 {
114+
o.AdditionalProperties = additionalProperties
115+
}
116+
117+
if hasInvalidField {
118+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
119+
}
120+
121+
return nil
122+
}

api/datadogV2/model_filters_per_product.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ type FiltersPerProduct struct {
1717
// Datadog (such as `@tag.key:value`), and only one tag or attribute may be used to define the access strategy
1818
// per telemetry type.
1919
Filters []string `json:"filters"`
20-
// Name of the product the dataset is for. Possible values are 'apm', 'rum', 'synthetics',
21-
// 'metrics', 'logs', 'sd_repoinfo', 'error_tracking', 'cloud_cost', and 'ml_obs'.
20+
// Name of the product the dataset is for. Possible values are 'apm', 'rum',
21+
// 'metrics', 'logs', 'error_tracking', and 'cloud_cost'.
2222
Product string `json:"product"`
2323
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2424
UnparsedObject map[string]interface{} `json:"-"`

0 commit comments

Comments
 (0)