Skip to content

Add citest stream to ListStreamSource #1358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-03-02 18:29:33.159238",
"spec_repo_commit": "911d7cda"
"regenerated": "2023-03-02 20:54:09.140271",
"spec_repo_commit": "b2aaf22c"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-03-02 18:29:33.171186",
"spec_repo_commit": "911d7cda"
"regenerated": "2023-03-02 20:54:09.152032",
"spec_repo_commit": "b2aaf22c"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4137,6 +4137,7 @@ components:
- logs_stream
- audit_stream
- ci_pipeline_stream
- ci_test_stream
- rum_issue_stream
- apm_issue_stream
- logs_pattern_stream
Expand All @@ -4148,6 +4149,7 @@ components:
- LOGS_STREAM
- AUDIT_STREAM
- CI_PIPELINE_STREAM
- CI_TEST_STREAM
- RUM_ISSUE_STREAM
- APM_ISSUE_STREAM
- LOGS_PATTERN_STREAM
Expand Down
51 changes: 51 additions & 0 deletions examples/v1/dashboards/CreateDashboard_3195475781.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""
Create a new dashboard with ci_test_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

body = Dashboard(
layout_type=DashboardLayoutType.ORDERED,
title="Example-Create_a_new_dashboard_with_ci_test_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.CI_TEST_STREAM,
query_string="test_level:suite",
),
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)
5 changes: 4 additions & 1 deletion src/datadog_api_client/v1/model/list_stream_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ 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", "ci_pipeline_stream", "rum_issue_stream", "apm_issue_stream", "logs_pattern_stream", "logs_transaction_stream", "event_stream"].
: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"].
:type value: str
"""

allowed_values = {
"logs_stream",
"audit_stream",
"ci_pipeline_stream",
"ci_test_stream",
"rum_issue_stream",
"apm_issue_stream",
"logs_pattern_stream",
Expand All @@ -33,6 +34,7 @@ class ListStreamSource(ModelSimple):
LOGS_STREAM: ClassVar["ListStreamSource"]
AUDIT_STREAM: ClassVar["ListStreamSource"]
CI_PIPELINE_STREAM: ClassVar["ListStreamSource"]
CI_TEST_STREAM: ClassVar["ListStreamSource"]
RUM_ISSUE_STREAM: ClassVar["ListStreamSource"]
APM_ISSUE_STREAM: ClassVar["ListStreamSource"]
LOGS_PATTERN_STREAM: ClassVar["ListStreamSource"]
Expand All @@ -49,6 +51,7 @@ def openapi_types(_):
ListStreamSource.LOGS_STREAM = ListStreamSource("logs_stream")
ListStreamSource.AUDIT_STREAM = ListStreamSource("audit_stream")
ListStreamSource.CI_PIPELINE_STREAM = ListStreamSource("ci_pipeline_stream")
ListStreamSource.CI_TEST_STREAM = ListStreamSource("ci_test_stream")
ListStreamSource.RUM_ISSUE_STREAM = ListStreamSource("rum_issue_stream")
ListStreamSource.APM_ISSUE_STREAM = ListStreamSource("apm_issue_stream")
ListStreamSource.LOGS_PATTERN_STREAM = ListStreamSource("logs_pattern_stream")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-03-02T20:37:14.366Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
interactions:
- request:
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_ci_test_stream_list_stream_widget-1677789434
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"}}]}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v1/dashboard
response:
body:
string: '{"id":"mdr-2je-u6x","title":"Test-Create_a_new_dashboard_with_ci_test_stream_list_stream_widget-1677789434
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":[]}

'
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/mdr-2je-u6x
response:
body:
string: '{"deleted_dashboard_id":"mdr-2je-u6x"}

'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
10 changes: 10 additions & 0 deletions tests/v1/features/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@ Feature: Dashboards
And the response "widgets[0].definition.check" is equal to "datadog.agent.up"
And the response "widgets[0].definition.grouping" is equal to "check"

@team:DataDog/dashboards
Scenario: Create a new dashboard with ci_test_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":"ci_test_stream","query_string":"test_level:suite"},"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].query.data_source" is equal to "ci_test_stream"
And the response "widgets[0].definition.requests[0].query.query_string" is equal to "test_level:suite"

@team:DataDog/dashboards
Scenario: Create a new dashboard with distribution widget and apm stats data
Given new "CreateDashboard" request
Expand Down