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-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"
}
}
}
19 changes: 19 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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).
Expand Down
28 changes: 28 additions & 0 deletions examples/v1/dashboards/ListDashboards_1062671515.java
Original file line number Diff line number Diff line change
@@ -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<DashboardSummaryDefinition> 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();
}
}
}
88 changes: 88 additions & 0 deletions src/main/java/com/datadog/api/client/v1/api/DashboardsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -1384,6 +1387,8 @@ public ApiResponse<SharedDashboardInvites> getPublicDashboardInvitationsWithHttp
public static class ListDashboardsOptionalParameters {
private Boolean filterShared;
private Boolean filterDeleted;
private Long count;
private Long start;

/**
* Set filterShared.
Expand All @@ -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;
}
}

/**
Expand Down Expand Up @@ -1469,6 +1497,58 @@ public CompletableFuture<DashboardSummary> listDashboardsAsync(
});
}

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

/**
* Get all dashboards.
*
* <p>See {@link #listDashboardsWithHttpInfo}.
*
* @return DashboardSummary
*/
public PaginationIterable<DashboardSummaryDefinition> 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<String, Object> args = new LinkedHashMap<String, Object>();
args.put("optionalParams", parameters);

PaginationIterable iterator =
new PaginationIterable(
this,
"listDashboards",
resultsPath,
valueGetterPath,
valueSetterPath,
valueSetterParamOptional,
true,
limit,
args);

return iterator;
}

/**
* Get all dashboards.
*
Expand All @@ -1492,6 +1572,8 @@ public ApiResponse<DashboardSummary> 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";

Expand All @@ -1500,6 +1582,8 @@ public ApiResponse<DashboardSummary> 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(
Expand Down Expand Up @@ -1534,6 +1618,8 @@ public CompletableFuture<ApiResponse<DashboardSummary>> 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";

Expand All @@ -1542,6 +1628,8 @@ public CompletableFuture<ApiResponse<DashboardSummary>> 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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-09-04T12:26:51.389Z
Original file line number Diff line number Diff line change
@@ -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"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down