|
4 | 4 | import com.datadog.api.client.ApiException;
|
5 | 5 | import com.datadog.api.client.ApiResponse;
|
6 | 6 | import com.datadog.api.client.Pair;
|
| 7 | +import com.datadog.api.client.v2.model.BulkDeleteAppsDatastoreItemsRequest; |
7 | 8 | import com.datadog.api.client.v2.model.BulkPutAppsDatastoreItemsRequest;
|
8 | 9 | import com.datadog.api.client.v2.model.CreateAppsDatastoreRequest;
|
9 | 10 | import com.datadog.api.client.v2.model.CreateAppsDatastoreResponse;
|
10 | 11 | import com.datadog.api.client.v2.model.Datastore;
|
11 | 12 | import com.datadog.api.client.v2.model.DatastoreArray;
|
12 | 13 | import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemRequest;
|
13 | 14 | import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemResponse;
|
| 15 | +import com.datadog.api.client.v2.model.DeleteAppsDatastoreItemResponseArray; |
14 | 16 | import com.datadog.api.client.v2.model.ItemApiPayload;
|
15 | 17 | import com.datadog.api.client.v2.model.ItemApiPayloadArray;
|
16 | 18 | import com.datadog.api.client.v2.model.PutAppsDatastoreItemResponseArray;
|
@@ -55,6 +57,172 @@ public void setApiClient(ApiClient apiClient) {
|
55 | 57 | this.apiClient = apiClient;
|
56 | 58 | }
|
57 | 59 |
|
| 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<DeleteAppsDatastoreItemResponseArray> |
| 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<DeleteAppsDatastoreItemResponseArray> |
| 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<ApiResponse<DeleteAppsDatastoreItemResponseArray>> |
| 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 | + |
58 | 226 | /**
|
59 | 227 | * Bulk write datastore items.
|
60 | 228 | *
|
|
0 commit comments