-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathdashboard.rb
More file actions
370 lines (312 loc) · 11.5 KB
/
Copy pathdashboard.rb
File metadata and controls
370 lines (312 loc) · 11.5 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
=begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
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 2020-Present Datadog, Inc.
=end
require 'date'
require 'time'
module DatadogAPIClient::V1
# 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.
class Dashboard
include BaseGenericModel
# Identifier of the dashboard author.
attr_accessor :author_handle
# Name of the dashboard author.
attr_accessor :author_name
# Creation date of the dashboard.
attr_accessor :created_at
# Description of the dashboard.
attr_accessor :description
# ID of the dashboard.
attr_accessor :id
# 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.
attr_accessor :is_read_only
# Layout type of the dashboard.
attr_reader :layout_type
# Modification date of the dashboard.
attr_accessor :modified_at
# List of handles of users to notify when changes are made to this dashboard.
attr_accessor :notify_list
# 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.
attr_accessor :reflow_type
# A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
attr_accessor :restricted_roles
# List of tabs for organizing dashboard widgets into groups.
attr_reader :tabs
# List of team names representing ownership of a dashboard.
attr_reader :tags
# Array of template variables saved views.
attr_accessor :template_variable_presets
# List of template variables for this dashboard.
attr_accessor :template_variables
# Title of the dashboard.
attr_reader :title
# The URL of the dashboard.
attr_accessor :url
# List of widgets to display on the dashboard.
attr_reader :widgets
attr_accessor :additional_properties
# Attribute mapping from ruby-style variable name to JSON key.
# @!visibility private
def self.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'
}
end
# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'author_handle' => :'String',
:'author_name' => :'String',
:'created_at' => :'Time',
:'description' => :'String',
:'id' => :'String',
:'is_read_only' => :'Boolean',
:'layout_type' => :'DashboardLayoutType',
:'modified_at' => :'Time',
:'notify_list' => :'Array<String>',
:'reflow_type' => :'DashboardReflowType',
:'restricted_roles' => :'Array<String>',
:'tabs' => :'Array<DashboardTab>',
:'tags' => :'Array<String>',
:'template_variable_presets' => :'Array<DashboardTemplateVariablePreset>',
:'template_variables' => :'Array<DashboardTemplateVariable>',
:'title' => :'String',
:'url' => :'String',
:'widgets' => :'Array<Widget>'
}
end
# List of attributes with nullable: true
# @!visibility private
def self.openapi_nullable
Set.new([
:'author_name',
:'description',
:'notify_list',
:'tabs',
:'tags',
:'template_variable_presets',
:'template_variables',
])
end
# Initializes the object
# @param attributes [Hash] Model attributes in the form of hash
# @!visibility private
def initialize(attributes = {})
if (!attributes.is_a?(Hash))
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::Dashboard` initialize method"
end
self.additional_properties = {}
# check to see if the attribute exists and convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h|
if (!self.class.attribute_map.key?(k.to_sym))
self.additional_properties[k.to_sym] = v
else
h[k.to_sym] = v
end
}
if attributes.key?(:'author_handle')
self.author_handle = attributes[:'author_handle']
end
if attributes.key?(:'author_name')
self.author_name = attributes[:'author_name']
end
if attributes.key?(:'created_at')
self.created_at = attributes[:'created_at']
end
if attributes.key?(:'description')
self.description = attributes[:'description']
end
if attributes.key?(:'id')
self.id = attributes[:'id']
end
if attributes.key?(:'is_read_only')
self.is_read_only = attributes[:'is_read_only']
end
if attributes.key?(:'layout_type')
self.layout_type = attributes[:'layout_type']
end
if attributes.key?(:'modified_at')
self.modified_at = attributes[:'modified_at']
end
if attributes.key?(:'notify_list')
if (value = attributes[:'notify_list']).is_a?(Array)
self.notify_list = value
end
end
if attributes.key?(:'reflow_type')
self.reflow_type = attributes[:'reflow_type']
end
if attributes.key?(:'restricted_roles')
if (value = attributes[:'restricted_roles']).is_a?(Array)
self.restricted_roles = value
end
end
if attributes.key?(:'tabs')
if (value = attributes[:'tabs']).is_a?(Array)
self.tabs = value
end
end
if attributes.key?(:'tags')
if (value = attributes[:'tags']).is_a?(Array)
self.tags = value
end
end
if attributes.key?(:'template_variable_presets')
if (value = attributes[:'template_variable_presets']).is_a?(Array)
self.template_variable_presets = value
end
end
if attributes.key?(:'template_variables')
if (value = attributes[:'template_variables']).is_a?(Array)
self.template_variables = value
end
end
if attributes.key?(:'title')
self.title = attributes[:'title']
end
if attributes.key?(:'url')
self.url = attributes[:'url']
end
if attributes.key?(:'widgets')
if (value = attributes[:'widgets']).is_a?(Array)
self.widgets = value
end
end
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
# @!visibility private
def valid?
return false if @layout_type.nil?
return false if !@tabs.nil? && @tabs.length > 100
return false if !@tags.nil? && @tags.length > 5
return false if @title.nil?
return false if @widgets.nil?
true
end
# Custom attribute writer method with validation
# @param layout_type [Object] Object to be assigned
# @!visibility private
def layout_type=(layout_type)
if layout_type.nil?
fail ArgumentError, 'invalid value for "layout_type", layout_type cannot be nil.'
end
@layout_type = layout_type
end
# Custom attribute writer method with validation
# @param tabs [Object] Object to be assigned
# @!visibility private
def tabs=(tabs)
if !tabs.nil? && tabs.length > 100
fail ArgumentError, 'invalid value for "tabs", number of items must be less than or equal to 100.'
end
@tabs = tabs
end
# Custom attribute writer method with validation
# @param tags [Object] Object to be assigned
# @!visibility private
def tags=(tags)
if !tags.nil? && tags.length > 5
fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 5.'
end
@tags = tags
end
# Custom attribute writer method with validation
# @param title [Object] Object to be assigned
# @!visibility private
def title=(title)
if title.nil?
fail ArgumentError, 'invalid value for "title", title cannot be nil.'
end
@title = title
end
# Custom attribute writer method with validation
# @param widgets [Object] Object to be assigned
# @!visibility private
def widgets=(widgets)
if widgets.nil?
fail ArgumentError, 'invalid value for "widgets", widgets cannot be nil.'
end
@widgets = widgets
end
# Returns the object in the form of hash, with additionalProperties support.
# @return [Hash] Returns the object in the form of hash
# @!visibility private
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end
hash[param] = _to_hash(value)
end
self.additional_properties.each_pair do |attr, value|
hash[attr] = value
end
hash
end
# Checks equality by comparing each attribute.
# @param o [Object] Object to be compared
# @!visibility private
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
author_handle == o.author_handle &&
author_name == o.author_name &&
created_at == o.created_at &&
description == o.description &&
id == o.id &&
is_read_only == o.is_read_only &&
layout_type == o.layout_type &&
modified_at == o.modified_at &&
notify_list == o.notify_list &&
reflow_type == o.reflow_type &&
restricted_roles == o.restricted_roles &&
tabs == o.tabs &&
tags == o.tags &&
template_variable_presets == o.template_variable_presets &&
template_variables == o.template_variables &&
title == o.title &&
url == o.url &&
widgets == o.widgets &&
additional_properties == o.additional_properties
end
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[author_handle, author_name, created_at, description, id, is_read_only, layout_type, modified_at, notify_list, reflow_type, restricted_roles, tabs, tags, template_variable_presets, template_variables, title, url, widgets, additional_properties].hash
end
end
end