Skip to content

Commit fdd4f17

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit fe3f31e4 of spec repo
1 parent 83dd302 commit fdd4f17

File tree

8 files changed

+139
-8
lines changed

8 files changed

+139
-8
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.5",
7-
"regenerated": "2023-07-14 13:32:03.152627",
8-
"spec_repo_commit": "2bd58701"
7+
"regenerated": "2023-07-14 19:02:21.181585",
8+
"spec_repo_commit": "fe3f31e4"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-07-14 13:32:03.246638",
13-
"spec_repo_commit": "2bd58701"
12+
"regenerated": "2023-07-14 19:02:21.198492",
13+
"spec_repo_commit": "fe3f31e4"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19366,16 +19366,19 @@ components:
1936619366
- $ref: '#/components/schemas/TopologyMapWidgetDefinition'
1936719367
type: object
1936819368
WidgetDisplayType:
19369-
description: Type of display to use for the request.
19369+
description: Type of display to use for the request. The `overlay` display type
19370+
is only compatible with widgets of type `timeseries`.
1937019371
enum:
1937119372
- area
1937219373
- bars
1937319374
- line
19375+
- overlay
1937419376
type: string
1937519377
x-enum-varnames:
1937619378
- AREA
1937719379
- BARS
1937819380
- LINE
19381+
- OVERLAY
1937919382
WidgetEvent:
1938019383
description: 'Event overlay control options.
1938119384

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
"""
2+
Create a new dashboard with a timeseries widget and an overlay request
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.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource
10+
from datadog_api_client.v1.model.formula_and_function_metric_query_definition import (
11+
FormulaAndFunctionMetricQueryDefinition,
12+
)
13+
from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat
14+
from datadog_api_client.v1.model.timeseries_widget_definition import TimeseriesWidgetDefinition
15+
from datadog_api_client.v1.model.timeseries_widget_definition_type import TimeseriesWidgetDefinitionType
16+
from datadog_api_client.v1.model.timeseries_widget_request import TimeseriesWidgetRequest
17+
from datadog_api_client.v1.model.widget import Widget
18+
from datadog_api_client.v1.model.widget_display_type import WidgetDisplayType
19+
from datadog_api_client.v1.model.widget_line_type import WidgetLineType
20+
from datadog_api_client.v1.model.widget_line_width import WidgetLineWidth
21+
from datadog_api_client.v1.model.widget_request_style import WidgetRequestStyle
22+
23+
body = Dashboard(
24+
layout_type=DashboardLayoutType.ORDERED,
25+
title="Example-Dashboard",
26+
widgets=[
27+
Widget(
28+
definition=TimeseriesWidgetDefinition(
29+
type=TimeseriesWidgetDefinitionType.TIMESERIES,
30+
requests=[
31+
TimeseriesWidgetRequest(
32+
on_right_yaxis=False,
33+
queries=[
34+
FormulaAndFunctionMetricQueryDefinition(
35+
data_source=FormulaAndFunctionMetricDataSource.METRICS,
36+
name="mymetric",
37+
query="avg:system.cpu.user{*}",
38+
),
39+
],
40+
response_format=FormulaAndFunctionResponseFormat.TIMESERIES,
41+
display_type=WidgetDisplayType.LINE,
42+
),
43+
TimeseriesWidgetRequest(
44+
response_format=FormulaAndFunctionResponseFormat.TIMESERIES,
45+
queries=[
46+
FormulaAndFunctionMetricQueryDefinition(
47+
data_source=FormulaAndFunctionMetricDataSource.METRICS,
48+
name="mymetricoverlay",
49+
query="avg:system.cpu.user{*}",
50+
),
51+
],
52+
style=WidgetRequestStyle(
53+
palette="purple",
54+
line_type=WidgetLineType.SOLID,
55+
line_width=WidgetLineWidth.NORMAL,
56+
),
57+
display_type=WidgetDisplayType.OVERLAY,
58+
),
59+
],
60+
),
61+
),
62+
],
63+
)
64+
65+
configuration = Configuration()
66+
with ApiClient(configuration) as api_client:
67+
api_instance = DashboardsApi(api_client)
68+
response = api_instance.create_dashboard(body=body)
69+
70+
print(response)

src/datadog_api_client/v1/model/timeseries_widget_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def __init__(
141141
:param audit_query: The log query.
142142
:type audit_query: LogQueryDefinition, optional
143143
144-
:param display_type: Type of display to use for the request.
144+
:param display_type: Type of display to use for the request. The ``overlay`` display type is only compatible with widgets of type ``timeseries``.
145145
:type display_type: WidgetDisplayType, optional
146146
147147
:param event_query: The log query.

src/datadog_api_client/v1/model/widget_display_type.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,22 @@
1414

1515
class WidgetDisplayType(ModelSimple):
1616
"""
17-
Type of display to use for the request.
17+
Type of display to use for the request. The `overlay` display type is only compatible with widgets of type `timeseries`.
1818
19-
:param value: Must be one of ["area", "bars", "line"].
19+
:param value: Must be one of ["area", "bars", "line", "overlay"].
2020
:type value: str
2121
"""
2222

2323
allowed_values = {
2424
"area",
2525
"bars",
2626
"line",
27+
"overlay",
2728
}
2829
AREA: ClassVar["WidgetDisplayType"]
2930
BARS: ClassVar["WidgetDisplayType"]
3031
LINE: ClassVar["WidgetDisplayType"]
32+
OVERLAY: ClassVar["WidgetDisplayType"]
3133

3234
@cached_property
3335
def openapi_types(_):
@@ -39,3 +41,4 @@ def openapi_types(_):
3941
WidgetDisplayType.AREA = WidgetDisplayType("area")
4042
WidgetDisplayType.BARS = WidgetDisplayType("bars")
4143
WidgetDisplayType.LINE = WidgetDisplayType("line")
44+
WidgetDisplayType.OVERLAY = WidgetDisplayType("overlay")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-07-14T16:50:52.704Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
interactions:
2+
- request:
3+
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_a_timeseries_widget_and_an_overlay_request-1689353452","widgets":[{"definition":{"requests":[{"display_type":"line","on_right_yaxis":false,"queries":[{"data_source":"metrics","name":"mymetric","query":"avg:system.cpu.user{*}"}],"response_format":"timeseries"},{"display_type":"overlay","queries":[{"data_source":"metrics","name":"mymetricoverlay","query":"avg:system.cpu.user{*}"}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"purple"}}],"type":"timeseries"}}]}'
4+
headers:
5+
accept:
6+
- application/json
7+
content-type:
8+
- application/json
9+
method: POST
10+
uri: https://api.datadoghq.com/api/v1/dashboard
11+
response:
12+
body:
13+
string: '{"id":"56a-eq2-76i","title":"Test-Create_a_new_dashboard_with_a_timeseries_widget_and_an_overlay_request-1689353452","description":null,"author_handle":"[email protected]","author_name":null,"layout_type":"ordered","url":"/dashboard/56a-eq2-76i/test-createanewdashboardwithatimeserieswidgetandanoverlayrequest-1689353452","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"display_type":"line","on_right_yaxis":false,"queries":[{"data_source":"metrics","name":"mymetric","query":"avg:system.cpu.user{*}"}],"response_format":"timeseries"},{"display_type":"overlay","queries":[{"data_source":"metrics","name":"mymetricoverlay","query":"avg:system.cpu.user{*}"}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"purple"}}],"type":"timeseries"},"id":4582756152438811}],"notify_list":null,"created_at":"2023-07-14T16:50:52.916992+00:00","modified_at":"2023-07-14T16:50:52.916992+00:00","restricted_roles":[]}
14+
15+
'
16+
headers:
17+
content-type:
18+
- application/json
19+
status:
20+
code: 200
21+
message: OK
22+
- request:
23+
body: null
24+
headers:
25+
accept:
26+
- application/json
27+
method: DELETE
28+
uri: https://api.datadoghq.com/api/v1/dashboard/56a-eq2-76i
29+
response:
30+
body:
31+
string: '{"deleted_dashboard_id":"56a-eq2-76i"}
32+
33+
'
34+
headers:
35+
content-type:
36+
- application/json
37+
status:
38+
code: 200
39+
message: OK
40+
version: 1

tests/v1/features/dashboards.feature

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,20 @@ Feature: Dashboards
159159
And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar"
160160
And the response "widgets[0].definition.requests[0].queries[0].query" is equal to "sum:my.cool.count.metric{*}"
161161

162+
@team:DataDog/dashboards-backend
163+
Scenario: Create a new dashboard with a timeseries widget and an overlay request
164+
Given new "CreateDashboard" request
165+
And body with value {"layout_type": "ordered", "title": "{{ unique }}", "widgets": [{"definition": {"type": "timeseries", "requests": [{"on_right_yaxis": false, "queries": [{"data_source": "metrics", "name": "mymetric", "query": "avg:system.cpu.user{*}"}], "response_format": "timeseries", "display_type": "line"}, {"response_format": "timeseries", "queries": [{"data_source": "metrics", "name": "mymetricoverlay", "query": "avg:system.cpu.user{*}"}], "style": {"palette": "purple", "line_type": "solid", "line_width": "normal"}, "display_type": "overlay"}]}}]}
166+
When the request is sent
167+
Then the response status is 200 OK
168+
And the response "widgets[0].definition.requests[0].response_format" is equal to "timeseries"
169+
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "metrics"
170+
And the response "widgets[0].definition.requests[0].queries[0].name" is equal to "mymetric"
171+
And the response "widgets[0].definition.requests[0].queries[0].query" is equal to "avg:system.cpu.user{*}"
172+
And the response "widgets[0].definition.requests[1].display_type" is equal to "overlay"
173+
And the response "widgets[0].definition.requests[1].queries[0].query" is equal to "avg:system.cpu.user{*}"
174+
And the response "widgets[0].definition.requests[1].queries[0].name" is equal to "mymetricoverlay"
175+
162176
@team:DataDog/dashboards-backend
163177
Scenario: Create a new dashboard with a timeseries widget using formulas and functions cloud cost query
164178
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)