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
102 changes: 102 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6553,6 +6553,46 @@ components:
description: The type of the object, must be `budget`.
type: string
type: object
BulkDeleteAppsDatastoreItemsRequest:
description: Request to delete items from a datastore.
properties:
data:
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestData'
type: object
BulkDeleteAppsDatastoreItemsRequestData:
description: Data wrapper containing the data needed to delete items from a
datastore.
properties:
attributes:
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestDataAttributes'
id:
description: ID for the datastore of the items to delete.
type: string
type:
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestDataType'
required:
- type
type: object
BulkDeleteAppsDatastoreItemsRequestDataAttributes:
description: Attributes of request data to delete items from a datastore.
properties:
item_keys:
description: List of primary keys identifying items to delete from datastore.
Up to 100 items can be deleted in a single request.
items:
type: string
maxItems: 100
type: array
type: object
BulkDeleteAppsDatastoreItemsRequestDataType:
default: items
description: Items resource type.
enum:
- items
example: items
type: string
x-enum-varnames:
- ITEMS
BulkMuteFindingsRequest:
description: The new bulk mute finding request.
properties:
Expand Down Expand Up @@ -14869,6 +14909,17 @@ components:
data:
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseData'
type: object
DeleteAppsDatastoreItemResponseArray:
description: The definition of `DeleteAppsDatastoreItemResponseArray` object.
properties:
data:
description: The `DeleteAppsDatastoreItemResponseArray` `data`.
items:
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseData'
type: array
required:
- data
type: object
DeleteAppsDatastoreItemResponseData:
description: Data containing the identifier of the datastore item that was successfully
deleted.
Expand Down Expand Up @@ -51257,6 +51308,57 @@ paths:
permissions:
- apps_datastore_write
/api/v2/actions-datastores/{datastore_id}/items/bulk:
delete:
description: Deletes multiple items from a datastore by their keys in a single
operation.
operationId: BulkDeleteDatastoreItems
parameters:
- description: The ID of the datastore.
in: path
name: datastore_id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequest'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseArray'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: Bad Request
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: Not Found
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: Internal Server Error
summary: Bulk delete datastore items
tags:
- Actions Datastores
x-permission:
operator: OR
permissions:
- apps_datastore_write
post:
description: Creates or replaces multiple items in a datastore by their keys
in a single operation.
Expand Down
42 changes: 42 additions & 0 deletions examples/v2/actions-datastores/BulkDeleteDatastoreItems.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Bulk delete datastore items returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ActionsDatastoresApi;
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequest;
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequestData;
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequestDataAttributes;
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequestDataType;
import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemResponseArray;
import java.util.Collections;

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

// there is a valid "datastore" in the system
String DATASTORE_DATA_ID = System.getenv("DATASTORE_DATA_ID");

BulkDeleteAppsDatastoreItemsRequest body =
new BulkDeleteAppsDatastoreItemsRequest()
.data(
new BulkDeleteAppsDatastoreItemsRequestData()
.attributes(
new BulkDeleteAppsDatastoreItemsRequestDataAttributes()
.itemKeys(Collections.singletonList("test-key")))
.type(BulkDeleteAppsDatastoreItemsRequestDataType.ITEMS));

try {
DeleteAppsDatastoreItemResponseArray result =
apiInstance.bulkDeleteDatastoreItems(DATASTORE_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ActionsDatastoresApi#bulkDeleteDatastoreItems");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import com.datadog.api.client.ApiException;
import com.datadog.api.client.ApiResponse;
import com.datadog.api.client.Pair;
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequest;
import com.datadog.api.client.v2.model.BulkPutAppsDatastoreItemsRequest;
import com.datadog.api.client.v2.model.CreateAppsDatastoreRequest;
import com.datadog.api.client.v2.model.CreateAppsDatastoreResponse;
import com.datadog.api.client.v2.model.Datastore;
import com.datadog.api.client.v2.model.DatastoreArray;
import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemRequest;
import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemResponse;
import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemResponseArray;
import com.datadog.api.client.v2.model.ItemApiPayload;
import com.datadog.api.client.v2.model.ItemApiPayloadArray;
import com.datadog.api.client.v2.model.PutAppsDatastoreItemResponseArray;
Expand Down Expand Up @@ -55,6 +57,172 @@ public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}

/**
* Bulk delete datastore items.
*
* <p>See {@link #bulkDeleteDatastoreItemsWithHttpInfo}.
*
* @param datastoreId The ID of the datastore. (required)
* @param body (required)
* @return DeleteAppsDatastoreItemResponseArray
* @throws ApiException if fails to make API call
*/
public DeleteAppsDatastoreItemResponseArray bulkDeleteDatastoreItems(
String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) throws ApiException {
return bulkDeleteDatastoreItemsWithHttpInfo(datastoreId, body).getData();
}

/**
* Bulk delete datastore items.
*
* <p>See {@link #bulkDeleteDatastoreItemsWithHttpInfoAsync}.
*
* @param datastoreId The ID of the datastore. (required)
* @param body (required)
* @return CompletableFuture&lt;DeleteAppsDatastoreItemResponseArray&gt;
*/
public CompletableFuture<DeleteAppsDatastoreItemResponseArray> bulkDeleteDatastoreItemsAsync(
String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) {
return bulkDeleteDatastoreItemsWithHttpInfoAsync(datastoreId, body)
.thenApply(
response -> {
return response.getData();
});
}

/**
* Deletes multiple items from a datastore by their keys in a single operation.
*
* @param datastoreId The ID of the datastore. (required)
* @param body (required)
* @return ApiResponse&lt;DeleteAppsDatastoreItemResponseArray&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> 400 </td><td> Bad Request </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>
* <tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
* </table>
*/
public ApiResponse<DeleteAppsDatastoreItemResponseArray> bulkDeleteDatastoreItemsWithHttpInfo(
String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) throws ApiException {
Object localVarPostBody = body;

// verify the required parameter 'datastoreId' is set
if (datastoreId == null) {
throw new ApiException(
400,
"Missing the required parameter 'datastoreId' when calling bulkDeleteDatastoreItems");
}

// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(
400, "Missing the required parameter 'body' when calling bulkDeleteDatastoreItems");
}
// create path and map variables
String localVarPath =
"/api/v2/actions-datastores/{datastore_id}/items/bulk"
.replaceAll(
"\\{" + "datastore_id" + "\\}", apiClient.escapeString(datastoreId.toString()));

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

Invocation.Builder builder =
apiClient.createBuilder(
"v2.ActionsDatastoresApi.bulkDeleteDatastoreItems",
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[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<DeleteAppsDatastoreItemResponseArray>() {});
}

/**
* Bulk delete datastore items.
*
* <p>See {@link #bulkDeleteDatastoreItemsWithHttpInfo}.
*
* @param datastoreId The ID of the datastore. (required)
* @param body (required)
* @return CompletableFuture&lt;ApiResponse&lt;DeleteAppsDatastoreItemResponseArray&gt;&gt;
*/
public CompletableFuture<ApiResponse<DeleteAppsDatastoreItemResponseArray>>
bulkDeleteDatastoreItemsWithHttpInfoAsync(
String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) {
Object localVarPostBody = body;

// verify the required parameter 'datastoreId' is set
if (datastoreId == null) {
CompletableFuture<ApiResponse<DeleteAppsDatastoreItemResponseArray>> result =
new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400,
"Missing the required parameter 'datastoreId' when calling"
+ " bulkDeleteDatastoreItems"));
return result;
}

// verify the required parameter 'body' is set
if (body == null) {
CompletableFuture<ApiResponse<DeleteAppsDatastoreItemResponseArray>> result =
new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400, "Missing the required parameter 'body' when calling bulkDeleteDatastoreItems"));
return result;
}
// create path and map variables
String localVarPath =
"/api/v2/actions-datastores/{datastore_id}/items/bulk"
.replaceAll(
"\\{" + "datastore_id" + "\\}", apiClient.escapeString(datastoreId.toString()));

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

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

/**
* Bulk write datastore items.
*
Expand Down
Loading