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.4",
"regenerated": "2023-05-30 14:28:54.949701",
"spec_repo_commit": "adf5379f"
"regenerated": "2023-05-31 17:18:49.688983",
"spec_repo_commit": "3b710977"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-05-30 14:28:54.964144",
"spec_repo_commit": "adf5379f"
"regenerated": "2023-05-31 17:18:49.701596",
"spec_repo_commit": "3b710977"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4289,6 +4289,8 @@ components:
description: Widget query.
example: '@service:app'
type: string
sort:
$ref: '#/components/schemas/WidgetFieldSort'
storage:
description: Option for storage location. Feature in Private Beta.
example: indexes
Expand Down
70 changes: 70 additions & 0 deletions examples/v1/dashboards/CreateDashboard_1877023900.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Create a new dashboard with list_stream widget with a valid sort parameter ASC

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.ListStreamColumn;
import com.datadog.api.client.v1.model.ListStreamColumnWidth;
import com.datadog.api.client.v1.model.ListStreamQuery;
import com.datadog.api.client.v1.model.ListStreamResponseFormat;
import com.datadog.api.client.v1.model.ListStreamSource;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinition;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinitionType;
import com.datadog.api.client.v1.model.ListStreamWidgetRequest;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import com.datadog.api.client.v1.model.WidgetEventSize;
import com.datadog.api.client.v1.model.WidgetFieldSort;
import com.datadog.api.client.v1.model.WidgetSort;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
DashboardsApi apiInstance = new DashboardsApi(defaultClient);

Dashboard body =
new Dashboard()
.layoutType(DashboardLayoutType.ORDERED)
.title("Example-Dashboard with list_stream widget")
.widgets(
Collections.singletonList(
new Widget()
.definition(
new WidgetDefinition(
new ListStreamWidgetDefinition()
.type(ListStreamWidgetDefinitionType.LIST_STREAM)
.requests(
Collections.singletonList(
new ListStreamWidgetRequest()
.columns(
Collections.singletonList(
new ListStreamColumn()
.width(ListStreamColumnWidth.AUTO)
.field("timestamp")))
.query(
new ListStreamQuery()
.dataSource(ListStreamSource.EVENT_STREAM)
.queryString("")
.eventSize(WidgetEventSize.LARGE)
.sort(
new WidgetFieldSort()
.column("timestamp")
.order(WidgetSort.ASCENDING)))
.responseFormat(
ListStreamResponseFormat.EVENT_LIST)))))));

try {
Dashboard result = apiInstance.createDashboard(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#createDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
70 changes: 70 additions & 0 deletions examples/v1/dashboards/CreateDashboard_2361531620.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Create a new dashboard with list_stream widget with a valid sort parameter DESC

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.ListStreamColumn;
import com.datadog.api.client.v1.model.ListStreamColumnWidth;
import com.datadog.api.client.v1.model.ListStreamQuery;
import com.datadog.api.client.v1.model.ListStreamResponseFormat;
import com.datadog.api.client.v1.model.ListStreamSource;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinition;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinitionType;
import com.datadog.api.client.v1.model.ListStreamWidgetRequest;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import com.datadog.api.client.v1.model.WidgetEventSize;
import com.datadog.api.client.v1.model.WidgetFieldSort;
import com.datadog.api.client.v1.model.WidgetSort;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
DashboardsApi apiInstance = new DashboardsApi(defaultClient);

Dashboard body =
new Dashboard()
.layoutType(DashboardLayoutType.ORDERED)
.title("Example-Dashboard with list_stream widget")
.widgets(
Collections.singletonList(
new Widget()
.definition(
new WidgetDefinition(
new ListStreamWidgetDefinition()
.type(ListStreamWidgetDefinitionType.LIST_STREAM)
.requests(
Collections.singletonList(
new ListStreamWidgetRequest()
.columns(
Collections.singletonList(
new ListStreamColumn()
.width(ListStreamColumnWidth.AUTO)
.field("timestamp")))
.query(
new ListStreamQuery()
.dataSource(ListStreamSource.EVENT_STREAM)
.queryString("")
.eventSize(WidgetEventSize.LARGE)
.sort(
new WidgetFieldSort()
.column("timestamp")
.order(WidgetSort.DESCENDING)))
.responseFormat(
ListStreamResponseFormat.EVENT_LIST)))))));

try {
Dashboard result = apiInstance.createDashboard(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#createDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ListStreamQuery.JSON_PROPERTY_GROUP_BY,
ListStreamQuery.JSON_PROPERTY_INDEXES,
ListStreamQuery.JSON_PROPERTY_QUERY_STRING,
ListStreamQuery.JSON_PROPERTY_SORT,
ListStreamQuery.JSON_PROPERTY_STORAGE
})
@jakarta.annotation.Generated(
Expand All @@ -47,6 +48,9 @@ public class ListStreamQuery {
public static final String JSON_PROPERTY_QUERY_STRING = "query_string";
private String queryString;

public static final String JSON_PROPERTY_SORT = "sort";
private WidgetFieldSort sort;

public static final String JSON_PROPERTY_STORAGE = "storage";
private String storage;

Expand Down Expand Up @@ -228,6 +232,28 @@ public void setQueryString(String queryString) {
this.queryString = queryString;
}

public ListStreamQuery sort(WidgetFieldSort sort) {
this.sort = sort;
this.unparsed |= sort.unparsed;
return this;
}

/**
* Which column and order to sort by
*
* @return sort
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SORT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public WidgetFieldSort getSort() {
return sort;
}

public void setSort(WidgetFieldSort sort) {
this.sort = sort;
}

public ListStreamQuery storage(String storage) {
this.storage = storage;
return this;
Expand Down Expand Up @@ -265,12 +291,14 @@ public boolean equals(Object o) {
&& Objects.equals(this.groupBy, listStreamQuery.groupBy)
&& Objects.equals(this.indexes, listStreamQuery.indexes)
&& Objects.equals(this.queryString, listStreamQuery.queryString)
&& Objects.equals(this.sort, listStreamQuery.sort)
&& Objects.equals(this.storage, listStreamQuery.storage);
}

@Override
public int hashCode() {
return Objects.hash(compute, dataSource, eventSize, groupBy, indexes, queryString, storage);
return Objects.hash(
compute, dataSource, eventSize, groupBy, indexes, queryString, sort, storage);
}

@Override
Expand All @@ -283,6 +311,7 @@ public String toString() {
sb.append(" groupBy: ").append(toIndentedString(groupBy)).append("\n");
sb.append(" indexes: ").append(toIndentedString(indexes)).append("\n");
sb.append(" queryString: ").append(toIndentedString(queryString)).append("\n");
sb.append(" sort: ").append(toIndentedString(sort)).append("\n");
sb.append(" storage: ").append(toIndentedString(storage)).append("\n");
sb.append("}");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-05-31T17:12:24.532Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_ASC-1685553144 with list_stream widget\",\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"timestamp\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"event_stream\",\"event_size\":\"l\",\"query_string\":\"\",\"sort\":{\"column\":\"timestamp\",\"order\":\"asc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"}}]}"
},
"headers": {},
"method": "POST",
"path": "/api/v1/dashboard",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"id\":\"td2-he3-3vj\",\"title\":\"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_ASC-1685553144 with list_stream widget\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/td2-he3-3vj/test-createanewdashboardwithliststreamwidgetwithavalidsortparameterasc-168555314\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"timestamp\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"event_stream\",\"event_size\":\"l\",\"query_string\":\"\",\"sort\":{\"column\":\"timestamp\",\"order\":\"asc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"},\"id\":4579982797049164}],\"notify_list\":null,\"created_at\":\"2023-05-31T17:12:24.700217+00:00\",\"modified_at\":\"2023-05-31T17:12:24.700217+00:00\",\"restricted_roles\":[]}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "262beabe-444a-04ec-c32e-92679e01c03d"
},
{
"httpRequest": {
"headers": {},
"method": "DELETE",
"path": "/api/v1/dashboard/td2-he3-3vj",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"deleted_dashboard_id\":\"td2-he3-3vj\"}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "df6728de-39f0-d9a8-232b-235100fbe048"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-05-31T17:12:24.923Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_DESC-1685553144 with list_stream widget\",\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"timestamp\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"event_stream\",\"event_size\":\"l\",\"query_string\":\"\",\"sort\":{\"column\":\"timestamp\",\"order\":\"desc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"}}]}"
},
"headers": {},
"method": "POST",
"path": "/api/v1/dashboard",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"id\":\"mwn-7ph-8z8\",\"title\":\"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_DESC-1685553144 with list_stream widget\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/mwn-7ph-8z8/test-createanewdashboardwithliststreamwidgetwithavalidsortparameterdesc-16855531\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"timestamp\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"event_stream\",\"event_size\":\"l\",\"query_string\":\"\",\"sort\":{\"column\":\"timestamp\",\"order\":\"desc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"},\"id\":8830087860290510}],\"notify_list\":null,\"created_at\":\"2023-05-31T17:12:25.020023+00:00\",\"modified_at\":\"2023-05-31T17:12:25.020023+00:00\",\"restricted_roles\":[]}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "4d9af33a-c1a6-4539-6afe-64b02fe6a4df"
},
{
"httpRequest": {
"headers": {},
"method": "DELETE",
"path": "/api/v1/dashboard/mwn-7ph-8z8",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"deleted_dashboard_id\":\"mwn-7ph-8z8\"}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "3505733a-4173-7b1a-0aac-71a2f23552b6"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,32 @@ Feature: Dashboards
And the response "widgets[0].definition.type" is equal to "list_stream"
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "apm_issue_stream"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with list_stream widget with a valid sort parameter ASC
Given new "CreateDashboard" request
And body with value {"layout_type": "ordered","title": "{{ unique }} with list_stream widget","widgets": [{"definition": {"type": "list_stream","requests": [{"columns": [{"width": "auto","field": "timestamp"}],"query": {"data_source": "event_stream","query_string": "","event_size": "l", "sort": {"column": "timestamp", "order": "asc"}},"response_format": "event_list"}]}}]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.type" is equal to "list_stream"
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "asc"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with list_stream widget with a valid sort parameter DESC
Given new "CreateDashboard" request
And body with value {"layout_type": "ordered","title": "{{ unique }} with list_stream widget","widgets": [{"definition": {"type": "list_stream","requests": [{"columns": [{"width": "auto","field": "timestamp"}],"query": {"data_source": "event_stream","query_string": "","event_size": "l", "sort": {"column": "timestamp", "order": "desc"}},"response_format": "event_list"}]}}]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.type" is equal to "list_stream"
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "desc"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with log_stream widget
Given new "CreateDashboard" request
Expand Down