Skip to content

Commit 97c4017

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add show_year option for event list widget (#1477)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent d7ae8aa commit 97c4017

File tree

7 files changed

+26
-12
lines changed

7 files changed

+26
-12
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-05-24 13:16:05.936665",
8-
"spec_repo_commit": "61d57b72"
7+
"regenerated": "2023-05-24 14:20:21.063926",
8+
"spec_repo_commit": "89276ce5"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-05-24 13:16:06.032642",
13-
"spec_repo_commit": "61d57b72"
12+
"regenerated": "2023-05-24 14:20:21.079435",
13+
"spec_repo_commit": "89276ce5"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4289,6 +4289,10 @@ components:
42894289
description: Widget query.
42904290
example: '@service:app'
42914291
type: string
4292+
show_year:
4293+
description: Option to display the year in the date column. To be used with
4294+
the `event_stream`.
4295+
type: boolean
42924296
storage:
42934297
description: Option for storage location. Feature in Private Beta.
42944298
example: indexes

examples/v1/dashboards/CreateDashboard_2432046716.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
data_source=ListStreamSource.EVENT_STREAM,
3737
query_string="",
3838
event_size=WidgetEventSize.LARGE,
39+
show_year=True,
3940
),
4041
response_format=ListStreamResponseFormat.EVENT_LIST,
4142
),

src/datadog_api_client/v1/model/list_stream_query.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def openapi_types(_):
4545
"group_by": ([ListStreamGroupByItems],),
4646
"indexes": ([str],),
4747
"query_string": (str,),
48+
"show_year": (bool,),
4849
"storage": (str,),
4950
}
5051

@@ -55,6 +56,7 @@ def openapi_types(_):
5556
"group_by": "group_by",
5657
"indexes": "indexes",
5758
"query_string": "query_string",
59+
"show_year": "show_year",
5860
"storage": "storage",
5961
}
6062

@@ -66,6 +68,7 @@ def __init__(
6668
event_size: Union[WidgetEventSize, UnsetType] = unset,
6769
group_by: Union[List[ListStreamGroupByItems], UnsetType] = unset,
6870
indexes: Union[List[str], UnsetType] = unset,
71+
show_year: Union[bool, UnsetType] = unset,
6972
storage: Union[str, UnsetType] = unset,
7073
**kwargs,
7174
):
@@ -90,6 +93,9 @@ def __init__(
9093
:param query_string: Widget query.
9194
:type query_string: str
9295
96+
:param show_year: Option to display the year in the date column. To be used with the ``event_stream``.
97+
:type show_year: bool, optional
98+
9399
:param storage: Option for storage location. Feature in Private Beta.
94100
:type storage: str, optional
95101
"""
@@ -101,6 +107,8 @@ def __init__(
101107
kwargs["group_by"] = group_by
102108
if indexes is not unset:
103109
kwargs["indexes"] = indexes
110+
if show_year is not unset:
111+
kwargs["show_year"] = show_year
104112
if storage is not unset:
105113
kwargs["storage"] = storage
106114
super().__init__(kwargs)
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-02-08T16:18:06.266Z
1+
2023-05-23T16:19:21.371Z

tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_event_stream_list_stream_widget.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- 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"}}]}'
3+
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_event_stream_list_stream_widget-1684858761
4+
with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"event_stream","event_size":"l","query_string":"","show_year":true},"response_format":"event_list"}],"type":"list_stream"}}]}'
55
headers:
66
accept:
77
- application/json
@@ -11,8 +11,8 @@ interactions:
1111
uri: https://api.datadoghq.com/api/v1/dashboard
1212
response:
1313
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"}
14+
string: '{"id":"s56-ph7-gmi","title":"Test-Create_a_new_dashboard_with_event_stream_list_stream_widget-1684858761
15+
with list_stream widget","description":null,"author_handle":"[email protected]","author_name":null,"layout_type":"ordered","url":"/dashboard/s56-ph7-gmi/test-createanewdashboardwitheventstreamliststreamwidget-1684858761-with-liststre","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":"","show_year":true},"response_format":"event_list"}],"type":"list_stream"},"id":3197043212239739}],"notify_list":null,"created_at":"2023-05-23T16:19:21.576643+00:00","modified_at":"2023-05-23T16:19:21.576643+00:00","restricted_roles":[]}
1616
1717
'
1818
headers:
@@ -27,10 +27,10 @@ interactions:
2727
accept:
2828
- application/json
2929
method: DELETE
30-
uri: https://api.datadoghq.com/api/v1/dashboard/zmh-rud-g4b
30+
uri: https://api.datadoghq.com/api/v1/dashboard/s56-ph7-gmi
3131
response:
3232
body:
33-
string: '{"deleted_dashboard_id":"zmh-rud-g4b"}
33+
string: '{"deleted_dashboard_id":"s56-ph7-gmi"}
3434
3535
'
3636
headers:

tests/v1/features/dashboards.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,14 @@ Feature: Dashboards
261261
@team:DataDog/dashboards-backend
262262
Scenario: Create a new dashboard with event_stream list_stream widget
263263
Given new "CreateDashboard" request
264-
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"}]}}]}
264+
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", "show_year": true},"response_format": "event_list"}]}}]}
265265
When the request is sent
266266
Then the response status is 200 OK
267267
And the response "widgets[0].definition.type" is equal to "list_stream"
268268
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
269269
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
270270
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
271+
And the response "widgets[0].definition.requests[0].query.show_year" is equal to true
271272

272273
@team:DataDog/dashboards-backend
273274
Scenario: Create a new dashboard with event_stream widget

0 commit comments

Comments
 (0)