Skip to content

Commit 42881c1

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit fb715cc of spec repo
1 parent 2b4e9c2 commit 42881c1

File tree

9 files changed

+305
-2
lines changed

9 files changed

+305
-2
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": "8ca2883",
3-
"generated": "2025-07-22 07:14:48.428"
2+
"spec_repo_commit": "fb715cc",
3+
"generated": "2025-07-22 13:20:23.304"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12537,6 +12537,14 @@ components:
1253712537
required:
1253812538
- data
1253912539
type: object
12540+
DatasetEditRequest:
12541+
description: Edit request for a dataset.
12542+
properties:
12543+
data:
12544+
$ref: '#/components/schemas/Dataset'
12545+
required:
12546+
- data
12547+
type: object
1254012548
DatasetResponseMulti:
1254112549
description: Response containing a list of datasets.
1254212550
properties:
@@ -48271,6 +48279,44 @@ paths:
4827148279
x-permission:
4827248280
operator: OPEN
4827348281
permissions: []
48282+
put:
48283+
description: Edits the dataset associated with the ID.
48284+
operationId: EditDataset
48285+
parameters:
48286+
- $ref: '#/components/parameters/DatasetID'
48287+
requestBody:
48288+
content:
48289+
application/json:
48290+
schema:
48291+
$ref: '#/components/schemas/DatasetEditRequest'
48292+
description: Dataset payload
48293+
required: true
48294+
responses:
48295+
'200':
48296+
content:
48297+
application/json:
48298+
schema:
48299+
$ref: '#/components/schemas/DatasetResponseSingle'
48300+
description: OK
48301+
'400':
48302+
$ref: '#/components/responses/BadRequestResponse'
48303+
'403':
48304+
$ref: '#/components/responses/NotAuthorizedResponse'
48305+
'404':
48306+
$ref: '#/components/responses/NotFoundResponse'
48307+
'429':
48308+
$ref: '#/components/responses/TooManyRequestsResponse'
48309+
security:
48310+
- apiKeyAuth: []
48311+
appKeyAuth: []
48312+
- AuthZ: []
48313+
summary: Edits a dataset
48314+
tags:
48315+
- Datasets
48316+
x-codegen-request-body-name: body
48317+
x-permission:
48318+
operator: OPEN
48319+
permissions: []
4827448320
/api/v2/deletion/data/{product}:
4827548321
post:
4827648322
description: Creates a data deletion request by providing a query and a timeframe
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Edits a dataset returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::DatasetsAPI.new
5+
6+
body = DatadogAPIClient::V2::DatasetEditRequest.new({
7+
data: DatadogAPIClient::V2::Dataset.new({
8+
attributes: DatadogAPIClient::V2::DatasetAttributes.new({
9+
created_at: nil,
10+
name: "Security Audit Dataset",
11+
principals: [
12+
"role:86245fce-0a4e-11f0-92bd-da7ad0900002",
13+
],
14+
product_filters: [
15+
DatadogAPIClient::V2::FiltersPerProduct.new({
16+
filters: [
17+
"@application.id:ABCD",
18+
],
19+
product: "logs",
20+
}),
21+
],
22+
}),
23+
id: "123e4567-e89b-12d3-a456-426614174000",
24+
type: "dataset",
25+
}),
26+
})
27+
p api_instance.edit_dataset("dataset_id", body)

features/scenarios_model_mapping.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,10 @@
15971597
"v2.GetDataset" => {
15981598
"dataset_id" => "String",
15991599
},
1600+
"v2.EditDataset" => {
1601+
"dataset_id" => "String",
1602+
"body" => "DatasetEditRequest",
1603+
},
16001604
"v2.CreateDataDeletionRequest" => {
16011605
"product" => "String",
16021606
"body" => "CreateDataDeletionRequestBody",

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: Edits a dataset returns "Bad Request" response
58+
Given new "EditDataset" 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: Edits a dataset returns "Not Found" response
66+
Given new "EditDataset" 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: Edits a dataset returns "OK" response
74+
Given new "EditDataset" 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+
"EditDataset": {
892+
"tag": "Datasets",
893+
"undo": {
894+
"type": "idempotent"
895+
}
896+
},
891897
"CreateDataDeletionRequest": {
892898
"tag": "Data Deletion",
893899
"undo": {

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,7 @@ def overrides
16171617
"v2.dataset" => "Dataset",
16181618
"v2.dataset_attributes" => "DatasetAttributes",
16191619
"v2.dataset_create_request" => "DatasetCreateRequest",
1620+
"v2.dataset_edit_request" => "DatasetEditRequest",
16201621
"v2.dataset_response_multi" => "DatasetResponseMulti",
16211622
"v2.dataset_response_single" => "DatasetResponseSingle",
16221623
"v2.data_transform" => "DataTransform",

lib/datadog_api_client/v2/api/datasets_api.rb

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,78 @@ def delete_dataset_with_http_info(dataset_id, opts = {})
155155
return data, status_code, headers
156156
end
157157

158+
# Edits a dataset.
159+
#
160+
# @see #edit_dataset_with_http_info
161+
def edit_dataset(dataset_id, body, opts = {})
162+
data, _status_code, _headers = edit_dataset_with_http_info(dataset_id, body, opts)
163+
data
164+
end
165+
166+
# Edits a dataset.
167+
#
168+
# Edits the dataset associated with the ID.
169+
#
170+
# @param dataset_id [String] The ID of a defined dataset.
171+
# @param body [DatasetEditRequest] Dataset payload
172+
# @param opts [Hash] the optional parameters
173+
# @return [Array<(DatasetResponseSingle, Integer, Hash)>] DatasetResponseSingle data, response status code and response headers
174+
def edit_dataset_with_http_info(dataset_id, body, opts = {})
175+
176+
if @api_client.config.debugging
177+
@api_client.config.logger.debug 'Calling API: DatasetsAPI.edit_dataset ...'
178+
end
179+
# verify the required parameter 'dataset_id' is set
180+
if @api_client.config.client_side_validation && dataset_id.nil?
181+
fail ArgumentError, "Missing the required parameter 'dataset_id' when calling DatasetsAPI.edit_dataset"
182+
end
183+
# verify the required parameter 'body' is set
184+
if @api_client.config.client_side_validation && body.nil?
185+
fail ArgumentError, "Missing the required parameter 'body' when calling DatasetsAPI.edit_dataset"
186+
end
187+
# resource path
188+
local_var_path = '/api/v2/datasets/{dataset_id}'.sub('{dataset_id}', CGI.escape(dataset_id.to_s).gsub('%2F', '/'))
189+
190+
# query parameters
191+
query_params = opts[:query_params] || {}
192+
193+
# header parameters
194+
header_params = opts[:header_params] || {}
195+
# HTTP header 'Accept' (if needed)
196+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
197+
# HTTP header 'Content-Type'
198+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
199+
200+
# form parameters
201+
form_params = opts[:form_params] || {}
202+
203+
# http body (model)
204+
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
205+
206+
# return_type
207+
return_type = opts[:debug_return_type] || 'DatasetResponseSingle'
208+
209+
# auth_names
210+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
211+
212+
new_options = opts.merge(
213+
:operation => :edit_dataset,
214+
:header_params => header_params,
215+
:query_params => query_params,
216+
:form_params => form_params,
217+
:body => post_body,
218+
:auth_names => auth_names,
219+
:return_type => return_type,
220+
:api_version => "V2"
221+
)
222+
223+
data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options)
224+
if @api_client.config.debugging
225+
@api_client.config.logger.debug "API called: DatasetsAPI#edit_dataset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
226+
end
227+
return data, status_code, headers
228+
end
229+
158230
# Get all datasets.
159231
#
160232
# @see #get_all_datasets_with_http_info
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Edit request for a dataset.
21+
class DatasetEditRequest
22+
include BaseGenericModel
23+
24+
# Dataset object.
25+
attr_reader :data
26+
27+
attr_accessor :additional_properties
28+
29+
# Attribute mapping from ruby-style variable name to JSON key.
30+
# @!visibility private
31+
def self.attribute_map
32+
{
33+
:'data' => :'data'
34+
}
35+
end
36+
37+
# Attribute type mapping.
38+
# @!visibility private
39+
def self.openapi_types
40+
{
41+
:'data' => :'Dataset'
42+
}
43+
end
44+
45+
# Initializes the object
46+
# @param attributes [Hash] Model attributes in the form of hash
47+
# @!visibility private
48+
def initialize(attributes = {})
49+
if (!attributes.is_a?(Hash))
50+
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetEditRequest` initialize method"
51+
end
52+
53+
self.additional_properties = {}
54+
# check to see if the attribute exists and convert string to symbol for hash key
55+
attributes = attributes.each_with_object({}) { |(k, v), h|
56+
if (!self.class.attribute_map.key?(k.to_sym))
57+
self.additional_properties[k.to_sym] = v
58+
else
59+
h[k.to_sym] = v
60+
end
61+
}
62+
63+
if attributes.key?(:'data')
64+
self.data = attributes[:'data']
65+
end
66+
end
67+
68+
# Check to see if the all the properties in the model are valid
69+
# @return true if the model is valid
70+
# @!visibility private
71+
def valid?
72+
return false if @data.nil?
73+
true
74+
end
75+
76+
# Custom attribute writer method with validation
77+
# @param data [Object] Object to be assigned
78+
# @!visibility private
79+
def data=(data)
80+
if data.nil?
81+
fail ArgumentError, 'invalid value for "data", data cannot be nil.'
82+
end
83+
@data = data
84+
end
85+
86+
# Returns the object in the form of hash, with additionalProperties support.
87+
# @return [Hash] Returns the object in the form of hash
88+
# @!visibility private
89+
def to_hash
90+
hash = {}
91+
self.class.attribute_map.each_pair do |attr, param|
92+
value = self.send(attr)
93+
if value.nil?
94+
is_nullable = self.class.openapi_nullable.include?(attr)
95+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
96+
end
97+
98+
hash[param] = _to_hash(value)
99+
end
100+
self.additional_properties.each_pair do |attr, value|
101+
hash[attr] = value
102+
end
103+
hash
104+
end
105+
106+
# Checks equality by comparing each attribute.
107+
# @param o [Object] Object to be compared
108+
# @!visibility private
109+
def ==(o)
110+
return true if self.equal?(o)
111+
self.class == o.class &&
112+
data == o.data &&
113+
additional_properties == o.additional_properties
114+
end
115+
116+
# Calculates hash code according to all attributes.
117+
# @return [Integer] Hash code
118+
# @!visibility private
119+
def hash
120+
[data, additional_properties].hash
121+
end
122+
end
123+
end

0 commit comments

Comments
 (0)