-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel_event.go
638 lines (544 loc) · 17.1 KB
/
model_event.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
/*
Linode API
[Read the API documentation](https://techdocs.akamai.com/linode-api/reference/api).
API version: 4.189.2
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"encoding/json"
"time"
)
// checks if the Event type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Event{}
// Event A collection of Event objects. An Event is an action taken against an entity related to your Account. For example, booting a Linode would create an Event. The Events returned depends on your grants.
type Event struct {
// The action that caused this Event. New actions may be added in the future.
Action *string `json:"action,omitempty"`
// When this Event was created.
Created *time.Time `json:"created,omitempty"`
// The total duration in seconds that it takes for the Event to complete.
Duration *float32 `json:"duration,omitempty"`
Entity *GetEvents200ResponseDataInnerEntity `json:"entity,omitempty"`
// The unique ID of this Event.
Id *int32 `json:"id,omitempty"`
// Provides additional information about the event. Additional information may include, but is not limited to, a more detailed representation of events which can help diagnose non-obvious failures.
Message NullableString `json:"message,omitempty"`
// A percentage estimating the amount of time remaining for an Event. Returns `null` for notification events.
PercentComplete *int32 `json:"percent_complete,omitempty"`
// The rate of completion of the Event. Only some Events will return rate; for example, migration and resize Events.
Rate *string `json:"rate,omitempty"`
// If this Event has been read.
Read *bool `json:"read,omitempty"`
SecondaryEntity *GetEvents200ResponseDataInnerSecondaryEntity `json:"secondary_entity,omitempty"`
// If this Event has been seen.
Seen *bool `json:"seen,omitempty"`
// The current status of this Event.
Status *string `json:"status,omitempty"`
// The estimated time remaining until the completion of this Event. This value is only returned for some in-progress migration events. For all other in-progress events, the `percent_complete` attribute will indicate about how much more work is to be done.
TimeRemaining NullableString `json:"time_remaining,omitempty"`
// The username of the User who caused the Event.
Username NullableString `json:"username,omitempty"`
}
// NewEvent instantiates a new Event 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 NewEvent() *Event {
this := Event{}
return &this
}
// NewEventWithDefaults instantiates a new Event 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 NewEventWithDefaults() *Event {
this := Event{}
return &this
}
// GetAction returns the Action field value if set, zero value otherwise.
func (o *Event) GetAction() string {
if o == nil || IsNil(o.Action) {
var ret string
return ret
}
return *o.Action
}
// GetActionOk returns a tuple with the Action field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetActionOk() (*string, bool) {
if o == nil || IsNil(o.Action) {
return nil, false
}
return o.Action, true
}
// HasAction returns a boolean if a field has been set.
func (o *Event) HasAction() bool {
if o != nil && !IsNil(o.Action) {
return true
}
return false
}
// SetAction gets a reference to the given string and assigns it to the Action field.
func (o *Event) SetAction(v string) {
o.Action = &v
}
// GetCreated returns the Created field value if set, zero value otherwise.
func (o *Event) GetCreated() time.Time {
if o == nil || IsNil(o.Created) {
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 *Event) GetCreatedOk() (*time.Time, bool) {
if o == nil || IsNil(o.Created) {
return nil, false
}
return o.Created, true
}
// HasCreated returns a boolean if a field has been set.
func (o *Event) HasCreated() bool {
if o != nil && !IsNil(o.Created) {
return true
}
return false
}
// SetCreated gets a reference to the given time.Time and assigns it to the Created field.
func (o *Event) SetCreated(v time.Time) {
o.Created = &v
}
// GetDuration returns the Duration field value if set, zero value otherwise.
func (o *Event) GetDuration() float32 {
if o == nil || IsNil(o.Duration) {
var ret float32
return ret
}
return *o.Duration
}
// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetDurationOk() (*float32, bool) {
if o == nil || IsNil(o.Duration) {
return nil, false
}
return o.Duration, true
}
// HasDuration returns a boolean if a field has been set.
func (o *Event) HasDuration() bool {
if o != nil && !IsNil(o.Duration) {
return true
}
return false
}
// SetDuration gets a reference to the given float32 and assigns it to the Duration field.
func (o *Event) SetDuration(v float32) {
o.Duration = &v
}
// GetEntity returns the Entity field value if set, zero value otherwise.
func (o *Event) GetEntity() GetEvents200ResponseDataInnerEntity {
if o == nil || IsNil(o.Entity) {
var ret GetEvents200ResponseDataInnerEntity
return ret
}
return *o.Entity
}
// GetEntityOk returns a tuple with the Entity field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetEntityOk() (*GetEvents200ResponseDataInnerEntity, bool) {
if o == nil || IsNil(o.Entity) {
return nil, false
}
return o.Entity, true
}
// HasEntity returns a boolean if a field has been set.
func (o *Event) HasEntity() bool {
if o != nil && !IsNil(o.Entity) {
return true
}
return false
}
// SetEntity gets a reference to the given GetEvents200ResponseDataInnerEntity and assigns it to the Entity field.
func (o *Event) SetEntity(v GetEvents200ResponseDataInnerEntity) {
o.Entity = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *Event) GetId() int32 {
if o == nil || IsNil(o.Id) {
var ret int32
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 *Event) GetIdOk() (*int32, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *Event) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given int32 and assigns it to the Id field.
func (o *Event) SetId(v int32) {
o.Id = &v
}
// GetMessage returns the Message field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Event) GetMessage() string {
if o == nil || IsNil(o.Message.Get()) {
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 *Event) 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 *Event) HasMessage() bool {
if o != nil && o.Message.IsSet() {
return true
}
return false
}
// SetMessage gets a reference to the given NullableString and assigns it to the Message field.
func (o *Event) SetMessage(v string) {
o.Message.Set(&v)
}
// SetMessageNil sets the value for Message to be an explicit nil
func (o *Event) SetMessageNil() {
o.Message.Set(nil)
}
// UnsetMessage ensures that no value is present for Message, not even an explicit nil
func (o *Event) UnsetMessage() {
o.Message.Unset()
}
// GetPercentComplete returns the PercentComplete field value if set, zero value otherwise.
func (o *Event) GetPercentComplete() int32 {
if o == nil || IsNil(o.PercentComplete) {
var ret int32
return ret
}
return *o.PercentComplete
}
// GetPercentCompleteOk returns a tuple with the PercentComplete field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetPercentCompleteOk() (*int32, bool) {
if o == nil || IsNil(o.PercentComplete) {
return nil, false
}
return o.PercentComplete, true
}
// HasPercentComplete returns a boolean if a field has been set.
func (o *Event) HasPercentComplete() bool {
if o != nil && !IsNil(o.PercentComplete) {
return true
}
return false
}
// SetPercentComplete gets a reference to the given int32 and assigns it to the PercentComplete field.
func (o *Event) SetPercentComplete(v int32) {
o.PercentComplete = &v
}
// GetRate returns the Rate field value if set, zero value otherwise.
func (o *Event) GetRate() string {
if o == nil || IsNil(o.Rate) {
var ret string
return ret
}
return *o.Rate
}
// GetRateOk returns a tuple with the Rate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetRateOk() (*string, bool) {
if o == nil || IsNil(o.Rate) {
return nil, false
}
return o.Rate, true
}
// HasRate returns a boolean if a field has been set.
func (o *Event) HasRate() bool {
if o != nil && !IsNil(o.Rate) {
return true
}
return false
}
// SetRate gets a reference to the given string and assigns it to the Rate field.
func (o *Event) SetRate(v string) {
o.Rate = &v
}
// GetRead returns the Read field value if set, zero value otherwise.
func (o *Event) GetRead() bool {
if o == nil || IsNil(o.Read) {
var ret bool
return ret
}
return *o.Read
}
// GetReadOk returns a tuple with the Read field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetReadOk() (*bool, bool) {
if o == nil || IsNil(o.Read) {
return nil, false
}
return o.Read, true
}
// HasRead returns a boolean if a field has been set.
func (o *Event) HasRead() bool {
if o != nil && !IsNil(o.Read) {
return true
}
return false
}
// SetRead gets a reference to the given bool and assigns it to the Read field.
func (o *Event) SetRead(v bool) {
o.Read = &v
}
// GetSecondaryEntity returns the SecondaryEntity field value if set, zero value otherwise.
func (o *Event) GetSecondaryEntity() GetEvents200ResponseDataInnerSecondaryEntity {
if o == nil || IsNil(o.SecondaryEntity) {
var ret GetEvents200ResponseDataInnerSecondaryEntity
return ret
}
return *o.SecondaryEntity
}
// GetSecondaryEntityOk returns a tuple with the SecondaryEntity field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetSecondaryEntityOk() (*GetEvents200ResponseDataInnerSecondaryEntity, bool) {
if o == nil || IsNil(o.SecondaryEntity) {
return nil, false
}
return o.SecondaryEntity, true
}
// HasSecondaryEntity returns a boolean if a field has been set.
func (o *Event) HasSecondaryEntity() bool {
if o != nil && !IsNil(o.SecondaryEntity) {
return true
}
return false
}
// SetSecondaryEntity gets a reference to the given GetEvents200ResponseDataInnerSecondaryEntity and assigns it to the SecondaryEntity field.
func (o *Event) SetSecondaryEntity(v GetEvents200ResponseDataInnerSecondaryEntity) {
o.SecondaryEntity = &v
}
// GetSeen returns the Seen field value if set, zero value otherwise.
func (o *Event) GetSeen() bool {
if o == nil || IsNil(o.Seen) {
var ret bool
return ret
}
return *o.Seen
}
// GetSeenOk returns a tuple with the Seen field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetSeenOk() (*bool, bool) {
if o == nil || IsNil(o.Seen) {
return nil, false
}
return o.Seen, true
}
// HasSeen returns a boolean if a field has been set.
func (o *Event) HasSeen() bool {
if o != nil && !IsNil(o.Seen) {
return true
}
return false
}
// SetSeen gets a reference to the given bool and assigns it to the Seen field.
func (o *Event) SetSeen(v bool) {
o.Seen = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *Event) GetStatus() string {
if o == nil || IsNil(o.Status) {
var ret string
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 *Event) GetStatusOk() (*string, bool) {
if o == nil || IsNil(o.Status) {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *Event) HasStatus() bool {
if o != nil && !IsNil(o.Status) {
return true
}
return false
}
// SetStatus gets a reference to the given string and assigns it to the Status field.
func (o *Event) SetStatus(v string) {
o.Status = &v
}
// GetTimeRemaining returns the TimeRemaining field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Event) GetTimeRemaining() string {
if o == nil || IsNil(o.TimeRemaining.Get()) {
var ret string
return ret
}
return *o.TimeRemaining.Get()
}
// GetTimeRemainingOk returns a tuple with the TimeRemaining 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 *Event) GetTimeRemainingOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.TimeRemaining.Get(), o.TimeRemaining.IsSet()
}
// HasTimeRemaining returns a boolean if a field has been set.
func (o *Event) HasTimeRemaining() bool {
if o != nil && o.TimeRemaining.IsSet() {
return true
}
return false
}
// SetTimeRemaining gets a reference to the given NullableString and assigns it to the TimeRemaining field.
func (o *Event) SetTimeRemaining(v string) {
o.TimeRemaining.Set(&v)
}
// SetTimeRemainingNil sets the value for TimeRemaining to be an explicit nil
func (o *Event) SetTimeRemainingNil() {
o.TimeRemaining.Set(nil)
}
// UnsetTimeRemaining ensures that no value is present for TimeRemaining, not even an explicit nil
func (o *Event) UnsetTimeRemaining() {
o.TimeRemaining.Unset()
}
// GetUsername returns the Username field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Event) GetUsername() string {
if o == nil || IsNil(o.Username.Get()) {
var ret string
return ret
}
return *o.Username.Get()
}
// GetUsernameOk returns a tuple with the Username 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 *Event) GetUsernameOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Username.Get(), o.Username.IsSet()
}
// HasUsername returns a boolean if a field has been set.
func (o *Event) HasUsername() bool {
if o != nil && o.Username.IsSet() {
return true
}
return false
}
// SetUsername gets a reference to the given NullableString and assigns it to the Username field.
func (o *Event) SetUsername(v string) {
o.Username.Set(&v)
}
// SetUsernameNil sets the value for Username to be an explicit nil
func (o *Event) SetUsernameNil() {
o.Username.Set(nil)
}
// UnsetUsername ensures that no value is present for Username, not even an explicit nil
func (o *Event) UnsetUsername() {
o.Username.Unset()
}
func (o Event) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Event) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Action) {
toSerialize["action"] = o.Action
}
if !IsNil(o.Created) {
toSerialize["created"] = o.Created
}
if !IsNil(o.Duration) {
toSerialize["duration"] = o.Duration
}
if !IsNil(o.Entity) {
toSerialize["entity"] = o.Entity
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if o.Message.IsSet() {
toSerialize["message"] = o.Message.Get()
}
if !IsNil(o.PercentComplete) {
toSerialize["percent_complete"] = o.PercentComplete
}
if !IsNil(o.Rate) {
toSerialize["rate"] = o.Rate
}
if !IsNil(o.Read) {
toSerialize["read"] = o.Read
}
if !IsNil(o.SecondaryEntity) {
toSerialize["secondary_entity"] = o.SecondaryEntity
}
if !IsNil(o.Seen) {
toSerialize["seen"] = o.Seen
}
if !IsNil(o.Status) {
toSerialize["status"] = o.Status
}
if o.TimeRemaining.IsSet() {
toSerialize["time_remaining"] = o.TimeRemaining.Get()
}
if o.Username.IsSet() {
toSerialize["username"] = o.Username.Get()
}
return toSerialize, nil
}
type NullableEvent struct {
value *Event
isSet bool
}
func (v NullableEvent) Get() *Event {
return v.value
}
func (v *NullableEvent) Set(val *Event) {
v.value = val
v.isSet = true
}
func (v NullableEvent) IsSet() bool {
return v.isSet
}
func (v *NullableEvent) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableEvent(val *Event) *NullableEvent {
return &NullableEvent{value: val, isSet: true}
}
func (v NullableEvent) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableEvent) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}