forked from DataDog/datadog-api-client-go
/
model_slo_threshold.go
299 lines (260 loc) · 8.27 KB
/
model_slo_threshold.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
/*
* 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.
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package datadog
import (
"encoding/json"
"fmt"
)
// SLOThreshold SLO thresholds (target and optionally warning) for a single time window.
type SLOThreshold struct {
// The target value for the service level indicator within the corresponding timeframe.
Target float64 `json:"target"`
// A string representation of the target that indicates its precision. It uses trailing zeros to show significant decimal places (e.g. `98.00`). Always included in service level objective responses. Ignored in create/update requests.
TargetDisplay *string `json:"target_display,omitempty"`
Timeframe SLOTimeframe `json:"timeframe"`
// The warning value for the service level objective.
Warning *float64 `json:"warning,omitempty"`
// A string representation of the warning target (see the description of the `target_display` field for details). Included in service level objective responses if a warning target exists. Ignored in create/update requests.
WarningDisplay *string `json:"warning_display,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:-`
}
// NewSLOThreshold instantiates a new SLOThreshold 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 NewSLOThreshold(target float64, timeframe SLOTimeframe) *SLOThreshold {
this := SLOThreshold{}
this.Target = target
this.Timeframe = timeframe
return &this
}
// NewSLOThresholdWithDefaults instantiates a new SLOThreshold 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 NewSLOThresholdWithDefaults() *SLOThreshold {
this := SLOThreshold{}
return &this
}
// GetTarget returns the Target field value
func (o *SLOThreshold) GetTarget() float64 {
if o == nil {
var ret float64
return ret
}
return o.Target
}
// GetTargetOk returns a tuple with the Target field value
// and a boolean to check if the value has been set.
func (o *SLOThreshold) GetTargetOk() (*float64, bool) {
if o == nil {
return nil, false
}
return &o.Target, true
}
// SetTarget sets field value
func (o *SLOThreshold) SetTarget(v float64) {
o.Target = v
}
// GetTargetDisplay returns the TargetDisplay field value if set, zero value otherwise.
func (o *SLOThreshold) GetTargetDisplay() string {
if o == nil || o.TargetDisplay == nil {
var ret string
return ret
}
return *o.TargetDisplay
}
// GetTargetDisplayOk returns a tuple with the TargetDisplay field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SLOThreshold) GetTargetDisplayOk() (*string, bool) {
if o == nil || o.TargetDisplay == nil {
return nil, false
}
return o.TargetDisplay, true
}
// HasTargetDisplay returns a boolean if a field has been set.
func (o *SLOThreshold) HasTargetDisplay() bool {
if o != nil && o.TargetDisplay != nil {
return true
}
return false
}
// SetTargetDisplay gets a reference to the given string and assigns it to the TargetDisplay field.
func (o *SLOThreshold) SetTargetDisplay(v string) {
o.TargetDisplay = &v
}
// GetTimeframe returns the Timeframe field value
func (o *SLOThreshold) GetTimeframe() SLOTimeframe {
if o == nil {
var ret SLOTimeframe
return ret
}
return o.Timeframe
}
// GetTimeframeOk returns a tuple with the Timeframe field value
// and a boolean to check if the value has been set.
func (o *SLOThreshold) GetTimeframeOk() (*SLOTimeframe, bool) {
if o == nil {
return nil, false
}
return &o.Timeframe, true
}
// SetTimeframe sets field value
func (o *SLOThreshold) SetTimeframe(v SLOTimeframe) {
o.Timeframe = v
}
// GetWarning returns the Warning field value if set, zero value otherwise.
func (o *SLOThreshold) GetWarning() float64 {
if o == nil || o.Warning == nil {
var ret float64
return ret
}
return *o.Warning
}
// GetWarningOk returns a tuple with the Warning field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SLOThreshold) GetWarningOk() (*float64, bool) {
if o == nil || o.Warning == nil {
return nil, false
}
return o.Warning, true
}
// HasWarning returns a boolean if a field has been set.
func (o *SLOThreshold) HasWarning() bool {
if o != nil && o.Warning != nil {
return true
}
return false
}
// SetWarning gets a reference to the given float64 and assigns it to the Warning field.
func (o *SLOThreshold) SetWarning(v float64) {
o.Warning = &v
}
// GetWarningDisplay returns the WarningDisplay field value if set, zero value otherwise.
func (o *SLOThreshold) GetWarningDisplay() string {
if o == nil || o.WarningDisplay == nil {
var ret string
return ret
}
return *o.WarningDisplay
}
// GetWarningDisplayOk returns a tuple with the WarningDisplay field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SLOThreshold) GetWarningDisplayOk() (*string, bool) {
if o == nil || o.WarningDisplay == nil {
return nil, false
}
return o.WarningDisplay, true
}
// HasWarningDisplay returns a boolean if a field has been set.
func (o *SLOThreshold) HasWarningDisplay() bool {
if o != nil && o.WarningDisplay != nil {
return true
}
return false
}
// SetWarningDisplay gets a reference to the given string and assigns it to the WarningDisplay field.
func (o *SLOThreshold) SetWarningDisplay(v string) {
o.WarningDisplay = &v
}
func (o SLOThreshold) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return json.Marshal(o.UnparsedObject)
}
if true {
toSerialize["target"] = o.Target
}
if o.TargetDisplay != nil {
toSerialize["target_display"] = o.TargetDisplay
}
if true {
toSerialize["timeframe"] = o.Timeframe
}
if o.Warning != nil {
toSerialize["warning"] = o.Warning
}
if o.WarningDisplay != nil {
toSerialize["warning_display"] = o.WarningDisplay
}
return json.Marshal(toSerialize)
}
func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
required := struct {
Target *float64 `json:"target"`
Timeframe *SLOTimeframe `json:"timeframe"`
}{}
all := struct {
Target float64 `json:"target"`
TargetDisplay *string `json:"target_display,omitempty"`
Timeframe SLOTimeframe `json:"timeframe"`
Warning *float64 `json:"warning,omitempty"`
WarningDisplay *string `json:"warning_display,omitempty"`
}{}
err = json.Unmarshal(bytes, &required)
if err != nil {
return err
}
if required.Target == nil {
return fmt.Errorf("Required field target missing")
}
if required.Timeframe == nil {
return fmt.Errorf("Required field timeframe missing")
}
err = json.Unmarshal(bytes, &all)
if err != nil {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
if v := all.Timeframe; !v.IsValid() {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
o.Target = all.Target
o.TargetDisplay = all.TargetDisplay
o.Timeframe = all.Timeframe
o.Warning = all.Warning
o.WarningDisplay = all.WarningDisplay
return nil
}
type NullableSLOThreshold struct {
value *SLOThreshold
isSet bool
}
func (v NullableSLOThreshold) Get() *SLOThreshold {
return v.value
}
func (v *NullableSLOThreshold) Set(val *SLOThreshold) {
v.value = val
v.isSet = true
}
func (v NullableSLOThreshold) IsSet() bool {
return v.isSet
}
func (v *NullableSLOThreshold) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSLOThreshold(val *SLOThreshold) *NullableSLOThreshold {
return &NullableSLOThreshold{value: val, isSet: true}
}
func (v NullableSLOThreshold) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSLOThreshold) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}