Skip to content

Commit c8fec1b

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add event_stream fields to dashboard list stream widget (#1329)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 5c7c5e1 commit c8fec1b

File tree

8 files changed

+129
-5
lines changed

8 files changed

+129
-5
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2023-02-08 15:58:24.646504",
8-
"spec_repo_commit": "7c0c43cc"
7+
"regenerated": "2023-02-08 16:22:55.326401",
8+
"spec_repo_commit": "c826f5c2"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-02-08 15:58:24.657649",
13-
"spec_repo_commit": "7c0c43cc"
12+
"regenerated": "2023-02-08 16:22:55.343166",
13+
"spec_repo_commit": "c826f5c2"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4078,6 +4078,8 @@ components:
40784078
type: array
40794079
data_source:
40804080
$ref: '#/components/schemas/ListStreamSource'
4081+
event_size:
4082+
$ref: '#/components/schemas/WidgetEventSize'
40814083
group_by:
40824084
description: Group by configuration for the List Stream Widget. Group by
40834085
can be used only with logs_pattern_stream (up to 3 items) or logs_transaction_stream
@@ -4122,6 +4124,7 @@ components:
41224124
- apm_issue_stream
41234125
- logs_pattern_stream
41244126
- logs_transaction_stream
4127+
- event_stream
41254128
example: apm_issue_stream
41264129
type: string
41274130
x-enum-varnames:
@@ -4131,6 +4134,7 @@ components:
41314134
- APM_ISSUE_STREAM
41324135
- LOGS_PATTERN_STREAM
41334136
- LOGS_TRANSACTION_STREAM
4137+
- EVENT_STREAM
41344138
ListStreamWidgetDefinition:
41354139
description: 'The list stream visualization displays a table of recent events
41364140
in your application that
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""
2+
Create a new dashboard with event_stream list_stream widget
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
7+
from datadog_api_client.v1.model.dashboard import Dashboard
8+
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
9+
from datadog_api_client.v1.model.list_stream_column import ListStreamColumn
10+
from datadog_api_client.v1.model.list_stream_column_width import ListStreamColumnWidth
11+
from datadog_api_client.v1.model.list_stream_query import ListStreamQuery
12+
from datadog_api_client.v1.model.list_stream_response_format import ListStreamResponseFormat
13+
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
14+
from datadog_api_client.v1.model.list_stream_widget_definition import ListStreamWidgetDefinition
15+
from datadog_api_client.v1.model.list_stream_widget_definition_type import ListStreamWidgetDefinitionType
16+
from datadog_api_client.v1.model.list_stream_widget_request import ListStreamWidgetRequest
17+
from datadog_api_client.v1.model.widget import Widget
18+
from datadog_api_client.v1.model.widget_event_size import WidgetEventSize
19+
20+
body = Dashboard(
21+
layout_type=DashboardLayoutType.ORDERED,
22+
title="Example-Create_a_new_dashboard_with_event_stream_list_stream_widget with list_stream widget",
23+
widgets=[
24+
Widget(
25+
definition=ListStreamWidgetDefinition(
26+
type=ListStreamWidgetDefinitionType.LIST_STREAM,
27+
requests=[
28+
ListStreamWidgetRequest(
29+
columns=[
30+
ListStreamColumn(
31+
width=ListStreamColumnWidth.AUTO,
32+
field="timestamp",
33+
),
34+
],
35+
query=ListStreamQuery(
36+
data_source=ListStreamSource.EVENT_STREAM,
37+
query_string="",
38+
event_size=WidgetEventSize.LARGE,
39+
),
40+
response_format=ListStreamResponseFormat.EVENT_LIST,
41+
),
42+
],
43+
),
44+
),
45+
],
46+
)
47+
48+
configuration = Configuration()
49+
with ApiClient(configuration) as api_client:
50+
api_instance = DashboardsApi(api_client)
51+
response = api_instance.create_dashboard(body=body)
52+
53+
print(response)

src/datadog_api_client/v1/model/list_stream_query.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
if TYPE_CHECKING:
1717
from datadog_api_client.v1.model.list_stream_compute_items import ListStreamComputeItems
1818
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
19+
from datadog_api_client.v1.model.widget_event_size import WidgetEventSize
1920
from datadog_api_client.v1.model.list_stream_group_by_items import ListStreamGroupByItems
2021

2122

@@ -34,11 +35,13 @@ class ListStreamQuery(ModelNormal):
3435
def openapi_types(_):
3536
from datadog_api_client.v1.model.list_stream_compute_items import ListStreamComputeItems
3637
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
38+
from datadog_api_client.v1.model.widget_event_size import WidgetEventSize
3739
from datadog_api_client.v1.model.list_stream_group_by_items import ListStreamGroupByItems
3840

3941
return {
4042
"compute": ([ListStreamComputeItems],),
4143
"data_source": (ListStreamSource,),
44+
"event_size": (WidgetEventSize,),
4245
"group_by": ([ListStreamGroupByItems],),
4346
"indexes": ([str],),
4447
"query_string": (str,),
@@ -48,6 +51,7 @@ def openapi_types(_):
4851
attribute_map = {
4952
"compute": "compute",
5053
"data_source": "data_source",
54+
"event_size": "event_size",
5155
"group_by": "group_by",
5256
"indexes": "indexes",
5357
"query_string": "query_string",
@@ -59,6 +63,7 @@ def __init__(
5963
data_source: ListStreamSource,
6064
query_string: str,
6165
compute: Union[List[ListStreamComputeItems], UnsetType] = unset,
66+
event_size: Union[WidgetEventSize, UnsetType] = unset,
6267
group_by: Union[List[ListStreamGroupByItems], UnsetType] = unset,
6368
indexes: Union[List[str], UnsetType] = unset,
6469
storage: Union[str, UnsetType] = unset,
@@ -73,6 +78,9 @@ def __init__(
7378
:param data_source: Source from which to query items to display in the stream.
7479
:type data_source: ListStreamSource
7580
81+
:param event_size: Size to use to display an event.
82+
:type event_size: WidgetEventSize, optional
83+
7684
: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.
7785
:type group_by: [ListStreamGroupByItems], optional
7886
@@ -87,6 +95,8 @@ def __init__(
8795
"""
8896
if compute is not unset:
8997
kwargs["compute"] = compute
98+
if event_size is not unset:
99+
kwargs["event_size"] = event_size
90100
if group_by is not unset:
91101
kwargs["group_by"] = group_by
92102
if indexes is not unset:

src/datadog_api_client/v1/model/list_stream_source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ListStreamSource(ModelSimple):
1616
"""
1717
Source from which to query items to display in the stream.
1818
19-
: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"].
19+
: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"].
2020
:type value: str
2121
"""
2222

@@ -27,13 +27,15 @@ class ListStreamSource(ModelSimple):
2727
"apm_issue_stream",
2828
"logs_pattern_stream",
2929
"logs_transaction_stream",
30+
"event_stream",
3031
}
3132
LOGS_STREAM: ClassVar["ListStreamSource"]
3233
AUDIT_STREAM: ClassVar["ListStreamSource"]
3334
RUM_ISSUE_STREAM: ClassVar["ListStreamSource"]
3435
APM_ISSUE_STREAM: ClassVar["ListStreamSource"]
3536
LOGS_PATTERN_STREAM: ClassVar["ListStreamSource"]
3637
LOGS_TRANSACTION_STREAM: ClassVar["ListStreamSource"]
38+
EVENT_STREAM: ClassVar["ListStreamSource"]
3739

3840
@cached_property
3941
def openapi_types(_):
@@ -48,3 +50,4 @@ def openapi_types(_):
4850
ListStreamSource.APM_ISSUE_STREAM = ListStreamSource("apm_issue_stream")
4951
ListStreamSource.LOGS_PATTERN_STREAM = ListStreamSource("logs_pattern_stream")
5052
ListStreamSource.LOGS_TRANSACTION_STREAM = ListStreamSource("logs_transaction_stream")
53+
ListStreamSource.EVENT_STREAM = ListStreamSource("event_stream")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-02-08T16:18:06.266Z
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
interactions:
2+
- request:
3+
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_event_stream_list_stream_widget-1675873086
4+
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"}}]}'
5+
headers:
6+
accept:
7+
- application/json
8+
content-type:
9+
- application/json
10+
method: POST
11+
uri: https://api.datadoghq.com/api/v1/dashboard
12+
response:
13+
body:
14+
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
15+
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":"[email protected]","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"}
16+
17+
'
18+
headers:
19+
content-type:
20+
- application/json
21+
status:
22+
code: 200
23+
message: OK
24+
- request:
25+
body: null
26+
headers:
27+
accept:
28+
- application/json
29+
method: DELETE
30+
uri: https://api.datadoghq.com/api/v1/dashboard/zmh-rud-g4b
31+
response:
32+
body:
33+
string: '{"deleted_dashboard_id":"zmh-rud-g4b"}
34+
35+
'
36+
headers:
37+
content-type:
38+
- application/json
39+
status:
40+
code: 200
41+
message: OK
42+
version: 1

tests/v1/features/dashboards.feature

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ Feature: Dashboards
204204
And the response "widgets[0].definition.requests[0].apm_stats_query.service" is equal to "cassandra"
205205
And the response "widgets[0].definition.requests[0].apm_stats_query.name" is equal to "cassandra.query"
206206

207+
@team:DataDog/dashboards
208+
Scenario: Create a new dashboard with event_stream list_stream widget
209+
Given new "CreateDashboard" request
210+
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"}]}}]}
211+
When the request is sent
212+
Then the response status is 200 OK
213+
And the response "widgets[0].definition.type" is equal to "list_stream"
214+
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
215+
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
216+
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
217+
207218
@team:DataDog/dashboards
208219
Scenario: Create a new dashboard with event_stream widget
209220
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)