Skip to content

Commit d89666a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Add citest stream to ListStreamSource (#1358)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 81a4e18 commit d89666a

File tree

7 files changed

+114
-5
lines changed

7 files changed

+114
-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-03-02 18:29:33.159238",
8-
"spec_repo_commit": "911d7cda"
7+
"regenerated": "2023-03-02 20:54:09.140271",
8+
"spec_repo_commit": "b2aaf22c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-03-02 18:29:33.171186",
13-
"spec_repo_commit": "911d7cda"
12+
"regenerated": "2023-03-02 20:54:09.152032",
13+
"spec_repo_commit": "b2aaf22c"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4137,6 +4137,7 @@ components:
41374137
- logs_stream
41384138
- audit_stream
41394139
- ci_pipeline_stream
4140+
- ci_test_stream
41404141
- rum_issue_stream
41414142
- apm_issue_stream
41424143
- logs_pattern_stream
@@ -4148,6 +4149,7 @@ components:
41484149
- LOGS_STREAM
41494150
- AUDIT_STREAM
41504151
- CI_PIPELINE_STREAM
4152+
- CI_TEST_STREAM
41514153
- RUM_ISSUE_STREAM
41524154
- APM_ISSUE_STREAM
41534155
- LOGS_PATTERN_STREAM
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
Create a new dashboard with ci_test_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+
19+
body = Dashboard(
20+
layout_type=DashboardLayoutType.ORDERED,
21+
title="Example-Create_a_new_dashboard_with_ci_test_stream_list_stream_widget with list_stream widget",
22+
widgets=[
23+
Widget(
24+
definition=ListStreamWidgetDefinition(
25+
type=ListStreamWidgetDefinitionType.LIST_STREAM,
26+
requests=[
27+
ListStreamWidgetRequest(
28+
columns=[
29+
ListStreamColumn(
30+
width=ListStreamColumnWidth.AUTO,
31+
field="timestamp",
32+
),
33+
],
34+
query=ListStreamQuery(
35+
data_source=ListStreamSource.CI_TEST_STREAM,
36+
query_string="test_level:suite",
37+
),
38+
response_format=ListStreamResponseFormat.EVENT_LIST,
39+
),
40+
],
41+
),
42+
),
43+
],
44+
)
45+
46+
configuration = Configuration()
47+
with ApiClient(configuration) as api_client:
48+
api_instance = DashboardsApi(api_client)
49+
response = api_instance.create_dashboard(body=body)
50+
51+
print(response)

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,14 +16,15 @@ 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", "ci_pipeline_stream", "rum_issue_stream", "apm_issue_stream", "logs_pattern_stream", "logs_transaction_stream", "event_stream"].
19+
:param value: If omitted defaults to "apm_issue_stream". Must be one of ["logs_stream", "audit_stream", "ci_pipeline_stream", "ci_test_stream", "rum_issue_stream", "apm_issue_stream", "logs_pattern_stream", "logs_transaction_stream", "event_stream"].
2020
:type value: str
2121
"""
2222

2323
allowed_values = {
2424
"logs_stream",
2525
"audit_stream",
2626
"ci_pipeline_stream",
27+
"ci_test_stream",
2728
"rum_issue_stream",
2829
"apm_issue_stream",
2930
"logs_pattern_stream",
@@ -33,6 +34,7 @@ class ListStreamSource(ModelSimple):
3334
LOGS_STREAM: ClassVar["ListStreamSource"]
3435
AUDIT_STREAM: ClassVar["ListStreamSource"]
3536
CI_PIPELINE_STREAM: ClassVar["ListStreamSource"]
37+
CI_TEST_STREAM: ClassVar["ListStreamSource"]
3638
RUM_ISSUE_STREAM: ClassVar["ListStreamSource"]
3739
APM_ISSUE_STREAM: ClassVar["ListStreamSource"]
3840
LOGS_PATTERN_STREAM: ClassVar["ListStreamSource"]
@@ -49,6 +51,7 @@ def openapi_types(_):
4951
ListStreamSource.LOGS_STREAM = ListStreamSource("logs_stream")
5052
ListStreamSource.AUDIT_STREAM = ListStreamSource("audit_stream")
5153
ListStreamSource.CI_PIPELINE_STREAM = ListStreamSource("ci_pipeline_stream")
54+
ListStreamSource.CI_TEST_STREAM = ListStreamSource("ci_test_stream")
5255
ListStreamSource.RUM_ISSUE_STREAM = ListStreamSource("rum_issue_stream")
5356
ListStreamSource.APM_ISSUE_STREAM = ListStreamSource("apm_issue_stream")
5457
ListStreamSource.LOGS_PATTERN_STREAM = ListStreamSource("logs_pattern_stream")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-03-02T20:37:14.366Z
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_ci_test_stream_list_stream_widget-1677789434
4+
with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"ci_test_stream","query_string":"test_level:suite"},"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: '{"id":"mdr-2je-u6x","title":"Test-Create_a_new_dashboard_with_ci_test_stream_list_stream_widget-1677789434
15+
with list_stream widget","description":null,"author_handle":"[email protected]","author_name":null,"layout_type":"ordered","url":"/dashboard/mdr-2je-u6x/test-createanewdashboardwithciteststreamliststreamwidget-1677789434-with-liststr","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"ci_test_stream","query_string":"test_level:suite"},"response_format":"event_list"}],"type":"list_stream"},"id":1680451278463569}],"notify_list":null,"created_at":"2023-03-02T20:37:14.537234+00:00","modified_at":"2023-03-02T20:37:14.537234+00:00","restricted_roles":[]}
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/mdr-2je-u6x
31+
response:
32+
body:
33+
string: '{"deleted_dashboard_id":"mdr-2je-u6x"}
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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@ Feature: Dashboards
215215
And the response "widgets[0].definition.check" is equal to "datadog.agent.up"
216216
And the response "widgets[0].definition.grouping" is equal to "check"
217217

218+
@team:DataDog/dashboards
219+
Scenario: Create a new dashboard with ci_test_stream list_stream widget
220+
Given new "CreateDashboard" request
221+
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":"ci_test_stream","query_string":"test_level:suite"},"response_format":"event_list"}]}}]}
222+
When the request is sent
223+
Then the response status is 200 OK
224+
And the response "widgets[0].definition.type" is equal to "list_stream"
225+
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "ci_test_stream"
226+
And the response "widgets[0].definition.requests[0].query.query_string" is equal to "test_level:suite"
227+
218228
@team:DataDog/dashboards
219229
Scenario: Create a new dashboard with distribution widget and apm stats data
220230
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)