diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3d27f6798ca..17509b56882 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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: @@ -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. @@ -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. diff --git a/examples/v2/actions-datastores/BulkDeleteDatastoreItems.java b/examples/v2/actions-datastores/BulkDeleteDatastoreItems.java new file mode 100644 index 00000000000..51bdc242436 --- /dev/null +++ b/examples/v2/actions-datastores/BulkDeleteDatastoreItems.java @@ -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(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/ActionsDatastoresApi.java b/src/main/java/com/datadog/api/client/v2/api/ActionsDatastoresApi.java index b4dbd96c55f..9d695696070 100644 --- a/src/main/java/com/datadog/api/client/v2/api/ActionsDatastoresApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/ActionsDatastoresApi.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ 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; @@ -55,6 +57,172 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Bulk delete datastore items. + * + *

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. + * + *

See {@link #bulkDeleteDatastoreItemsWithHttpInfoAsync}. + * + * @param datastoreId The ID of the datastore. (required) + * @param body (required) + * @return CompletableFuture<DeleteAppsDatastoreItemResponseArray> + */ + public CompletableFuture 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<DeleteAppsDatastoreItemResponseArray> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
500 Internal Server Error -
+ */ + public ApiResponse 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 localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ActionsDatastoresApi.bulkDeleteDatastoreItems", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Bulk delete datastore items. + * + *

See {@link #bulkDeleteDatastoreItemsWithHttpInfo}. + * + * @param datastoreId The ID of the datastore. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<DeleteAppsDatastoreItemResponseArray>> + */ + public CompletableFuture> + bulkDeleteDatastoreItemsWithHttpInfoAsync( + String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'datastoreId' is set + if (datastoreId == null) { + CompletableFuture> 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> 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 localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ActionsDatastoresApi.bulkDeleteDatastoreItems", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Bulk write datastore items. * diff --git a/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequest.java b/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequest.java new file mode 100644 index 00000000000..0598d44d289 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequest.java @@ -0,0 +1,138 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to delete items from a datastore. */ +@JsonPropertyOrder({BulkDeleteAppsDatastoreItemsRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BulkDeleteAppsDatastoreItemsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private BulkDeleteAppsDatastoreItemsRequestData data; + + public BulkDeleteAppsDatastoreItemsRequest data(BulkDeleteAppsDatastoreItemsRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data wrapper containing the data needed to delete items from a datastore. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BulkDeleteAppsDatastoreItemsRequestData getData() { + return data; + } + + public void setData(BulkDeleteAppsDatastoreItemsRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return BulkDeleteAppsDatastoreItemsRequest + */ + @JsonAnySetter + public BulkDeleteAppsDatastoreItemsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this BulkDeleteAppsDatastoreItemsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BulkDeleteAppsDatastoreItemsRequest bulkDeleteAppsDatastoreItemsRequest = + (BulkDeleteAppsDatastoreItemsRequest) o; + return Objects.equals(this.data, bulkDeleteAppsDatastoreItemsRequest.data) + && Objects.equals( + this.additionalProperties, bulkDeleteAppsDatastoreItemsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkDeleteAppsDatastoreItemsRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestData.java b/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestData.java new file mode 100644 index 00000000000..e7d18231eed --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestData.java @@ -0,0 +1,212 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data wrapper containing the data needed to delete items from a datastore. */ +@JsonPropertyOrder({ + BulkDeleteAppsDatastoreItemsRequestData.JSON_PROPERTY_ATTRIBUTES, + BulkDeleteAppsDatastoreItemsRequestData.JSON_PROPERTY_ID, + BulkDeleteAppsDatastoreItemsRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BulkDeleteAppsDatastoreItemsRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private BulkDeleteAppsDatastoreItemsRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private BulkDeleteAppsDatastoreItemsRequestDataType type = + BulkDeleteAppsDatastoreItemsRequestDataType.ITEMS; + + public BulkDeleteAppsDatastoreItemsRequestData() {} + + @JsonCreator + public BulkDeleteAppsDatastoreItemsRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + BulkDeleteAppsDatastoreItemsRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public BulkDeleteAppsDatastoreItemsRequestData attributes( + BulkDeleteAppsDatastoreItemsRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of request data to delete items from a datastore. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BulkDeleteAppsDatastoreItemsRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(BulkDeleteAppsDatastoreItemsRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public BulkDeleteAppsDatastoreItemsRequestData id(String id) { + this.id = id; + return this; + } + + /** + * ID for the datastore of the items to delete. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public BulkDeleteAppsDatastoreItemsRequestData type( + BulkDeleteAppsDatastoreItemsRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Items resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BulkDeleteAppsDatastoreItemsRequestDataType getType() { + return type; + } + + public void setType(BulkDeleteAppsDatastoreItemsRequestDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return BulkDeleteAppsDatastoreItemsRequestData + */ + @JsonAnySetter + public BulkDeleteAppsDatastoreItemsRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this BulkDeleteAppsDatastoreItemsRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BulkDeleteAppsDatastoreItemsRequestData bulkDeleteAppsDatastoreItemsRequestData = + (BulkDeleteAppsDatastoreItemsRequestData) o; + return Objects.equals(this.attributes, bulkDeleteAppsDatastoreItemsRequestData.attributes) + && Objects.equals(this.id, bulkDeleteAppsDatastoreItemsRequestData.id) + && Objects.equals(this.type, bulkDeleteAppsDatastoreItemsRequestData.type) + && Objects.equals( + this.additionalProperties, + bulkDeleteAppsDatastoreItemsRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkDeleteAppsDatastoreItemsRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestDataAttributes.java new file mode 100644 index 00000000000..aae536241b5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestDataAttributes.java @@ -0,0 +1,151 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of request data to delete items from a datastore. */ +@JsonPropertyOrder({BulkDeleteAppsDatastoreItemsRequestDataAttributes.JSON_PROPERTY_ITEM_KEYS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BulkDeleteAppsDatastoreItemsRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ITEM_KEYS = "item_keys"; + private List itemKeys = null; + + public BulkDeleteAppsDatastoreItemsRequestDataAttributes itemKeys(List itemKeys) { + this.itemKeys = itemKeys; + return this; + } + + public BulkDeleteAppsDatastoreItemsRequestDataAttributes addItemKeysItem(String itemKeysItem) { + if (this.itemKeys == null) { + this.itemKeys = new ArrayList<>(); + } + this.itemKeys.add(itemKeysItem); + return this; + } + + /** + * List of primary keys identifying items to delete from datastore. Up to 100 items can be deleted + * in a single request. + * + * @return itemKeys + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ITEM_KEYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getItemKeys() { + return itemKeys; + } + + public void setItemKeys(List itemKeys) { + this.itemKeys = itemKeys; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return BulkDeleteAppsDatastoreItemsRequestDataAttributes + */ + @JsonAnySetter + public BulkDeleteAppsDatastoreItemsRequestDataAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this BulkDeleteAppsDatastoreItemsRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BulkDeleteAppsDatastoreItemsRequestDataAttributes + bulkDeleteAppsDatastoreItemsRequestDataAttributes = + (BulkDeleteAppsDatastoreItemsRequestDataAttributes) o; + return Objects.equals(this.itemKeys, bulkDeleteAppsDatastoreItemsRequestDataAttributes.itemKeys) + && Objects.equals( + this.additionalProperties, + bulkDeleteAppsDatastoreItemsRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(itemKeys, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkDeleteAppsDatastoreItemsRequestDataAttributes {\n"); + sb.append(" itemKeys: ").append(toIndentedString(itemKeys)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestDataType.java new file mode 100644 index 00000000000..916a3780625 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BulkDeleteAppsDatastoreItemsRequestDataType.java @@ -0,0 +1,62 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Items resource type. */ +@JsonSerialize( + using = + BulkDeleteAppsDatastoreItemsRequestDataType + .BulkDeleteAppsDatastoreItemsRequestDataTypeSerializer.class) +public class BulkDeleteAppsDatastoreItemsRequestDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("items")); + + public static final BulkDeleteAppsDatastoreItemsRequestDataType ITEMS = + new BulkDeleteAppsDatastoreItemsRequestDataType("items"); + + BulkDeleteAppsDatastoreItemsRequestDataType(String value) { + super(value, allowedValues); + } + + public static class BulkDeleteAppsDatastoreItemsRequestDataTypeSerializer + extends StdSerializer { + public BulkDeleteAppsDatastoreItemsRequestDataTypeSerializer( + Class t) { + super(t); + } + + public BulkDeleteAppsDatastoreItemsRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + BulkDeleteAppsDatastoreItemsRequestDataType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static BulkDeleteAppsDatastoreItemsRequestDataType fromValue(String value) { + return new BulkDeleteAppsDatastoreItemsRequestDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DeleteAppsDatastoreItemResponseArray.java b/src/main/java/com/datadog/api/client/v2/model/DeleteAppsDatastoreItemResponseArray.java new file mode 100644 index 00000000000..3f4fdcdad87 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DeleteAppsDatastoreItemResponseArray.java @@ -0,0 +1,158 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The definition of DeleteAppsDatastoreItemResponseArray object. */ +@JsonPropertyOrder({DeleteAppsDatastoreItemResponseArray.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DeleteAppsDatastoreItemResponseArray { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public DeleteAppsDatastoreItemResponseArray() {} + + @JsonCreator + public DeleteAppsDatastoreItemResponseArray( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public DeleteAppsDatastoreItemResponseArray data(List data) { + this.data = data; + for (DeleteAppsDatastoreItemResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public DeleteAppsDatastoreItemResponseArray addDataItem( + DeleteAppsDatastoreItemResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The DeleteAppsDatastoreItemResponseArray data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return DeleteAppsDatastoreItemResponseArray + */ + @JsonAnySetter + public DeleteAppsDatastoreItemResponseArray putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this DeleteAppsDatastoreItemResponseArray object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteAppsDatastoreItemResponseArray deleteAppsDatastoreItemResponseArray = + (DeleteAppsDatastoreItemResponseArray) o; + return Objects.equals(this.data, deleteAppsDatastoreItemResponseArray.data) + && Objects.equals( + this.additionalProperties, deleteAppsDatastoreItemResponseArray.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteAppsDatastoreItemResponseArray {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..1a4af2a579c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-29T19:31:22.205Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Bad_Request_response.json new file mode 100644 index 00000000000..3e6caee50a0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Bad_Request_response.json @@ -0,0 +1,88 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"\",\"name\":\"Test Datastore\",\"org_access\":\"contributor\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"type\":\"datastores\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/actions-datastores", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"2b088869-d596-4103-9cff-038b5f81fc0c\",\"type\":\"datastores\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d31" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"item_keys\":[]},\"type\":\"items\"}}" + }, + "headers": {}, + "method": "DELETE", + "path": "/api/v2/actions-datastores/2b088869-d596-4103-9cff-038b5f81fc0c/items/bulk", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"id\":\"61325aff-aaa7-4571-80e2-e87ed8ffb103\",\"title\":\"missing required field\",\"detail\":\"at least one item key is required\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "250acdec-c02d-6e90-debb-4e7c003fc3d3" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/actions-datastores/2b088869-d596-4103-9cff-038b5f81fc0c", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"2b088869-d596-4103-9cff-038b5f81fc0c\",\"type\":\"datastores\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "510e9832-93e0-8107-932c-e07babeb6246" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..993c6b84a01 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-29T19:31:56.639Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Not_Found_response.json new file mode 100644 index 00000000000..5b83cac28f4 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"item_keys\":[\"nonexistent\"]},\"type\":\"items\"}}" + }, + "headers": {}, + "method": "DELETE", + "path": "/api/v2/actions-datastores/c1eb5bb8-726a-4e59-9a61-ccbb26f95329/items/bulk", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"id\":\"d53325f5-a7f3-4075-ace7-f8e22a25b72f\",\"title\":\"datastore not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "070d0045-b957-3b98-f361-16e1cdf72cf4" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_OK_response.freeze new file mode 100644 index 00000000000..21a63d0927a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-29T19:32:10.669Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_OK_response.json new file mode 100644 index 00000000000..b8c9cddb379 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Bulk_delete_datastore_items_returns_OK_response.json @@ -0,0 +1,118 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"\",\"name\":\"Test Datastore\",\"org_access\":\"contributor\",\"primary_column_name\":\"id\",\"primary_key_generation_strategy\":\"none\"},\"type\":\"datastores\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/actions-datastores", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"c6bc5eee-04af-4d7e-97a5-57c9c4dc0b15\",\"type\":\"datastores\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d2e" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"conflict_mode\":\"fail_on_conflict\",\"values\":[{\"data\":\"test-value\",\"id\":\"test-key\"}]},\"type\":\"items\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/actions-datastores/c6bc5eee-04af-4d7e-97a5-57c9c4dc0b15/items/bulk", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"8267c8c1-dfcd-4364-83e5-359c0ab302fc\",\"type\":\"items\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2a614ad6-00e1-ff3d-0750-22e3d3852d18" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"item_keys\":[\"test-key\"]},\"type\":\"items\"}}" + }, + "headers": {}, + "method": "DELETE", + "path": "/api/v2/actions-datastores/c6bc5eee-04af-4d7e-97a5-57c9c4dc0b15/items/bulk", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"8267c8c1-dfcd-4364-83e5-359c0ab302fc\",\"type\":\"items\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c67910b3-d90b-fdbc-1757-9bd9f2b28fda" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/actions-datastores/c6bc5eee-04af-4d7e-97a5-57c9c4dc0b15", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"c6bc5eee-04af-4d7e-97a5-57c9c4dc0b15\",\"type\":\"datastores\"}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "542bfff9-e7fc-bd10-3df4-3d492559ee8f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Bulk_write_datastore_items_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Bulk_write_datastore_items_returns_Bad_Request_response.json index d2aaa4405eb..65e125afa4a 100644 --- a/src/test/resources/cassettes/features/v2/Bulk_write_datastore_items_returns_Bad_Request_response.json +++ b/src/test/resources/cassettes/features/v2/Bulk_write_datastore_items_returns_Bad_Request_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d31" + "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d33" }, { "httpRequest": { diff --git a/src/test/resources/cassettes/features/v2/Bulk_write_datastore_items_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Bulk_write_datastore_items_returns_OK_response.json index b7e39e620cf..47d0ea88ae4 100644 --- a/src/test/resources/cassettes/features/v2/Bulk_write_datastore_items_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Bulk_write_datastore_items_returns_OK_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d2e" + "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d2f" }, { "httpRequest": { diff --git a/src/test/resources/cassettes/features/v2/Delete_datastore_item_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Delete_datastore_item_returns_OK_response.json index 322e59257d8..e1f6cfcce7c 100644 --- a/src/test/resources/cassettes/features/v2/Delete_datastore_item_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Delete_datastore_item_returns_OK_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d2f" + "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d30" }, { "httpRequest": { diff --git a/src/test/resources/cassettes/features/v2/Get_datastore_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_datastore_returns_OK_response.json index dd938880392..4aba2dd2af0 100644 --- a/src/test/resources/cassettes/features/v2/Get_datastore_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Get_datastore_returns_OK_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d33" + "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d35" }, { "httpRequest": { diff --git a/src/test/resources/cassettes/features/v2/List_datastore_items_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_datastore_items_returns_OK_response.json index ca6902dd772..1ec023c7a3f 100644 --- a/src/test/resources/cassettes/features/v2/List_datastore_items_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/List_datastore_items_returns_OK_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d32" + "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d34" }, { "httpRequest": { diff --git a/src/test/resources/cassettes/features/v2/Update_datastore_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_datastore_returns_OK_response.json index f1607018fa7..817c27a7388 100644 --- a/src/test/resources/cassettes/features/v2/Update_datastore_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Update_datastore_returns_OK_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d30" + "id": "6574cf7e-1c55-24e1-45d2-b92f9fa74d32" }, { "httpRequest": { diff --git a/src/test/resources/com/datadog/api/client/v2/api/actions_datastores.feature b/src/test/resources/com/datadog/api/client/v2/api/actions_datastores.feature index ed19da3aec2..a8cd02fe052 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/actions_datastores.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/actions_datastores.feature @@ -4,9 +4,36 @@ Feature: Actions Datastores datastores owned by your organization. Background: - Given an instance of "ActionsDatastores" API - And a valid "apiKeyAuth" key in the system + Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system + And an instance of "ActionsDatastores" API + + @team:DataDog/app-builder-backend + Scenario: Bulk delete datastore items returns "Bad Request" response + Given new "BulkDeleteDatastoreItems" request + And there is a valid "datastore" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + And body with value {"data": {"attributes": {"item_keys": []}, "type": "items"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Bulk delete datastore items returns "Not Found" response + Given new "BulkDeleteDatastoreItems" request + And request contains "datastore_id" parameter with value "c1eb5bb8-726a-4e59-9a61-ccbb26f95329" + And body with value {"data": {"attributes": {"item_keys": ["nonexistent"]}, "type": "items"}} + When the request is sent + Then the response status is 404 Not Found + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Bulk delete datastore items returns "OK" response + Given new "BulkDeleteDatastoreItems" request + And there is a valid "datastore" in the system + And there is a valid "datastore_item" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + And body with value {"data": {"attributes": {"item_keys": ["test-key"]}, "type": "items"}} + When the request is sent + Then the response status is 200 OK @team:DataDog/app-builder-backend Scenario: Bulk write datastore items returns "Bad Request" response diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 95d8a19dcbd..c4c269d3cab 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -54,6 +54,12 @@ "type": "idempotent" } }, + "BulkDeleteDatastoreItems": { + "tag": "Actions Datastores", + "undo": { + "type": "idempotent" + } + }, "BulkWriteDatastoreItems": { "tag": "Actions Datastores", "undo": {