-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_dashboard.go
743 lines (657 loc) · 24.2 KB
/
model_dashboard.go
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
// 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.
package datadogV1
import (
"fmt"
"time"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// Dashboard 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.
type Dashboard struct {
// Identifier of the dashboard author.
AuthorHandle *string `json:"author_handle,omitempty"`
// Name of the dashboard author.
AuthorName datadog.NullableString `json:"author_name,omitempty"`
// Creation date of the dashboard.
CreatedAt *time.Time `json:"created_at,omitempty"`
// Description of the dashboard.
Description datadog.NullableString `json:"description,omitempty"`
// ID of the dashboard.
Id *string `json:"id,omitempty"`
// 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
IsReadOnly *bool `json:"is_read_only,omitempty"`
// Layout type of the dashboard.
LayoutType DashboardLayoutType `json:"layout_type"`
// Modification date of the dashboard.
ModifiedAt *time.Time `json:"modified_at,omitempty"`
// List of handles of users to notify when changes are made to this dashboard.
NotifyList datadog.NullableList[string] `json:"notify_list,omitempty"`
// 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.
ReflowType *DashboardReflowType `json:"reflow_type,omitempty"`
// A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
//
// 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
RestrictedRoles []string `json:"restricted_roles,omitempty"`
// List of team names representing ownership of a dashboard.
Tags datadog.NullableList[string] `json:"tags,omitempty"`
// Array of template variables saved views.
TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"`
// List of template variables for this dashboard.
TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"`
// Title of the dashboard.
Title string `json:"title"`
// The URL of the dashboard.
Url *string `json:"url,omitempty"`
// List of widgets to display on the dashboard.
Widgets []Widget `json:"widgets"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{}
}
// NewDashboard instantiates a new Dashboard object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewDashboard(layoutType DashboardLayoutType, title string, widgets []Widget) *Dashboard {
this := Dashboard{}
var isReadOnly bool = false
this.IsReadOnly = &isReadOnly
this.LayoutType = layoutType
this.Title = title
this.Widgets = widgets
return &this
}
// NewDashboardWithDefaults instantiates a new Dashboard object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewDashboardWithDefaults() *Dashboard {
this := Dashboard{}
var isReadOnly bool = false
this.IsReadOnly = &isReadOnly
return &this
}
// GetAuthorHandle returns the AuthorHandle field value if set, zero value otherwise.
func (o *Dashboard) GetAuthorHandle() string {
if o == nil || o.AuthorHandle == nil {
var ret string
return ret
}
return *o.AuthorHandle
}
// GetAuthorHandleOk returns a tuple with the AuthorHandle field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetAuthorHandleOk() (*string, bool) {
if o == nil || o.AuthorHandle == nil {
return nil, false
}
return o.AuthorHandle, true
}
// HasAuthorHandle returns a boolean if a field has been set.
func (o *Dashboard) HasAuthorHandle() bool {
return o != nil && o.AuthorHandle != nil
}
// SetAuthorHandle gets a reference to the given string and assigns it to the AuthorHandle field.
func (o *Dashboard) SetAuthorHandle(v string) {
o.AuthorHandle = &v
}
// GetAuthorName returns the AuthorName field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Dashboard) GetAuthorName() string {
if o == nil || o.AuthorName.Get() == nil {
var ret string
return ret
}
return *o.AuthorName.Get()
}
// GetAuthorNameOk returns a tuple with the AuthorName field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *Dashboard) GetAuthorNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.AuthorName.Get(), o.AuthorName.IsSet()
}
// HasAuthorName returns a boolean if a field has been set.
func (o *Dashboard) HasAuthorName() bool {
return o != nil && o.AuthorName.IsSet()
}
// SetAuthorName gets a reference to the given datadog.NullableString and assigns it to the AuthorName field.
func (o *Dashboard) SetAuthorName(v string) {
o.AuthorName.Set(&v)
}
// SetAuthorNameNil sets the value for AuthorName to be an explicit nil.
func (o *Dashboard) SetAuthorNameNil() {
o.AuthorName.Set(nil)
}
// UnsetAuthorName ensures that no value is present for AuthorName, not even an explicit nil.
func (o *Dashboard) UnsetAuthorName() {
o.AuthorName.Unset()
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *Dashboard) GetCreatedAt() time.Time {
if o == nil || o.CreatedAt == nil {
var ret time.Time
return ret
}
return *o.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetCreatedAtOk() (*time.Time, bool) {
if o == nil || o.CreatedAt == nil {
return nil, false
}
return o.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *Dashboard) HasCreatedAt() bool {
return o != nil && o.CreatedAt != nil
}
// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field.
func (o *Dashboard) SetCreatedAt(v time.Time) {
o.CreatedAt = &v
}
// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Dashboard) GetDescription() string {
if o == nil || o.Description.Get() == nil {
var ret string
return ret
}
return *o.Description.Get()
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *Dashboard) GetDescriptionOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Description.Get(), o.Description.IsSet()
}
// HasDescription returns a boolean if a field has been set.
func (o *Dashboard) HasDescription() bool {
return o != nil && o.Description.IsSet()
}
// SetDescription gets a reference to the given datadog.NullableString and assigns it to the Description field.
func (o *Dashboard) SetDescription(v string) {
o.Description.Set(&v)
}
// SetDescriptionNil sets the value for Description to be an explicit nil.
func (o *Dashboard) SetDescriptionNil() {
o.Description.Set(nil)
}
// UnsetDescription ensures that no value is present for Description, not even an explicit nil.
func (o *Dashboard) UnsetDescription() {
o.Description.Unset()
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *Dashboard) GetId() string {
if o == nil || o.Id == nil {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetIdOk() (*string, bool) {
if o == nil || o.Id == nil {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *Dashboard) HasId() bool {
return o != nil && o.Id != nil
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *Dashboard) SetId(v string) {
o.Id = &v
}
// GetIsReadOnly returns the IsReadOnly field value if set, zero value otherwise.
// Deprecated
func (o *Dashboard) GetIsReadOnly() bool {
if o == nil || o.IsReadOnly == nil {
var ret bool
return ret
}
return *o.IsReadOnly
}
// GetIsReadOnlyOk returns a tuple with the IsReadOnly field value if set, nil otherwise
// and a boolean to check if the value has been set.
// Deprecated
func (o *Dashboard) GetIsReadOnlyOk() (*bool, bool) {
if o == nil || o.IsReadOnly == nil {
return nil, false
}
return o.IsReadOnly, true
}
// HasIsReadOnly returns a boolean if a field has been set.
func (o *Dashboard) HasIsReadOnly() bool {
return o != nil && o.IsReadOnly != nil
}
// SetIsReadOnly gets a reference to the given bool and assigns it to the IsReadOnly field.
// Deprecated
func (o *Dashboard) SetIsReadOnly(v bool) {
o.IsReadOnly = &v
}
// GetLayoutType returns the LayoutType field value.
func (o *Dashboard) GetLayoutType() DashboardLayoutType {
if o == nil {
var ret DashboardLayoutType
return ret
}
return o.LayoutType
}
// GetLayoutTypeOk returns a tuple with the LayoutType field value
// and a boolean to check if the value has been set.
func (o *Dashboard) GetLayoutTypeOk() (*DashboardLayoutType, bool) {
if o == nil {
return nil, false
}
return &o.LayoutType, true
}
// SetLayoutType sets field value.
func (o *Dashboard) SetLayoutType(v DashboardLayoutType) {
o.LayoutType = v
}
// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise.
func (o *Dashboard) GetModifiedAt() time.Time {
if o == nil || o.ModifiedAt == nil {
var ret time.Time
return ret
}
return *o.ModifiedAt
}
// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetModifiedAtOk() (*time.Time, bool) {
if o == nil || o.ModifiedAt == nil {
return nil, false
}
return o.ModifiedAt, true
}
// HasModifiedAt returns a boolean if a field has been set.
func (o *Dashboard) HasModifiedAt() bool {
return o != nil && o.ModifiedAt != nil
}
// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field.
func (o *Dashboard) SetModifiedAt(v time.Time) {
o.ModifiedAt = &v
}
// GetNotifyList returns the NotifyList field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Dashboard) GetNotifyList() []string {
if o == nil || o.NotifyList.Get() == nil {
var ret []string
return ret
}
return *o.NotifyList.Get()
}
// GetNotifyListOk returns a tuple with the NotifyList field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *Dashboard) GetNotifyListOk() (*[]string, bool) {
if o == nil {
return nil, false
}
return o.NotifyList.Get(), o.NotifyList.IsSet()
}
// HasNotifyList returns a boolean if a field has been set.
func (o *Dashboard) HasNotifyList() bool {
return o != nil && o.NotifyList.IsSet()
}
// SetNotifyList gets a reference to the given datadog.NullableList[string] and assigns it to the NotifyList field.
func (o *Dashboard) SetNotifyList(v []string) {
o.NotifyList.Set(&v)
}
// SetNotifyListNil sets the value for NotifyList to be an explicit nil.
func (o *Dashboard) SetNotifyListNil() {
o.NotifyList.Set(nil)
}
// UnsetNotifyList ensures that no value is present for NotifyList, not even an explicit nil.
func (o *Dashboard) UnsetNotifyList() {
o.NotifyList.Unset()
}
// GetReflowType returns the ReflowType field value if set, zero value otherwise.
func (o *Dashboard) GetReflowType() DashboardReflowType {
if o == nil || o.ReflowType == nil {
var ret DashboardReflowType
return ret
}
return *o.ReflowType
}
// GetReflowTypeOk returns a tuple with the ReflowType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetReflowTypeOk() (*DashboardReflowType, bool) {
if o == nil || o.ReflowType == nil {
return nil, false
}
return o.ReflowType, true
}
// HasReflowType returns a boolean if a field has been set.
func (o *Dashboard) HasReflowType() bool {
return o != nil && o.ReflowType != nil
}
// SetReflowType gets a reference to the given DashboardReflowType and assigns it to the ReflowType field.
func (o *Dashboard) SetReflowType(v DashboardReflowType) {
o.ReflowType = &v
}
// GetRestrictedRoles returns the RestrictedRoles field value if set, zero value otherwise.
// Deprecated
func (o *Dashboard) GetRestrictedRoles() []string {
if o == nil || o.RestrictedRoles == nil {
var ret []string
return ret
}
return o.RestrictedRoles
}
// GetRestrictedRolesOk returns a tuple with the RestrictedRoles field value if set, nil otherwise
// and a boolean to check if the value has been set.
// Deprecated
func (o *Dashboard) GetRestrictedRolesOk() (*[]string, bool) {
if o == nil || o.RestrictedRoles == nil {
return nil, false
}
return &o.RestrictedRoles, true
}
// HasRestrictedRoles returns a boolean if a field has been set.
func (o *Dashboard) HasRestrictedRoles() bool {
return o != nil && o.RestrictedRoles != nil
}
// SetRestrictedRoles gets a reference to the given []string and assigns it to the RestrictedRoles field.
// Deprecated
func (o *Dashboard) SetRestrictedRoles(v []string) {
o.RestrictedRoles = v
}
// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Dashboard) GetTags() []string {
if o == nil || o.Tags.Get() == nil {
var ret []string
return ret
}
return *o.Tags.Get()
}
// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *Dashboard) GetTagsOk() (*[]string, bool) {
if o == nil {
return nil, false
}
return o.Tags.Get(), o.Tags.IsSet()
}
// HasTags returns a boolean if a field has been set.
func (o *Dashboard) HasTags() bool {
return o != nil && o.Tags.IsSet()
}
// SetTags gets a reference to the given datadog.NullableList[string] and assigns it to the Tags field.
func (o *Dashboard) SetTags(v []string) {
o.Tags.Set(&v)
}
// SetTagsNil sets the value for Tags to be an explicit nil.
func (o *Dashboard) SetTagsNil() {
o.Tags.Set(nil)
}
// UnsetTags ensures that no value is present for Tags, not even an explicit nil.
func (o *Dashboard) UnsetTags() {
o.Tags.Unset()
}
// GetTemplateVariablePresets returns the TemplateVariablePresets field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Dashboard) GetTemplateVariablePresets() []DashboardTemplateVariablePreset {
if o == nil {
var ret []DashboardTemplateVariablePreset
return ret
}
return o.TemplateVariablePresets
}
// GetTemplateVariablePresetsOk returns a tuple with the TemplateVariablePresets field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *Dashboard) GetTemplateVariablePresetsOk() (*[]DashboardTemplateVariablePreset, bool) {
if o == nil || o.TemplateVariablePresets == nil {
return nil, false
}
return &o.TemplateVariablePresets, true
}
// HasTemplateVariablePresets returns a boolean if a field has been set.
func (o *Dashboard) HasTemplateVariablePresets() bool {
return o != nil && o.TemplateVariablePresets != nil
}
// SetTemplateVariablePresets gets a reference to the given []DashboardTemplateVariablePreset and assigns it to the TemplateVariablePresets field.
func (o *Dashboard) SetTemplateVariablePresets(v []DashboardTemplateVariablePreset) {
o.TemplateVariablePresets = v
}
// GetTemplateVariables returns the TemplateVariables field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Dashboard) GetTemplateVariables() []DashboardTemplateVariable {
if o == nil {
var ret []DashboardTemplateVariable
return ret
}
return o.TemplateVariables
}
// GetTemplateVariablesOk returns a tuple with the TemplateVariables field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *Dashboard) GetTemplateVariablesOk() (*[]DashboardTemplateVariable, bool) {
if o == nil || o.TemplateVariables == nil {
return nil, false
}
return &o.TemplateVariables, true
}
// HasTemplateVariables returns a boolean if a field has been set.
func (o *Dashboard) HasTemplateVariables() bool {
return o != nil && o.TemplateVariables != nil
}
// SetTemplateVariables gets a reference to the given []DashboardTemplateVariable and assigns it to the TemplateVariables field.
func (o *Dashboard) SetTemplateVariables(v []DashboardTemplateVariable) {
o.TemplateVariables = v
}
// GetTitle returns the Title field value.
func (o *Dashboard) GetTitle() string {
if o == nil {
var ret string
return ret
}
return o.Title
}
// GetTitleOk returns a tuple with the Title field value
// and a boolean to check if the value has been set.
func (o *Dashboard) GetTitleOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Title, true
}
// SetTitle sets field value.
func (o *Dashboard) SetTitle(v string) {
o.Title = v
}
// GetUrl returns the Url field value if set, zero value otherwise.
func (o *Dashboard) GetUrl() string {
if o == nil || o.Url == nil {
var ret string
return ret
}
return *o.Url
}
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetUrlOk() (*string, bool) {
if o == nil || o.Url == nil {
return nil, false
}
return o.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (o *Dashboard) HasUrl() bool {
return o != nil && o.Url != nil
}
// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *Dashboard) SetUrl(v string) {
o.Url = &v
}
// GetWidgets returns the Widgets field value.
func (o *Dashboard) GetWidgets() []Widget {
if o == nil {
var ret []Widget
return ret
}
return o.Widgets
}
// GetWidgetsOk returns a tuple with the Widgets field value
// and a boolean to check if the value has been set.
func (o *Dashboard) GetWidgetsOk() (*[]Widget, bool) {
if o == nil {
return nil, false
}
return &o.Widgets, true
}
// SetWidgets sets field value.
func (o *Dashboard) SetWidgets(v []Widget) {
o.Widgets = v
}
// MarshalJSON serializes the struct using spec logic.
func (o Dashboard) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.AuthorHandle != nil {
toSerialize["author_handle"] = o.AuthorHandle
}
if o.AuthorName.IsSet() {
toSerialize["author_name"] = o.AuthorName.Get()
}
if o.CreatedAt != nil {
if o.CreatedAt.Nanosecond() == 0 {
toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00")
} else {
toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00")
}
}
if o.Description.IsSet() {
toSerialize["description"] = o.Description.Get()
}
if o.Id != nil {
toSerialize["id"] = o.Id
}
if o.IsReadOnly != nil {
toSerialize["is_read_only"] = o.IsReadOnly
}
toSerialize["layout_type"] = o.LayoutType
if o.ModifiedAt != nil {
if o.ModifiedAt.Nanosecond() == 0 {
toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00")
} else {
toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00")
}
}
if o.NotifyList.IsSet() {
toSerialize["notify_list"] = o.NotifyList.Get()
}
if o.ReflowType != nil {
toSerialize["reflow_type"] = o.ReflowType
}
if o.RestrictedRoles != nil {
toSerialize["restricted_roles"] = o.RestrictedRoles
}
if o.Tags.IsSet() {
toSerialize["tags"] = o.Tags.Get()
}
if o.TemplateVariablePresets != nil {
toSerialize["template_variable_presets"] = o.TemplateVariablePresets
}
if o.TemplateVariables != nil {
toSerialize["template_variables"] = o.TemplateVariables
}
toSerialize["title"] = o.Title
if o.Url != nil {
toSerialize["url"] = o.Url
}
toSerialize["widgets"] = o.Widgets
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
AuthorHandle *string `json:"author_handle,omitempty"`
AuthorName datadog.NullableString `json:"author_name,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
Description datadog.NullableString `json:"description,omitempty"`
Id *string `json:"id,omitempty"`
IsReadOnly *bool `json:"is_read_only,omitempty"`
LayoutType *DashboardLayoutType `json:"layout_type"`
ModifiedAt *time.Time `json:"modified_at,omitempty"`
NotifyList datadog.NullableList[string] `json:"notify_list,omitempty"`
ReflowType *DashboardReflowType `json:"reflow_type,omitempty"`
RestrictedRoles []string `json:"restricted_roles,omitempty"`
Tags datadog.NullableList[string] `json:"tags,omitempty"`
TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"`
TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"`
Title *string `json:"title"`
Url *string `json:"url,omitempty"`
Widgets *[]Widget `json:"widgets"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.LayoutType == nil {
return fmt.Errorf("required field layout_type missing")
}
if all.Title == nil {
return fmt.Errorf("required field title missing")
}
if all.Widgets == nil {
return fmt.Errorf("required field widgets missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"author_handle", "author_name", "created_at", "description", "id", "is_read_only", "layout_type", "modified_at", "notify_list", "reflow_type", "restricted_roles", "tags", "template_variable_presets", "template_variables", "title", "url", "widgets"})
} else {
return err
}
hasInvalidField := false
o.AuthorHandle = all.AuthorHandle
o.AuthorName = all.AuthorName
o.CreatedAt = all.CreatedAt
o.Description = all.Description
o.Id = all.Id
o.IsReadOnly = all.IsReadOnly
if !all.LayoutType.IsValid() {
hasInvalidField = true
} else {
o.LayoutType = *all.LayoutType
}
o.ModifiedAt = all.ModifiedAt
o.NotifyList = all.NotifyList
if all.ReflowType != nil && !all.ReflowType.IsValid() {
hasInvalidField = true
} else {
o.ReflowType = all.ReflowType
}
o.RestrictedRoles = all.RestrictedRoles
o.Tags = all.Tags
o.TemplateVariablePresets = all.TemplateVariablePresets
o.TemplateVariables = all.TemplateVariables
o.Title = *all.Title
o.Url = all.Url
o.Widgets = *all.Widgets
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}