diff --git a/.apigentools-info b/.apigentools-info index 8e3d95e6ac..fd9a1d750e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-02-08 15:58:24.646504", - "spec_repo_commit": "7c0c43cc" + "regenerated": "2023-02-08 16:22:55.326401", + "spec_repo_commit": "c826f5c2" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-02-08 15:58:24.657649", - "spec_repo_commit": "7c0c43cc" + "regenerated": "2023-02-08 16:22:55.343166", + "spec_repo_commit": "c826f5c2" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 35d15d1da5..be2ef8cb7c 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -4078,6 +4078,8 @@ components: type: array data_source: $ref: '#/components/schemas/ListStreamSource' + event_size: + $ref: '#/components/schemas/WidgetEventSize' group_by: description: Group by configuration for the List Stream Widget. Group by can be used only with logs_pattern_stream (up to 3 items) or logs_transaction_stream @@ -4122,6 +4124,7 @@ components: - apm_issue_stream - logs_pattern_stream - logs_transaction_stream + - event_stream example: apm_issue_stream type: string x-enum-varnames: @@ -4131,6 +4134,7 @@ components: - APM_ISSUE_STREAM - LOGS_PATTERN_STREAM - LOGS_TRANSACTION_STREAM + - EVENT_STREAM ListStreamWidgetDefinition: description: 'The list stream visualization displays a table of recent events in your application that diff --git a/examples/v1/dashboards/CreateDashboard_2432046716.py b/examples/v1/dashboards/CreateDashboard_2432046716.py new file mode 100644 index 0000000000..c6387895d9 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2432046716.py @@ -0,0 +1,53 @@ +""" +Create a new dashboard with event_stream list_stream widget +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.dashboards_api import DashboardsApi +from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType +from datadog_api_client.v1.model.list_stream_column import ListStreamColumn +from datadog_api_client.v1.model.list_stream_column_width import ListStreamColumnWidth +from datadog_api_client.v1.model.list_stream_query import ListStreamQuery +from datadog_api_client.v1.model.list_stream_response_format import ListStreamResponseFormat +from datadog_api_client.v1.model.list_stream_source import ListStreamSource +from datadog_api_client.v1.model.list_stream_widget_definition import ListStreamWidgetDefinition +from datadog_api_client.v1.model.list_stream_widget_definition_type import ListStreamWidgetDefinitionType +from datadog_api_client.v1.model.list_stream_widget_request import ListStreamWidgetRequest +from datadog_api_client.v1.model.widget import Widget +from datadog_api_client.v1.model.widget_event_size import WidgetEventSize + +body = Dashboard( + layout_type=DashboardLayoutType.ORDERED, + title="Example-Create_a_new_dashboard_with_event_stream_list_stream_widget with list_stream widget", + widgets=[ + Widget( + definition=ListStreamWidgetDefinition( + type=ListStreamWidgetDefinitionType.LIST_STREAM, + requests=[ + ListStreamWidgetRequest( + columns=[ + ListStreamColumn( + width=ListStreamColumnWidth.AUTO, + field="timestamp", + ), + ], + query=ListStreamQuery( + data_source=ListStreamSource.EVENT_STREAM, + query_string="", + event_size=WidgetEventSize.LARGE, + ), + response_format=ListStreamResponseFormat.EVENT_LIST, + ), + ], + ), + ), + ], +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = DashboardsApi(api_client) + response = api_instance.create_dashboard(body=body) + + print(response) diff --git a/src/datadog_api_client/v1/model/list_stream_query.py b/src/datadog_api_client/v1/model/list_stream_query.py index 6f85355156..dde1883813 100644 --- a/src/datadog_api_client/v1/model/list_stream_query.py +++ b/src/datadog_api_client/v1/model/list_stream_query.py @@ -16,6 +16,7 @@ if TYPE_CHECKING: from datadog_api_client.v1.model.list_stream_compute_items import ListStreamComputeItems from datadog_api_client.v1.model.list_stream_source import ListStreamSource + from datadog_api_client.v1.model.widget_event_size import WidgetEventSize from datadog_api_client.v1.model.list_stream_group_by_items import ListStreamGroupByItems @@ -34,11 +35,13 @@ class ListStreamQuery(ModelNormal): def openapi_types(_): from datadog_api_client.v1.model.list_stream_compute_items import ListStreamComputeItems from datadog_api_client.v1.model.list_stream_source import ListStreamSource + from datadog_api_client.v1.model.widget_event_size import WidgetEventSize from datadog_api_client.v1.model.list_stream_group_by_items import ListStreamGroupByItems return { "compute": ([ListStreamComputeItems],), "data_source": (ListStreamSource,), + "event_size": (WidgetEventSize,), "group_by": ([ListStreamGroupByItems],), "indexes": ([str],), "query_string": (str,), @@ -48,6 +51,7 @@ def openapi_types(_): attribute_map = { "compute": "compute", "data_source": "data_source", + "event_size": "event_size", "group_by": "group_by", "indexes": "indexes", "query_string": "query_string", @@ -59,6 +63,7 @@ def __init__( data_source: ListStreamSource, query_string: str, compute: Union[List[ListStreamComputeItems], UnsetType] = unset, + event_size: Union[WidgetEventSize, UnsetType] = unset, group_by: Union[List[ListStreamGroupByItems], UnsetType] = unset, indexes: Union[List[str], UnsetType] = unset, storage: Union[str, UnsetType] = unset, @@ -73,6 +78,9 @@ def __init__( :param data_source: Source from which to query items to display in the stream. :type data_source: ListStreamSource + :param event_size: Size to use to display an event. + :type event_size: WidgetEventSize, optional + :param group_by: Group by configuration for the List Stream Widget. Group by can be used only with logs_pattern_stream (up to 3 items) or logs_transaction_stream (one group by item is required) list stream source. :type group_by: [ListStreamGroupByItems], optional @@ -87,6 +95,8 @@ def __init__( """ if compute is not unset: kwargs["compute"] = compute + if event_size is not unset: + kwargs["event_size"] = event_size if group_by is not unset: kwargs["group_by"] = group_by if indexes is not unset: diff --git a/src/datadog_api_client/v1/model/list_stream_source.py b/src/datadog_api_client/v1/model/list_stream_source.py index c5c3449603..ad2796d4a7 100644 --- a/src/datadog_api_client/v1/model/list_stream_source.py +++ b/src/datadog_api_client/v1/model/list_stream_source.py @@ -16,7 +16,7 @@ class ListStreamSource(ModelSimple): """ Source from which to query items to display in the stream. - :param value: If omitted defaults to "apm_issue_stream". Must be one of ["logs_stream", "audit_stream", "rum_issue_stream", "apm_issue_stream", "logs_pattern_stream", "logs_transaction_stream"]. + :param value: If omitted defaults to "apm_issue_stream". Must be one of ["logs_stream", "audit_stream", "rum_issue_stream", "apm_issue_stream", "logs_pattern_stream", "logs_transaction_stream", "event_stream"]. :type value: str """ @@ -27,6 +27,7 @@ class ListStreamSource(ModelSimple): "apm_issue_stream", "logs_pattern_stream", "logs_transaction_stream", + "event_stream", } LOGS_STREAM: ClassVar["ListStreamSource"] AUDIT_STREAM: ClassVar["ListStreamSource"] @@ -34,6 +35,7 @@ class ListStreamSource(ModelSimple): APM_ISSUE_STREAM: ClassVar["ListStreamSource"] LOGS_PATTERN_STREAM: ClassVar["ListStreamSource"] LOGS_TRANSACTION_STREAM: ClassVar["ListStreamSource"] + EVENT_STREAM: ClassVar["ListStreamSource"] @cached_property def openapi_types(_): @@ -48,3 +50,4 @@ def openapi_types(_): ListStreamSource.APM_ISSUE_STREAM = ListStreamSource("apm_issue_stream") ListStreamSource.LOGS_PATTERN_STREAM = ListStreamSource("logs_pattern_stream") ListStreamSource.LOGS_TRANSACTION_STREAM = ListStreamSource("logs_transaction_stream") +ListStreamSource.EVENT_STREAM = ListStreamSource("event_stream") diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_event_stream_list_stream_widget.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_event_stream_list_stream_widget.frozen new file mode 100644 index 0000000000..b5d81941fc --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_event_stream_list_stream_widget.frozen @@ -0,0 +1 @@ +2023-02-08T16:18:06.266Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_event_stream_list_stream_widget.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_event_stream_list_stream_widget.yaml new file mode 100644 index 0000000000..b84c79431e --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_event_stream_list_stream_widget.yaml @@ -0,0 +1,42 @@ +interactions: +- request: + body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_event_stream_list_stream_widget-1675873086 + with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"event_stream","event_size":"l","query_string":""},"response_format":"event_list"}],"type":"list_stream"}}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + string: '{"notify_list":null,"description":null,"restricted_roles":[],"author_name":null,"template_variables":null,"is_read_only":false,"id":"zmh-rud-g4b","title":"Test-Create_a_new_dashboard_with_event_stream_list_stream_widget-1675873086 + with list_stream widget","url":"/dashboard/zmh-rud-g4b/test-createanewdashboardwitheventstreamliststreamwidget-1675873086-with-liststre","created_at":"2023-02-08T16:18:06.512655+00:00","modified_at":"2023-02-08T16:18:06.512655+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"query":{"query_string":"","data_source":"event_stream","event_size":"l"},"response_format":"event_list","columns":[{"field":"timestamp","width":"auto"}]}],"type":"list_stream"},"id":3303593204363469}],"layout_type":"ordered"} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/zmh-rud-g4b + response: + body: + string: '{"deleted_dashboard_id":"zmh-rud-g4b"} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index f1cfe43c87..ae002091a4 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -204,6 +204,17 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].apm_stats_query.service" is equal to "cassandra" And the response "widgets[0].definition.requests[0].apm_stats_query.name" is equal to "cassandra.query" + @team:DataDog/dashboards + Scenario: Create a new dashboard with event_stream list_stream widget + 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"},"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" + @team:DataDog/dashboards Scenario: Create a new dashboard with event_stream widget Given new "CreateDashboard" request