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
37 changes: 37 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,13 @@ components:
description: A role UUID.
type: string
type: array
tabs:
description: List of tabs for organizing dashboard widgets into groups.
items:
$ref: '#/components/schemas/DashboardTab'
maxItems: 100
nullable: true
type: array
tags:
description: List of team names representing ownership of a dashboard.
items:
Expand Down Expand Up @@ -1681,6 +1688,36 @@ components:
description: URL of the dashboard.
type: string
type: object
DashboardTab:
description: Dashboard tab for organizing widgets.
properties:
id:
description: UUID of the tab.
example: ''
format: uuid
type: string
name:
description: Name of the tab.
example: L
maxLength: 100
minLength: 1
type: string
widget_ids:
description: List of widget IDs belonging to this tab. The backend also
accepts positional references in @N format (1-indexed) as a convenience
for Terraform and other declarative tools.
example:
- 0
items:
description: Widget ID.
format: int64
type: integer
type: array
required:
- id
- name
- widget_ids
type: object
DashboardTemplateVariable:
description: Template variable.
properties:
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,13 @@ datadog\_api\_client.v1.model.dashboard\_summary\_definition module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.dashboard\_tab module
---------------------------------------------------

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

datadog\_api\_client.v1.model.dashboard\_template\_variable module
------------------------------------------------------------------

Expand Down
13 changes: 13 additions & 0 deletions src/datadog_api_client/v1/model/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
if TYPE_CHECKING:
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


class Dashboard(ModelNormal):
validations = {
"tabs": {
"max_items": 100,
},
"tags": {
"max_items": 5,
},
Expand All @@ -34,6 +38,7 @@ class Dashboard(ModelNormal):
def openapi_types(_):
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
Expand All @@ -50,6 +55,7 @@ def openapi_types(_):
"notify_list": ([str], none_type),
"reflow_type": (DashboardReflowType,),
"restricted_roles": ([str],),
"tabs": ([DashboardTab], none_type),
"tags": ([str], none_type),
"template_variable_presets": ([DashboardTemplateVariablePreset], none_type),
"template_variables": ([DashboardTemplateVariable], none_type),
Expand All @@ -70,6 +76,7 @@ def openapi_types(_):
"notify_list": "notify_list",
"reflow_type": "reflow_type",
"restricted_roles": "restricted_roles",
"tabs": "tabs",
"tags": "tags",
"template_variable_presets": "template_variable_presets",
"template_variables": "template_variables",
Expand Down Expand Up @@ -101,6 +108,7 @@ def __init__(
notify_list: Union[List[str], none_type, UnsetType] = unset,
reflow_type: Union[DashboardReflowType, UnsetType] = unset,
restricted_roles: Union[List[str], UnsetType] = unset,
tabs: Union[List[DashboardTab], none_type, UnsetType] = unset,
tags: Union[List[str], none_type, UnsetType] = unset,
template_variable_presets: Union[List[DashboardTemplateVariablePreset], none_type, UnsetType] = unset,
template_variables: Union[List[DashboardTemplateVariable], none_type, UnsetType] = unset,
Expand Down Expand Up @@ -148,6 +156,9 @@ def __init__(
:param restricted_roles: A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
:type restricted_roles: [str], optional

:param tabs: List of tabs for organizing dashboard widgets into groups.
:type tabs: [DashboardTab], none_type, optional

:param tags: List of team names representing ownership of a dashboard.
:type tags: [str], none_type, optional

Expand Down Expand Up @@ -186,6 +197,8 @@ def __init__(
kwargs["reflow_type"] = reflow_type
if restricted_roles is not unset:
kwargs["restricted_roles"] = restricted_roles
if tabs is not unset:
kwargs["tabs"] = tabs
if tags is not unset:
kwargs["tags"] = tags
if template_variable_presets is not unset:
Expand Down
54 changes: 54 additions & 0 deletions src/datadog_api_client/v1/model/dashboard_tab.py
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 typing import List

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
UUID,
)


class DashboardTab(ModelNormal):
validations = {
"name": {
"max_length": 100,
"min_length": 1,
},
}

@cached_property
def openapi_types(_):
return {
"id": (UUID,),
"name": (str,),
"widget_ids": ([int],),
}

attribute_map = {
"id": "id",
"name": "name",
"widget_ids": "widget_ids",
}

def __init__(self_, id: UUID, name: str, widget_ids: List[int], **kwargs):
"""
Dashboard tab for organizing widgets.

:param id: UUID of the tab.
:type id: UUID

:param name: Name of the tab.
:type name: str

:param widget_ids: List of widget IDs belonging to this tab. The backend also accepts positional references in @N format (1-indexed) as a convenience for Terraform and other declarative tools.
:type widget_ids: [int]
"""
super().__init__(kwargs)

self_.id = id
self_.name = name
self_.widget_ids = widget_ids
2 changes: 2 additions & 0 deletions src/datadog_api_client/v1/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
from datadog_api_client.v1.model.dashboard_share_type import DashboardShareType
from datadog_api_client.v1.model.dashboard_summary import DashboardSummary
from datadog_api_client.v1.model.dashboard_summary_definition import DashboardSummaryDefinition
from datadog_api_client.v1.model.dashboard_tab import DashboardTab
from datadog_api_client.v1.model.dashboard_template_variable import DashboardTemplateVariable
from datadog_api_client.v1.model.dashboard_template_variable_preset import DashboardTemplateVariablePreset
from datadog_api_client.v1.model.dashboard_template_variable_preset_value import DashboardTemplateVariablePresetValue
Expand Down Expand Up @@ -1238,6 +1239,7 @@
"DashboardShareType",
"DashboardSummary",
"DashboardSummaryDefinition",
"DashboardTab",
"DashboardTemplateVariable",
"DashboardTemplateVariablePreset",
"DashboardTemplateVariablePresetValue",
Expand Down
6 changes: 3 additions & 3 deletions tests/v1/features/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,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": [], "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 {"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

Expand Down Expand Up @@ -1342,15 +1342,15 @@ 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": [], "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 {"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

@generated @skip @team:DataDog/dashboards-backend
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": [], "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 {"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

Expand Down
Loading