Skip to content
Open
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
70 changes: 70 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,8 @@ components:
format: date-time
readOnly: true
type: string
default_timeframe:
$ref: "#/components/schemas/DashboardDefaultTimeframeSetting"
description:
description: Description of the dashboard.
nullable: true
Expand Down Expand Up @@ -1557,13 +1559,55 @@ components:
required:
- data
type: object
DashboardDefaultTimeframeSetting:
description: The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
discriminator:
mapping:
fixed: "#/components/schemas/DashboardFixedTimeframe"
live: "#/components/schemas/DashboardLiveTimeframe"
propertyName: type
nullable: true
oneOf:
- $ref: "#/components/schemas/DashboardLiveTimeframe"
- $ref: "#/components/schemas/DashboardFixedTimeframe"
type: object
DashboardDeleteResponse:
description: Response from the delete dashboard call.
properties:
deleted_dashboard_id:
description: ID of the deleted dashboard.
type: string
type: object
DashboardFixedTimeframe:
description: A fixed dashboard timeframe.
properties:
from:
description: Start time in milliseconds since epoch.
example: 1712080128000
format: int64
minimum: 0
type: integer
to:
description: End time in milliseconds since epoch.
example: 1712083128000
format: int64
minimum: 0
type: integer
type:
$ref: "#/components/schemas/DashboardFixedTimeframeType"
required:
- type
- from
- to
type: object
DashboardFixedTimeframeType:
description: Type of fixed timeframe.
enum:
- fixed
example: fixed
type: string
x-enum-varnames:
- FIXED
DashboardGlobalTime:
description: Object containing the live span selection for the dashboard.
properties:
Expand Down Expand Up @@ -1672,6 +1716,32 @@ components:
$ref: "#/components/schemas/DashboardList"
type: array
type: object
DashboardLiveTimeframe:
description: A live dashboard timeframe.
properties:
type:
$ref: "#/components/schemas/DashboardLiveTimeframeType"
unit:
$ref: "#/components/schemas/WidgetLiveSpanUnit"
value:
description: Value of the live timeframe span.
example: 4
format: int64
minimum: 1
type: integer
required:
- type
- value
- unit
type: object
DashboardLiveTimeframeType:
description: Type of live timeframe.
enum:
- live
example: live
type: string
x-enum-varnames:
- LIVE
DashboardReflowType:
description: |-
Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'.
Expand Down
35 changes: 35 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,34 @@ datadog\_api\_client.v1.model.dashboard\_bulk\_delete\_request module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_default\_timeframe\_setting module
---------------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.dashboard_default_timeframe_setting
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_delete\_response module
----------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.dashboard_delete_response
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_fixed\_timeframe module
----------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.dashboard_fixed_timeframe
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_fixed\_timeframe\_type module
----------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.dashboard_fixed_timeframe_type
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_global\_time module
------------------------------------------------------------

Expand Down Expand Up @@ -620,6 +641,20 @@ datadog\_api\_client.v1.model.dashboard\_list\_list\_response module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_live\_timeframe module
---------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.dashboard_live_timeframe
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_live\_timeframe\_type module
---------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.dashboard_live_timeframe_type
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_reflow\_type module
------------------------------------------------------------

Expand Down
16 changes: 16 additions & 0 deletions src/datadog_api_client/v1/model/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@


if TYPE_CHECKING:
from datadog_api_client.v1.model.dashboard_default_timeframe_setting import DashboardDefaultTimeframeSetting
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.dashboard_reflow_type import DashboardReflowType
from datadog_api_client.v1.model.dashboard_tab import DashboardTab
from datadog_api_client.v1.model.dashboard_template_variable_preset import DashboardTemplateVariablePreset
from datadog_api_client.v1.model.dashboard_template_variable import DashboardTemplateVariable
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.dashboard_live_timeframe import DashboardLiveTimeframe
from datadog_api_client.v1.model.dashboard_fixed_timeframe import DashboardFixedTimeframe


class Dashboard(ModelNormal):
Expand All @@ -36,6 +39,7 @@ class Dashboard(ModelNormal):

@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.dashboard_default_timeframe_setting import DashboardDefaultTimeframeSetting
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.dashboard_reflow_type import DashboardReflowType
from datadog_api_client.v1.model.dashboard_tab import DashboardTab
Expand All @@ -47,6 +51,7 @@ def openapi_types(_):
"author_handle": (str,),
"author_name": (str, none_type),
"created_at": (datetime,),
"default_timeframe": (DashboardDefaultTimeframeSetting,),
"description": (str, none_type),
"id": (str,),
"is_read_only": (bool,),
Expand All @@ -68,6 +73,7 @@ def openapi_types(_):
"author_handle": "author_handle",
"author_name": "author_name",
"created_at": "created_at",
"default_timeframe": "default_timeframe",
"description": "description",
"id": "id",
"is_read_only": "is_read_only",
Expand Down Expand Up @@ -101,6 +107,11 @@ def __init__(
author_handle: Union[str, UnsetType] = unset,
author_name: Union[str, none_type, UnsetType] = unset,
created_at: Union[datetime, UnsetType] = unset,
default_timeframe: Union[
Union[DashboardDefaultTimeframeSetting, DashboardLiveTimeframe, DashboardFixedTimeframe],
none_type,
UnsetType,
] = unset,
description: Union[str, none_type, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
is_read_only: Union[bool, UnsetType] = unset,
Expand Down Expand Up @@ -128,6 +139,9 @@ def __init__(
:param created_at: Creation date of the dashboard.
:type created_at: datetime, optional

:param default_timeframe: The default timeframe applied when opening the dashboard. Set to ``null`` to clear the dashboard's default timeframe.
:type default_timeframe: DashboardDefaultTimeframeSetting, none_type, optional

:param description: Description of the dashboard.
:type description: str, none_type, optional

Expand Down Expand Up @@ -183,6 +197,8 @@ def __init__(
kwargs["author_name"] = author_name
if created_at is not unset:
kwargs["created_at"] = created_at
if default_timeframe is not unset:
kwargs["default_timeframe"] = default_timeframe
if description is not unset:
kwargs["description"] = description
if id is not unset:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelComposed,
cached_property,
)


class DashboardDefaultTimeframeSetting(ModelComposed):
_nullable = True

def __init__(self, **kwargs):
"""
The default timeframe applied when opening the dashboard. Set to ``null`` to clear the dashboard's default timeframe.

:param type: Type of live timeframe.
:type type: DashboardLiveTimeframeType

:param unit: Unit of the time span.
:type unit: WidgetLiveSpanUnit

:param value: Value of the live timeframe span.
:type value: int

:param _from: Start time in milliseconds since epoch.
:type _from: int

:param to: End time in milliseconds since epoch.
:type to: int
"""
super().__init__(kwargs)

@cached_property
def _composed_schemas(_):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
from datadog_api_client.v1.model.dashboard_live_timeframe import DashboardLiveTimeframe
from datadog_api_client.v1.model.dashboard_fixed_timeframe import DashboardFixedTimeframe

return {
"oneOf": [
DashboardLiveTimeframe,
DashboardFixedTimeframe,
],
}
61 changes: 61 additions & 0 deletions src/datadog_api_client/v1/model/dashboard_fixed_timeframe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v1.model.dashboard_fixed_timeframe_type import DashboardFixedTimeframeType


class DashboardFixedTimeframe(ModelNormal):
validations = {
"_from": {
"inclusive_minimum": 0,
},
"to": {
"inclusive_minimum": 0,
},
}

@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.dashboard_fixed_timeframe_type import DashboardFixedTimeframeType

return {
"_from": (int,),
"to": (int,),
"type": (DashboardFixedTimeframeType,),
}

attribute_map = {
"_from": "from",
"to": "to",
"type": "type",
}

def __init__(self_, _from: int, to: int, type: DashboardFixedTimeframeType, **kwargs):
"""
A fixed dashboard timeframe.

:param _from: Start time in milliseconds since epoch.
:type _from: int

:param to: End time in milliseconds since epoch.
:type to: int

:param type: Type of fixed timeframe.
:type type: DashboardFixedTimeframeType
"""
super().__init__(kwargs)

self_._from = _from
self_.to = to
self_.type = type
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class DashboardFixedTimeframeType(ModelSimple):
"""
Type of fixed timeframe.

:param value: If omitted defaults to "fixed". Must be one of ["fixed"].
:type value: str
"""

allowed_values = {
"fixed",
}
FIXED: ClassVar["DashboardFixedTimeframeType"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


DashboardFixedTimeframeType.FIXED = DashboardFixedTimeframeType("fixed")
Loading
Loading