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:23:07.308"
"spec_repo_commit": "e4f653f",
"generated": "2025-07-25 14:07:18.059"
}
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
27 changes: 27 additions & 0 deletions examples/v2/datasets/UpdateDataset.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Edit a dataset returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::DatasetsAPI.new

body = DatadogAPIClient::V2::DatasetUpdateRequest.new({
data: DatadogAPIClient::V2::Dataset.new({
attributes: DatadogAPIClient::V2::DatasetAttributes.new({
created_at: nil,
name: "Security Audit Dataset",
principals: [
"role:86245fce-0a4e-11f0-92bd-da7ad0900002",
],
product_filters: [
DatadogAPIClient::V2::FiltersPerProduct.new({
filters: [
"@application.id:ABCD",
],
product: "logs",
}),
],
}),
id: "123e4567-e89b-12d3-a456-426614174000",
type: "dataset",
}),
})
p api_instance.update_dataset("dataset_id", body)
4 changes: 4 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,10 @@
"v2.GetDataset" => {
"dataset_id" => "String",
},
"v2.UpdateDataset" => {
"dataset_id" => "String",
"body" => "DatasetUpdateRequest",
},
"v2.CreateDataDeletionRequest" => {
"product" => "String",
"body" => "CreateDataDeletionRequestBody",
Expand Down
24 changes: 24 additions & 0 deletions features/v2/datasets.feature
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ Feature: Datasets
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/aaa-granular-access
Scenario: Edit a dataset returns "Bad Request" response
Given new "UpdateDataset" request
And request contains "dataset_id" parameter from "REPLACE.ME"
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"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/aaa-granular-access
Scenario: Edit a dataset returns "Not Found" response
Given new "UpdateDataset" request
And request contains "dataset_id" parameter from "REPLACE.ME"
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"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/aaa-granular-access
Scenario: Edit a dataset returns "OK" response
Given new "UpdateDataset" request
And request contains "dataset_id" parameter from "REPLACE.ME"
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"}}
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/aaa-granular-access
Scenario: Get a single dataset by ID returns "Bad Request" response
Given new "GetDataset" request
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,12 @@
"type": "safe"
}
},
"UpdateDataset": {
"tag": "Datasets",
"undo": {
"type": "idempotent"
}
},
"CreateDataDeletionRequest": {
"tag": "Data Deletion",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,7 @@ def overrides
"v2.dataset_create_request" => "DatasetCreateRequest",
"v2.dataset_response_multi" => "DatasetResponseMulti",
"v2.dataset_response_single" => "DatasetResponseSingle",
"v2.dataset_update_request" => "DatasetUpdateRequest",
"v2.data_transform" => "DataTransform",
"v2.data_transform_properties" => "DataTransformProperties",
"v2.data_transform_type" => "DataTransformType",
Expand Down
72 changes: 72 additions & 0 deletions lib/datadog_api_client/v2/api/datasets_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,77 @@ def get_dataset_with_http_info(dataset_id, opts = {})
end
return data, status_code, headers
end

# Edit a dataset.
#
# @see #update_dataset_with_http_info
def update_dataset(dataset_id, body, opts = {})
data, _status_code, _headers = update_dataset_with_http_info(dataset_id, body, opts)
data
end

# Edit a dataset.
#
# Edits the dataset associated with the ID.
#
# @param dataset_id [String] The ID of a defined dataset.
# @param body [DatasetUpdateRequest] Dataset payload
# @param opts [Hash] the optional parameters
# @return [Array<(DatasetResponseSingle, Integer, Hash)>] DatasetResponseSingle data, response status code and response headers
def update_dataset_with_http_info(dataset_id, body, opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DatasetsAPI.update_dataset ...'
end
# verify the required parameter 'dataset_id' is set
if @api_client.config.client_side_validation && dataset_id.nil?
fail ArgumentError, "Missing the required parameter 'dataset_id' when calling DatasetsAPI.update_dataset"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling DatasetsAPI.update_dataset"
end
# resource path
local_var_path = '/api/v2/datasets/{dataset_id}'.sub('{dataset_id}', CGI.escape(dataset_id.to_s).gsub('%2F', '/'))

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

# return_type
return_type = opts[:debug_return_type] || 'DatasetResponseSingle'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

new_options = opts.merge(
:operation => :update_dataset,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DatasetsAPI#update_dataset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
12 changes: 12 additions & 0 deletions lib/datadog_api_client/v2/models/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@

module DatadogAPIClient::V2
# 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.
class Dataset
include BaseGenericModel

Expand Down
12 changes: 12 additions & 0 deletions lib/datadog_api_client/v2/models/dataset_create_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ class DatasetCreateRequest
include BaseGenericModel

# 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.
attr_reader :data

attr_accessor :additional_properties
Expand Down
12 changes: 12 additions & 0 deletions lib/datadog_api_client/v2/models/dataset_response_single.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ class DatasetResponseSingle
include BaseGenericModel

# 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.
attr_reader :data

attr_accessor :additional_properties
Expand Down
Loading
Loading