diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 2ba4dbf6d6..729000cd1e 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1443,6 +1443,10 @@ components: format: date-time readOnly: true type: string + default_timeframe: + $ref: "#/components/schemas/DashboardDefaultTimeframeSetting" + description: The default timeframe applied when opening the dashboard. Set to `null` to clear. + nullable: true description: description: Description of the dashboard. nullable: true @@ -1557,6 +1561,11 @@ 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. + oneOf: + - $ref: "#/components/schemas/DashboardLiveTimeframe" + - $ref: "#/components/schemas/DashboardFixedTimeframe" DashboardDeleteResponse: description: Response from the delete dashboard call. properties: @@ -1564,6 +1573,36 @@ components: 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: @@ -1672,6 +1711,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'. diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 1b6e3313f9..134b1fdbdd 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -564,6 +564,13 @@ 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 ---------------------------------------------------------------- @@ -571,6 +578,20 @@ datadog\_api\_client.v1.model.dashboard\_delete\_response module :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 ------------------------------------------------------------ @@ -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 ------------------------------------------------------------ diff --git a/examples/v1/dashboards/CreateDashboard_4032568083.py b/examples/v1/dashboards/CreateDashboard_4032568083.py new file mode 100644 index 0000000000..2a17f9407d --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_4032568083.py @@ -0,0 +1,47 @@ +""" +Create a new dashboard with a live default_timeframe returns "OK" response +""" + +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.dashboard_live_timeframe import DashboardLiveTimeframe +from datadog_api_client.v1.model.dashboard_live_timeframe_type import DashboardLiveTimeframeType +from datadog_api_client.v1.model.note_widget_definition import NoteWidgetDefinition +from datadog_api_client.v1.model.note_widget_definition_type import NoteWidgetDefinitionType +from datadog_api_client.v1.model.widget import Widget +from datadog_api_client.v1.model.widget_live_span_unit import WidgetLiveSpanUnit +from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign +from datadog_api_client.v1.model.widget_tick_edge import WidgetTickEdge + +body = Dashboard( + title="Example-Dashboard", + layout_type=DashboardLayoutType.ORDERED, + widgets=[ + Widget( + definition=NoteWidgetDefinition( + type=NoteWidgetDefinitionType.NOTE, + content="test", + background_color="white", + font_size="14", + text_align=WidgetTextAlign.LEFT, + show_tick=False, + tick_pos="50%", + tick_edge=WidgetTickEdge.LEFT, + ), + ), + ], + default_timeframe=DashboardLiveTimeframe( + type=DashboardLiveTimeframeType.LIVE, + unit=WidgetLiveSpanUnit.HOUR, + value=4, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = DashboardsApi(api_client) + response = api_instance.create_dashboard(body=body) + + print(response) diff --git a/src/datadog_api_client/v1/model/dashboard.py b/src/datadog_api_client/v1/model/dashboard.py index 13c8ebc136..10c7d15b11 100644 --- a/src/datadog_api_client/v1/model/dashboard.py +++ b/src/datadog_api_client/v1/model/dashboard.py @@ -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): @@ -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 @@ -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,), @@ -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", @@ -101,6 +107,9 @@ 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[ + DashboardDefaultTimeframeSetting, DashboardLiveTimeframe, DashboardFixedTimeframe, UnsetType + ] = unset, description: Union[str, none_type, UnsetType] = unset, id: Union[str, UnsetType] = unset, is_read_only: Union[bool, UnsetType] = unset, @@ -128,6 +137,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, optional + :param description: Description of the dashboard. :type description: str, none_type, optional @@ -183,6 +195,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: diff --git a/src/datadog_api_client/v1/model/dashboard_default_timeframe_setting.py b/src/datadog_api_client/v1/model/dashboard_default_timeframe_setting.py new file mode 100644 index 0000000000..967973d82c --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_default_timeframe_setting.py @@ -0,0 +1,52 @@ +# 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): + 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, + ], + } diff --git a/src/datadog_api_client/v1/model/dashboard_fixed_timeframe.py b/src/datadog_api_client/v1/model/dashboard_fixed_timeframe.py new file mode 100644 index 0000000000..260da325a5 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_fixed_timeframe.py @@ -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 diff --git a/src/datadog_api_client/v1/model/dashboard_fixed_timeframe_type.py b/src/datadog_api_client/v1/model/dashboard_fixed_timeframe_type.py new file mode 100644 index 0000000000..415182e3c8 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_fixed_timeframe_type.py @@ -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") diff --git a/src/datadog_api_client/v1/model/dashboard_live_timeframe.py b/src/datadog_api_client/v1/model/dashboard_live_timeframe.py new file mode 100644 index 0000000000..8d26802219 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_live_timeframe.py @@ -0,0 +1,60 @@ +# 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_live_timeframe_type import DashboardLiveTimeframeType + from datadog_api_client.v1.model.widget_live_span_unit import WidgetLiveSpanUnit + + +class DashboardLiveTimeframe(ModelNormal): + validations = { + "value": { + "inclusive_minimum": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.dashboard_live_timeframe_type import DashboardLiveTimeframeType + from datadog_api_client.v1.model.widget_live_span_unit import WidgetLiveSpanUnit + + return { + "type": (DashboardLiveTimeframeType,), + "unit": (WidgetLiveSpanUnit,), + "value": (int,), + } + + attribute_map = { + "type": "type", + "unit": "unit", + "value": "value", + } + + def __init__(self_, type: DashboardLiveTimeframeType, unit: WidgetLiveSpanUnit, value: int, **kwargs): + """ + A live dashboard 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 + """ + super().__init__(kwargs) + + self_.type = type + self_.unit = unit + self_.value = value diff --git a/src/datadog_api_client/v1/model/dashboard_live_timeframe_type.py b/src/datadog_api_client/v1/model/dashboard_live_timeframe_type.py new file mode 100644 index 0000000000..396f38b6d6 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_live_timeframe_type.py @@ -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 DashboardLiveTimeframeType(ModelSimple): + """ + Type of live timeframe. + + :param value: If omitted defaults to "live". Must be one of ["live"]. + :type value: str + """ + + allowed_values = { + "live", + } + LIVE: ClassVar["DashboardLiveTimeframeType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DashboardLiveTimeframeType.LIVE = DashboardLiveTimeframeType("live") diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 85c9757ab5..8126d6f813 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -78,7 +78,10 @@ from datadog_api_client.v1.model.dashboard_bulk_action_data import DashboardBulkActionData from datadog_api_client.v1.model.dashboard_bulk_action_data_list import DashboardBulkActionDataList from datadog_api_client.v1.model.dashboard_bulk_delete_request import DashboardBulkDeleteRequest +from datadog_api_client.v1.model.dashboard_default_timeframe_setting import DashboardDefaultTimeframeSetting from datadog_api_client.v1.model.dashboard_delete_response import DashboardDeleteResponse +from datadog_api_client.v1.model.dashboard_fixed_timeframe import DashboardFixedTimeframe +from datadog_api_client.v1.model.dashboard_fixed_timeframe_type import DashboardFixedTimeframeType from datadog_api_client.v1.model.dashboard_global_time import DashboardGlobalTime from datadog_api_client.v1.model.dashboard_global_time_live_span import DashboardGlobalTimeLiveSpan from datadog_api_client.v1.model.dashboard_invite_type import DashboardInviteType @@ -86,6 +89,8 @@ from datadog_api_client.v1.model.dashboard_list import DashboardList from datadog_api_client.v1.model.dashboard_list_delete_response import DashboardListDeleteResponse from datadog_api_client.v1.model.dashboard_list_list_response import DashboardListListResponse +from datadog_api_client.v1.model.dashboard_live_timeframe import DashboardLiveTimeframe +from datadog_api_client.v1.model.dashboard_live_timeframe_type import DashboardLiveTimeframeType from datadog_api_client.v1.model.dashboard_reflow_type import DashboardReflowType from datadog_api_client.v1.model.dashboard_resource_type import DashboardResourceType from datadog_api_client.v1.model.dashboard_restore_request import DashboardRestoreRequest @@ -1475,7 +1480,10 @@ "DashboardBulkActionData", "DashboardBulkActionDataList", "DashboardBulkDeleteRequest", + "DashboardDefaultTimeframeSetting", "DashboardDeleteResponse", + "DashboardFixedTimeframe", + "DashboardFixedTimeframeType", "DashboardGlobalTime", "DashboardGlobalTimeLiveSpan", "DashboardInviteType", @@ -1483,6 +1491,8 @@ "DashboardList", "DashboardListDeleteResponse", "DashboardListListResponse", + "DashboardLiveTimeframe", + "DashboardLiveTimeframeType", "DashboardReflowType", "DashboardResourceType", "DashboardRestoreRequest", diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_live_default_timeframe_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_live_default_timeframe_returns_ok_response.frozen new file mode 100644 index 0000000000..cd5f7343ba --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_live_default_timeframe_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-06-22T17:48:02.651Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_live_default_timeframe_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_live_default_timeframe_returns_ok_response.yaml new file mode 100644 index 0000000000..c8bf8245fd --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_live_default_timeframe_returns_ok_response.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: '{"default_timeframe":{"type":"live","unit":"hour","value":4},"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_a_live_default_timeframe_returns_OK_response-1782150482","widgets":[{"definition":{"background_color":"white","content":"test","font_size":"14","show_tick":false,"text_align":"left","tick_edge":"left","tick_pos":"50%","type":"note"}}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + string: '{"id":"3v2-z74-apr","title":"Test-Create_a_new_dashboard_with_a_live_default_timeframe_returns_OK_response-1782150482","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"ordered","url":"/dashboard/3v2-z74-apr/test-createanewdashboardwithalivedefaulttimeframereturnsokresponse-1782150482","template_variables":null,"widgets":[{"definition":{"background_color":"white","content":"test","font_size":"14","show_tick":false,"text_align":"left","tick_edge":"left","tick_pos":"50%","type":"note"},"id":2716227217953845}],"notify_list":null,"created_at":"2026-06-22T17:48:02.860491+00:00","modified_at":"2026-06-22T17:48:02.860491+00:00","default_timeframe":{"type":"live","unit":"hour","value":4},"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/3v2-z74-apr + response: + body: + string: '{"deleted_dashboard_id":"3v2-z74-apr"}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 932dc22b0b..fcdfaf309d 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -90,7 +90,7 @@ Feature: Dashboards @generated @skip @team:DataDog/dashboards-backend Scenario: Create a new dashboard returns "Bad Request" response Given new "CreateDashboard" request - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"default_timeframe": {"type": "live", "unit": "minute", "value": 4}, "description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 400 Bad Request @@ -171,6 +171,16 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].formulas[0].formula" is equal to "hour_before(query1)" And the response "widgets[0].definition.requests[0].formulas[1].formula" is equal to "query1" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with a live default_timeframe returns "OK" response + Given new "CreateDashboard" request + And body with value {"title": "{{ unique }}", "layout_type": "ordered", "widgets": [{"definition": {"type": "note", "content": "test", "background_color": "white", "font_size": "14", "text_align": "left", "show_tick": false, "tick_pos": "50%", "tick_edge": "left"}}], "default_timeframe": {"type": "live", "unit": "hour", "value": 4}} + When the request is sent + Then the response status is 200 OK + And the response "default_timeframe.type" is equal to "live" + And the response "default_timeframe.unit" is equal to "hour" + And the response "default_timeframe.value" is equal to 4 + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with a query value widget using the percentile aggregator Given new "CreateDashboard" request @@ -1463,7 +1473,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Bad Request" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"default_timeframe": {"type": "live", "unit": "minute", "value": 4}, "description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 400 Bad Request @@ -1471,7 +1481,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Item Not Found" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} + And body with value {"default_timeframe": {"type": "live", "unit": "minute", "value": 4}, "description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]} When the request is sent Then the response status is 404 Item Not Found