-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_slo_overall_statuses.go
453 lines (395 loc) · 15.7 KB
/
model_slo_overall_statuses.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
// 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 (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// SLOOverallStatuses Overall status of the SLO by timeframes.
type SLOOverallStatuses struct {
// Error message if SLO status or error budget could not be calculated.
Error datadog.NullableString `json:"error,omitempty"`
// Remaining error budget of the SLO in percentage.
ErrorBudgetRemaining datadog.NullableFloat64 `json:"error_budget_remaining,omitempty"`
// timestamp (UNIX time in seconds) of when the SLO status and error budget
// were calculated.
IndexedAt *int64 `json:"indexed_at,omitempty"`
// Error budget remaining for an SLO.
RawErrorBudgetRemaining NullableSLORawErrorBudgetRemaining `json:"raw_error_budget_remaining,omitempty"`
// The amount of decimal places the SLI value is accurate to.
SpanPrecision datadog.NullableInt64 `json:"span_precision,omitempty"`
// State of the SLO.
State *SLOState `json:"state,omitempty"`
// The status of the SLO.
Status datadog.NullableFloat64 `json:"status,omitempty"`
// The target of the SLO.
Target *float64 `json:"target,omitempty"`
// The SLO time window options. Note that "custom" is not a valid option for creating
// or updating SLOs. It is only used when querying SLO history over custom timeframes.
Timeframe *SLOTimeframe `json:"timeframe,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{}
}
// NewSLOOverallStatuses instantiates a new SLOOverallStatuses 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 NewSLOOverallStatuses() *SLOOverallStatuses {
this := SLOOverallStatuses{}
return &this
}
// NewSLOOverallStatusesWithDefaults instantiates a new SLOOverallStatuses 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 NewSLOOverallStatusesWithDefaults() *SLOOverallStatuses {
this := SLOOverallStatuses{}
return &this
}
// GetError returns the Error field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SLOOverallStatuses) GetError() string {
if o == nil || o.Error.Get() == nil {
var ret string
return ret
}
return *o.Error.Get()
}
// GetErrorOk returns a tuple with the Error 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 *SLOOverallStatuses) GetErrorOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Error.Get(), o.Error.IsSet()
}
// HasError returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasError() bool {
return o != nil && o.Error.IsSet()
}
// SetError gets a reference to the given datadog.NullableString and assigns it to the Error field.
func (o *SLOOverallStatuses) SetError(v string) {
o.Error.Set(&v)
}
// SetErrorNil sets the value for Error to be an explicit nil.
func (o *SLOOverallStatuses) SetErrorNil() {
o.Error.Set(nil)
}
// UnsetError ensures that no value is present for Error, not even an explicit nil.
func (o *SLOOverallStatuses) UnsetError() {
o.Error.Unset()
}
// GetErrorBudgetRemaining returns the ErrorBudgetRemaining field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SLOOverallStatuses) GetErrorBudgetRemaining() float64 {
if o == nil || o.ErrorBudgetRemaining.Get() == nil {
var ret float64
return ret
}
return *o.ErrorBudgetRemaining.Get()
}
// GetErrorBudgetRemainingOk returns a tuple with the ErrorBudgetRemaining 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 *SLOOverallStatuses) GetErrorBudgetRemainingOk() (*float64, bool) {
if o == nil {
return nil, false
}
return o.ErrorBudgetRemaining.Get(), o.ErrorBudgetRemaining.IsSet()
}
// HasErrorBudgetRemaining returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasErrorBudgetRemaining() bool {
return o != nil && o.ErrorBudgetRemaining.IsSet()
}
// SetErrorBudgetRemaining gets a reference to the given datadog.NullableFloat64 and assigns it to the ErrorBudgetRemaining field.
func (o *SLOOverallStatuses) SetErrorBudgetRemaining(v float64) {
o.ErrorBudgetRemaining.Set(&v)
}
// SetErrorBudgetRemainingNil sets the value for ErrorBudgetRemaining to be an explicit nil.
func (o *SLOOverallStatuses) SetErrorBudgetRemainingNil() {
o.ErrorBudgetRemaining.Set(nil)
}
// UnsetErrorBudgetRemaining ensures that no value is present for ErrorBudgetRemaining, not even an explicit nil.
func (o *SLOOverallStatuses) UnsetErrorBudgetRemaining() {
o.ErrorBudgetRemaining.Unset()
}
// GetIndexedAt returns the IndexedAt field value if set, zero value otherwise.
func (o *SLOOverallStatuses) GetIndexedAt() int64 {
if o == nil || o.IndexedAt == nil {
var ret int64
return ret
}
return *o.IndexedAt
}
// GetIndexedAtOk returns a tuple with the IndexedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SLOOverallStatuses) GetIndexedAtOk() (*int64, bool) {
if o == nil || o.IndexedAt == nil {
return nil, false
}
return o.IndexedAt, true
}
// HasIndexedAt returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasIndexedAt() bool {
return o != nil && o.IndexedAt != nil
}
// SetIndexedAt gets a reference to the given int64 and assigns it to the IndexedAt field.
func (o *SLOOverallStatuses) SetIndexedAt(v int64) {
o.IndexedAt = &v
}
// GetRawErrorBudgetRemaining returns the RawErrorBudgetRemaining field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SLOOverallStatuses) GetRawErrorBudgetRemaining() SLORawErrorBudgetRemaining {
if o == nil || o.RawErrorBudgetRemaining.Get() == nil {
var ret SLORawErrorBudgetRemaining
return ret
}
return *o.RawErrorBudgetRemaining.Get()
}
// GetRawErrorBudgetRemainingOk returns a tuple with the RawErrorBudgetRemaining 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 *SLOOverallStatuses) GetRawErrorBudgetRemainingOk() (*SLORawErrorBudgetRemaining, bool) {
if o == nil {
return nil, false
}
return o.RawErrorBudgetRemaining.Get(), o.RawErrorBudgetRemaining.IsSet()
}
// HasRawErrorBudgetRemaining returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasRawErrorBudgetRemaining() bool {
return o != nil && o.RawErrorBudgetRemaining.IsSet()
}
// SetRawErrorBudgetRemaining gets a reference to the given NullableSLORawErrorBudgetRemaining and assigns it to the RawErrorBudgetRemaining field.
func (o *SLOOverallStatuses) SetRawErrorBudgetRemaining(v SLORawErrorBudgetRemaining) {
o.RawErrorBudgetRemaining.Set(&v)
}
// SetRawErrorBudgetRemainingNil sets the value for RawErrorBudgetRemaining to be an explicit nil.
func (o *SLOOverallStatuses) SetRawErrorBudgetRemainingNil() {
o.RawErrorBudgetRemaining.Set(nil)
}
// UnsetRawErrorBudgetRemaining ensures that no value is present for RawErrorBudgetRemaining, not even an explicit nil.
func (o *SLOOverallStatuses) UnsetRawErrorBudgetRemaining() {
o.RawErrorBudgetRemaining.Unset()
}
// GetSpanPrecision returns the SpanPrecision field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SLOOverallStatuses) GetSpanPrecision() int64 {
if o == nil || o.SpanPrecision.Get() == nil {
var ret int64
return ret
}
return *o.SpanPrecision.Get()
}
// GetSpanPrecisionOk returns a tuple with the SpanPrecision 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 *SLOOverallStatuses) GetSpanPrecisionOk() (*int64, bool) {
if o == nil {
return nil, false
}
return o.SpanPrecision.Get(), o.SpanPrecision.IsSet()
}
// HasSpanPrecision returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasSpanPrecision() bool {
return o != nil && o.SpanPrecision.IsSet()
}
// SetSpanPrecision gets a reference to the given datadog.NullableInt64 and assigns it to the SpanPrecision field.
func (o *SLOOverallStatuses) SetSpanPrecision(v int64) {
o.SpanPrecision.Set(&v)
}
// SetSpanPrecisionNil sets the value for SpanPrecision to be an explicit nil.
func (o *SLOOverallStatuses) SetSpanPrecisionNil() {
o.SpanPrecision.Set(nil)
}
// UnsetSpanPrecision ensures that no value is present for SpanPrecision, not even an explicit nil.
func (o *SLOOverallStatuses) UnsetSpanPrecision() {
o.SpanPrecision.Unset()
}
// GetState returns the State field value if set, zero value otherwise.
func (o *SLOOverallStatuses) GetState() SLOState {
if o == nil || o.State == nil {
var ret SLOState
return ret
}
return *o.State
}
// GetStateOk returns a tuple with the State field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SLOOverallStatuses) GetStateOk() (*SLOState, bool) {
if o == nil || o.State == nil {
return nil, false
}
return o.State, true
}
// HasState returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasState() bool {
return o != nil && o.State != nil
}
// SetState gets a reference to the given SLOState and assigns it to the State field.
func (o *SLOOverallStatuses) SetState(v SLOState) {
o.State = &v
}
// GetStatus returns the Status field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SLOOverallStatuses) GetStatus() float64 {
if o == nil || o.Status.Get() == nil {
var ret float64
return ret
}
return *o.Status.Get()
}
// GetStatusOk returns a tuple with the Status 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 *SLOOverallStatuses) GetStatusOk() (*float64, bool) {
if o == nil {
return nil, false
}
return o.Status.Get(), o.Status.IsSet()
}
// HasStatus returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasStatus() bool {
return o != nil && o.Status.IsSet()
}
// SetStatus gets a reference to the given datadog.NullableFloat64 and assigns it to the Status field.
func (o *SLOOverallStatuses) SetStatus(v float64) {
o.Status.Set(&v)
}
// SetStatusNil sets the value for Status to be an explicit nil.
func (o *SLOOverallStatuses) SetStatusNil() {
o.Status.Set(nil)
}
// UnsetStatus ensures that no value is present for Status, not even an explicit nil.
func (o *SLOOverallStatuses) UnsetStatus() {
o.Status.Unset()
}
// GetTarget returns the Target field value if set, zero value otherwise.
func (o *SLOOverallStatuses) GetTarget() float64 {
if o == nil || o.Target == nil {
var ret float64
return ret
}
return *o.Target
}
// GetTargetOk returns a tuple with the Target field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SLOOverallStatuses) GetTargetOk() (*float64, bool) {
if o == nil || o.Target == nil {
return nil, false
}
return o.Target, true
}
// HasTarget returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasTarget() bool {
return o != nil && o.Target != nil
}
// SetTarget gets a reference to the given float64 and assigns it to the Target field.
func (o *SLOOverallStatuses) SetTarget(v float64) {
o.Target = &v
}
// GetTimeframe returns the Timeframe field value if set, zero value otherwise.
func (o *SLOOverallStatuses) GetTimeframe() SLOTimeframe {
if o == nil || o.Timeframe == nil {
var ret SLOTimeframe
return ret
}
return *o.Timeframe
}
// GetTimeframeOk returns a tuple with the Timeframe field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SLOOverallStatuses) GetTimeframeOk() (*SLOTimeframe, bool) {
if o == nil || o.Timeframe == nil {
return nil, false
}
return o.Timeframe, true
}
// HasTimeframe returns a boolean if a field has been set.
func (o *SLOOverallStatuses) HasTimeframe() bool {
return o != nil && o.Timeframe != nil
}
// SetTimeframe gets a reference to the given SLOTimeframe and assigns it to the Timeframe field.
func (o *SLOOverallStatuses) SetTimeframe(v SLOTimeframe) {
o.Timeframe = &v
}
// MarshalJSON serializes the struct using spec logic.
func (o SLOOverallStatuses) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Error.IsSet() {
toSerialize["error"] = o.Error.Get()
}
if o.ErrorBudgetRemaining.IsSet() {
toSerialize["error_budget_remaining"] = o.ErrorBudgetRemaining.Get()
}
if o.IndexedAt != nil {
toSerialize["indexed_at"] = o.IndexedAt
}
if o.RawErrorBudgetRemaining.IsSet() {
toSerialize["raw_error_budget_remaining"] = o.RawErrorBudgetRemaining.Get()
}
if o.SpanPrecision.IsSet() {
toSerialize["span_precision"] = o.SpanPrecision.Get()
}
if o.State != nil {
toSerialize["state"] = o.State
}
if o.Status.IsSet() {
toSerialize["status"] = o.Status.Get()
}
if o.Target != nil {
toSerialize["target"] = o.Target
}
if o.Timeframe != nil {
toSerialize["timeframe"] = o.Timeframe
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *SLOOverallStatuses) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Error datadog.NullableString `json:"error,omitempty"`
ErrorBudgetRemaining datadog.NullableFloat64 `json:"error_budget_remaining,omitempty"`
IndexedAt *int64 `json:"indexed_at,omitempty"`
RawErrorBudgetRemaining NullableSLORawErrorBudgetRemaining `json:"raw_error_budget_remaining,omitempty"`
SpanPrecision datadog.NullableInt64 `json:"span_precision,omitempty"`
State *SLOState `json:"state,omitempty"`
Status datadog.NullableFloat64 `json:"status,omitempty"`
Target *float64 `json:"target,omitempty"`
Timeframe *SLOTimeframe `json:"timeframe,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{"error", "error_budget_remaining", "indexed_at", "raw_error_budget_remaining", "span_precision", "state", "status", "target", "timeframe"})
} else {
return err
}
hasInvalidField := false
o.Error = all.Error
o.ErrorBudgetRemaining = all.ErrorBudgetRemaining
o.IndexedAt = all.IndexedAt
o.RawErrorBudgetRemaining = all.RawErrorBudgetRemaining
o.SpanPrecision = all.SpanPrecision
if all.State != nil && !all.State.IsValid() {
hasInvalidField = true
} else {
o.State = all.State
}
o.Status = all.Status
o.Target = all.Target
if all.Timeframe != nil && !all.Timeframe.IsValid() {
hasInvalidField = true
} else {
o.Timeframe = all.Timeframe
}
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}