-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_search_slo_threshold.go
279 lines (244 loc) · 9.05 KB
/
model_search_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
// 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"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// SearchSLOThreshold SLO thresholds (target and optionally warning) for a single time window.
type SearchSLOThreshold 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 (for example `98.00`).
//
// Always included in service level objective responses. Ignored in
// create/update requests.
TargetDisplay *string `json:"target_display,omitempty"`
// The SLO time window options.
Timeframe SearchSLOTimeframe `json:"timeframe"`
// The warning value for the service level objective.
Warning datadog.NullableFloat64 `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 datadog.NullableString `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:"-"`
AdditionalProperties map[string]interface{}
}
// NewSearchSLOThreshold instantiates a new SearchSLOThreshold 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 NewSearchSLOThreshold(target float64, timeframe SearchSLOTimeframe) *SearchSLOThreshold {
this := SearchSLOThreshold{}
this.Target = target
this.Timeframe = timeframe
return &this
}
// NewSearchSLOThresholdWithDefaults instantiates a new SearchSLOThreshold 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 NewSearchSLOThresholdWithDefaults() *SearchSLOThreshold {
this := SearchSLOThreshold{}
return &this
}
// GetTarget returns the Target field value.
func (o *SearchSLOThreshold) 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 *SearchSLOThreshold) GetTargetOk() (*float64, bool) {
if o == nil {
return nil, false
}
return &o.Target, true
}
// SetTarget sets field value.
func (o *SearchSLOThreshold) SetTarget(v float64) {
o.Target = v
}
// GetTargetDisplay returns the TargetDisplay field value if set, zero value otherwise.
func (o *SearchSLOThreshold) 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 *SearchSLOThreshold) 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 *SearchSLOThreshold) HasTargetDisplay() bool {
return o != nil && o.TargetDisplay != nil
}
// SetTargetDisplay gets a reference to the given string and assigns it to the TargetDisplay field.
func (o *SearchSLOThreshold) SetTargetDisplay(v string) {
o.TargetDisplay = &v
}
// GetTimeframe returns the Timeframe field value.
func (o *SearchSLOThreshold) GetTimeframe() SearchSLOTimeframe {
if o == nil {
var ret SearchSLOTimeframe
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 *SearchSLOThreshold) GetTimeframeOk() (*SearchSLOTimeframe, bool) {
if o == nil {
return nil, false
}
return &o.Timeframe, true
}
// SetTimeframe sets field value.
func (o *SearchSLOThreshold) SetTimeframe(v SearchSLOTimeframe) {
o.Timeframe = v
}
// GetWarning returns the Warning field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SearchSLOThreshold) GetWarning() float64 {
if o == nil || o.Warning.Get() == nil {
var ret float64
return ret
}
return *o.Warning.Get()
}
// GetWarningOk returns a tuple with the Warning 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 *SearchSLOThreshold) GetWarningOk() (*float64, bool) {
if o == nil {
return nil, false
}
return o.Warning.Get(), o.Warning.IsSet()
}
// HasWarning returns a boolean if a field has been set.
func (o *SearchSLOThreshold) HasWarning() bool {
return o != nil && o.Warning.IsSet()
}
// SetWarning gets a reference to the given datadog.NullableFloat64 and assigns it to the Warning field.
func (o *SearchSLOThreshold) SetWarning(v float64) {
o.Warning.Set(&v)
}
// SetWarningNil sets the value for Warning to be an explicit nil.
func (o *SearchSLOThreshold) SetWarningNil() {
o.Warning.Set(nil)
}
// UnsetWarning ensures that no value is present for Warning, not even an explicit nil.
func (o *SearchSLOThreshold) UnsetWarning() {
o.Warning.Unset()
}
// GetWarningDisplay returns the WarningDisplay field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SearchSLOThreshold) GetWarningDisplay() string {
if o == nil || o.WarningDisplay.Get() == nil {
var ret string
return ret
}
return *o.WarningDisplay.Get()
}
// GetWarningDisplayOk returns a tuple with the WarningDisplay 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 *SearchSLOThreshold) GetWarningDisplayOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.WarningDisplay.Get(), o.WarningDisplay.IsSet()
}
// HasWarningDisplay returns a boolean if a field has been set.
func (o *SearchSLOThreshold) HasWarningDisplay() bool {
return o != nil && o.WarningDisplay.IsSet()
}
// SetWarningDisplay gets a reference to the given datadog.NullableString and assigns it to the WarningDisplay field.
func (o *SearchSLOThreshold) SetWarningDisplay(v string) {
o.WarningDisplay.Set(&v)
}
// SetWarningDisplayNil sets the value for WarningDisplay to be an explicit nil.
func (o *SearchSLOThreshold) SetWarningDisplayNil() {
o.WarningDisplay.Set(nil)
}
// UnsetWarningDisplay ensures that no value is present for WarningDisplay, not even an explicit nil.
func (o *SearchSLOThreshold) UnsetWarningDisplay() {
o.WarningDisplay.Unset()
}
// MarshalJSON serializes the struct using spec logic.
func (o SearchSLOThreshold) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["target"] = o.Target
if o.TargetDisplay != nil {
toSerialize["target_display"] = o.TargetDisplay
}
toSerialize["timeframe"] = o.Timeframe
if o.Warning.IsSet() {
toSerialize["warning"] = o.Warning.Get()
}
if o.WarningDisplay.IsSet() {
toSerialize["warning_display"] = o.WarningDisplay.Get()
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *SearchSLOThreshold) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Target *float64 `json:"target"`
TargetDisplay *string `json:"target_display,omitempty"`
Timeframe *SearchSLOTimeframe `json:"timeframe"`
Warning datadog.NullableFloat64 `json:"warning,omitempty"`
WarningDisplay datadog.NullableString `json:"warning_display,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Target == nil {
return fmt.Errorf("required field target missing")
}
if all.Timeframe == nil {
return fmt.Errorf("required field timeframe missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"target", "target_display", "timeframe", "warning", "warning_display"})
} else {
return err
}
hasInvalidField := false
o.Target = *all.Target
o.TargetDisplay = all.TargetDisplay
if !all.Timeframe.IsValid() {
hasInvalidField = true
} else {
o.Timeframe = *all.Timeframe
}
o.Warning = all.Warning
o.WarningDisplay = all.WarningDisplay
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}