Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
5 changes: 5 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26095,6 +26095,7 @@ paths:
name: count
required: false
schema:
default: 100
example: 5
format: int64
type: integer
Expand Down Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions examples/v1/notebooks/ListNotebooks_788665428.java
Original file line number Diff line number Diff line change
@@ -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<NotebooksResponseData> 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();
}
}
}
57 changes: 56 additions & 1 deletion src/main/java/com/datadog/api/client/v1/api/NotebooksApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -641,6 +644,58 @@ public CompletableFuture<NotebooksResponse> listNotebooksAsync(
});
}

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

/**
* Get all notebooks.
*
* <p>See {@link #listNotebooksWithHttpInfo}.
*
* @return NotebooksResponse
*/
public PaginationIterable<NotebooksResponseData> 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<String, Object> args = new LinkedHashMap<String, Object>();
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 <code>query
* </code> in the notebook <code>name</code> or author <code>handle</code>.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-08-31T09:47:14.068Z
Original file line number Diff line number Diff line change
@@ -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"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down