|
5 | 5 | import com.datadog.api.client.ApiResponse; |
6 | 6 | import com.datadog.api.client.Pair; |
7 | 7 | import com.datadog.api.client.v2.model.DatasetCreateRequest; |
| 8 | +import com.datadog.api.client.v2.model.DatasetEditRequest; |
8 | 9 | import com.datadog.api.client.v2.model.DatasetResponseMulti; |
9 | 10 | import com.datadog.api.client.v2.model.DatasetResponseSingle; |
10 | 11 | import jakarta.ws.rs.client.Invocation; |
@@ -77,6 +78,25 @@ public CompletableFuture<DatasetResponseSingle> createDatasetAsync(DatasetCreate |
77 | 78 | /** |
78 | 79 | * Create a dataset with the configurations in the request. |
79 | 80 | * |
| 81 | + * <h3>Datasets Constraints</h3> |
| 82 | + * |
| 83 | + * <ul> |
| 84 | + * <li><strong>Tag Limit per Dataset</strong>: |
| 85 | + * <li> |
| 86 | + * <p>Each Restricted Dataset supports a maximum of 10 key:value pairs. |
| 87 | + * <li> |
| 88 | + * <p><strong>Tag Key Rules per Telemetry Type</strong>: |
| 89 | + * <li>Only one tag key or attribute may be used to define access within a single telemetry |
| 90 | + * type. |
| 91 | + * <li> |
| 92 | + * <p>The same or different tag key may be used across different telemetry types. |
| 93 | + * <li> |
| 94 | + * <p><strong>Tag Value Uniqueness</strong>: |
| 95 | + * <li>Tag values must be unique within a single dataset. |
| 96 | + * <li>A tag value used in one dataset cannot be reused in another dataset of the same telemetry |
| 97 | + * type. |
| 98 | + * </ul> |
| 99 | + * |
80 | 100 | * @param body Dataset payload (required) |
81 | 101 | * @return ApiResponse<DatasetResponseSingle> |
82 | 102 | * @throws ApiException if fails to make API call |
@@ -310,6 +330,180 @@ public CompletableFuture<ApiResponse<Void>> deleteDatasetWithHttpInfoAsync(Strin |
310 | 330 | null); |
311 | 331 | } |
312 | 332 |
|
| 333 | + /** |
| 334 | + * Edits a dataset. |
| 335 | + * |
| 336 | + * <p>See {@link #editDatasetWithHttpInfo}. |
| 337 | + * |
| 338 | + * @param datasetId The ID of a defined dataset. (required) |
| 339 | + * @param body Dataset payload (required) |
| 340 | + * @return DatasetResponseSingle |
| 341 | + * @throws ApiException if fails to make API call |
| 342 | + */ |
| 343 | + public DatasetResponseSingle editDataset(String datasetId, DatasetEditRequest body) |
| 344 | + throws ApiException { |
| 345 | + return editDatasetWithHttpInfo(datasetId, body).getData(); |
| 346 | + } |
| 347 | + |
| 348 | + /** |
| 349 | + * Edits a dataset. |
| 350 | + * |
| 351 | + * <p>See {@link #editDatasetWithHttpInfoAsync}. |
| 352 | + * |
| 353 | + * @param datasetId The ID of a defined dataset. (required) |
| 354 | + * @param body Dataset payload (required) |
| 355 | + * @return CompletableFuture<DatasetResponseSingle> |
| 356 | + */ |
| 357 | + public CompletableFuture<DatasetResponseSingle> editDatasetAsync( |
| 358 | + String datasetId, DatasetEditRequest body) { |
| 359 | + return editDatasetWithHttpInfoAsync(datasetId, body) |
| 360 | + .thenApply( |
| 361 | + response -> { |
| 362 | + return response.getData(); |
| 363 | + }); |
| 364 | + } |
| 365 | + |
| 366 | + /** |
| 367 | + * Edits the dataset associated with the ID. |
| 368 | + * |
| 369 | + * <h3>Datasets Constraints</h3> |
| 370 | + * |
| 371 | + * <ul> |
| 372 | + * <li><strong>Tag Limit per Dataset</strong>: |
| 373 | + * <li> |
| 374 | + * <p>Each Restricted Dataset supports a maximum of 10 key:value pairs. |
| 375 | + * <li> |
| 376 | + * <p><strong>Tag Key Rules per Telemetry Type</strong>: |
| 377 | + * <li>Only one tag key or attribute may be used to define access within a single telemetry |
| 378 | + * type. |
| 379 | + * <li> |
| 380 | + * <p>The same or different tag key may be used across different telemetry types. |
| 381 | + * <li> |
| 382 | + * <p><strong>Tag Value Uniqueness</strong>: |
| 383 | + * <li>Tag values must be unique within a single dataset. |
| 384 | + * <li>A tag value used in one dataset cannot be reused in another dataset of the same telemetry |
| 385 | + * type. |
| 386 | + * </ul> |
| 387 | + * |
| 388 | + * @param datasetId The ID of a defined dataset. (required) |
| 389 | + * @param body Dataset payload (required) |
| 390 | + * @return ApiResponse<DatasetResponseSingle> |
| 391 | + * @throws ApiException if fails to make API call |
| 392 | + * @http.response.details |
| 393 | + * <table border="1"> |
| 394 | + * <caption>Response details</caption> |
| 395 | + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> |
| 396 | + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> |
| 397 | + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> |
| 398 | + * <tr><td> 403 </td><td> Not Authorized </td><td> - </td></tr> |
| 399 | + * <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> |
| 400 | + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> |
| 401 | + * </table> |
| 402 | + */ |
| 403 | + public ApiResponse<DatasetResponseSingle> editDatasetWithHttpInfo( |
| 404 | + String datasetId, DatasetEditRequest body) throws ApiException { |
| 405 | + Object localVarPostBody = body; |
| 406 | + |
| 407 | + // verify the required parameter 'datasetId' is set |
| 408 | + if (datasetId == null) { |
| 409 | + throw new ApiException( |
| 410 | + 400, "Missing the required parameter 'datasetId' when calling editDataset"); |
| 411 | + } |
| 412 | + |
| 413 | + // verify the required parameter 'body' is set |
| 414 | + if (body == null) { |
| 415 | + throw new ApiException(400, "Missing the required parameter 'body' when calling editDataset"); |
| 416 | + } |
| 417 | + // create path and map variables |
| 418 | + String localVarPath = |
| 419 | + "/api/v2/datasets/{dataset_id}" |
| 420 | + .replaceAll("\\{" + "dataset_id" + "\\}", apiClient.escapeString(datasetId.toString())); |
| 421 | + |
| 422 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 423 | + |
| 424 | + Invocation.Builder builder = |
| 425 | + apiClient.createBuilder( |
| 426 | + "v2.DatasetsApi.editDataset", |
| 427 | + localVarPath, |
| 428 | + new ArrayList<Pair>(), |
| 429 | + localVarHeaderParams, |
| 430 | + new HashMap<String, String>(), |
| 431 | + new String[] {"application/json"}, |
| 432 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 433 | + return apiClient.invokeAPI( |
| 434 | + "PUT", |
| 435 | + builder, |
| 436 | + localVarHeaderParams, |
| 437 | + new String[] {"application/json"}, |
| 438 | + localVarPostBody, |
| 439 | + new HashMap<String, Object>(), |
| 440 | + false, |
| 441 | + new GenericType<DatasetResponseSingle>() {}); |
| 442 | + } |
| 443 | + |
| 444 | + /** |
| 445 | + * Edits a dataset. |
| 446 | + * |
| 447 | + * <p>See {@link #editDatasetWithHttpInfo}. |
| 448 | + * |
| 449 | + * @param datasetId The ID of a defined dataset. (required) |
| 450 | + * @param body Dataset payload (required) |
| 451 | + * @return CompletableFuture<ApiResponse<DatasetResponseSingle>> |
| 452 | + */ |
| 453 | + public CompletableFuture<ApiResponse<DatasetResponseSingle>> editDatasetWithHttpInfoAsync( |
| 454 | + String datasetId, DatasetEditRequest body) { |
| 455 | + Object localVarPostBody = body; |
| 456 | + |
| 457 | + // verify the required parameter 'datasetId' is set |
| 458 | + if (datasetId == null) { |
| 459 | + CompletableFuture<ApiResponse<DatasetResponseSingle>> result = new CompletableFuture<>(); |
| 460 | + result.completeExceptionally( |
| 461 | + new ApiException( |
| 462 | + 400, "Missing the required parameter 'datasetId' when calling editDataset")); |
| 463 | + return result; |
| 464 | + } |
| 465 | + |
| 466 | + // verify the required parameter 'body' is set |
| 467 | + if (body == null) { |
| 468 | + CompletableFuture<ApiResponse<DatasetResponseSingle>> result = new CompletableFuture<>(); |
| 469 | + result.completeExceptionally( |
| 470 | + new ApiException(400, "Missing the required parameter 'body' when calling editDataset")); |
| 471 | + return result; |
| 472 | + } |
| 473 | + // create path and map variables |
| 474 | + String localVarPath = |
| 475 | + "/api/v2/datasets/{dataset_id}" |
| 476 | + .replaceAll("\\{" + "dataset_id" + "\\}", apiClient.escapeString(datasetId.toString())); |
| 477 | + |
| 478 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 479 | + |
| 480 | + Invocation.Builder builder; |
| 481 | + try { |
| 482 | + builder = |
| 483 | + apiClient.createBuilder( |
| 484 | + "v2.DatasetsApi.editDataset", |
| 485 | + localVarPath, |
| 486 | + new ArrayList<Pair>(), |
| 487 | + localVarHeaderParams, |
| 488 | + new HashMap<String, String>(), |
| 489 | + new String[] {"application/json"}, |
| 490 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 491 | + } catch (ApiException ex) { |
| 492 | + CompletableFuture<ApiResponse<DatasetResponseSingle>> result = new CompletableFuture<>(); |
| 493 | + result.completeExceptionally(ex); |
| 494 | + return result; |
| 495 | + } |
| 496 | + return apiClient.invokeAPIAsync( |
| 497 | + "PUT", |
| 498 | + builder, |
| 499 | + localVarHeaderParams, |
| 500 | + new String[] {"application/json"}, |
| 501 | + localVarPostBody, |
| 502 | + new HashMap<String, Object>(), |
| 503 | + false, |
| 504 | + new GenericType<DatasetResponseSingle>() {}); |
| 505 | + } |
| 506 | + |
313 | 507 | /** |
314 | 508 | * Get all datasets. |
315 | 509 | * |
|
0 commit comments