From 0cddb685cc13a7d9ed7eb58c1c9b0c7f2b91308e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 6 Sep 2023 11:52:55 +0000 Subject: [PATCH] Regenerate client from commit c59cafad of spec repo --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 19 ++++ .../dashboards/ListDashboards_1062671515.java | 28 ++++++ .../api/client/v1/api/DashboardsApi.java | 88 +++++++++++++++++++ ...returns_OK_response_with_pagination.freeze | 1 + ...s_returns_OK_response_with_pagination.json | 67 ++++++++++++++ .../api/client/v1/api/dashboards.feature | 8 ++ 7 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 examples/v1/dashboards/ListDashboards_1062671515.java create mode 100644 src/test/resources/cassettes/features/v1/Get_all_dashboards_returns_OK_response_with_pagination.freeze create mode 100644 src/test/resources/cassettes/features/v1/Get_all_dashboards_returns_OK_response_with_pagination.json diff --git a/.apigentools-info b/.apigentools-info index 43b8d6d8e16..e245121c14f 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.5", - "regenerated": "2023-09-05 15:12:57.606752", - "spec_repo_commit": "eb534d74" + "regenerated": "2023-09-06 11:51:22.537852", + "spec_repo_commit": "c59cafad" }, "v2": { "apigentools_version": "1.6.5", - "regenerated": "2023-09-05 15:12:57.623557", - "spec_repo_commit": "eb534d74" + "regenerated": "2023-09-06 11:51:22.551228", + "spec_repo_commit": "c59cafad" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 3276b321afa..495f32939eb 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -20836,6 +20836,21 @@ paths: required: false schema: type: boolean + - description: The maximum number of dashboards returned in the list. + in: query + name: count + required: false + schema: + default: 100 + format: int64 + type: integer + - description: The specific offset to use as the beginning of the returned response. + in: query + name: start + required: false + schema: + format: int64 + type: integer responses: '200': content: @@ -20859,6 +20874,10 @@ paths: summary: Get all dashboards tags: - Dashboards + x-pagination: + limitParam: count + pageOffsetParam: start + resultsPath: dashboards patch: description: Restore dashboards using the specified IDs. If there are any failures, no dashboards will be restored (partial success is not allowed). diff --git a/examples/v1/dashboards/ListDashboards_1062671515.java b/examples/v1/dashboards/ListDashboards_1062671515.java new file mode 100644 index 00000000000..7ef32a80a2b --- /dev/null +++ b/examples/v1/dashboards/ListDashboards_1062671515.java @@ -0,0 +1,28 @@ +// Get all dashboards returns "OK" response with pagination + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.PaginationIterable; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.api.DashboardsApi.ListDashboardsOptionalParameters; +import com.datadog.api.client.v1.model.DashboardSummaryDefinition; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + try { + PaginationIterable iterable = + apiInstance.listDashboardsWithPagination( + new ListDashboardsOptionalParameters().count(2L)); + + for (DashboardSummaryDefinition item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println("Exception when calling DashboardsApi#listDashboardsWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v1/api/DashboardsApi.java b/src/main/java/com/datadog/api/client/v1/api/DashboardsApi.java index ab88d940d07..bd4c4fab4f4 100644 --- a/src/main/java/com/datadog/api/client/v1/api/DashboardsApi.java +++ b/src/main/java/com/datadog/api/client/v1/api/DashboardsApi.java @@ -3,12 +3,14 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.PaginationIterable; import com.datadog.api.client.Pair; import com.datadog.api.client.v1.model.Dashboard; import com.datadog.api.client.v1.model.DashboardBulkDeleteRequest; import com.datadog.api.client.v1.model.DashboardDeleteResponse; import com.datadog.api.client.v1.model.DashboardRestoreRequest; import com.datadog.api.client.v1.model.DashboardSummary; +import com.datadog.api.client.v1.model.DashboardSummaryDefinition; import com.datadog.api.client.v1.model.DeleteSharedDashboardResponse; import com.datadog.api.client.v1.model.SharedDashboard; import com.datadog.api.client.v1.model.SharedDashboardInvites; @@ -17,6 +19,7 @@ import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -1384,6 +1387,8 @@ public ApiResponse getPublicDashboardInvitationsWithHttp public static class ListDashboardsOptionalParameters { private Boolean filterShared; private Boolean filterDeleted; + private Long count; + private Long start; /** * Set filterShared. @@ -1409,6 +1414,29 @@ public ListDashboardsOptionalParameters filterDeleted(Boolean filterDeleted) { this.filterDeleted = filterDeleted; return this; } + + /** + * Set count. + * + * @param count The maximum number of dashboards returned in the list. (optional, default to + * 100) + * @return ListDashboardsOptionalParameters + */ + public ListDashboardsOptionalParameters count(Long count) { + this.count = count; + return this; + } + + /** + * Set start. + * + * @param start The specific offset to use as the beginning of the returned response. (optional) + * @return ListDashboardsOptionalParameters + */ + public ListDashboardsOptionalParameters start(Long start) { + this.start = start; + return this; + } } /** @@ -1469,6 +1497,58 @@ public CompletableFuture listDashboardsAsync( }); } + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfo}. + * + * @return PaginationIterable<DashboardSummaryDefinition> + */ + public PaginationIterable listDashboardsWithPagination() { + ListDashboardsOptionalParameters parameters = new ListDashboardsOptionalParameters(); + return listDashboardsWithPagination(parameters); + } + + /** + * Get all dashboards. + * + *

See {@link #listDashboardsWithHttpInfo}. + * + * @return DashboardSummary + */ + public PaginationIterable listDashboardsWithPagination( + ListDashboardsOptionalParameters parameters) { + String resultsPath = "getDashboards"; + String valueGetterPath = ""; + String valueSetterPath = "start"; + Boolean valueSetterParamOptional = true; + Long limit; + + if (parameters.count == null) { + limit = 100l; + parameters.count(limit); + } else { + limit = parameters.count; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listDashboards", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + true, + limit, + args); + + return iterator; + } + /** * Get all dashboards. * @@ -1492,6 +1572,8 @@ public ApiResponse listDashboardsWithHttpInfo( Object localVarPostBody = null; Boolean filterShared = parameters.filterShared; Boolean filterDeleted = parameters.filterDeleted; + Long count = parameters.count; + Long start = parameters.start; // create path and map variables String localVarPath = "/api/v1/dashboard"; @@ -1500,6 +1582,8 @@ public ApiResponse listDashboardsWithHttpInfo( localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[shared]", filterShared)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[deleted]", filterDeleted)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", count)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start", start)); Invocation.Builder builder = apiClient.createBuilder( @@ -1534,6 +1618,8 @@ public CompletableFuture> listDashboardsWithHttpIn Object localVarPostBody = null; Boolean filterShared = parameters.filterShared; Boolean filterDeleted = parameters.filterDeleted; + Long count = parameters.count; + Long start = parameters.start; // create path and map variables String localVarPath = "/api/v1/dashboard"; @@ -1542,6 +1628,8 @@ public CompletableFuture> listDashboardsWithHttpIn localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[shared]", filterShared)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[deleted]", filterDeleted)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", count)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start", start)); Invocation.Builder builder; try { diff --git a/src/test/resources/cassettes/features/v1/Get_all_dashboards_returns_OK_response_with_pagination.freeze b/src/test/resources/cassettes/features/v1/Get_all_dashboards_returns_OK_response_with_pagination.freeze new file mode 100644 index 00000000000..180059c6b3d --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_all_dashboards_returns_OK_response_with_pagination.freeze @@ -0,0 +1 @@ +2023-09-04T12:26:51.389Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Get_all_dashboards_returns_OK_response_with_pagination.json b/src/test/resources/cassettes/features/v1/Get_all_dashboards_returns_OK_response_with_pagination.json new file mode 100644 index 00000000000..8367067ae31 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_all_dashboards_returns_OK_response_with_pagination.json @@ -0,0 +1,67 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v1/dashboard", + "queryStringParameters": { + "count": [ + "2" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"dashboards\":[{\"id\":\"5vp-fxm-s4j\",\"title\":\"PCF Testing\",\"description\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/5vp-fxm-s4j/pcf-testing\",\"is_read_only\":false,\"created_at\":\"2022-06-08T10:40:29.941695+00:00\",\"modified_at\":\"2023-07-27T12:26:28.359080+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"deleted_at\":null},{\"id\":\"ubf-m9i-gms\",\"title\":\"OpenStack Controller Overview\",\"description\":\"## OpenStack Controller - Overview\\n\\nPreset dashboard for the OpenStack Controller integration. Used for OpenStack deployments v13 and higher. \\n\\n[See integration docs for more details](https://docs.datadoghq.com/integrations/openstack_controller/)\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/ubf-m9i-gms/openstack-controller-overview\",\"is_read_only\":false,\"created_at\":\"2023-04-28T19:16:35.964720+00:00\",\"modified_at\":\"2023-08-07T13:53:31.924789+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"deleted_at\":null}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b29213e7-8fb8-044d-a793-bea81fe4dd28" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v1/dashboard", + "queryStringParameters": { + "count": [ + "2" + ], + "start": [ + "2" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"dashboards\":[{\"id\":\"ja7-nhx-7zs\",\"title\":\"OpenStack Controller Overview [Default Microversion]\",\"description\":\"## OpenStack Controller - Overview\\n\\nPreset dashboard for the OpenStack Controller integration. Used for OpenStack deployments v13 and higher. \\n\\n[See integration docs for more details](https://docs.datadoghq.com/integrations/openstack_controller/)\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/ja7-nhx-7zs/openstack-controller-overview-default-microversion\",\"is_read_only\":false,\"created_at\":\"2023-08-29T19:56:15.999851+00:00\",\"modified_at\":\"2023-08-29T20:12:33.385536+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"deleted_at\":null}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "40e70edf-61ee-192e-4735-474683db8943" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature b/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature index f5899bf931f..89f45dbe1f9 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature @@ -874,6 +874,14 @@ Feature: Dashboards And the response "dashboards[0].title" has the same value as "dashboard.title" And the response "dashboards[0].id" has the same value as "dashboard.id" + @replay-only @skip-validation @team:DataDog/dashboards-backend @with-pagination + Scenario: Get all dashboards returns "OK" response with pagination + Given new "ListDashboards" request + And request contains "count" parameter with value 2 + When the request with pagination is sent + Then the response status is 200 OK + And the response has 3 items + @generated @skip @team:DataDog/dashboards-backend Scenario: Get all invitations for a shared dashboard returns "Not Found" response Given new "GetPublicDashboardInvitations" request