From 9528535bdf8a8c0b08c44f6091fdabcea32eba39 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 4 Sep 2023 09:08:18 +0000 Subject: [PATCH] Regenerate client from commit a5115137 of spec repo --- .apigentools-info | 8 +-- .generator/schemas/v1/openapi.yaml | 5 ++ .../v1/notebooks/ListNotebooks_788665428.java | 27 ++++++++ .../api/client/v1/api/NotebooksApi.java | 57 +++++++++++++++- ...returns_OK_response_with_pagination.freeze | 1 + ...s_returns_OK_response_with_pagination.json | 67 +++++++++++++++++++ .../api/client/v1/api/notebooks.feature | 8 +++ 7 files changed, 168 insertions(+), 5 deletions(-) create mode 100644 examples/v1/notebooks/ListNotebooks_788665428.java create mode 100644 src/test/resources/cassettes/features/v1/Get_all_notebooks_returns_OK_response_with_pagination.freeze create mode 100644 src/test/resources/cassettes/features/v1/Get_all_notebooks_returns_OK_response_with_pagination.json diff --git a/.apigentools-info b/.apigentools-info index 116ab1911a6..ec1f8799642 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.5", - "regenerated": "2023-09-01 14:18:50.029978", - "spec_repo_commit": "fd65b2e4" + "regenerated": "2023-09-04 09:06:23.298237", + "spec_repo_commit": "a5115137" }, "v2": { "apigentools_version": "1.6.5", - "regenerated": "2023-09-01 14:18:50.048484", - "spec_repo_commit": "fd65b2e4" + "regenerated": "2023-09-04 09:06:23.315039", + "spec_repo_commit": "a5115137" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index a9b1608d777..3276b321afa 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -26095,6 +26095,7 @@ paths: name: count required: false schema: + default: 100 example: 5 format: int64 type: integer @@ -26179,6 +26180,10 @@ paths: summary: Get all notebooks tags: - Notebooks + x-pagination: + limitParam: count + pageOffsetParam: start + resultsPath: data post: description: Create a notebook using the specified options. operationId: CreateNotebook diff --git a/examples/v1/notebooks/ListNotebooks_788665428.java b/examples/v1/notebooks/ListNotebooks_788665428.java new file mode 100644 index 00000000000..3a45cd3d7e7 --- /dev/null +++ b/examples/v1/notebooks/ListNotebooks_788665428.java @@ -0,0 +1,27 @@ +// Get all notebooks returns "OK" response with pagination + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.PaginationIterable; +import com.datadog.api.client.v1.api.NotebooksApi; +import com.datadog.api.client.v1.api.NotebooksApi.ListNotebooksOptionalParameters; +import com.datadog.api.client.v1.model.NotebooksResponseData; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + NotebooksApi apiInstance = new NotebooksApi(defaultClient); + + try { + PaginationIterable iterable = + apiInstance.listNotebooksWithPagination(new ListNotebooksOptionalParameters().count(2L)); + + for (NotebooksResponseData item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println("Exception when calling NotebooksApi#listNotebooksWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v1/api/NotebooksApi.java b/src/main/java/com/datadog/api/client/v1/api/NotebooksApi.java index ae4942f9c13..69f68c40a03 100644 --- a/src/main/java/com/datadog/api/client/v1/api/NotebooksApi.java +++ b/src/main/java/com/datadog/api/client/v1/api/NotebooksApi.java @@ -3,15 +3,18 @@ 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.NotebookCreateRequest; import com.datadog.api.client.v1.model.NotebookResponse; import com.datadog.api.client.v1.model.NotebookUpdateRequest; import com.datadog.api.client.v1.model.NotebooksResponse; +import com.datadog.api.client.v1.model.NotebooksResponseData; import jakarta.ws.rs.client.Invocation; 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; @@ -502,7 +505,7 @@ public ListNotebooksOptionalParameters start(Long start) { /** * Set count. * - * @param count The number of notebooks to be returned. (optional) + * @param count The number of notebooks to be returned. (optional, default to 100) * @return ListNotebooksOptionalParameters */ public ListNotebooksOptionalParameters count(Long count) { @@ -641,6 +644,58 @@ public CompletableFuture listNotebooksAsync( }); } + /** + * Get all notebooks. + * + *

See {@link #listNotebooksWithHttpInfo}. + * + * @return PaginationIterable<NotebooksResponseData> + */ + public PaginationIterable listNotebooksWithPagination() { + ListNotebooksOptionalParameters parameters = new ListNotebooksOptionalParameters(); + return listNotebooksWithPagination(parameters); + } + + /** + * Get all notebooks. + * + *

See {@link #listNotebooksWithHttpInfo}. + * + * @return NotebooksResponse + */ + public PaginationIterable listNotebooksWithPagination( + ListNotebooksOptionalParameters parameters) { + String resultsPath = "getData"; + 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, + "listNotebooks", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + true, + limit, + args); + + return iterator; + } + /** * Get all notebooks. This can also be used to search for notebooks with a particular query * in the notebook name or author handle. diff --git a/src/test/resources/cassettes/features/v1/Get_all_notebooks_returns_OK_response_with_pagination.freeze b/src/test/resources/cassettes/features/v1/Get_all_notebooks_returns_OK_response_with_pagination.freeze new file mode 100644 index 00000000000..d20fdf2517f --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_all_notebooks_returns_OK_response_with_pagination.freeze @@ -0,0 +1 @@ +2023-08-31T09:47:14.068Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Get_all_notebooks_returns_OK_response_with_pagination.json b/src/test/resources/cassettes/features/v1/Get_all_notebooks_returns_OK_response_with_pagination.json new file mode 100644 index 00000000000..2a4e13f4cb3 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_all_notebooks_returns_OK_response_with_pagination.json @@ -0,0 +1,67 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v1/notebooks", + "queryStringParameters": { + "count": [ + "2" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"type\":\"notebooks\",\"id\":4758632,\"attributes\":{\"name\":\"PCF Container Usage Attribution\",\"cells\":[{\"type\":\"notebook_cells\",\"id\":\"jod8dstf\",\"attributes\":{\"split_by\":{\"tags\":[],\"keys\":[]},\"definition\":{\"title\":\"Count of containers\",\"type\":\"query_table\",\"requests\":[{\"response_format\":\"scalar\",\"formulas\":[{\"alias\":\"containers\",\"formula\":\"query1\",\"limit\":{\"count\":10000,\"order\":\"desc\"}}],\"queries\":[{\"name\":\"query1\",\"data_source\":\"metrics\",\"query\":\"avg:cloudfoundry.nozzle.app.instances{$container_deployement_guid,$troux_uuid} by {app_name,bosh_id}\",\"aggregator\":\"avg\"}]}]},\"graph_size\":\"m\",\"time\":null}},{\"type\":\"notebook_cells\",\"id\":\"0t3xetbt\",\"attributes\":{\"definition\":{\"type\":\"markdown\",\"text\":\"This displays the count of containers per `troux_uuid` (`bosh_id`) and `container_deployment_guid` (`app_name`)\"}}},{\"type\":\"notebook_cells\",\"id\":\"7lxv9snf\",\"attributes\":{\"definition\":{\"title\":\"Percentage breakdown of containers on VMs\",\"requests\":[{\"response_format\":\"scalar\",\"formulas\":[{\"formula\":\"query1\",\"limit\":{\"order\":\"desc\"}}],\"queries\":[{\"query\":\"avg:cloudfoundry.nozzle.app.instances{$troux_uuid,$container_deployement_guid} by {app_name,bosh_id}.rollup(avg, 3600)\",\"data_source\":\"metrics\",\"name\":\"query1\",\"aggregator\":\"sum\"}],\"style\":{\"palette\":\"datadog16\"}}],\"type\":\"sunburst\",\"legend\":{\"type\":\"automatic\"}},\"time\":null}},{\"type\":\"notebook_cells\",\"id\":\"uhwq9m18\",\"attributes\":{\"definition\":{\"type\":\"markdown\",\"text\":\"This displays the count of containers per\\u00a0`troux_uuid` (`bosh_id`)\\u00a0and\\u00a0`container_deployment_guid` (`app_name`) as percentages of total containers\\n\"}}},{\"type\":\"notebook_cells\",\"id\":\"fcid5x88\",\"attributes\":{\"split_by\":{\"tags\":[],\"keys\":[]},\"definition\":{\"title\":\"Number of VMs per container_deployment_guid\",\"type\":\"query_value\",\"requests\":[{\"response_format\":\"scalar\",\"queries\":[{\"name\":\"query1\",\"data_source\":\"metrics\",\"query\":\"avg:cloudfoundry.nozzle.app.instances{$troux_uuid,$container_deployement_guid}\",\"aggregator\":\"avg\"}],\"formulas\":[{\"formula\":\"count_nonzero(query1)\",\"alias\":\"VMs\"}]}],\"autoscale\":true,\"precision\":2},\"graph_size\":\"xs\",\"time\":null}},{\"type\":\"notebook_cells\",\"id\":\"7qmg68gc\",\"attributes\":{\"definition\":{\"type\":\"markdown\",\"text\":\"When filtering by the template variable `container_deployment_guid`, this value represents the number of VMs (or `troux_uuid`s) that `container_deployment_guid` runs on \"}}},{\"type\":\"notebook_cells\",\"id\":\"h75xo4j5\",\"attributes\":{\"split_by\":{\"tags\":[],\"keys\":[]},\"definition\":{\"type\":\"query_table\",\"requests\":[{\"queries\":[{\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"avg:system.cpu.user{$troux_uuid,$container_deployement_guid} by {bosh_id,application_name}.rollup(avg, 3600)\",\"aggregator\":\"avg\"}],\"formulas\":[{\"conditional_formats\":[],\"cell_display_mode\":\"bar\",\"formula\":\"query1\",\"limit\":{\"count\":500,\"order\":\"desc\"}}],\"response_format\":\"scalar\"}],\"has_search_bar\":\"auto\"},\"time\":null}}],\"time\":{\"live_span\":\"2d\"},\"metadata\":{\"take_snapshots\":false,\"is_template\":false,\"is_favorite\":false,\"type\":null},\"template_variables\":[{\"name\":\"container_deployement_guid\",\"prefix\":\"app_name\",\"available_values\":[],\"default\":\"*\"},{\"name\":\"troux_uuid\",\"prefix\":\"bosh_id\",\"available_values\":[],\"default\":\"*\"}],\"status\":\"published\",\"modified\":\"2023-02-27T17:53:59.623647+00:00\",\"created\":\"2023-02-15T18:12:35.189588+00:00\",\"author\":{\"name\":\"Sarah Witt\",\"handle\":\"sarah.witt@datadoghq.com\",\"email\":\"sarah.witt@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/7f710a0bcefa8df8d47bfcba79f69a40?s=48&d=retro\",\"title\":null,\"verified\":true,\"disabled\":false,\"status\":\"Active\"}}},{\"type\":\"notebooks\",\"id\":4823614,\"attributes\":{\"name\":\"Sarah Feb 22 2023 11:04\",\"cells\":[{\"type\":\"notebook_cells\",\"id\":\"dnulkt1p\",\"attributes\":{\"split_by\":{\"tags\":[],\"keys\":[]},\"definition\":{\"show_legend\":true,\"type\":\"timeseries\",\"requests\":[{\"response_format\":\"timeseries\",\"queries\":[{\"name\":\"query1\",\"data_source\":\"metrics\",\"query\":\"avg:system.cpu.user{*}\"}],\"style\":{\"palette\":\"dog_classic\",\"line_type\":\"solid\",\"line_width\":\"normal\"},\"display_type\":\"line\"}]},\"time\":null}}],\"time\":{\"live_span\":\"1h\"},\"metadata\":{\"take_snapshots\":false,\"is_template\":false,\"is_favorite\":false,\"type\":null},\"template_variables\":[],\"status\":\"published\",\"modified\":\"2023-02-22T16:04:51.449049+00:00\",\"created\":\"2023-02-22T16:04:51.449049+00:00\",\"author\":{\"name\":\"Sarah Witt\",\"handle\":\"sarah.witt@datadoghq.com\",\"email\":\"sarah.witt@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/7f710a0bcefa8df8d47bfcba79f69a40?s=48&d=retro\",\"title\":null,\"verified\":true,\"disabled\":false,\"status\":\"Active\"}}}],\"meta\":{\"page\":{\"total_count\":158,\"total_filtered_count\":2}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8411da1c-9392-3341-7092-ea377d2379ef" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v1/notebooks", + "queryStringParameters": { + "count": [ + "2" + ], + "start": [ + "2" + ] + }, + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"type\":\"notebooks\",\"id\":4745953,\"attributes\":{\"name\":\"PCF Container Usage Attribution\",\"cells\":[{\"type\":\"notebook_cells\",\"id\":\"bqyp7v5p\",\"attributes\":{\"definition\":{\"title\":\"Count of containers\",\"type\":\"query_table\",\"requests\":[{\"response_format\":\"scalar\",\"formulas\":[{\"alias\":\"containers\",\"formula\":\"query1\",\"limit\":{\"count\":500,\"order\":\"desc\"}}],\"queries\":[{\"name\":\"query1\",\"data_source\":\"metrics\",\"query\":\"avg:cloudfoundry.nozzle.app.instances{$troux_uuid,$container_deployment_guid} by {app_name,bosh_id}.rollup(avg, 3600)\",\"aggregator\":\"sum\"}]}]},\"time\":null,\"split_by\":{\"keys\":[],\"tags\":[]},\"graph_size\":\"m\"}},{\"type\":\"notebook_cells\",\"id\":\"svgafvhk\",\"attributes\":{\"definition\":{\"type\":\"markdown\",\"text\":\"This displays the count of containers per `troux_uuid` (`bosh_id`) and `container_deployment_guid` (`app_name`)\"}}},{\"type\":\"notebook_cells\",\"id\":\"vq0zsiia\",\"attributes\":{\"definition\":{\"title\":\"Percentage breakdown of containers on VMs\",\"requests\":[{\"response_format\":\"scalar\",\"formulas\":[{\"formula\":\"query1\",\"limit\":{\"order\":\"desc\"}}],\"queries\":[{\"query\":\"avg:cloudfoundry.nozzle.app.instances{$troux_uuid,$container_deployment_guid} by {app_name,bosh_id}.rollup(avg, 3600)\",\"data_source\":\"metrics\",\"name\":\"query1\",\"aggregator\":\"sum\"}],\"style\":{\"palette\":\"datadog16\"}}],\"type\":\"sunburst\",\"legend\":{\"type\":\"automatic\"}},\"time\":null}},{\"type\":\"notebook_cells\",\"id\":\"oldqd75v\",\"attributes\":{\"definition\":{\"type\":\"markdown\",\"text\":\"This displays the count of containers per\\u00a0`troux_uuid` (`bosh_id`)\\u00a0and\\u00a0`container_deployment_guid` (`app_name`) as percentages of total containers\\n\"}}},{\"type\":\"notebook_cells\",\"id\":\"m2dcz3jo\",\"attributes\":{\"definition\":{\"title\":\"Number of VMs per container_deployment_guid\",\"type\":\"query_value\",\"requests\":[{\"response_format\":\"scalar\",\"queries\":[{\"name\":\"query1\",\"data_source\":\"metrics\",\"query\":\"avg:cloudfoundry.nozzle.app.instances{$troux_uuid,$container_deployment_guid}\",\"aggregator\":\"avg\"}],\"formulas\":[{\"formula\":\"count_nonzero(query1)\",\"alias\":\"VMs\"}]}],\"autoscale\":true,\"precision\":2},\"time\":null,\"split_by\":{\"keys\":[],\"tags\":[]},\"graph_size\":\"xs\"}},{\"type\":\"notebook_cells\",\"id\":\"39crgjxd\",\"attributes\":{\"definition\":{\"type\":\"markdown\",\"text\":\"When filtering by the template variable `container_deployment_guid`, this value represents the number of VMs (or `troux_uuid`s) that `container_deployment_guid` runs on \"}}}],\"time\":{\"live_span\":\"2d\"},\"metadata\":{\"take_snapshots\":false,\"is_template\":false,\"is_favorite\":false,\"type\":null},\"template_variables\":[{\"name\":\"container_deployment_guid\",\"prefix\":\"app_name\",\"available_values\":[],\"default\":\"*\"},{\"name\":\"troux_uuid\",\"prefix\":\"bosh_id\",\"available_values\":[],\"default\":\"*\"}],\"status\":\"published\",\"modified\":\"2023-02-16T17:32:46.774359+00:00\",\"created\":\"2023-02-14T20:04:16.789408+00:00\",\"author\":{\"name\":\"Sarah Witt\",\"handle\":\"sarah.witt@datadoghq.com\",\"email\":\"sarah.witt@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/7f710a0bcefa8df8d47bfcba79f69a40?s=48&d=retro\",\"title\":null,\"verified\":true,\"disabled\":false,\"status\":\"Active\"}}}],\"meta\":{\"page\":{\"total_count\":158,\"total_filtered_count\":2}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "457a2edf-5653-169d-4f94-900f94004dfb" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v1/api/notebooks.feature b/src/test/resources/com/datadog/api/client/v1/api/notebooks.feature index 55e703e5a42..2788eb421e5 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/notebooks.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/notebooks.feature @@ -86,6 +86,14 @@ Feature: Notebooks Then the response status is 200 OK And the response "data" has item with field "attributes.status" with value "published" + @replay-only @skip-validation @team:DataDog/notebooks @with-pagination + Scenario: Get all notebooks returns "OK" response with pagination + Given new "ListNotebooks" 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/notebooks Scenario: Update a notebook returns "Bad Request" response Given new "UpdateNotebook" request