Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "d51e9a8",
"generated": "2025-07-25 13:24:47.988"
"spec_repo_commit": "e4f653f",
"generated": "2025-07-25 14:08:41.556"
}
60 changes: 56 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12478,7 +12478,14 @@ components:
- type
type: object
Dataset:
description: Dataset object.
description: "Dataset object.\n\n### Datasets Constraints\n- **Tag Limit per
Dataset**:\n - Each restricted dataset supports a maximum of 10 key:value
pairs per product.\n\n- **Tag Key Rules per Telemetry Type**:\n - Only one
tag key or attribute may be used to define access within a single telemetry
type.\n - The same or different tag key may be used across different telemetry
types.\n\n- **Tag Value Uniqueness**:\n - Tag values must be unique within
a single dataset.\n - A tag value used in one dataset cannot be reused in
another dataset of the same telemetry type."
properties:
attributes:
$ref: '#/components/schemas/DatasetAttributes'
Expand Down Expand Up @@ -12556,6 +12563,14 @@ components:
required:
- data
type: object
DatasetUpdateRequest:
description: Edit request for a dataset.
properties:
data:
$ref: '#/components/schemas/Dataset'
required:
- data
type: object
Date:
description: Date as Unix timestamp in milliseconds.
example: 1722439510282
Expand Down Expand Up @@ -16083,10 +16098,9 @@ components:
type: array
product:
description: 'Name of the product the dataset is for. Possible values are
''apm'', ''rum'', ''synthetics'',
''apm'', ''rum'',

''metrics'', ''logs'', ''sd_repoinfo'', ''error_tracking'', ''cloud_cost'',
and ''ml_obs''.'
''metrics'', ''logs'', ''error_tracking'', and ''cloud_cost''.'
example: logs
type: string
required:
Expand Down Expand Up @@ -48282,6 +48296,44 @@ paths:
x-permission:
operator: OPEN
permissions: []
put:
description: Edits the dataset associated with the ID.
operationId: UpdateDataset
parameters:
- $ref: '#/components/parameters/DatasetID'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DatasetUpdateRequest'
description: Dataset payload
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/DatasetResponseSingle'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Edit a dataset
tags:
- Datasets
x-codegen-request-body-name: body
x-permission:
operator: OPEN
permissions: []
/api/v2/deletion/data/{product}:
post:
description: Creates a data deletion request by providing a query and a timeframe
Expand Down
81 changes: 81 additions & 0 deletions api/datadogV2/api_datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,87 @@ func (a *DatasetsApi) GetDataset(ctx _context.Context, datasetId string) (Datase
return localVarReturnValue, localVarHTTPResponse, nil
}

// UpdateDataset Edit a dataset.
// Edits the dataset associated with the ID.
func (a *DatasetsApi) UpdateDataset(ctx _context.Context, datasetId string, body DatasetUpdateRequest) (DatasetResponseSingle, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarReturnValue DatasetResponseSingle
)

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.DatasetsApi.UpdateDataset")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/datasets/{dataset_id}"
localVarPath = datadog.ReplacePathParameter(localVarPath, "{dataset_id}", _neturl.PathEscape(datadog.ParameterToString(datasetId, "")))

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Content-Type"] = "application/json"
localVarHeaderParams["Accept"] = "application/json"

// body params
localVarPostBody = &body
if a.Client.Cfg.DelegatedTokenConfig != nil {
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
if err != nil {
return localVarReturnValue, nil, err
}
} else {
datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
}
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

// NewDatasetsApi Returns NewDatasetsApi.
func NewDatasetsApi(client *datadog.APIClient) *DatasetsApi {
return &DatasetsApi{
Expand Down
1 change: 1 addition & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
// - [DatasetsApi.DeleteDataset]
// - [DatasetsApi.GetAllDatasets]
// - [DatasetsApi.GetDataset]
// - [DatasetsApi.UpdateDataset]
// - [DomainAllowlistApi.GetDomainAllowlist]
// - [DomainAllowlistApi.PatchDomainAllowlist]
// - [DowntimesApi.CancelDowntime]
Expand Down
12 changes: 12 additions & 0 deletions api/datadogV2/model_dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ import (
)

// Dataset Dataset object.
//
// ### Datasets Constraints
// - **Tag Limit per Dataset**:
// - Each restricted dataset supports a maximum of 10 key:value pairs per product.
//
// - **Tag Key Rules per Telemetry Type**:
// - Only one tag key or attribute may be used to define access within a single telemetry type.
// - The same or different tag key may be used across different telemetry types.
//
// - **Tag Value Uniqueness**:
// - Tag values must be unique within a single dataset.
// - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
type Dataset struct {
// Dataset metadata and configuration(s).
Attributes DatasetAttributes `json:"attributes"`
Expand Down
12 changes: 12 additions & 0 deletions api/datadogV2/model_dataset_create_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ import (
// DatasetCreateRequest Create request for a dataset.
type DatasetCreateRequest struct {
// Dataset object.
//
// ### Datasets Constraints
// - **Tag Limit per Dataset**:
// - Each restricted dataset supports a maximum of 10 key:value pairs per product.
//
// - **Tag Key Rules per Telemetry Type**:
// - Only one tag key or attribute may be used to define access within a single telemetry type.
// - The same or different tag key may be used across different telemetry types.
//
// - **Tag Value Uniqueness**:
// - Tag values must be unique within a single dataset.
// - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
Data Dataset `json:"data"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
Expand Down
12 changes: 12 additions & 0 deletions api/datadogV2/model_dataset_response_single.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ import (
// DatasetResponseSingle Response containing a single dataset object.
type DatasetResponseSingle struct {
// Dataset object.
//
// ### Datasets Constraints
// - **Tag Limit per Dataset**:
// - Each restricted dataset supports a maximum of 10 key:value pairs per product.
//
// - **Tag Key Rules per Telemetry Type**:
// - Only one tag key or attribute may be used to define access within a single telemetry type.
// - The same or different tag key may be used across different telemetry types.
//
// - **Tag Value Uniqueness**:
// - Tag values must be unique within a single dataset.
// - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
Data Dataset `json:"data"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
Expand Down
122 changes: 122 additions & 0 deletions api/datadogV2/model_dataset_update_request.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// DatasetUpdateRequest Edit request for a dataset.
type DatasetUpdateRequest struct {
// Dataset object.
//
// ### Datasets Constraints
// - **Tag Limit per Dataset**:
// - Each restricted dataset supports a maximum of 10 key:value pairs per product.
//
// - **Tag Key Rules per Telemetry Type**:
// - Only one tag key or attribute may be used to define access within a single telemetry type.
// - The same or different tag key may be used across different telemetry types.
//
// - **Tag Value Uniqueness**:
// - Tag values must be unique within a single dataset.
// - A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
Data Dataset `json:"data"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewDatasetUpdateRequest instantiates a new DatasetUpdateRequest object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewDatasetUpdateRequest(data Dataset) *DatasetUpdateRequest {
this := DatasetUpdateRequest{}
this.Data = data
return &this
}

// NewDatasetUpdateRequestWithDefaults instantiates a new DatasetUpdateRequest object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewDatasetUpdateRequestWithDefaults() *DatasetUpdateRequest {
this := DatasetUpdateRequest{}
return &this
}

// GetData returns the Data field value.
func (o *DatasetUpdateRequest) GetData() Dataset {
if o == nil {
var ret Dataset
return ret
}
return o.Data
}

// GetDataOk returns a tuple with the Data field value
// and a boolean to check if the value has been set.
func (o *DatasetUpdateRequest) GetDataOk() (*Dataset, bool) {
if o == nil {
return nil, false
}
return &o.Data, true
}

// SetData sets field value.
func (o *DatasetUpdateRequest) SetData(v Dataset) {
o.Data = v
}

// MarshalJSON serializes the struct using spec logic.
func (o DatasetUpdateRequest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["data"] = o.Data

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *DatasetUpdateRequest) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Data *Dataset `json:"data"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Data == nil {
return fmt.Errorf("required field data missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"data"})
} else {
return err
}

hasInvalidField := false
if all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Data = *all.Data

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
4 changes: 2 additions & 2 deletions api/datadogV2/model_filters_per_product.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type FiltersPerProduct struct {
// Datadog (such as `@tag.key:value`), and only one tag or attribute may be used to define the access strategy
// per telemetry type.
Filters []string `json:"filters"`
// Name of the product the dataset is for. Possible values are 'apm', 'rum', 'synthetics',
// 'metrics', 'logs', 'sd_repoinfo', 'error_tracking', 'cloud_cost', and 'ml_obs'.
// Name of the product the dataset is for. Possible values are 'apm', 'rum',
// 'metrics', 'logs', 'error_tracking', and 'cloud_cost'.
Product string `json:"product"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
Expand Down
Loading
Loading