-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathdashboard.py
More file actions
214 lines (184 loc) · 8.64 KB
/
dashboard.py
File metadata and controls
214 lines (184 loc) · 8.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# 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, Union, TYPE_CHECKING
from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
datetime,
none_type,
unset,
UnsetType,
)
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,
},
}
@cached_property
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
return {
"author_handle": (str,),
"author_name": (str, none_type),
"created_at": (datetime,),
"description": (str, none_type),
"id": (str,),
"is_read_only": (bool,),
"layout_type": (DashboardLayoutType,),
"modified_at": (datetime,),
"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),
"title": (str,),
"url": (str,),
"widgets": ([Widget],),
}
attribute_map = {
"author_handle": "author_handle",
"author_name": "author_name",
"created_at": "created_at",
"description": "description",
"id": "id",
"is_read_only": "is_read_only",
"layout_type": "layout_type",
"modified_at": "modified_at",
"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",
"title": "title",
"url": "url",
"widgets": "widgets",
}
read_only_vars = {
"author_handle",
"author_name",
"created_at",
"id",
"modified_at",
"url",
}
def __init__(
self_,
layout_type: DashboardLayoutType,
title: str,
widgets: List[Widget],
author_handle: Union[str, UnsetType] = unset,
author_name: Union[str, none_type, UnsetType] = unset,
created_at: Union[datetime, UnsetType] = unset,
description: Union[str, none_type, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
is_read_only: Union[bool, UnsetType] = unset,
modified_at: Union[datetime, UnsetType] = unset,
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,
url: Union[str, UnsetType] = unset,
**kwargs,
):
"""
A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying
key performance metrics, which enable you to monitor the health of your infrastructure.
:param author_handle: Identifier of the dashboard author.
:type author_handle: str, optional
:param author_name: Name of the dashboard author.
:type author_name: str, none_type, optional
:param created_at: Creation date of the dashboard.
:type created_at: datetime, optional
:param description: Description of the dashboard.
:type description: str, none_type, optional
:param id: ID of the dashboard.
:type id: str, optional
:param is_read_only: Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
This property is deprecated; please use the `Restriction Policies API <https://docs.datadoghq.com/api/latest/restriction-policies/>`_ instead to manage write authorization for individual dashboards. **Deprecated**.
:type is_read_only: bool, optional
:param layout_type: Layout type of the dashboard.
:type layout_type: DashboardLayoutType
:param modified_at: Modification date of the dashboard.
:type modified_at: datetime, optional
:param notify_list: List of handles of users to notify when changes are made to this dashboard.
:type notify_list: [str], none_type, optional
:param reflow_type: Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'.
If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto',
widgets should not have layouts.
:type reflow_type: DashboardReflowType, optional
: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
:param template_variable_presets: Array of template variables saved views.
:type template_variable_presets: [DashboardTemplateVariablePreset], none_type, optional
:param template_variables: List of template variables for this dashboard.
:type template_variables: [DashboardTemplateVariable], none_type, optional
:param title: Title of the dashboard.
:type title: str
:param url: The URL of the dashboard.
:type url: str, optional
:param widgets: List of widgets to display on the dashboard.
:type widgets: [Widget]
"""
if author_handle is not unset:
kwargs["author_handle"] = author_handle
if author_name is not unset:
kwargs["author_name"] = author_name
if created_at is not unset:
kwargs["created_at"] = created_at
if description is not unset:
kwargs["description"] = description
if id is not unset:
kwargs["id"] = id
if is_read_only is not unset:
kwargs["is_read_only"] = is_read_only
if modified_at is not unset:
kwargs["modified_at"] = modified_at
if notify_list is not unset:
kwargs["notify_list"] = notify_list
if reflow_type is not unset:
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:
kwargs["template_variable_presets"] = template_variable_presets
if template_variables is not unset:
kwargs["template_variables"] = template_variables
if url is not unset:
kwargs["url"] = url
super().__init__(kwargs)
self_.layout_type = layout_type
self_.title = title
self_.widgets = widgets