-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_downtime_response_attributes.go
548 lines (481 loc) · 20.3 KB
/
model_downtime_response_attributes.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
// 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 datadogV2
import (
"time"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// DowntimeResponseAttributes Downtime details.
type DowntimeResponseAttributes struct {
// Time that the downtime was canceled.
Canceled datadog.NullableTime `json:"canceled,omitempty"`
// Creation time of the downtime.
Created *time.Time `json:"created,omitempty"`
// The timezone in which to display the downtime's start and end times in Datadog applications. This is not used
// as an offset for scheduling.
DisplayTimezone datadog.NullableString `json:"display_timezone,omitempty"`
// A message to include with notifications for this downtime. Email notifications can be sent to specific users
// by using the same `@username` notation as events.
Message datadog.NullableString `json:"message,omitempty"`
// Time that the downtime was last modified.
Modified *time.Time `json:"modified,omitempty"`
// Monitor identifier for the downtime.
MonitorIdentifier *DowntimeMonitorIdentifier `json:"monitor_identifier,omitempty"`
// If the first recovery notification during a downtime should be muted.
MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"`
// States that will trigger a monitor notification when the `notify_end_types` action occurs.
NotifyEndStates []DowntimeNotifyEndStateTypes `json:"notify_end_states,omitempty"`
// Actions that will trigger a monitor notification if the downtime is in the `notify_end_types` state.
NotifyEndTypes []DowntimeNotifyEndStateActions `json:"notify_end_types,omitempty"`
// The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules:
// one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules are
// provided, the downtime will begin immediately and never end.
Schedule *DowntimeScheduleResponse `json:"schedule,omitempty"`
// The scope to which the downtime applies. Must follow the [common search syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/).
Scope *string `json:"scope,omitempty"`
// The current status of the downtime.
Status *DowntimeStatus `json:"status,omitempty"`
// 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{}
}
// NewDowntimeResponseAttributes instantiates a new DowntimeResponseAttributes 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 NewDowntimeResponseAttributes() *DowntimeResponseAttributes {
this := DowntimeResponseAttributes{}
var displayTimezone string = "UTC"
this.DisplayTimezone = *datadog.NewNullableString(&displayTimezone)
return &this
}
// NewDowntimeResponseAttributesWithDefaults instantiates a new DowntimeResponseAttributes 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 NewDowntimeResponseAttributesWithDefaults() *DowntimeResponseAttributes {
this := DowntimeResponseAttributes{}
var displayTimezone string = "UTC"
this.DisplayTimezone = *datadog.NewNullableString(&displayTimezone)
return &this
}
// GetCanceled returns the Canceled field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *DowntimeResponseAttributes) GetCanceled() time.Time {
if o == nil || o.Canceled.Get() == nil {
var ret time.Time
return ret
}
return *o.Canceled.Get()
}
// GetCanceledOk returns a tuple with the Canceled 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 *DowntimeResponseAttributes) GetCanceledOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return o.Canceled.Get(), o.Canceled.IsSet()
}
// HasCanceled returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasCanceled() bool {
return o != nil && o.Canceled.IsSet()
}
// SetCanceled gets a reference to the given datadog.NullableTime and assigns it to the Canceled field.
func (o *DowntimeResponseAttributes) SetCanceled(v time.Time) {
o.Canceled.Set(&v)
}
// SetCanceledNil sets the value for Canceled to be an explicit nil.
func (o *DowntimeResponseAttributes) SetCanceledNil() {
o.Canceled.Set(nil)
}
// UnsetCanceled ensures that no value is present for Canceled, not even an explicit nil.
func (o *DowntimeResponseAttributes) UnsetCanceled() {
o.Canceled.Unset()
}
// GetCreated returns the Created field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetCreated() time.Time {
if o == nil || o.Created == nil {
var ret time.Time
return ret
}
return *o.Created
}
// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetCreatedOk() (*time.Time, bool) {
if o == nil || o.Created == nil {
return nil, false
}
return o.Created, true
}
// HasCreated returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasCreated() bool {
return o != nil && o.Created != nil
}
// SetCreated gets a reference to the given time.Time and assigns it to the Created field.
func (o *DowntimeResponseAttributes) SetCreated(v time.Time) {
o.Created = &v
}
// GetDisplayTimezone returns the DisplayTimezone field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *DowntimeResponseAttributes) GetDisplayTimezone() string {
if o == nil || o.DisplayTimezone.Get() == nil {
var ret string
return ret
}
return *o.DisplayTimezone.Get()
}
// GetDisplayTimezoneOk returns a tuple with the DisplayTimezone 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 *DowntimeResponseAttributes) GetDisplayTimezoneOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.DisplayTimezone.Get(), o.DisplayTimezone.IsSet()
}
// HasDisplayTimezone returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasDisplayTimezone() bool {
return o != nil && o.DisplayTimezone.IsSet()
}
// SetDisplayTimezone gets a reference to the given datadog.NullableString and assigns it to the DisplayTimezone field.
func (o *DowntimeResponseAttributes) SetDisplayTimezone(v string) {
o.DisplayTimezone.Set(&v)
}
// SetDisplayTimezoneNil sets the value for DisplayTimezone to be an explicit nil.
func (o *DowntimeResponseAttributes) SetDisplayTimezoneNil() {
o.DisplayTimezone.Set(nil)
}
// UnsetDisplayTimezone ensures that no value is present for DisplayTimezone, not even an explicit nil.
func (o *DowntimeResponseAttributes) UnsetDisplayTimezone() {
o.DisplayTimezone.Unset()
}
// GetMessage returns the Message field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *DowntimeResponseAttributes) GetMessage() string {
if o == nil || o.Message.Get() == nil {
var ret string
return ret
}
return *o.Message.Get()
}
// GetMessageOk returns a tuple with the Message 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 *DowntimeResponseAttributes) GetMessageOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Message.Get(), o.Message.IsSet()
}
// HasMessage returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasMessage() bool {
return o != nil && o.Message.IsSet()
}
// SetMessage gets a reference to the given datadog.NullableString and assigns it to the Message field.
func (o *DowntimeResponseAttributes) SetMessage(v string) {
o.Message.Set(&v)
}
// SetMessageNil sets the value for Message to be an explicit nil.
func (o *DowntimeResponseAttributes) SetMessageNil() {
o.Message.Set(nil)
}
// UnsetMessage ensures that no value is present for Message, not even an explicit nil.
func (o *DowntimeResponseAttributes) UnsetMessage() {
o.Message.Unset()
}
// GetModified returns the Modified field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetModified() time.Time {
if o == nil || o.Modified == nil {
var ret time.Time
return ret
}
return *o.Modified
}
// GetModifiedOk returns a tuple with the Modified field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetModifiedOk() (*time.Time, bool) {
if o == nil || o.Modified == nil {
return nil, false
}
return o.Modified, true
}
// HasModified returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasModified() bool {
return o != nil && o.Modified != nil
}
// SetModified gets a reference to the given time.Time and assigns it to the Modified field.
func (o *DowntimeResponseAttributes) SetModified(v time.Time) {
o.Modified = &v
}
// GetMonitorIdentifier returns the MonitorIdentifier field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetMonitorIdentifier() DowntimeMonitorIdentifier {
if o == nil || o.MonitorIdentifier == nil {
var ret DowntimeMonitorIdentifier
return ret
}
return *o.MonitorIdentifier
}
// GetMonitorIdentifierOk returns a tuple with the MonitorIdentifier field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetMonitorIdentifierOk() (*DowntimeMonitorIdentifier, bool) {
if o == nil || o.MonitorIdentifier == nil {
return nil, false
}
return o.MonitorIdentifier, true
}
// HasMonitorIdentifier returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasMonitorIdentifier() bool {
return o != nil && o.MonitorIdentifier != nil
}
// SetMonitorIdentifier gets a reference to the given DowntimeMonitorIdentifier and assigns it to the MonitorIdentifier field.
func (o *DowntimeResponseAttributes) SetMonitorIdentifier(v DowntimeMonitorIdentifier) {
o.MonitorIdentifier = &v
}
// GetMuteFirstRecoveryNotification returns the MuteFirstRecoveryNotification field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetMuteFirstRecoveryNotification() bool {
if o == nil || o.MuteFirstRecoveryNotification == nil {
var ret bool
return ret
}
return *o.MuteFirstRecoveryNotification
}
// GetMuteFirstRecoveryNotificationOk returns a tuple with the MuteFirstRecoveryNotification field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetMuteFirstRecoveryNotificationOk() (*bool, bool) {
if o == nil || o.MuteFirstRecoveryNotification == nil {
return nil, false
}
return o.MuteFirstRecoveryNotification, true
}
// HasMuteFirstRecoveryNotification returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasMuteFirstRecoveryNotification() bool {
return o != nil && o.MuteFirstRecoveryNotification != nil
}
// SetMuteFirstRecoveryNotification gets a reference to the given bool and assigns it to the MuteFirstRecoveryNotification field.
func (o *DowntimeResponseAttributes) SetMuteFirstRecoveryNotification(v bool) {
o.MuteFirstRecoveryNotification = &v
}
// GetNotifyEndStates returns the NotifyEndStates field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetNotifyEndStates() []DowntimeNotifyEndStateTypes {
if o == nil || o.NotifyEndStates == nil {
var ret []DowntimeNotifyEndStateTypes
return ret
}
return o.NotifyEndStates
}
// GetNotifyEndStatesOk returns a tuple with the NotifyEndStates field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetNotifyEndStatesOk() (*[]DowntimeNotifyEndStateTypes, bool) {
if o == nil || o.NotifyEndStates == nil {
return nil, false
}
return &o.NotifyEndStates, true
}
// HasNotifyEndStates returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasNotifyEndStates() bool {
return o != nil && o.NotifyEndStates != nil
}
// SetNotifyEndStates gets a reference to the given []DowntimeNotifyEndStateTypes and assigns it to the NotifyEndStates field.
func (o *DowntimeResponseAttributes) SetNotifyEndStates(v []DowntimeNotifyEndStateTypes) {
o.NotifyEndStates = v
}
// GetNotifyEndTypes returns the NotifyEndTypes field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetNotifyEndTypes() []DowntimeNotifyEndStateActions {
if o == nil || o.NotifyEndTypes == nil {
var ret []DowntimeNotifyEndStateActions
return ret
}
return o.NotifyEndTypes
}
// GetNotifyEndTypesOk returns a tuple with the NotifyEndTypes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetNotifyEndTypesOk() (*[]DowntimeNotifyEndStateActions, bool) {
if o == nil || o.NotifyEndTypes == nil {
return nil, false
}
return &o.NotifyEndTypes, true
}
// HasNotifyEndTypes returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasNotifyEndTypes() bool {
return o != nil && o.NotifyEndTypes != nil
}
// SetNotifyEndTypes gets a reference to the given []DowntimeNotifyEndStateActions and assigns it to the NotifyEndTypes field.
func (o *DowntimeResponseAttributes) SetNotifyEndTypes(v []DowntimeNotifyEndStateActions) {
o.NotifyEndTypes = v
}
// GetSchedule returns the Schedule field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetSchedule() DowntimeScheduleResponse {
if o == nil || o.Schedule == nil {
var ret DowntimeScheduleResponse
return ret
}
return *o.Schedule
}
// GetScheduleOk returns a tuple with the Schedule field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetScheduleOk() (*DowntimeScheduleResponse, bool) {
if o == nil || o.Schedule == nil {
return nil, false
}
return o.Schedule, true
}
// HasSchedule returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasSchedule() bool {
return o != nil && o.Schedule != nil
}
// SetSchedule gets a reference to the given DowntimeScheduleResponse and assigns it to the Schedule field.
func (o *DowntimeResponseAttributes) SetSchedule(v DowntimeScheduleResponse) {
o.Schedule = &v
}
// GetScope returns the Scope field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetScope() string {
if o == nil || o.Scope == nil {
var ret string
return ret
}
return *o.Scope
}
// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetScopeOk() (*string, bool) {
if o == nil || o.Scope == nil {
return nil, false
}
return o.Scope, true
}
// HasScope returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasScope() bool {
return o != nil && o.Scope != nil
}
// SetScope gets a reference to the given string and assigns it to the Scope field.
func (o *DowntimeResponseAttributes) SetScope(v string) {
o.Scope = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *DowntimeResponseAttributes) GetStatus() DowntimeStatus {
if o == nil || o.Status == nil {
var ret DowntimeStatus
return ret
}
return *o.Status
}
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DowntimeResponseAttributes) GetStatusOk() (*DowntimeStatus, bool) {
if o == nil || o.Status == nil {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *DowntimeResponseAttributes) HasStatus() bool {
return o != nil && o.Status != nil
}
// SetStatus gets a reference to the given DowntimeStatus and assigns it to the Status field.
func (o *DowntimeResponseAttributes) SetStatus(v DowntimeStatus) {
o.Status = &v
}
// MarshalJSON serializes the struct using spec logic.
func (o DowntimeResponseAttributes) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Canceled.IsSet() {
toSerialize["canceled"] = o.Canceled.Get()
}
if o.Created != nil {
if o.Created.Nanosecond() == 0 {
toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05Z07:00")
} else {
toSerialize["created"] = o.Created.Format("2006-01-02T15:04:05.000Z07:00")
}
}
if o.DisplayTimezone.IsSet() {
toSerialize["display_timezone"] = o.DisplayTimezone.Get()
}
if o.Message.IsSet() {
toSerialize["message"] = o.Message.Get()
}
if o.Modified != nil {
if o.Modified.Nanosecond() == 0 {
toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05Z07:00")
} else {
toSerialize["modified"] = o.Modified.Format("2006-01-02T15:04:05.000Z07:00")
}
}
if o.MonitorIdentifier != nil {
toSerialize["monitor_identifier"] = o.MonitorIdentifier
}
if o.MuteFirstRecoveryNotification != nil {
toSerialize["mute_first_recovery_notification"] = o.MuteFirstRecoveryNotification
}
if o.NotifyEndStates != nil {
toSerialize["notify_end_states"] = o.NotifyEndStates
}
if o.NotifyEndTypes != nil {
toSerialize["notify_end_types"] = o.NotifyEndTypes
}
if o.Schedule != nil {
toSerialize["schedule"] = o.Schedule
}
if o.Scope != nil {
toSerialize["scope"] = o.Scope
}
if o.Status != nil {
toSerialize["status"] = o.Status
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *DowntimeResponseAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Canceled datadog.NullableTime `json:"canceled,omitempty"`
Created *time.Time `json:"created,omitempty"`
DisplayTimezone datadog.NullableString `json:"display_timezone,omitempty"`
Message datadog.NullableString `json:"message,omitempty"`
Modified *time.Time `json:"modified,omitempty"`
MonitorIdentifier *DowntimeMonitorIdentifier `json:"monitor_identifier,omitempty"`
MuteFirstRecoveryNotification *bool `json:"mute_first_recovery_notification,omitempty"`
NotifyEndStates []DowntimeNotifyEndStateTypes `json:"notify_end_states,omitempty"`
NotifyEndTypes []DowntimeNotifyEndStateActions `json:"notify_end_types,omitempty"`
Schedule *DowntimeScheduleResponse `json:"schedule,omitempty"`
Scope *string `json:"scope,omitempty"`
Status *DowntimeStatus `json:"status,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"canceled", "created", "display_timezone", "message", "modified", "monitor_identifier", "mute_first_recovery_notification", "notify_end_states", "notify_end_types", "schedule", "scope", "status"})
} else {
return err
}
hasInvalidField := false
o.Canceled = all.Canceled
o.Created = all.Created
o.DisplayTimezone = all.DisplayTimezone
o.Message = all.Message
o.Modified = all.Modified
o.MonitorIdentifier = all.MonitorIdentifier
o.MuteFirstRecoveryNotification = all.MuteFirstRecoveryNotification
o.NotifyEndStates = all.NotifyEndStates
o.NotifyEndTypes = all.NotifyEndTypes
o.Schedule = all.Schedule
o.Scope = all.Scope
if all.Status != nil && !all.Status.IsValid() {
hasInvalidField = true
} else {
o.Status = all.Status
}
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}