diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 6d9c8c016aa..3ade5f79a8a 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -6143,6 +6143,7 @@ components: - security_runtime_stream - security_signals_stream - incidents_stream + - case_stream example: logs_stream type: string x-enum-varnames: @@ -6163,6 +6164,7 @@ components: - SECURITY_RUNTIME_STREAM - SECURITY_SIGNALS_STREAM - INCIDENTS_STREAM + - CASE_STREAM ListStreamWidgetDefinition: description: |- The list stream visualization displays a table of recent events in your application that diff --git a/examples/v1/dashboards/CreateDashboard_1996494326.java b/examples/v1/dashboards/CreateDashboard_1996494326.java new file mode 100644 index 00000000000..54e7a8879cf --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1996494326.java @@ -0,0 +1,69 @@ +// Create a new dashboard with case_stream list_stream widget + +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.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(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + Dashboard body = + new Dashboard() + .layoutType(DashboardLayoutType.ORDERED) + .title("Example-Dashboard with case_stream 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("created_at"))) + .query( + new ListStreamQuery() + .dataSource(ListStreamSource.CASE_STREAM) + .queryString("*") + .sort( + new WidgetFieldSort() + .column("created_at") + .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(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/ListStreamSource.java b/src/main/java/com/datadog/api/client/v1/model/ListStreamSource.java index b2c1eb9a995..2e01a5e00cb 100644 --- a/src/main/java/com/datadog/api/client/v1/model/ListStreamSource.java +++ b/src/main/java/com/datadog/api/client/v1/model/ListStreamSource.java @@ -44,7 +44,8 @@ public class ListStreamSource extends ModelEnum { "issue_stream", "security_runtime_stream", "security_signals_stream", - "incidents_stream")); + "incidents_stream", + "case_stream")); public static final ListStreamSource LOGS_STREAM = new ListStreamSource("logs_stream"); public static final ListStreamSource AUDIT_STREAM = new ListStreamSource("audit_stream"); @@ -70,6 +71,7 @@ public class ListStreamSource extends ModelEnum { public static final ListStreamSource SECURITY_SIGNALS_STREAM = new ListStreamSource("security_signals_stream"); public static final ListStreamSource INCIDENTS_STREAM = new ListStreamSource("incidents_stream"); + public static final ListStreamSource CASE_STREAM = new ListStreamSource("case_stream"); ListStreamSource(String value) { super(value, allowedValues); 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 afe8356d4cd..dc368642f59 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 @@ -403,6 +403,17 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "group" And the response "widgets[0].definition.requests[0].sort.order_by[0].name" is equal to "service" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with case_stream list_stream widget + Given new "CreateDashboard" request + And body with value {"layout_type":"ordered","title":"{{ unique }} with case_stream list_stream widget","widgets":[{"definition":{"type":"list_stream","requests":[{"columns":[{"width":"auto","field":"created_at"}],"query":{"data_source":"case_stream","query_string":"*","sort":{"column":"created_at","order":"desc"}},"response_format":"event_list"}]}}]} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.requests[0].query.data_source" is equal to "case_stream" + And the response "widgets[0].definition.requests[0].query.query_string" is equal to "*" + And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "created_at" + 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 check_status widget Given new "CreateDashboard" request diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index e17a377c310..64ce8c4b210 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -322,6 +322,13 @@ "scenario": "Create a new dashboard with bar_chart widget sorted by group", "version": "v1" }, + { + "feature": "Dashboards", + "feature_file": "../../com/datadog/api/client/v1/api/dashboards.feature", + "file": "v1/dashboards/create-a-new-dashboard-with-case-stream-list-stream-widget.json", + "scenario": "Create a new dashboard with case_stream list_stream widget", + "version": "v1" + }, { "feature": "Dashboards", "feature_file": "../../com/datadog/api/client/v1/api/dashboards.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-case-stream-list-stream-widget.json b/src/test/resources/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-case-stream-list-stream-widget.json new file mode 100644 index 00000000000..16f2f7ce683 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-case-stream-list-stream-widget.json @@ -0,0 +1,55 @@ +{ + "api": "Dashboards", + "expected_status": 200, + "feature": "Dashboards", + "id": "v1/Dashboards/Create a new dashboard with case_stream list_stream widget", + "operation_id": "CreateDashboard", + "request": { + "body": { + "schema": { + "format": null, + "ref": "Dashboard", + "type": "object" + }, + "source": "inline", + "value": { + "layout_type": "ordered", + "title": "{{ unique }} with case_stream list_stream widget", + "widgets": [ + { + "definition": { + "requests": [ + { + "columns": [ + { + "field": "created_at", + "width": "auto" + } + ], + "query": { + "data_source": "case_stream", + "query_string": "*", + "sort": { + "column": "created_at", + "order": "desc" + } + }, + "response_format": "event_list" + } + ], + "type": "list_stream" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v1/dashboard" + }, + "scenario": "Create a new dashboard with case_stream list_stream widget", + "schema_version": 1, + "version": "v1" +} diff --git a/src/test/resources/generated-test/test-server-data/v1/dashboards.json b/src/test/resources/generated-test/test-server-data/v1/dashboards.json index db1ac171665..60c6c752266 100644 --- a/src/test/resources/generated-test/test-server-data/v1/dashboards.json +++ b/src/test/resources/generated-test/test-server-data/v1/dashboards.json @@ -3185,6 +3185,89 @@ "scenario": "Create a new dashboard with bar_chart widget sorted by group", "version": "v1" }, + { + "feature": "Dashboards", + "frozen_at": "2026-09-30T01:58:34.406Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "layout_type": "ordered", + "title": "Test-Create_a_new_dashboard_with_case_stream_list_stream_widget-1790733514 with case_stream list_stream widget", + "widgets": [ + { + "definition": { + "requests": [ + { + "columns": [ + { + "field": "created_at", + "width": "auto" + } + ], + "query": { + "data_source": "case_stream", + "query_string": "*", + "sort": { + "column": "created_at", + "order": "desc" + } + }, + "response_format": "event_list" + } + ], + "type": "list_stream" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v1/dashboard", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"id\":\"kb4-hic-k5w\",\"title\":\"Test-Create_a_new_dashboard_with_case_stream_list_stream_widget-1790733514 with case_stream list_stream widget\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":\"frog\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/kb4-hic-k5w/test-createanewdashboardwithcasestreamliststreamwidget-1790733514-with-casestrea\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"created_at\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"case_stream\",\"query_string\":\"*\",\"sort\":{\"column\":\"created_at\",\"order\":\"desc\"}},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"},\"id\":2376957674388246}],\"notify_list\":null,\"created_at\":\"2026-09-30T01:58:34.620706+00:00\",\"modified_at\":\"2026-09-30T01:58:34.620706+00:00\",\"restricted_roles\":[]}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v1/dashboard/kb4-hic-k5w", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_dashboard_id\":\"kb4-hic-k5w\"}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Create a new dashboard with case_stream list_stream widget", + "version": "v1" + }, { "feature": "Dashboards", "frozen_at": "2024-11-15T19:32:37.699Z",