forked from Dynatrace/dynatrace-configuration-as-code-core
/
model_synthetic_monitor.go
512 lines (429 loc) · 14.1 KB
/
model_synthetic_monitor.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
/*
Dynatrace Environment API
Documentation of the Dynatrace Environment API v1. To read about use cases and examples, see [Dynatrace Documentation](https://dt-url.net/xc03k3c). Notes about compatibility: * Operations marked as early adopter or preview may be changed in non-compatible ways, although we try to avoid this. * We may add new enum constants without incrementing the API version; thus, clients need to handle unknown enum constants gracefully.
API version: 1.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package environment
import (
"bytes"
"encoding/json"
"fmt"
)
// checks if the SyntheticMonitor type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &SyntheticMonitor{}
// SyntheticMonitor The synthetic monitor. The actual set of fields depends the type of the monitor. Find the list of actual objects in the description of the **type** field or see [Synthetic monitors API - JSON models](https://dt-url.net/2523se9).
type SyntheticMonitor struct {
AnomalyDetection *AnomalyDetection `json:"anomalyDetection,omitempty"`
// A set of automatically assigned applications.
AutomaticallyAssignedApps []string `json:"automaticallyAssignedApps"`
// The origin of a monitor
CreatedFrom string `json:"createdFrom"`
// The monitor is enabled (`true`) or disabled (`false`).
Enabled bool `json:"enabled"`
// The entity ID of the monitor.
EntityId string `json:"entityId"`
// The frequency of the monitor, in minutes. You can use one of the following values: `5`, `10`, `15`, `30`, and `60`.
FrequencyMin int32 `json:"frequencyMin"`
// A list of locations from which the monitor is executed. To specify a location, use its entity ID.
Locations []string `json:"locations"`
// A set of management zones to which the monitor belongs to.
ManagementZones []ManagementZone `json:"managementZones"`
// A set of manually assigned applications.
ManuallyAssignedApps []string `json:"manuallyAssignedApps"`
// The name of the monitor.
Name string `json:"name"`
// The script of a [browser](https://dt-url.net/9c103rda) or HTTP monitor.
Script map[string]interface{} `json:"script"`
// A set of tags assigned to the monitor.
Tags []TagWithSourceInfo `json:"tags"`
// Defines the actual set of fields depending on the value. See one of the following objects: * `BROWSER` -> BrowserSyntheticMonitor * `HTTP` -> HttpSyntheticMonitor
Type string `json:"type"`
}
type _SyntheticMonitor SyntheticMonitor
// NewSyntheticMonitor instantiates a new SyntheticMonitor 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 NewSyntheticMonitor(automaticallyAssignedApps []string, createdFrom string, enabled bool, entityId string, frequencyMin int32, locations []string, managementZones []ManagementZone, manuallyAssignedApps []string, name string, script map[string]interface{}, tags []TagWithSourceInfo, type_ string) *SyntheticMonitor {
this := SyntheticMonitor{}
this.AutomaticallyAssignedApps = automaticallyAssignedApps
this.CreatedFrom = createdFrom
this.Enabled = enabled
this.EntityId = entityId
this.FrequencyMin = frequencyMin
this.Locations = locations
this.ManagementZones = managementZones
this.ManuallyAssignedApps = manuallyAssignedApps
this.Name = name
this.Script = script
this.Tags = tags
this.Type = type_
return &this
}
// NewSyntheticMonitorWithDefaults instantiates a new SyntheticMonitor 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 NewSyntheticMonitorWithDefaults() *SyntheticMonitor {
this := SyntheticMonitor{}
return &this
}
// GetAnomalyDetection returns the AnomalyDetection field value if set, zero value otherwise.
func (o *SyntheticMonitor) GetAnomalyDetection() AnomalyDetection {
if o == nil || IsNil(o.AnomalyDetection) {
var ret AnomalyDetection
return ret
}
return *o.AnomalyDetection
}
// GetAnomalyDetectionOk returns a tuple with the AnomalyDetection field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetAnomalyDetectionOk() (*AnomalyDetection, bool) {
if o == nil || IsNil(o.AnomalyDetection) {
return nil, false
}
return o.AnomalyDetection, true
}
// HasAnomalyDetection returns a boolean if a field has been set.
func (o *SyntheticMonitor) HasAnomalyDetection() bool {
if o != nil && !IsNil(o.AnomalyDetection) {
return true
}
return false
}
// SetAnomalyDetection gets a reference to the given AnomalyDetection and assigns it to the AnomalyDetection field.
func (o *SyntheticMonitor) SetAnomalyDetection(v AnomalyDetection) {
o.AnomalyDetection = &v
}
// GetAutomaticallyAssignedApps returns the AutomaticallyAssignedApps field value
func (o *SyntheticMonitor) GetAutomaticallyAssignedApps() []string {
if o == nil {
var ret []string
return ret
}
return o.AutomaticallyAssignedApps
}
// GetAutomaticallyAssignedAppsOk returns a tuple with the AutomaticallyAssignedApps field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetAutomaticallyAssignedAppsOk() ([]string, bool) {
if o == nil {
return nil, false
}
return o.AutomaticallyAssignedApps, true
}
// SetAutomaticallyAssignedApps sets field value
func (o *SyntheticMonitor) SetAutomaticallyAssignedApps(v []string) {
o.AutomaticallyAssignedApps = v
}
// GetCreatedFrom returns the CreatedFrom field value
func (o *SyntheticMonitor) GetCreatedFrom() string {
if o == nil {
var ret string
return ret
}
return o.CreatedFrom
}
// GetCreatedFromOk returns a tuple with the CreatedFrom field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetCreatedFromOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.CreatedFrom, true
}
// SetCreatedFrom sets field value
func (o *SyntheticMonitor) SetCreatedFrom(v string) {
o.CreatedFrom = v
}
// GetEnabled returns the Enabled field value
func (o *SyntheticMonitor) GetEnabled() bool {
if o == nil {
var ret bool
return ret
}
return o.Enabled
}
// GetEnabledOk returns a tuple with the Enabled field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetEnabledOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.Enabled, true
}
// SetEnabled sets field value
func (o *SyntheticMonitor) SetEnabled(v bool) {
o.Enabled = v
}
// GetEntityId returns the EntityId field value
func (o *SyntheticMonitor) GetEntityId() string {
if o == nil {
var ret string
return ret
}
return o.EntityId
}
// GetEntityIdOk returns a tuple with the EntityId field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetEntityIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.EntityId, true
}
// SetEntityId sets field value
func (o *SyntheticMonitor) SetEntityId(v string) {
o.EntityId = v
}
// GetFrequencyMin returns the FrequencyMin field value
func (o *SyntheticMonitor) GetFrequencyMin() int32 {
if o == nil {
var ret int32
return ret
}
return o.FrequencyMin
}
// GetFrequencyMinOk returns a tuple with the FrequencyMin field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetFrequencyMinOk() (*int32, bool) {
if o == nil {
return nil, false
}
return &o.FrequencyMin, true
}
// SetFrequencyMin sets field value
func (o *SyntheticMonitor) SetFrequencyMin(v int32) {
o.FrequencyMin = v
}
// GetLocations returns the Locations field value
func (o *SyntheticMonitor) GetLocations() []string {
if o == nil {
var ret []string
return ret
}
return o.Locations
}
// GetLocationsOk returns a tuple with the Locations field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetLocationsOk() ([]string, bool) {
if o == nil {
return nil, false
}
return o.Locations, true
}
// SetLocations sets field value
func (o *SyntheticMonitor) SetLocations(v []string) {
o.Locations = v
}
// GetManagementZones returns the ManagementZones field value
func (o *SyntheticMonitor) GetManagementZones() []ManagementZone {
if o == nil {
var ret []ManagementZone
return ret
}
return o.ManagementZones
}
// GetManagementZonesOk returns a tuple with the ManagementZones field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetManagementZonesOk() ([]ManagementZone, bool) {
if o == nil {
return nil, false
}
return o.ManagementZones, true
}
// SetManagementZones sets field value
func (o *SyntheticMonitor) SetManagementZones(v []ManagementZone) {
o.ManagementZones = v
}
// GetManuallyAssignedApps returns the ManuallyAssignedApps field value
func (o *SyntheticMonitor) GetManuallyAssignedApps() []string {
if o == nil {
var ret []string
return ret
}
return o.ManuallyAssignedApps
}
// GetManuallyAssignedAppsOk returns a tuple with the ManuallyAssignedApps field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetManuallyAssignedAppsOk() ([]string, bool) {
if o == nil {
return nil, false
}
return o.ManuallyAssignedApps, true
}
// SetManuallyAssignedApps sets field value
func (o *SyntheticMonitor) SetManuallyAssignedApps(v []string) {
o.ManuallyAssignedApps = v
}
// GetName returns the Name field value
func (o *SyntheticMonitor) 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 *SyntheticMonitor) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *SyntheticMonitor) SetName(v string) {
o.Name = v
}
// GetScript returns the Script field value
func (o *SyntheticMonitor) GetScript() map[string]interface{} {
if o == nil {
var ret map[string]interface{}
return ret
}
return o.Script
}
// GetScriptOk returns a tuple with the Script field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetScriptOk() (map[string]interface{}, bool) {
if o == nil {
return map[string]interface{}{}, false
}
return o.Script, true
}
// SetScript sets field value
func (o *SyntheticMonitor) SetScript(v map[string]interface{}) {
o.Script = v
}
// GetTags returns the Tags field value
func (o *SyntheticMonitor) GetTags() []TagWithSourceInfo {
if o == nil {
var ret []TagWithSourceInfo
return ret
}
return o.Tags
}
// GetTagsOk returns a tuple with the Tags field value
// and a boolean to check if the value has been set.
func (o *SyntheticMonitor) GetTagsOk() ([]TagWithSourceInfo, bool) {
if o == nil {
return nil, false
}
return o.Tags, true
}
// SetTags sets field value
func (o *SyntheticMonitor) SetTags(v []TagWithSourceInfo) {
o.Tags = v
}
// GetType returns the Type field value
func (o *SyntheticMonitor) GetType() string {
if o == nil {
var ret string
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 *SyntheticMonitor) GetTypeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}
// SetType sets field value
func (o *SyntheticMonitor) SetType(v string) {
o.Type = v
}
func (o SyntheticMonitor) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o SyntheticMonitor) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.AnomalyDetection) {
toSerialize["anomalyDetection"] = o.AnomalyDetection
}
toSerialize["automaticallyAssignedApps"] = o.AutomaticallyAssignedApps
toSerialize["createdFrom"] = o.CreatedFrom
toSerialize["enabled"] = o.Enabled
toSerialize["entityId"] = o.EntityId
toSerialize["frequencyMin"] = o.FrequencyMin
toSerialize["locations"] = o.Locations
toSerialize["managementZones"] = o.ManagementZones
toSerialize["manuallyAssignedApps"] = o.ManuallyAssignedApps
toSerialize["name"] = o.Name
toSerialize["script"] = o.Script
toSerialize["tags"] = o.Tags
toSerialize["type"] = o.Type
return toSerialize, nil
}
func (o *SyntheticMonitor) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"automaticallyAssignedApps",
"createdFrom",
"enabled",
"entityId",
"frequencyMin",
"locations",
"managementZones",
"manuallyAssignedApps",
"name",
"script",
"tags",
"type",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varSyntheticMonitor := _SyntheticMonitor{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varSyntheticMonitor)
if err != nil {
return err
}
*o = SyntheticMonitor(varSyntheticMonitor)
return err
}
type NullableSyntheticMonitor struct {
value *SyntheticMonitor
isSet bool
}
func (v NullableSyntheticMonitor) Get() *SyntheticMonitor {
return v.value
}
func (v *NullableSyntheticMonitor) Set(val *SyntheticMonitor) {
v.value = val
v.isSet = true
}
func (v NullableSyntheticMonitor) IsSet() bool {
return v.isSet
}
func (v *NullableSyntheticMonitor) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSyntheticMonitor(val *SyntheticMonitor) *NullableSyntheticMonitor {
return &NullableSyntheticMonitor{value: val, isSet: true}
}
func (v NullableSyntheticMonitor) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSyntheticMonitor) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}