forked from DataDog/datadog-api-client-go
/
model_service_level_objective_request.go
423 lines (368 loc) · 12.7 KB
/
model_service_level_objective_request.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
/*
* 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"
)
// ServiceLevelObjectiveRequest A service level objective object includes a service level indicator, thresholds for one or more timeframes, and metadata (`name`, `description`, `tags`, etc.).
type ServiceLevelObjectiveRequest struct {
// A user-defined description of the service level objective. Always included in service level objective responses (but may be `null`). Optional in create/update requests.
Description NullableString `json:"description,omitempty"`
// A list of (up to 20) monitor groups that narrow the scope of a monitor service level objective. Included in service level objective responses if it is not empty. Optional in create/update requests for monitor service level objectives, but may only be used when then length of the `monitor_ids` field is one.
Groups *[]string `json:"groups,omitempty"`
// A list of monitor ids that defines the scope of a monitor service level objective. **Required if type is `monitor`**.
MonitorIds *[]int64 `json:"monitor_ids,omitempty"`
// The name of the service level objective object.
Name string `json:"name"`
Query *ServiceLevelObjectiveQuery `json:"query,omitempty"`
// A list of tags associated with this service level objective. Always included in service level objective responses (but may be empty). Optional in create/update requests.
Tags *[]string `json:"tags,omitempty"`
// The thresholds (timeframes and associated targets) for this service level objective object.
Thresholds []SLOThreshold `json:"thresholds"`
Type SLOType `json:"type"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:-`
}
// NewServiceLevelObjectiveRequest instantiates a new ServiceLevelObjectiveRequest 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 NewServiceLevelObjectiveRequest(name string, thresholds []SLOThreshold, type_ SLOType) *ServiceLevelObjectiveRequest {
this := ServiceLevelObjectiveRequest{}
this.Name = name
this.Thresholds = thresholds
this.Type = type_
return &this
}
// NewServiceLevelObjectiveRequestWithDefaults instantiates a new ServiceLevelObjectiveRequest 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 NewServiceLevelObjectiveRequestWithDefaults() *ServiceLevelObjectiveRequest {
this := ServiceLevelObjectiveRequest{}
return &this
}
// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ServiceLevelObjectiveRequest) GetDescription() string {
if o == nil || o.Description.Get() == nil {
var ret string
return ret
}
return *o.Description.Get()
}
// GetDescriptionOk returns a tuple with the Description 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 *ServiceLevelObjectiveRequest) GetDescriptionOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Description.Get(), o.Description.IsSet()
}
// HasDescription returns a boolean if a field has been set.
func (o *ServiceLevelObjectiveRequest) HasDescription() bool {
if o != nil && o.Description.IsSet() {
return true
}
return false
}
// SetDescription gets a reference to the given NullableString and assigns it to the Description field.
func (o *ServiceLevelObjectiveRequest) SetDescription(v string) {
o.Description.Set(&v)
}
// SetDescriptionNil sets the value for Description to be an explicit nil
func (o *ServiceLevelObjectiveRequest) SetDescriptionNil() {
o.Description.Set(nil)
}
// UnsetDescription ensures that no value is present for Description, not even an explicit nil
func (o *ServiceLevelObjectiveRequest) UnsetDescription() {
o.Description.Unset()
}
// GetGroups returns the Groups field value if set, zero value otherwise.
func (o *ServiceLevelObjectiveRequest) GetGroups() []string {
if o == nil || o.Groups == nil {
var ret []string
return ret
}
return *o.Groups
}
// GetGroupsOk returns a tuple with the Groups field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ServiceLevelObjectiveRequest) GetGroupsOk() (*[]string, bool) {
if o == nil || o.Groups == nil {
return nil, false
}
return o.Groups, true
}
// HasGroups returns a boolean if a field has been set.
func (o *ServiceLevelObjectiveRequest) HasGroups() bool {
if o != nil && o.Groups != nil {
return true
}
return false
}
// SetGroups gets a reference to the given []string and assigns it to the Groups field.
func (o *ServiceLevelObjectiveRequest) SetGroups(v []string) {
o.Groups = &v
}
// GetMonitorIds returns the MonitorIds field value if set, zero value otherwise.
func (o *ServiceLevelObjectiveRequest) GetMonitorIds() []int64 {
if o == nil || o.MonitorIds == nil {
var ret []int64
return ret
}
return *o.MonitorIds
}
// GetMonitorIdsOk returns a tuple with the MonitorIds field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ServiceLevelObjectiveRequest) GetMonitorIdsOk() (*[]int64, bool) {
if o == nil || o.MonitorIds == nil {
return nil, false
}
return o.MonitorIds, true
}
// HasMonitorIds returns a boolean if a field has been set.
func (o *ServiceLevelObjectiveRequest) HasMonitorIds() bool {
if o != nil && o.MonitorIds != nil {
return true
}
return false
}
// SetMonitorIds gets a reference to the given []int64 and assigns it to the MonitorIds field.
func (o *ServiceLevelObjectiveRequest) SetMonitorIds(v []int64) {
o.MonitorIds = &v
}
// GetName returns the Name field value
func (o *ServiceLevelObjectiveRequest) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *ServiceLevelObjectiveRequest) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *ServiceLevelObjectiveRequest) SetName(v string) {
o.Name = v
}
// GetQuery returns the Query field value if set, zero value otherwise.
func (o *ServiceLevelObjectiveRequest) GetQuery() ServiceLevelObjectiveQuery {
if o == nil || o.Query == nil {
var ret ServiceLevelObjectiveQuery
return ret
}
return *o.Query
}
// GetQueryOk returns a tuple with the Query field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ServiceLevelObjectiveRequest) GetQueryOk() (*ServiceLevelObjectiveQuery, bool) {
if o == nil || o.Query == nil {
return nil, false
}
return o.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (o *ServiceLevelObjectiveRequest) HasQuery() bool {
if o != nil && o.Query != nil {
return true
}
return false
}
// SetQuery gets a reference to the given ServiceLevelObjectiveQuery and assigns it to the Query field.
func (o *ServiceLevelObjectiveRequest) SetQuery(v ServiceLevelObjectiveQuery) {
o.Query = &v
}
// GetTags returns the Tags field value if set, zero value otherwise.
func (o *ServiceLevelObjectiveRequest) GetTags() []string {
if o == nil || o.Tags == nil {
var ret []string
return ret
}
return *o.Tags
}
// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ServiceLevelObjectiveRequest) GetTagsOk() (*[]string, bool) {
if o == nil || o.Tags == nil {
return nil, false
}
return o.Tags, true
}
// HasTags returns a boolean if a field has been set.
func (o *ServiceLevelObjectiveRequest) HasTags() bool {
if o != nil && o.Tags != nil {
return true
}
return false
}
// SetTags gets a reference to the given []string and assigns it to the Tags field.
func (o *ServiceLevelObjectiveRequest) SetTags(v []string) {
o.Tags = &v
}
// GetThresholds returns the Thresholds field value
func (o *ServiceLevelObjectiveRequest) GetThresholds() []SLOThreshold {
if o == nil {
var ret []SLOThreshold
return ret
}
return o.Thresholds
}
// GetThresholdsOk returns a tuple with the Thresholds field value
// and a boolean to check if the value has been set.
func (o *ServiceLevelObjectiveRequest) GetThresholdsOk() (*[]SLOThreshold, bool) {
if o == nil {
return nil, false
}
return &o.Thresholds, true
}
// SetThresholds sets field value
func (o *ServiceLevelObjectiveRequest) SetThresholds(v []SLOThreshold) {
o.Thresholds = v
}
// GetType returns the Type field value
func (o *ServiceLevelObjectiveRequest) GetType() SLOType {
if o == nil {
var ret SLOType
return ret
}
return o.Type
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *ServiceLevelObjectiveRequest) GetTypeOk() (*SLOType, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}
// SetType sets field value
func (o *ServiceLevelObjectiveRequest) SetType(v SLOType) {
o.Type = v
}
func (o ServiceLevelObjectiveRequest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return json.Marshal(o.UnparsedObject)
}
if o.Description.IsSet() {
toSerialize["description"] = o.Description.Get()
}
if o.Groups != nil {
toSerialize["groups"] = o.Groups
}
if o.MonitorIds != nil {
toSerialize["monitor_ids"] = o.MonitorIds
}
if true {
toSerialize["name"] = o.Name
}
if o.Query != nil {
toSerialize["query"] = o.Query
}
if o.Tags != nil {
toSerialize["tags"] = o.Tags
}
if true {
toSerialize["thresholds"] = o.Thresholds
}
if true {
toSerialize["type"] = o.Type
}
return json.Marshal(toSerialize)
}
func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
required := struct {
Name *string `json:"name"`
Thresholds *[]SLOThreshold `json:"thresholds"`
Type *SLOType `json:"type"`
}{}
all := struct {
Description NullableString `json:"description,omitempty"`
Groups *[]string `json:"groups,omitempty"`
MonitorIds *[]int64 `json:"monitor_ids,omitempty"`
Name string `json:"name"`
Query *ServiceLevelObjectiveQuery `json:"query,omitempty"`
Tags *[]string `json:"tags,omitempty"`
Thresholds []SLOThreshold `json:"thresholds"`
Type SLOType `json:"type"`
}{}
err = json.Unmarshal(bytes, &required)
if err != nil {
return err
}
if required.Name == nil {
return fmt.Errorf("Required field name missing")
}
if required.Thresholds == nil {
return fmt.Errorf("Required field thresholds missing")
}
if required.Type == nil {
return fmt.Errorf("Required field type 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.Type; !v.IsValid() {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
o.Description = all.Description
o.Groups = all.Groups
o.MonitorIds = all.MonitorIds
o.Name = all.Name
o.Query = all.Query
o.Tags = all.Tags
o.Thresholds = all.Thresholds
o.Type = all.Type
return nil
}
type NullableServiceLevelObjectiveRequest struct {
value *ServiceLevelObjectiveRequest
isSet bool
}
func (v NullableServiceLevelObjectiveRequest) Get() *ServiceLevelObjectiveRequest {
return v.value
}
func (v *NullableServiceLevelObjectiveRequest) Set(val *ServiceLevelObjectiveRequest) {
v.value = val
v.isSet = true
}
func (v NullableServiceLevelObjectiveRequest) IsSet() bool {
return v.isSet
}
func (v *NullableServiceLevelObjectiveRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableServiceLevelObjectiveRequest(val *ServiceLevelObjectiveRequest) *NullableServiceLevelObjectiveRequest {
return &NullableServiceLevelObjectiveRequest{value: val, isSet: true}
}
func (v NullableServiceLevelObjectiveRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableServiceLevelObjectiveRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}