Skip to content

Commit a726e0a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Powerpack Live Span Support (#1738)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 34d2891 commit a726e0a

28 files changed

+219
-108
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.6",
7-
"regenerated": "2023-10-25 09:00:22.540949",
8-
"spec_repo_commit": "9ebdefa4"
7+
"regenerated": "2023-10-25 13:57:25.705674",
8+
"spec_repo_commit": "fb2f4134"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-25 09:00:22.569393",
13-
"spec_repo_commit": "9ebdefa4"
12+
"regenerated": "2023-10-25 13:57:25.768693",
13+
"spec_repo_commit": "fb2f4134"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11170,6 +11170,8 @@ components:
1117011170
$ref: '#/components/schemas/PowerpackGroupWidgetDefinition'
1117111171
layout:
1117211172
$ref: '#/components/schemas/PowerpackGroupWidgetLayout'
11173+
live_span:
11174+
$ref: '#/components/schemas/WidgetLiveSpan'
1117311175
required:
1117411176
- definition
1117511177
type: object
@@ -18581,6 +18583,42 @@ components:
1858118583
type: string
1858218584
x-enum-varnames:
1858318585
- USERS
18586+
WidgetLiveSpan:
18587+
description: The available timeframes depend on the widget you are using.
18588+
enum:
18589+
- 1m
18590+
- 5m
18591+
- 10m
18592+
- 15m
18593+
- 30m
18594+
- 1h
18595+
- 4h
18596+
- 1d
18597+
- 2d
18598+
- 1w
18599+
- 1mo
18600+
- 3mo
18601+
- 6mo
18602+
- 1y
18603+
- alert
18604+
example: 5m
18605+
type: string
18606+
x-enum-varnames:
18607+
- PAST_ONE_MINUTE
18608+
- PAST_FIVE_MINUTES
18609+
- PAST_TEN_MINUTES
18610+
- PAST_FIFTEEN_MINUTES
18611+
- PAST_THIRTY_MINUTES
18612+
- PAST_ONE_HOUR
18613+
- PAST_FOUR_HOURS
18614+
- PAST_ONE_DAY
18615+
- PAST_TWO_DAYS
18616+
- PAST_ONE_WEEK
18617+
- PAST_ONE_MONTH
18618+
- PAST_THREE_MONTHS
18619+
- PAST_SIX_MONTHS
18620+
- PAST_ONE_YEAR
18621+
- ALERT
1858418622
securitySchemes:
1858518623
AuthZ:
1858618624
description: This API uses OAuth 2 with the implicit grant flow.

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8373,6 +8373,13 @@ users\_type
83738373
:members:
83748374
:show-inheritance:
83758375

8376+
widget\_live\_span
8377+
------------------
8378+
8379+
.. automodule:: datadog_api_client.v2.model.widget_live_span
8380+
:members:
8381+
:show-inheritance:
8382+
83768383

83778384
.. automodule:: datadog_api_client.v2.model
83788385
:members:

examples/v2/powerpack/CreatePowerpack.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from datadog_api_client.v2.model.powerpack_group_widget_layout import PowerpackGroupWidgetLayout
1313
from datadog_api_client.v2.model.powerpack_inner_widgets import PowerpackInnerWidgets
1414
from datadog_api_client.v2.model.powerpack_template_variable import PowerpackTemplateVariable
15+
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan
1516

1617
body = Powerpack(
1718
data=PowerpackData(
@@ -35,6 +36,7 @@
3536
x=0,
3637
y=0,
3738
),
39+
live_span=WidgetLiveSpan.PAST_ONE_HOUR,
3840
),
3941
name="Example-Powerpack",
4042
tags=[

examples/v2/powerpack/UpdatePowerpack.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from datadog_api_client.v2.model.powerpack_group_widget_layout import PowerpackGroupWidgetLayout
1414
from datadog_api_client.v2.model.powerpack_inner_widgets import PowerpackInnerWidgets
1515
from datadog_api_client.v2.model.powerpack_template_variable import PowerpackTemplateVariable
16+
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan
1617

1718
# there is a valid "powerpack" in the system
1819
POWERPACK_DATA_ID = environ["POWERPACK_DATA_ID"]
@@ -39,6 +40,7 @@
3940
x=0,
4041
y=0,
4142
),
43+
live_span=WidgetLiveSpan.PAST_ONE_HOUR,
4244
),
4345
name="Example-Powerpack",
4446
tags=[

src/datadog_api_client/v2/model/powerpack_group_widget.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,33 @@
1616
if TYPE_CHECKING:
1717
from datadog_api_client.v2.model.powerpack_group_widget_definition import PowerpackGroupWidgetDefinition
1818
from datadog_api_client.v2.model.powerpack_group_widget_layout import PowerpackGroupWidgetLayout
19+
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan
1920

2021

2122
class PowerpackGroupWidget(ModelNormal):
2223
@cached_property
2324
def openapi_types(_):
2425
from datadog_api_client.v2.model.powerpack_group_widget_definition import PowerpackGroupWidgetDefinition
2526
from datadog_api_client.v2.model.powerpack_group_widget_layout import PowerpackGroupWidgetLayout
27+
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan
2628

2729
return {
2830
"definition": (PowerpackGroupWidgetDefinition,),
2931
"layout": (PowerpackGroupWidgetLayout,),
32+
"live_span": (WidgetLiveSpan,),
3033
}
3134

3235
attribute_map = {
3336
"definition": "definition",
3437
"layout": "layout",
38+
"live_span": "live_span",
3539
}
3640

3741
def __init__(
3842
self_,
3943
definition: PowerpackGroupWidgetDefinition,
4044
layout: Union[PowerpackGroupWidgetLayout, UnsetType] = unset,
45+
live_span: Union[WidgetLiveSpan, UnsetType] = unset,
4146
**kwargs,
4247
):
4348
"""
@@ -48,9 +53,14 @@ def __init__(
4853
4954
:param layout: Powerpack group widget layout.
5055
:type layout: PowerpackGroupWidgetLayout, optional
56+
57+
:param live_span: The available timeframes depend on the widget you are using.
58+
:type live_span: WidgetLiveSpan, optional
5159
"""
5260
if layout is not unset:
5361
kwargs["layout"] = layout
62+
if live_span is not unset:
63+
kwargs["live_span"] = live_span
5464
super().__init__(kwargs)
5565

5666
self_.definition = definition
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class WidgetLiveSpan(ModelSimple):
16+
"""
17+
The available timeframes depend on the widget you are using.
18+
19+
:param value: Must be one of ["1m", "5m", "10m", "15m", "30m", "1h", "4h", "1d", "2d", "1w", "1mo", "3mo", "6mo", "1y", "alert"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"1m",
25+
"5m",
26+
"10m",
27+
"15m",
28+
"30m",
29+
"1h",
30+
"4h",
31+
"1d",
32+
"2d",
33+
"1w",
34+
"1mo",
35+
"3mo",
36+
"6mo",
37+
"1y",
38+
"alert",
39+
}
40+
PAST_ONE_MINUTE: ClassVar["WidgetLiveSpan"]
41+
PAST_FIVE_MINUTES: ClassVar["WidgetLiveSpan"]
42+
PAST_TEN_MINUTES: ClassVar["WidgetLiveSpan"]
43+
PAST_FIFTEEN_MINUTES: ClassVar["WidgetLiveSpan"]
44+
PAST_THIRTY_MINUTES: ClassVar["WidgetLiveSpan"]
45+
PAST_ONE_HOUR: ClassVar["WidgetLiveSpan"]
46+
PAST_FOUR_HOURS: ClassVar["WidgetLiveSpan"]
47+
PAST_ONE_DAY: ClassVar["WidgetLiveSpan"]
48+
PAST_TWO_DAYS: ClassVar["WidgetLiveSpan"]
49+
PAST_ONE_WEEK: ClassVar["WidgetLiveSpan"]
50+
PAST_ONE_MONTH: ClassVar["WidgetLiveSpan"]
51+
PAST_THREE_MONTHS: ClassVar["WidgetLiveSpan"]
52+
PAST_SIX_MONTHS: ClassVar["WidgetLiveSpan"]
53+
PAST_ONE_YEAR: ClassVar["WidgetLiveSpan"]
54+
ALERT: ClassVar["WidgetLiveSpan"]
55+
56+
@cached_property
57+
def openapi_types(_):
58+
return {
59+
"value": (str,),
60+
}
61+
62+
63+
WidgetLiveSpan.PAST_ONE_MINUTE = WidgetLiveSpan("1m")
64+
WidgetLiveSpan.PAST_FIVE_MINUTES = WidgetLiveSpan("5m")
65+
WidgetLiveSpan.PAST_TEN_MINUTES = WidgetLiveSpan("10m")
66+
WidgetLiveSpan.PAST_FIFTEEN_MINUTES = WidgetLiveSpan("15m")
67+
WidgetLiveSpan.PAST_THIRTY_MINUTES = WidgetLiveSpan("30m")
68+
WidgetLiveSpan.PAST_ONE_HOUR = WidgetLiveSpan("1h")
69+
WidgetLiveSpan.PAST_FOUR_HOURS = WidgetLiveSpan("4h")
70+
WidgetLiveSpan.PAST_ONE_DAY = WidgetLiveSpan("1d")
71+
WidgetLiveSpan.PAST_TWO_DAYS = WidgetLiveSpan("2d")
72+
WidgetLiveSpan.PAST_ONE_WEEK = WidgetLiveSpan("1w")
73+
WidgetLiveSpan.PAST_ONE_MONTH = WidgetLiveSpan("1mo")
74+
WidgetLiveSpan.PAST_THREE_MONTHS = WidgetLiveSpan("3mo")
75+
WidgetLiveSpan.PAST_SIX_MONTHS = WidgetLiveSpan("6mo")
76+
WidgetLiveSpan.PAST_ONE_YEAR = WidgetLiveSpan("1y")
77+
WidgetLiveSpan.ALERT = WidgetLiveSpan("alert")

src/datadog_api_client/v2/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,7 @@
14261426
from datadog_api_client.v2.model.user_update_request import UserUpdateRequest
14271427
from datadog_api_client.v2.model.users_response import UsersResponse
14281428
from datadog_api_client.v2.model.users_type import UsersType
1429+
from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan
14291430

14301431
__all__ = [
14311432
"APIErrorResponse",
@@ -2628,4 +2629,5 @@
26282629
"UserUpdateRequest",
26292630
"UsersResponse",
26302631
"UsersType",
2632+
"WidgetLiveSpan",
26312633
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-10-11T18:44:47.026Z
1+
2023-10-24T18:32:08.933Z

tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_powerpack_widget.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
33
body: '{"data":{"attributes":{"description":"Sample powerpack","group_widget":{"definition":{"layout_type":"ordered","show_title":true,"title":"Sample
4-
Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"}}]},"layout":{"height":3,"width":12,"x":0,"y":0}},"name":"Test-Create_a_new_dashboard_with_powerpack_widget-1697049887","tags":["tag:sample"],"template_variables":[{"defaults":["*"],"name":"sample"}]},"type":"powerpack"}}'
4+
Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"}}]},"layout":{"height":3,"width":12,"x":0,"y":0},"live_span":"1h"},"name":"Test-Create_a_new_dashboard_with_powerpack_widget-1698172328","tags":["tag:sample"],"template_variables":[{"defaults":["*"],"name":"sample"}]},"type":"powerpack"}}'
55
headers:
66
accept:
77
- application/json
@@ -11,9 +11,10 @@ interactions:
1111
uri: https://api.datadoghq.com/api/v2/powerpacks
1212
response:
1313
body:
14-
string: '{"data":{"type":"powerpack","id":"40778356-6866-11ee-812e-da7ad0900002","attributes":{"name":"Test-Create_a_new_dashboard_with_powerpack_widget-1697049887","description":"Sample
14+
string: '{"data":{"type":"powerpack","id":"a3e591c8-729b-11ee-bde6-da7ad0900002","attributes":{"name":"Test-Create_a_new_dashboard_with_powerpack_widget-1698172328","description":"Sample
1515
powerpack","group_widget":{"definition":{"layout_type":"ordered","show_title":true,"title":"Sample
16-
Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"},"id":6750168893668334}]},"layout":{"height":3,"width":12,"x":0,"y":0}},"template_variables":[{"defaults":["*"],"name":"sample"}],"tags":["tag:sample"]},"relationships":{"author":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"email":"[email protected]"}}]}
16+
Powerpack","type":"group","widgets":[{"definition":{"content":"test","type":"note"},"id":1041433464205113}]},"layout":{"height":3,"width":12,"x":0,"y":0},"live_span":"1h"},"template_variables":[{"defaults":["*"],"name":"sample"}],"tags":["tag:sample"]},"relationships":{"author":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}},"included":[{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"name":"CI
17+
Account","email":"[email protected]"}}]}
1718
1819
'
1920
headers:
@@ -23,8 +24,8 @@ interactions:
2324
code: 200
2425
message: OK
2526
- request:
26-
body: '{"description":"description","is_read_only":false,"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_powerpack_widget-1697049887
27-
with powerpack widget","widgets":[{"definition":{"powerpack_id":"40778356-6866-11ee-812e-da7ad0900002","template_variables":{"controlled_by_powerpack":[{"name":"foo","prefix":"bar","values":["baz","qux","quuz"]}],"controlled_externally":[]},"type":"powerpack"},"layout":{"height":2,"is_column_break":false,"width":2,"x":1,"y":1}}]}'
27+
body: '{"description":"description","is_read_only":false,"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_powerpack_widget-1698172328
28+
with powerpack widget","widgets":[{"definition":{"powerpack_id":"a3e591c8-729b-11ee-bde6-da7ad0900002","template_variables":{"controlled_by_powerpack":[{"name":"foo","prefix":"bar","values":["baz","qux","quuz"]}],"controlled_externally":[]},"type":"powerpack"},"layout":{"height":2,"is_column_break":false,"width":2,"x":1,"y":1}}]}'
2829
headers:
2930
accept:
3031
- application/json
@@ -34,8 +35,9 @@ interactions:
3435
uri: https://api.datadoghq.com/api/v1/dashboard
3536
response:
3637
body:
37-
string: '{"id":"wap-jgr-c99","title":"Test-Create_a_new_dashboard_with_powerpack_widget-1697049887
38-
with powerpack widget","description":"description","author_handle":"[email protected]","author_name":null,"layout_type":"ordered","url":"/dashboard/wap-jgr-c99/test-createanewdashboardwithpowerpackwidget-1697049887-with-powerpack-widget","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"powerpack_id":"40778356-6866-11ee-812e-da7ad0900002","template_variables":{"controlled_by_powerpack":[{"name":"foo","prefix":"bar","values":["baz","qux","quuz"]}],"controlled_externally":[]},"type":"powerpack"},"layout":{"height":2,"is_column_break":false,"width":2,"x":1,"y":1},"id":2124665012947075}],"notify_list":null,"created_at":"2023-10-11T18:44:47.485150+00:00","modified_at":"2023-10-11T18:44:47.485150+00:00","restricted_roles":[]}
38+
string: '{"id":"u4a-itq-xia","title":"Test-Create_a_new_dashboard_with_powerpack_widget-1698172328
39+
with powerpack widget","description":"description","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
40+
Account","layout_type":"ordered","url":"/dashboard/u4a-itq-xia/test-createanewdashboardwithpowerpackwidget-1698172328-with-powerpack-widget","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"powerpack_id":"a3e591c8-729b-11ee-bde6-da7ad0900002","template_variables":{"controlled_by_powerpack":[{"name":"foo","prefix":"bar","values":["baz","qux","quuz"]}],"controlled_externally":[]},"type":"powerpack"},"layout":{"height":2,"is_column_break":false,"width":2,"x":1,"y":1},"id":1423357855337541}],"notify_list":null,"created_at":"2023-10-24T18:32:09.719784+00:00","modified_at":"2023-10-24T18:32:09.719784+00:00","restricted_roles":[]}
3941
4042
'
4143
headers:
@@ -50,10 +52,10 @@ interactions:
5052
accept:
5153
- application/json
5254
method: DELETE
53-
uri: https://api.datadoghq.com/api/v1/dashboard/wap-jgr-c99
55+
uri: https://api.datadoghq.com/api/v1/dashboard/u4a-itq-xia
5456
response:
5557
body:
56-
string: '{"deleted_dashboard_id":"wap-jgr-c99"}
58+
string: '{"deleted_dashboard_id":"u4a-itq-xia"}
5759
5860
'
5961
headers:
@@ -68,7 +70,7 @@ interactions:
6870
accept:
6971
- '*/*'
7072
method: DELETE
71-
uri: https://api.datadoghq.com/api/v2/powerpacks/40778356-6866-11ee-812e-da7ad0900002
73+
uri: https://api.datadoghq.com/api/v2/powerpacks/a3e591c8-729b-11ee-bde6-da7ad0900002
7274
response:
7375
body:
7476
string: ''

0 commit comments

Comments
 (0)