Skip to content

Commit eab4a8d

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit d8d7c4e of spec repo
1 parent d6973c6 commit eab4a8d

11 files changed

Lines changed: 431 additions & 3 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,8 @@ components:
14431443
format: date-time
14441444
readOnly: true
14451445
type: string
1446+
default_timeframe:
1447+
$ref: "#/components/schemas/DashboardDefaultTimeframeSetting"
14461448
description:
14471449
description: Description of the dashboard.
14481450
nullable: true
@@ -1557,13 +1559,50 @@ components:
15571559
required:
15581560
- data
15591561
type: object
1562+
DashboardDefaultTimeframeSetting:
1563+
description: The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
1564+
nullable: true
1565+
oneOf:
1566+
- $ref: "#/components/schemas/DashboardLiveTimeframe"
1567+
- $ref: "#/components/schemas/DashboardFixedTimeframe"
1568+
type: object
15601569
DashboardDeleteResponse:
15611570
description: Response from the delete dashboard call.
15621571
properties:
15631572
deleted_dashboard_id:
15641573
description: ID of the deleted dashboard.
15651574
type: string
15661575
type: object
1576+
DashboardFixedTimeframe:
1577+
description: A fixed dashboard timeframe.
1578+
properties:
1579+
from:
1580+
description: Start time in milliseconds since epoch.
1581+
example: 1712080128000
1582+
format: int64
1583+
minimum: 0
1584+
type: integer
1585+
to:
1586+
description: End time in milliseconds since epoch.
1587+
example: 1712083128000
1588+
format: int64
1589+
minimum: 0
1590+
type: integer
1591+
type:
1592+
$ref: "#/components/schemas/DashboardFixedTimeframeType"
1593+
required:
1594+
- type
1595+
- from
1596+
- to
1597+
type: object
1598+
DashboardFixedTimeframeType:
1599+
description: Type of fixed timeframe.
1600+
enum:
1601+
- fixed
1602+
example: fixed
1603+
type: string
1604+
x-enum-varnames:
1605+
- FIXED
15671606
DashboardGlobalTime:
15681607
description: Object containing the live span selection for the dashboard.
15691608
properties:
@@ -1672,6 +1711,32 @@ components:
16721711
$ref: "#/components/schemas/DashboardList"
16731712
type: array
16741713
type: object
1714+
DashboardLiveTimeframe:
1715+
description: A live dashboard timeframe.
1716+
properties:
1717+
type:
1718+
$ref: "#/components/schemas/DashboardLiveTimeframeType"
1719+
unit:
1720+
$ref: "#/components/schemas/WidgetLiveSpanUnit"
1721+
value:
1722+
description: Value of the live timeframe span.
1723+
example: 4
1724+
format: int64
1725+
minimum: 1
1726+
type: integer
1727+
required:
1728+
- type
1729+
- value
1730+
- unit
1731+
type: object
1732+
DashboardLiveTimeframeType:
1733+
description: Type of live timeframe.
1734+
enum:
1735+
- live
1736+
example: live
1737+
type: string
1738+
x-enum-varnames:
1739+
- LIVE
16751740
DashboardReflowType:
16761741
description: |-
16771742
Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'.

docs/datadog_api_client.v1.model.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,13 +564,34 @@ datadog\_api\_client.v1.model.dashboard\_bulk\_delete\_request module
564564
:members:
565565
:show-inheritance:
566566

567+
datadog\_api\_client.v1.model.dashboard\_default\_timeframe\_setting module
568+
---------------------------------------------------------------------------
569+
570+
.. automodule:: datadog_api_client.v1.model.dashboard_default_timeframe_setting
571+
:members:
572+
:show-inheritance:
573+
567574
datadog\_api\_client.v1.model.dashboard\_delete\_response module
568575
----------------------------------------------------------------
569576

570577
.. automodule:: datadog_api_client.v1.model.dashboard_delete_response
571578
:members:
572579
:show-inheritance:
573580

581+
datadog\_api\_client.v1.model.dashboard\_fixed\_timeframe module
582+
----------------------------------------------------------------
583+
584+
.. automodule:: datadog_api_client.v1.model.dashboard_fixed_timeframe
585+
:members:
586+
:show-inheritance:
587+
588+
datadog\_api\_client.v1.model.dashboard\_fixed\_timeframe\_type module
589+
----------------------------------------------------------------------
590+
591+
.. automodule:: datadog_api_client.v1.model.dashboard_fixed_timeframe_type
592+
:members:
593+
:show-inheritance:
594+
574595
datadog\_api\_client.v1.model.dashboard\_global\_time module
575596
------------------------------------------------------------
576597

@@ -620,6 +641,20 @@ datadog\_api\_client.v1.model.dashboard\_list\_list\_response module
620641
:members:
621642
:show-inheritance:
622643

644+
datadog\_api\_client.v1.model.dashboard\_live\_timeframe module
645+
---------------------------------------------------------------
646+
647+
.. automodule:: datadog_api_client.v1.model.dashboard_live_timeframe
648+
:members:
649+
:show-inheritance:
650+
651+
datadog\_api\_client.v1.model.dashboard\_live\_timeframe\_type module
652+
---------------------------------------------------------------------
653+
654+
.. automodule:: datadog_api_client.v1.model.dashboard_live_timeframe_type
655+
:members:
656+
:show-inheritance:
657+
623658
datadog\_api\_client.v1.model.dashboard\_reflow\_type module
624659
------------------------------------------------------------
625660

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""
2+
Create a new dashboard with a live default_timeframe returns "OK" response
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.dashboard_live_timeframe import DashboardLiveTimeframe
10+
from datadog_api_client.v1.model.dashboard_live_timeframe_type import DashboardLiveTimeframeType
11+
from datadog_api_client.v1.model.note_widget_definition import NoteWidgetDefinition
12+
from datadog_api_client.v1.model.note_widget_definition_type import NoteWidgetDefinitionType
13+
from datadog_api_client.v1.model.widget import Widget
14+
from datadog_api_client.v1.model.widget_live_span_unit import WidgetLiveSpanUnit
15+
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
16+
from datadog_api_client.v1.model.widget_tick_edge import WidgetTickEdge
17+
18+
body = Dashboard(
19+
title="Example-Dashboard",
20+
layout_type=DashboardLayoutType.ORDERED,
21+
widgets=[
22+
Widget(
23+
definition=NoteWidgetDefinition(
24+
type=NoteWidgetDefinitionType.NOTE,
25+
content="test",
26+
background_color="white",
27+
font_size="14",
28+
text_align=WidgetTextAlign.LEFT,
29+
show_tick=False,
30+
tick_pos="50%",
31+
tick_edge=WidgetTickEdge.LEFT,
32+
),
33+
),
34+
],
35+
default_timeframe=DashboardLiveTimeframe(
36+
type=DashboardLiveTimeframeType.LIVE,
37+
unit=WidgetLiveSpanUnit.HOUR,
38+
value=4,
39+
),
40+
)
41+
42+
configuration = Configuration()
43+
with ApiClient(configuration) as api_client:
44+
api_instance = DashboardsApi(api_client)
45+
response = api_instance.create_dashboard(body=body)
46+
47+
print(response)

src/datadog_api_client/v1/model/dashboard.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616

1717

1818
if TYPE_CHECKING:
19+
from datadog_api_client.v1.model.dashboard_default_timeframe_setting import DashboardDefaultTimeframeSetting
1920
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
2021
from datadog_api_client.v1.model.dashboard_reflow_type import DashboardReflowType
2122
from datadog_api_client.v1.model.dashboard_tab import DashboardTab
2223
from datadog_api_client.v1.model.dashboard_template_variable_preset import DashboardTemplateVariablePreset
2324
from datadog_api_client.v1.model.dashboard_template_variable import DashboardTemplateVariable
2425
from datadog_api_client.v1.model.widget import Widget
26+
from datadog_api_client.v1.model.dashboard_live_timeframe import DashboardLiveTimeframe
27+
from datadog_api_client.v1.model.dashboard_fixed_timeframe import DashboardFixedTimeframe
2528

2629

2730
class Dashboard(ModelNormal):
@@ -36,6 +39,7 @@ class Dashboard(ModelNormal):
3639

3740
@cached_property
3841
def openapi_types(_):
42+
from datadog_api_client.v1.model.dashboard_default_timeframe_setting import DashboardDefaultTimeframeSetting
3943
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
4044
from datadog_api_client.v1.model.dashboard_reflow_type import DashboardReflowType
4145
from datadog_api_client.v1.model.dashboard_tab import DashboardTab
@@ -47,6 +51,7 @@ def openapi_types(_):
4751
"author_handle": (str,),
4852
"author_name": (str, none_type),
4953
"created_at": (datetime,),
54+
"default_timeframe": (DashboardDefaultTimeframeSetting,),
5055
"description": (str, none_type),
5156
"id": (str,),
5257
"is_read_only": (bool,),
@@ -68,6 +73,7 @@ def openapi_types(_):
6873
"author_handle": "author_handle",
6974
"author_name": "author_name",
7075
"created_at": "created_at",
76+
"default_timeframe": "default_timeframe",
7177
"description": "description",
7278
"id": "id",
7379
"is_read_only": "is_read_only",
@@ -101,6 +107,11 @@ def __init__(
101107
author_handle: Union[str, UnsetType] = unset,
102108
author_name: Union[str, none_type, UnsetType] = unset,
103109
created_at: Union[datetime, UnsetType] = unset,
110+
default_timeframe: Union[
111+
Union[DashboardDefaultTimeframeSetting, DashboardLiveTimeframe, DashboardFixedTimeframe],
112+
none_type,
113+
UnsetType,
114+
] = unset,
104115
description: Union[str, none_type, UnsetType] = unset,
105116
id: Union[str, UnsetType] = unset,
106117
is_read_only: Union[bool, UnsetType] = unset,
@@ -128,6 +139,9 @@ def __init__(
128139
:param created_at: Creation date of the dashboard.
129140
:type created_at: datetime, optional
130141
142+
:param default_timeframe: The default timeframe applied when opening the dashboard. Set to ``null`` to clear the dashboard's default timeframe.
143+
:type default_timeframe: DashboardDefaultTimeframeSetting, none_type, optional
144+
131145
:param description: Description of the dashboard.
132146
:type description: str, none_type, optional
133147
@@ -183,6 +197,8 @@ def __init__(
183197
kwargs["author_name"] = author_name
184198
if created_at is not unset:
185199
kwargs["created_at"] = created_at
200+
if default_timeframe is not unset:
201+
kwargs["default_timeframe"] = default_timeframe
186202
if description is not unset:
187203
kwargs["description"] = description
188204
if id is not unset:
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
ModelComposed,
9+
cached_property,
10+
)
11+
12+
13+
class DashboardDefaultTimeframeSetting(ModelComposed):
14+
_nullable = True
15+
16+
def __init__(self, **kwargs):
17+
"""
18+
The default timeframe applied when opening the dashboard. Set to ``null`` to clear the dashboard's default timeframe.
19+
20+
:param type: Type of live timeframe.
21+
:type type: DashboardLiveTimeframeType
22+
23+
:param unit: Unit of the time span.
24+
:type unit: WidgetLiveSpanUnit
25+
26+
:param value: Value of the live timeframe span.
27+
:type value: int
28+
29+
:param _from: Start time in milliseconds since epoch.
30+
:type _from: int
31+
32+
:param to: End time in milliseconds since epoch.
33+
:type to: int
34+
"""
35+
super().__init__(kwargs)
36+
37+
@cached_property
38+
def _composed_schemas(_):
39+
# we need this here to make our import statements work
40+
# we must store _composed_schemas in here so the code is only run
41+
# when we invoke this method. If we kept this at the class
42+
# level we would get an error because the class level
43+
# code would be run when this module is imported, and these composed
44+
# classes don't exist yet because their module has not finished
45+
# loading
46+
from datadog_api_client.v1.model.dashboard_live_timeframe import DashboardLiveTimeframe
47+
from datadog_api_client.v1.model.dashboard_fixed_timeframe import DashboardFixedTimeframe
48+
49+
return {
50+
"oneOf": [
51+
DashboardLiveTimeframe,
52+
DashboardFixedTimeframe,
53+
],
54+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
from typing import TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
)
12+
13+
14+
if TYPE_CHECKING:
15+
from datadog_api_client.v1.model.dashboard_fixed_timeframe_type import DashboardFixedTimeframeType
16+
17+
18+
class DashboardFixedTimeframe(ModelNormal):
19+
validations = {
20+
"_from": {
21+
"inclusive_minimum": 0,
22+
},
23+
"to": {
24+
"inclusive_minimum": 0,
25+
},
26+
}
27+
28+
@cached_property
29+
def openapi_types(_):
30+
from datadog_api_client.v1.model.dashboard_fixed_timeframe_type import DashboardFixedTimeframeType
31+
32+
return {
33+
"_from": (int,),
34+
"to": (int,),
35+
"type": (DashboardFixedTimeframeType,),
36+
}
37+
38+
attribute_map = {
39+
"_from": "from",
40+
"to": "to",
41+
"type": "type",
42+
}
43+
44+
def __init__(self_, _from: int, to: int, type: DashboardFixedTimeframeType, **kwargs):
45+
"""
46+
A fixed dashboard timeframe.
47+
48+
:param _from: Start time in milliseconds since epoch.
49+
:type _from: int
50+
51+
:param to: End time in milliseconds since epoch.
52+
:type to: int
53+
54+
:param type: Type of fixed timeframe.
55+
:type type: DashboardFixedTimeframeType
56+
"""
57+
super().__init__(kwargs)
58+
59+
self_._from = _from
60+
self_.to = to
61+
self_.type = type

0 commit comments

Comments
 (0)