Skip to content

Commit cb79f27

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add BulkDeleteDatastoreItems to Datastore API spec (DataDog#2695)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent d619850 commit cb79f27

18 files changed

+940
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6553,6 +6553,46 @@ components:
65536553
description: The type of the object, must be `budget`.
65546554
type: string
65556555
type: object
6556+
BulkDeleteAppsDatastoreItemsRequest:
6557+
description: Request to delete items from a datastore.
6558+
properties:
6559+
data:
6560+
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestData'
6561+
type: object
6562+
BulkDeleteAppsDatastoreItemsRequestData:
6563+
description: Data wrapper containing the data needed to delete items from a
6564+
datastore.
6565+
properties:
6566+
attributes:
6567+
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestDataAttributes'
6568+
id:
6569+
description: ID for the datastore of the items to delete.
6570+
type: string
6571+
type:
6572+
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestDataType'
6573+
required:
6574+
- type
6575+
type: object
6576+
BulkDeleteAppsDatastoreItemsRequestDataAttributes:
6577+
description: Attributes of request data to delete items from a datastore.
6578+
properties:
6579+
item_keys:
6580+
description: List of primary keys identifying items to delete from datastore.
6581+
Up to 100 items can be deleted in a single request.
6582+
items:
6583+
type: string
6584+
maxItems: 100
6585+
type: array
6586+
type: object
6587+
BulkDeleteAppsDatastoreItemsRequestDataType:
6588+
default: items
6589+
description: Items resource type.
6590+
enum:
6591+
- items
6592+
example: items
6593+
type: string
6594+
x-enum-varnames:
6595+
- ITEMS
65566596
BulkMuteFindingsRequest:
65576597
description: The new bulk mute finding request.
65586598
properties:
@@ -14869,6 +14909,17 @@ components:
1486914909
data:
1487014910
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseData'
1487114911
type: object
14912+
DeleteAppsDatastoreItemResponseArray:
14913+
description: The definition of `DeleteAppsDatastoreItemResponseArray` object.
14914+
properties:
14915+
data:
14916+
description: The `DeleteAppsDatastoreItemResponseArray` `data`.
14917+
items:
14918+
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseData'
14919+
type: array
14920+
required:
14921+
- data
14922+
type: object
1487214923
DeleteAppsDatastoreItemResponseData:
1487314924
description: Data containing the identifier of the datastore item that was successfully
1487414925
deleted.
@@ -51257,6 +51308,57 @@ paths:
5125751308
permissions:
5125851309
- apps_datastore_write
5125951310
/api/v2/actions-datastores/{datastore_id}/items/bulk:
51311+
delete:
51312+
description: Deletes multiple items from a datastore by their keys in a single
51313+
operation.
51314+
operationId: BulkDeleteDatastoreItems
51315+
parameters:
51316+
- description: The ID of the datastore.
51317+
in: path
51318+
name: datastore_id
51319+
required: true
51320+
schema:
51321+
type: string
51322+
requestBody:
51323+
content:
51324+
application/json:
51325+
schema:
51326+
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequest'
51327+
required: true
51328+
responses:
51329+
'200':
51330+
content:
51331+
application/json:
51332+
schema:
51333+
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseArray'
51334+
description: OK
51335+
'400':
51336+
content:
51337+
application/json:
51338+
schema:
51339+
$ref: '#/components/schemas/JSONAPIErrorResponse'
51340+
description: Bad Request
51341+
'404':
51342+
content:
51343+
application/json:
51344+
schema:
51345+
$ref: '#/components/schemas/JSONAPIErrorResponse'
51346+
description: Not Found
51347+
'429':
51348+
$ref: '#/components/responses/TooManyRequestsResponse'
51349+
'500':
51350+
content:
51351+
application/json:
51352+
schema:
51353+
$ref: '#/components/schemas/JSONAPIErrorResponse'
51354+
description: Internal Server Error
51355+
summary: Bulk delete datastore items
51356+
tags:
51357+
- Actions Datastores
51358+
x-permission:
51359+
operator: OR
51360+
permissions:
51361+
- apps_datastore_write
5126051362
post:
5126151363
description: Creates or replaces multiple items in a datastore by their keys
5126251364
in a single operation.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-29T19:31:22.205Z

cassettes/features/v2/actions_datastores/Bulk-delete-datastore-items-returns-Bad-Request-response.yml

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-29T19:31:56.639Z

cassettes/features/v2/actions_datastores/Bulk-delete-datastore-items-returns-Not-Found-response.yml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-29T19:32:10.669Z

cassettes/features/v2/actions_datastores/Bulk-delete-datastore-items-returns-OK-response.yml

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Bulk delete datastore items returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::ActionsDatastoresAPI.new
5+
6+
# there is a valid "datastore" in the system
7+
DATASTORE_DATA_ID = ENV["DATASTORE_DATA_ID"]
8+
9+
body = DatadogAPIClient::V2::BulkDeleteAppsDatastoreItemsRequest.new({
10+
data: DatadogAPIClient::V2::BulkDeleteAppsDatastoreItemsRequestData.new({
11+
attributes: DatadogAPIClient::V2::BulkDeleteAppsDatastoreItemsRequestDataAttributes.new({
12+
item_keys: [
13+
"test-key",
14+
],
15+
}),
16+
type: DatadogAPIClient::V2::BulkDeleteAppsDatastoreItemsRequestDataType::ITEMS,
17+
}),
18+
})
19+
p api_instance.bulk_delete_datastore_items(DATASTORE_DATA_ID, body)

features/scenarios_model_mapping.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,10 @@
867867
"datastore_id" => "String",
868868
"body" => "UpdateAppsDatastoreItemRequest",
869869
},
870+
"v2.BulkDeleteDatastoreItems" => {
871+
"datastore_id" => "String",
872+
"body" => "BulkDeleteAppsDatastoreItemsRequest",
873+
},
870874
"v2.BulkWriteDatastoreItems" => {
871875
"datastore_id" => "String",
872876
"body" => "BulkPutAppsDatastoreItemsRequest",

features/v2/actions_datastores.feature

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,36 @@ Feature: Actions Datastores
44
datastores owned by your organization.
55

66
Background:
7-
Given an instance of "ActionsDatastores" API
8-
And a valid "apiKeyAuth" key in the system
7+
Given a valid "apiKeyAuth" key in the system
98
And a valid "appKeyAuth" key in the system
9+
And an instance of "ActionsDatastores" API
10+
11+
@team:DataDog/app-builder-backend
12+
Scenario: Bulk delete datastore items returns "Bad Request" response
13+
Given new "BulkDeleteDatastoreItems" request
14+
And there is a valid "datastore" in the system
15+
And request contains "datastore_id" parameter from "datastore.data.id"
16+
And body with value {"data": {"attributes": {"item_keys": []}, "type": "items"}}
17+
When the request is sent
18+
Then the response status is 400 Bad Request
19+
20+
@team:DataDog/app-builder-backend
21+
Scenario: Bulk delete datastore items returns "Not Found" response
22+
Given new "BulkDeleteDatastoreItems" request
23+
And request contains "datastore_id" parameter with value "c1eb5bb8-726a-4e59-9a61-ccbb26f95329"
24+
And body with value {"data": {"attributes": {"item_keys": ["nonexistent"]}, "type": "items"}}
25+
When the request is sent
26+
Then the response status is 404 Not Found
27+
28+
@skip-typescript @team:DataDog/app-builder-backend
29+
Scenario: Bulk delete datastore items returns "OK" response
30+
Given new "BulkDeleteDatastoreItems" request
31+
And there is a valid "datastore" in the system
32+
And there is a valid "datastore_item" in the system
33+
And request contains "datastore_id" parameter from "datastore.data.id"
34+
And body with value {"data": {"attributes": {"item_keys": ["test-key"]}, "type": "items"}}
35+
When the request is sent
36+
Then the response status is 200 OK
1037

1138
@team:DataDog/app-builder-backend
1239
Scenario: Bulk write datastore items returns "Bad Request" response

0 commit comments

Comments
 (0)