Skip to content

Commit 5c9d904

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Add delete log index to public API (#2273)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent faefe94 commit 5c9d904

File tree

7 files changed

+139
-4
lines changed

7 files changed

+139
-4
lines changed

.apigentools-info

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-03-06 18:30:10.435668",
8-
"spec_repo_commit": "fb234cde"
7+
"regenerated": "2025-03-06 19:05:43.111831",
8+
"spec_repo_commit": "b892dbfc"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-03-06 18:30:10.454101",
13-
"spec_repo_commit": "fb234cde"
12+
"regenerated": "2025-03-06 19:05:43.127161",
13+
"spec_repo_commit": "b892dbfc"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -28758,6 +28758,47 @@ paths:
2875828758
permissions:
2875928759
- logs_modify_indexes
2876028760
/api/v1/logs/config/indexes/{name}:
28761+
delete:
28762+
description: 'Delete an existing index from your organization. Index deletions
28763+
are permanent and cannot be reverted.
28764+
28765+
You cannot recreate an index with the same name as deleted ones.'
28766+
operationId: DeleteLogsIndex
28767+
parameters:
28768+
- description: Name of the log index.
28769+
in: path
28770+
name: name
28771+
required: true
28772+
schema:
28773+
type: string
28774+
responses:
28775+
'200':
28776+
content:
28777+
application/json:
28778+
schema:
28779+
$ref: '#/components/schemas/LogsIndex'
28780+
description: OK
28781+
'403':
28782+
content:
28783+
application/json:
28784+
schema:
28785+
$ref: '#/components/schemas/APIErrorResponse'
28786+
description: Forbidden
28787+
'404':
28788+
content:
28789+
application/json:
28790+
schema:
28791+
$ref: '#/components/schemas/LogsAPIErrorResponse'
28792+
description: Not Found
28793+
'429':
28794+
$ref: '#/components/responses/TooManyRequestsResponse'
28795+
summary: Delete an index
28796+
tags:
28797+
- Logs Indexes
28798+
x-permission:
28799+
operator: OR
28800+
permissions:
28801+
- logs_modify_indexes
2876128802
get:
2876228803
description: Get one log index from your organization. This endpoint takes no
2876328804
JSON arguments.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Delete an index returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::LogsIndexesAPI.new
5+
p api_instance.delete_logs_index("name")

features/scenarios_model_mapping.rb

+3
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@
500500
"v1.CreateLogsIndex" => {
501501
"body" => "LogsIndex",
502502
},
503+
"v1.DeleteLogsIndex" => {
504+
"name" => "String",
505+
},
503506
"v1.GetLogsIndex" => {
504507
"name" => "String",
505508
},

features/v1/logs_indexes.feature

+14
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ Feature: Logs Indexes
2222
When the request is sent
2323
Then the response status is 200 OK
2424

25+
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
26+
Scenario: Delete an index returns "Not Found" response
27+
Given new "DeleteLogsIndex" request
28+
And request contains "name" parameter from "REPLACE.ME"
29+
When the request is sent
30+
Then the response status is 404 Not Found
31+
32+
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
33+
Scenario: Delete an index returns "OK" response
34+
Given new "DeleteLogsIndex" request
35+
And request contains "name" parameter from "REPLACE.ME"
36+
When the request is sent
37+
Then the response status is 200 OK
38+
2539
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
2640
Scenario: Get all indexes returns "OK" response
2741
Given new "ListLogIndexes" request

features/v1/undo.json

+6
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,12 @@
694694
"type": "unsafe"
695695
}
696696
},
697+
"DeleteLogsIndex": {
698+
"tag": "Logs Indexes",
699+
"undo": {
700+
"type": "idempotent"
701+
}
702+
},
697703
"GetLogsIndex": {
698704
"tag": "Logs Indexes",
699705
"undo": {

lib/datadog_api_client/v1/api/logs_indexes_api.rb

+66
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,72 @@ def create_logs_index_with_http_info(body, opts = {})
9090
return data, status_code, headers
9191
end
9292

93+
# Delete an index.
94+
#
95+
# @see #delete_logs_index_with_http_info
96+
def delete_logs_index(name, opts = {})
97+
data, _status_code, _headers = delete_logs_index_with_http_info(name, opts)
98+
data
99+
end
100+
101+
# Delete an index.
102+
#
103+
# Delete an existing index from your organization. Index deletions are permanent and cannot be reverted.
104+
# You cannot recreate an index with the same name as deleted ones.
105+
#
106+
# @param name [String] Name of the log index.
107+
# @param opts [Hash] the optional parameters
108+
# @return [Array<(LogsIndex, Integer, Hash)>] LogsIndex data, response status code and response headers
109+
def delete_logs_index_with_http_info(name, opts = {})
110+
111+
if @api_client.config.debugging
112+
@api_client.config.logger.debug 'Calling API: LogsIndexesAPI.delete_logs_index ...'
113+
end
114+
# verify the required parameter 'name' is set
115+
if @api_client.config.client_side_validation && name.nil?
116+
fail ArgumentError, "Missing the required parameter 'name' when calling LogsIndexesAPI.delete_logs_index"
117+
end
118+
# resource path
119+
local_var_path = '/api/v1/logs/config/indexes/{name}'.sub('{name}', CGI.escape(name.to_s).gsub('%2F', '/'))
120+
121+
# query parameters
122+
query_params = opts[:query_params] || {}
123+
124+
# header parameters
125+
header_params = opts[:header_params] || {}
126+
# HTTP header 'Accept' (if needed)
127+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
128+
129+
# form parameters
130+
form_params = opts[:form_params] || {}
131+
132+
# http body (model)
133+
post_body = opts[:debug_body]
134+
135+
# return_type
136+
return_type = opts[:debug_return_type] || 'LogsIndex'
137+
138+
# auth_names
139+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
140+
141+
new_options = opts.merge(
142+
:operation => :delete_logs_index,
143+
:header_params => header_params,
144+
:query_params => query_params,
145+
:form_params => form_params,
146+
:body => post_body,
147+
:auth_names => auth_names,
148+
:return_type => return_type,
149+
:api_version => "V1"
150+
)
151+
152+
data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options)
153+
if @api_client.config.debugging
154+
@api_client.config.logger.debug "API called: LogsIndexesAPI#delete_logs_index\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155+
end
156+
return data, status_code, headers
157+
end
158+
93159
# Get an index.
94160
#
95161
# @see #get_logs_index_with_http_info

0 commit comments

Comments
 (0)