|
7 | 7 | import com.datadog.api.client.v2.model.DatasetCreateRequest; |
8 | 8 | import com.datadog.api.client.v2.model.DatasetResponseMulti; |
9 | 9 | import com.datadog.api.client.v2.model.DatasetResponseSingle; |
| 10 | +import com.datadog.api.client.v2.model.DatasetUpdateRequest; |
10 | 11 | import jakarta.ws.rs.client.Invocation; |
11 | 12 | import jakarta.ws.rs.core.GenericType; |
12 | 13 | import java.util.ArrayList; |
@@ -554,4 +555,161 @@ public CompletableFuture<ApiResponse<DatasetResponseSingle>> getDatasetWithHttpI |
554 | 555 | false, |
555 | 556 | new GenericType<DatasetResponseSingle>() {}); |
556 | 557 | } |
| 558 | + |
| 559 | + /** |
| 560 | + * Edit a dataset. |
| 561 | + * |
| 562 | + * <p>See {@link #updateDatasetWithHttpInfo}. |
| 563 | + * |
| 564 | + * @param datasetId The ID of a defined dataset. (required) |
| 565 | + * @param body Dataset payload (required) |
| 566 | + * @return DatasetResponseSingle |
| 567 | + * @throws ApiException if fails to make API call |
| 568 | + */ |
| 569 | + public DatasetResponseSingle updateDataset(String datasetId, DatasetUpdateRequest body) |
| 570 | + throws ApiException { |
| 571 | + return updateDatasetWithHttpInfo(datasetId, body).getData(); |
| 572 | + } |
| 573 | + |
| 574 | + /** |
| 575 | + * Edit a dataset. |
| 576 | + * |
| 577 | + * <p>See {@link #updateDatasetWithHttpInfoAsync}. |
| 578 | + * |
| 579 | + * @param datasetId The ID of a defined dataset. (required) |
| 580 | + * @param body Dataset payload (required) |
| 581 | + * @return CompletableFuture<DatasetResponseSingle> |
| 582 | + */ |
| 583 | + public CompletableFuture<DatasetResponseSingle> updateDatasetAsync( |
| 584 | + String datasetId, DatasetUpdateRequest body) { |
| 585 | + return updateDatasetWithHttpInfoAsync(datasetId, body) |
| 586 | + .thenApply( |
| 587 | + response -> { |
| 588 | + return response.getData(); |
| 589 | + }); |
| 590 | + } |
| 591 | + |
| 592 | + /** |
| 593 | + * Edits the dataset associated with the ID. |
| 594 | + * |
| 595 | + * @param datasetId The ID of a defined dataset. (required) |
| 596 | + * @param body Dataset payload (required) |
| 597 | + * @return ApiResponse<DatasetResponseSingle> |
| 598 | + * @throws ApiException if fails to make API call |
| 599 | + * @http.response.details |
| 600 | + * <table border="1"> |
| 601 | + * <caption>Response details</caption> |
| 602 | + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> |
| 603 | + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> |
| 604 | + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> |
| 605 | + * <tr><td> 403 </td><td> Not Authorized </td><td> - </td></tr> |
| 606 | + * <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> |
| 607 | + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> |
| 608 | + * </table> |
| 609 | + */ |
| 610 | + public ApiResponse<DatasetResponseSingle> updateDatasetWithHttpInfo( |
| 611 | + String datasetId, DatasetUpdateRequest body) throws ApiException { |
| 612 | + Object localVarPostBody = body; |
| 613 | + |
| 614 | + // verify the required parameter 'datasetId' is set |
| 615 | + if (datasetId == null) { |
| 616 | + throw new ApiException( |
| 617 | + 400, "Missing the required parameter 'datasetId' when calling updateDataset"); |
| 618 | + } |
| 619 | + |
| 620 | + // verify the required parameter 'body' is set |
| 621 | + if (body == null) { |
| 622 | + throw new ApiException( |
| 623 | + 400, "Missing the required parameter 'body' when calling updateDataset"); |
| 624 | + } |
| 625 | + // create path and map variables |
| 626 | + String localVarPath = |
| 627 | + "/api/v2/datasets/{dataset_id}" |
| 628 | + .replaceAll("\\{" + "dataset_id" + "\\}", apiClient.escapeString(datasetId.toString())); |
| 629 | + |
| 630 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 631 | + |
| 632 | + Invocation.Builder builder = |
| 633 | + apiClient.createBuilder( |
| 634 | + "v2.DatasetsApi.updateDataset", |
| 635 | + localVarPath, |
| 636 | + new ArrayList<Pair>(), |
| 637 | + localVarHeaderParams, |
| 638 | + new HashMap<String, String>(), |
| 639 | + new String[] {"application/json"}, |
| 640 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 641 | + return apiClient.invokeAPI( |
| 642 | + "PUT", |
| 643 | + builder, |
| 644 | + localVarHeaderParams, |
| 645 | + new String[] {"application/json"}, |
| 646 | + localVarPostBody, |
| 647 | + new HashMap<String, Object>(), |
| 648 | + false, |
| 649 | + new GenericType<DatasetResponseSingle>() {}); |
| 650 | + } |
| 651 | + |
| 652 | + /** |
| 653 | + * Edit a dataset. |
| 654 | + * |
| 655 | + * <p>See {@link #updateDatasetWithHttpInfo}. |
| 656 | + * |
| 657 | + * @param datasetId The ID of a defined dataset. (required) |
| 658 | + * @param body Dataset payload (required) |
| 659 | + * @return CompletableFuture<ApiResponse<DatasetResponseSingle>> |
| 660 | + */ |
| 661 | + public CompletableFuture<ApiResponse<DatasetResponseSingle>> updateDatasetWithHttpInfoAsync( |
| 662 | + String datasetId, DatasetUpdateRequest body) { |
| 663 | + Object localVarPostBody = body; |
| 664 | + |
| 665 | + // verify the required parameter 'datasetId' is set |
| 666 | + if (datasetId == null) { |
| 667 | + CompletableFuture<ApiResponse<DatasetResponseSingle>> result = new CompletableFuture<>(); |
| 668 | + result.completeExceptionally( |
| 669 | + new ApiException( |
| 670 | + 400, "Missing the required parameter 'datasetId' when calling updateDataset")); |
| 671 | + return result; |
| 672 | + } |
| 673 | + |
| 674 | + // verify the required parameter 'body' is set |
| 675 | + if (body == null) { |
| 676 | + CompletableFuture<ApiResponse<DatasetResponseSingle>> result = new CompletableFuture<>(); |
| 677 | + result.completeExceptionally( |
| 678 | + new ApiException( |
| 679 | + 400, "Missing the required parameter 'body' when calling updateDataset")); |
| 680 | + return result; |
| 681 | + } |
| 682 | + // create path and map variables |
| 683 | + String localVarPath = |
| 684 | + "/api/v2/datasets/{dataset_id}" |
| 685 | + .replaceAll("\\{" + "dataset_id" + "\\}", apiClient.escapeString(datasetId.toString())); |
| 686 | + |
| 687 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 688 | + |
| 689 | + Invocation.Builder builder; |
| 690 | + try { |
| 691 | + builder = |
| 692 | + apiClient.createBuilder( |
| 693 | + "v2.DatasetsApi.updateDataset", |
| 694 | + localVarPath, |
| 695 | + new ArrayList<Pair>(), |
| 696 | + localVarHeaderParams, |
| 697 | + new HashMap<String, String>(), |
| 698 | + new String[] {"application/json"}, |
| 699 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 700 | + } catch (ApiException ex) { |
| 701 | + CompletableFuture<ApiResponse<DatasetResponseSingle>> result = new CompletableFuture<>(); |
| 702 | + result.completeExceptionally(ex); |
| 703 | + return result; |
| 704 | + } |
| 705 | + return apiClient.invokeAPIAsync( |
| 706 | + "PUT", |
| 707 | + builder, |
| 708 | + localVarHeaderParams, |
| 709 | + new String[] {"application/json"}, |
| 710 | + localVarPostBody, |
| 711 | + new HashMap<String, Object>(), |
| 712 | + false, |
| 713 | + new GenericType<DatasetResponseSingle>() {}); |
| 714 | + } |
557 | 715 | } |
0 commit comments