Skip to content

Commit c9f63e7

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 318be36 of spec repo
1 parent 0056194 commit c9f63e7

22 files changed

Lines changed: 1315 additions & 8 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6557,6 +6557,46 @@ components:
65576557
description: The type of the object, must be `budget`.
65586558
type: string
65596559
type: object
6560+
BulkDeleteAppsDatastoreItemsRequest:
6561+
description: Request to delete items from a datastore.
6562+
properties:
6563+
data:
6564+
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestData'
6565+
type: object
6566+
BulkDeleteAppsDatastoreItemsRequestData:
6567+
description: Data wrapper containing the data needed to delete items from a
6568+
datastore.
6569+
properties:
6570+
attributes:
6571+
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestDataAttributes'
6572+
id:
6573+
description: ID for the datastore of the items to delete.
6574+
type: string
6575+
type:
6576+
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequestDataType'
6577+
required:
6578+
- type
6579+
type: object
6580+
BulkDeleteAppsDatastoreItemsRequestDataAttributes:
6581+
description: Attributes of request data to delete items from a datastore.
6582+
properties:
6583+
item_keys:
6584+
description: List of primary keys identifying items to delete from datastore.
6585+
Up to 100 items can be deleted in a single request.
6586+
items:
6587+
type: string
6588+
maxItems: 100
6589+
type: array
6590+
type: object
6591+
BulkDeleteAppsDatastoreItemsRequestDataType:
6592+
default: items
6593+
description: Items resource type.
6594+
enum:
6595+
- items
6596+
example: items
6597+
type: string
6598+
x-enum-varnames:
6599+
- ITEMS
65606600
BulkMuteFindingsRequest:
65616601
description: The new bulk mute finding request.
65626602
properties:
@@ -14889,6 +14929,17 @@ components:
1488914929
data:
1489014930
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseData'
1489114931
type: object
14932+
DeleteAppsDatastoreItemResponseArray:
14933+
description: The definition of `DeleteAppsDatastoreItemResponseArray` object.
14934+
properties:
14935+
data:
14936+
description: The `DeleteAppsDatastoreItemResponseArray` `data`.
14937+
items:
14938+
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseData'
14939+
type: array
14940+
required:
14941+
- data
14942+
type: object
1489214943
DeleteAppsDatastoreItemResponseData:
1489314944
description: Data containing the identifier of the datastore item that was successfully
1489414945
deleted.
@@ -51282,6 +51333,57 @@ paths:
5128251333
permissions:
5128351334
- apps_datastore_write
5128451335
/api/v2/actions-datastores/{datastore_id}/items/bulk:
51336+
delete:
51337+
description: Deletes multiple items from a datastore by their keys in a single
51338+
operation.
51339+
operationId: BulkDeleteDatastoreItems
51340+
parameters:
51341+
- description: The ID of the datastore.
51342+
in: path
51343+
name: datastore_id
51344+
required: true
51345+
schema:
51346+
type: string
51347+
requestBody:
51348+
content:
51349+
application/json:
51350+
schema:
51351+
$ref: '#/components/schemas/BulkDeleteAppsDatastoreItemsRequest'
51352+
required: true
51353+
responses:
51354+
'200':
51355+
content:
51356+
application/json:
51357+
schema:
51358+
$ref: '#/components/schemas/DeleteAppsDatastoreItemResponseArray'
51359+
description: OK
51360+
'400':
51361+
content:
51362+
application/json:
51363+
schema:
51364+
$ref: '#/components/schemas/JSONAPIErrorResponse'
51365+
description: Bad Request
51366+
'404':
51367+
content:
51368+
application/json:
51369+
schema:
51370+
$ref: '#/components/schemas/JSONAPIErrorResponse'
51371+
description: Not Found
51372+
'429':
51373+
$ref: '#/components/responses/TooManyRequestsResponse'
51374+
'500':
51375+
content:
51376+
application/json:
51377+
schema:
51378+
$ref: '#/components/schemas/JSONAPIErrorResponse'
51379+
description: Internal Server Error
51380+
summary: Bulk delete datastore items
51381+
tags:
51382+
- Actions Datastores
51383+
x-permission:
51384+
operator: OR
51385+
permissions:
51386+
- apps_datastore_write
5128551387
post:
5128651388
description: Creates or replaces multiple items in a datastore by their keys
5128751389
in a single operation.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Bulk delete datastore items returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.ActionsDatastoresApi;
6+
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequest;
7+
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequestData;
8+
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequestDataAttributes;
9+
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequestDataType;
10+
import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemResponseArray;
11+
import java.util.Collections;
12+
13+
public class Example {
14+
public static void main(String[] args) {
15+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
16+
ActionsDatastoresApi apiInstance = new ActionsDatastoresApi(defaultClient);
17+
18+
// there is a valid "datastore" in the system
19+
String DATASTORE_DATA_ID = System.getenv("DATASTORE_DATA_ID");
20+
21+
BulkDeleteAppsDatastoreItemsRequest body =
22+
new BulkDeleteAppsDatastoreItemsRequest()
23+
.data(
24+
new BulkDeleteAppsDatastoreItemsRequestData()
25+
.attributes(
26+
new BulkDeleteAppsDatastoreItemsRequestDataAttributes()
27+
.itemKeys(Collections.singletonList("test-key")))
28+
.type(BulkDeleteAppsDatastoreItemsRequestDataType.ITEMS));
29+
30+
try {
31+
DeleteAppsDatastoreItemResponseArray result =
32+
apiInstance.bulkDeleteDatastoreItems(DATASTORE_DATA_ID, body);
33+
System.out.println(result);
34+
} catch (ApiException e) {
35+
System.err.println("Exception when calling ActionsDatastoresApi#bulkDeleteDatastoreItems");
36+
System.err.println("Status code: " + e.getCode());
37+
System.err.println("Reason: " + e.getResponseBody());
38+
System.err.println("Response headers: " + e.getResponseHeaders());
39+
e.printStackTrace();
40+
}
41+
}
42+
}

src/main/java/com/datadog/api/client/v2/api/ActionsDatastoresApi.java

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.ApiResponse;
66
import com.datadog.api.client.Pair;
7+
import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequest;
78
import com.datadog.api.client.v2.model.BulkPutAppsDatastoreItemsRequest;
89
import com.datadog.api.client.v2.model.CreateAppsDatastoreRequest;
910
import com.datadog.api.client.v2.model.CreateAppsDatastoreResponse;
1011
import com.datadog.api.client.v2.model.Datastore;
1112
import com.datadog.api.client.v2.model.DatastoreArray;
1213
import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemRequest;
1314
import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemResponse;
15+
import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemResponseArray;
1416
import com.datadog.api.client.v2.model.ItemApiPayload;
1517
import com.datadog.api.client.v2.model.ItemApiPayloadArray;
1618
import com.datadog.api.client.v2.model.PutAppsDatastoreItemResponseArray;
@@ -55,6 +57,172 @@ public void setApiClient(ApiClient apiClient) {
5557
this.apiClient = apiClient;
5658
}
5759

60+
/**
61+
* Bulk delete datastore items.
62+
*
63+
* <p>See {@link #bulkDeleteDatastoreItemsWithHttpInfo}.
64+
*
65+
* @param datastoreId The ID of the datastore. (required)
66+
* @param body (required)
67+
* @return DeleteAppsDatastoreItemResponseArray
68+
* @throws ApiException if fails to make API call
69+
*/
70+
public DeleteAppsDatastoreItemResponseArray bulkDeleteDatastoreItems(
71+
String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) throws ApiException {
72+
return bulkDeleteDatastoreItemsWithHttpInfo(datastoreId, body).getData();
73+
}
74+
75+
/**
76+
* Bulk delete datastore items.
77+
*
78+
* <p>See {@link #bulkDeleteDatastoreItemsWithHttpInfoAsync}.
79+
*
80+
* @param datastoreId The ID of the datastore. (required)
81+
* @param body (required)
82+
* @return CompletableFuture&lt;DeleteAppsDatastoreItemResponseArray&gt;
83+
*/
84+
public CompletableFuture<DeleteAppsDatastoreItemResponseArray> bulkDeleteDatastoreItemsAsync(
85+
String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) {
86+
return bulkDeleteDatastoreItemsWithHttpInfoAsync(datastoreId, body)
87+
.thenApply(
88+
response -> {
89+
return response.getData();
90+
});
91+
}
92+
93+
/**
94+
* Deletes multiple items from a datastore by their keys in a single operation.
95+
*
96+
* @param datastoreId The ID of the datastore. (required)
97+
* @param body (required)
98+
* @return ApiResponse&lt;DeleteAppsDatastoreItemResponseArray&gt;
99+
* @throws ApiException if fails to make API call
100+
* @http.response.details
101+
* <table border="1">
102+
* <caption>Response details</caption>
103+
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
104+
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
105+
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
106+
* <tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
107+
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
108+
* <tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
109+
* </table>
110+
*/
111+
public ApiResponse<DeleteAppsDatastoreItemResponseArray> bulkDeleteDatastoreItemsWithHttpInfo(
112+
String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) throws ApiException {
113+
Object localVarPostBody = body;
114+
115+
// verify the required parameter 'datastoreId' is set
116+
if (datastoreId == null) {
117+
throw new ApiException(
118+
400,
119+
"Missing the required parameter 'datastoreId' when calling bulkDeleteDatastoreItems");
120+
}
121+
122+
// verify the required parameter 'body' is set
123+
if (body == null) {
124+
throw new ApiException(
125+
400, "Missing the required parameter 'body' when calling bulkDeleteDatastoreItems");
126+
}
127+
// create path and map variables
128+
String localVarPath =
129+
"/api/v2/actions-datastores/{datastore_id}/items/bulk"
130+
.replaceAll(
131+
"\\{" + "datastore_id" + "\\}", apiClient.escapeString(datastoreId.toString()));
132+
133+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
134+
135+
Invocation.Builder builder =
136+
apiClient.createBuilder(
137+
"v2.ActionsDatastoresApi.bulkDeleteDatastoreItems",
138+
localVarPath,
139+
new ArrayList<Pair>(),
140+
localVarHeaderParams,
141+
new HashMap<String, String>(),
142+
new String[] {"application/json"},
143+
new String[] {"apiKeyAuth", "appKeyAuth"});
144+
return apiClient.invokeAPI(
145+
"DELETE",
146+
builder,
147+
localVarHeaderParams,
148+
new String[] {"application/json"},
149+
localVarPostBody,
150+
new HashMap<String, Object>(),
151+
false,
152+
new GenericType<DeleteAppsDatastoreItemResponseArray>() {});
153+
}
154+
155+
/**
156+
* Bulk delete datastore items.
157+
*
158+
* <p>See {@link #bulkDeleteDatastoreItemsWithHttpInfo}.
159+
*
160+
* @param datastoreId The ID of the datastore. (required)
161+
* @param body (required)
162+
* @return CompletableFuture&lt;ApiResponse&lt;DeleteAppsDatastoreItemResponseArray&gt;&gt;
163+
*/
164+
public CompletableFuture<ApiResponse<DeleteAppsDatastoreItemResponseArray>>
165+
bulkDeleteDatastoreItemsWithHttpInfoAsync(
166+
String datastoreId, BulkDeleteAppsDatastoreItemsRequest body) {
167+
Object localVarPostBody = body;
168+
169+
// verify the required parameter 'datastoreId' is set
170+
if (datastoreId == null) {
171+
CompletableFuture<ApiResponse<DeleteAppsDatastoreItemResponseArray>> result =
172+
new CompletableFuture<>();
173+
result.completeExceptionally(
174+
new ApiException(
175+
400,
176+
"Missing the required parameter 'datastoreId' when calling"
177+
+ " bulkDeleteDatastoreItems"));
178+
return result;
179+
}
180+
181+
// verify the required parameter 'body' is set
182+
if (body == null) {
183+
CompletableFuture<ApiResponse<DeleteAppsDatastoreItemResponseArray>> result =
184+
new CompletableFuture<>();
185+
result.completeExceptionally(
186+
new ApiException(
187+
400, "Missing the required parameter 'body' when calling bulkDeleteDatastoreItems"));
188+
return result;
189+
}
190+
// create path and map variables
191+
String localVarPath =
192+
"/api/v2/actions-datastores/{datastore_id}/items/bulk"
193+
.replaceAll(
194+
"\\{" + "datastore_id" + "\\}", apiClient.escapeString(datastoreId.toString()));
195+
196+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
197+
198+
Invocation.Builder builder;
199+
try {
200+
builder =
201+
apiClient.createBuilder(
202+
"v2.ActionsDatastoresApi.bulkDeleteDatastoreItems",
203+
localVarPath,
204+
new ArrayList<Pair>(),
205+
localVarHeaderParams,
206+
new HashMap<String, String>(),
207+
new String[] {"application/json"},
208+
new String[] {"apiKeyAuth", "appKeyAuth"});
209+
} catch (ApiException ex) {
210+
CompletableFuture<ApiResponse<DeleteAppsDatastoreItemResponseArray>> result =
211+
new CompletableFuture<>();
212+
result.completeExceptionally(ex);
213+
return result;
214+
}
215+
return apiClient.invokeAPIAsync(
216+
"DELETE",
217+
builder,
218+
localVarHeaderParams,
219+
new String[] {"application/json"},
220+
localVarPostBody,
221+
new HashMap<String, Object>(),
222+
false,
223+
new GenericType<DeleteAppsDatastoreItemResponseArray>() {});
224+
}
225+
58226
/**
59227
* Bulk write datastore items.
60228
*

0 commit comments

Comments
 (0)