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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-03-06 18:30:07.423746",
"spec_repo_commit": "fb234cde"
"regenerated": "2025-03-06 19:05:52.226828",
"spec_repo_commit": "b892dbfc"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-03-06 18:30:07.439256",
"spec_repo_commit": "fb234cde"
"regenerated": "2025-03-06 19:05:52.242572",
"spec_repo_commit": "b892dbfc"
}
}
}
41 changes: 41 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28758,6 +28758,47 @@ paths:
permissions:
- logs_modify_indexes
/api/v1/logs/config/indexes/{name}:
delete:
description: 'Delete an existing index from your organization. Index deletions
are permanent and cannot be reverted.

You cannot recreate an index with the same name as deleted ones.'
operationId: DeleteLogsIndex
parameters:
- description: Name of the log index.
in: path
name: name
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/LogsIndex'
description: OK
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/LogsAPIErrorResponse'
description: Not Found
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Delete an index
tags:
- Logs Indexes
x-permission:
operator: OR
permissions:
- logs_modify_indexes
get:
description: Get one log index from your organization. This endpoint takes no
JSON arguments.
Expand Down
24 changes: 24 additions & 0 deletions examples/v1/logs-indexes/DeleteLogsIndex.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Delete an index returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsIndexesApi;
import com.datadog.api.client.v1.model.LogsIndex;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsIndexesApi apiInstance = new LogsIndexesApi(defaultClient);

try {
LogsIndex result = apiInstance.deleteLogsIndex("name");
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsIndexesApi#deleteLogsIndex");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
134 changes: 134 additions & 0 deletions src/main/java/com/datadog/api/client/v1/api/LogsIndexesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,140 @@ public CompletableFuture<ApiResponse<LogsIndex>> createLogsIndexWithHttpInfoAsyn
new GenericType<LogsIndex>() {});
}

/**
* Delete an index.
*
* <p>See {@link #deleteLogsIndexWithHttpInfo}.
*
* @param name Name of the log index. (required)
* @return LogsIndex
* @throws ApiException if fails to make API call
*/
public LogsIndex deleteLogsIndex(String name) throws ApiException {
return deleteLogsIndexWithHttpInfo(name).getData();
}

/**
* Delete an index.
*
* <p>See {@link #deleteLogsIndexWithHttpInfoAsync}.
*
* @param name Name of the log index. (required)
* @return CompletableFuture&lt;LogsIndex&gt;
*/
public CompletableFuture<LogsIndex> deleteLogsIndexAsync(String name) {
return deleteLogsIndexWithHttpInfoAsync(name)
.thenApply(
response -> {
return response.getData();
});
}

/**
* Delete an existing index from your organization. Index deletions are permanent and cannot be
* reverted. You cannot recreate an index with the same name as deleted ones.
*
* @param name Name of the log index. (required)
* @return ApiResponse&lt;LogsIndex&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
* <tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<LogsIndex> deleteLogsIndexWithHttpInfo(String name) throws ApiException {
Object localVarPostBody = null;

// verify the required parameter 'name' is set
if (name == null) {
throw new ApiException(
400, "Missing the required parameter 'name' when calling deleteLogsIndex");
}
// create path and map variables
String localVarPath =
"/api/v1/logs/config/indexes/{name}"
.replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString()));

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v1.LogsIndexesApi.deleteLogsIndex",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth"});
return apiClient.invokeAPI(
"DELETE",
builder,
localVarHeaderParams,
new String[] {},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<LogsIndex>() {});
}

/**
* Delete an index.
*
* <p>See {@link #deleteLogsIndexWithHttpInfo}.
*
* @param name Name of the log index. (required)
* @return CompletableFuture&lt;ApiResponse&lt;LogsIndex&gt;&gt;
*/
public CompletableFuture<ApiResponse<LogsIndex>> deleteLogsIndexWithHttpInfoAsync(String name) {
Object localVarPostBody = null;

// verify the required parameter 'name' is set
if (name == null) {
CompletableFuture<ApiResponse<LogsIndex>> result = new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400, "Missing the required parameter 'name' when calling deleteLogsIndex"));
return result;
}
// create path and map variables
String localVarPath =
"/api/v1/logs/config/indexes/{name}"
.replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString()));

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v1.LogsIndexesApi.deleteLogsIndex",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<LogsIndex>> result = new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"DELETE",
builder,
localVarHeaderParams,
new String[] {},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<LogsIndex>() {});
}

/**
* Get an index.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ Feature: Logs Indexes
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
Scenario: Delete an index returns "Not Found" response
Given new "DeleteLogsIndex" request
And request contains "name" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
Scenario: Delete an index returns "OK" response
Given new "DeleteLogsIndex" request
And request contains "name" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
Scenario: Get all indexes returns "OK" response
Given new "ListLogIndexes" request
Expand Down
6 changes: 6 additions & 0 deletions src/test/resources/com/datadog/api/client/v1/api/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,12 @@
"type": "unsafe"
}
},
"DeleteLogsIndex": {
"tag": "Logs Indexes",
"undo": {
"type": "idempotent"
}
},
"GetLogsIndex": {
"tag": "Logs Indexes",
"undo": {
Expand Down