Skip to content

Commit 1623dd5

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

File tree

6 files changed

+121
-4
lines changed

6 files changed

+121
-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:09.334459",
8-
"spec_repo_commit": "fb234cde"
7+
"regenerated": "2025-03-06 19:05:51.416503",
8+
"spec_repo_commit": "b892dbfc"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-03-06 18:30:09.350543",
13-
"spec_repo_commit": "fb234cde"
12+
"regenerated": "2025-03-06 19:05:51.625848",
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,15 @@
1+
"""
2+
Delete an index returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v1.api.logs_indexes_api import LogsIndexesApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = LogsIndexesApi(api_client)
11+
response = api_instance.delete_logs_index(
12+
name="name",
13+
)
14+
15+
print(response)

src/datadog_api_client/v1/api/logs_indexes_api.py

+41
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,29 @@ def __init__(self, api_client=None):
4343
api_client=api_client,
4444
)
4545

46+
self._delete_logs_index_endpoint = _Endpoint(
47+
settings={
48+
"response_type": (LogsIndex,),
49+
"auth": ["apiKeyAuth", "appKeyAuth"],
50+
"endpoint_path": "/api/v1/logs/config/indexes/{name}",
51+
"operation_id": "delete_logs_index",
52+
"http_method": "DELETE",
53+
"version": "v1",
54+
},
55+
params_map={
56+
"name": {
57+
"required": True,
58+
"openapi_types": (str,),
59+
"attribute": "name",
60+
"location": "path",
61+
},
62+
},
63+
headers_map={
64+
"accept": ["application/json"],
65+
},
66+
api_client=api_client,
67+
)
68+
4669
self._get_logs_index_endpoint = _Endpoint(
4770
settings={
4871
"response_type": (LogsIndex,),
@@ -161,6 +184,24 @@ def create_logs_index(
161184

162185
return self._create_logs_index_endpoint.call_with_http_info(**kwargs)
163186

187+
def delete_logs_index(
188+
self,
189+
name: str,
190+
) -> LogsIndex:
191+
"""Delete an index.
192+
193+
Delete an existing index from your organization. Index deletions are permanent and cannot be reverted.
194+
You cannot recreate an index with the same name as deleted ones.
195+
196+
:param name: Name of the log index.
197+
:type name: str
198+
:rtype: LogsIndex
199+
"""
200+
kwargs: Dict[str, Any] = {}
201+
kwargs["name"] = name
202+
203+
return self._delete_logs_index_endpoint.call_with_http_info(**kwargs)
204+
164205
def get_logs_index(
165206
self,
166207
name: str,

tests/v1/features/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

tests/v1/features/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": {

0 commit comments

Comments
 (0)