-
Notifications
You must be signed in to change notification settings - Fork 54
/
model_synthetics_ci_test_.go
568 lines (500 loc) · 18.4 KB
/
model_synthetics_ci_test_.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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
// 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"
)
// SyntheticsCITest Configuration for Continuous Testing.
type SyntheticsCITest struct {
// Disable certificate checks in API tests.
AllowInsecureCertificates *bool `json:"allowInsecureCertificates,omitempty"`
// Object to handle basic authentication when performing the test.
BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"`
// Body to include in the test.
Body *string `json:"body,omitempty"`
// Type of the data sent in a Synthetic API test.
BodyType *string `json:"bodyType,omitempty"`
// Cookies for the request.
Cookies *string `json:"cookies,omitempty"`
// For browser test, array with the different device IDs used to run the test.
DeviceIds []SyntheticsDeviceID `json:"deviceIds,omitempty"`
// For API HTTP test, whether or not the test should follow redirects.
FollowRedirects *bool `json:"followRedirects,omitempty"`
// Headers to include when performing the test.
Headers map[string]string `json:"headers,omitempty"`
// Array of locations used to run the test.
Locations []string `json:"locations,omitempty"`
// Metadata for the Synthetic tests run.
Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"`
// The public ID of the Synthetic test to trigger.
PublicId string `json:"public_id"`
// Object describing the retry strategy to apply to a Synthetic test.
Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"`
// Starting URL for the browser test.
StartUrl *string `json:"startUrl,omitempty"`
// Variables to replace in the test.
Variables map[string]string `json:"variables,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{}
}
// NewSyntheticsCITest instantiates a new SyntheticsCITest 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 NewSyntheticsCITest(publicId string) *SyntheticsCITest {
this := SyntheticsCITest{}
this.PublicId = publicId
return &this
}
// NewSyntheticsCITestWithDefaults instantiates a new SyntheticsCITest 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 NewSyntheticsCITestWithDefaults() *SyntheticsCITest {
this := SyntheticsCITest{}
return &this
}
// GetAllowInsecureCertificates returns the AllowInsecureCertificates field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetAllowInsecureCertificates() bool {
if o == nil || o.AllowInsecureCertificates == nil {
var ret bool
return ret
}
return *o.AllowInsecureCertificates
}
// GetAllowInsecureCertificatesOk returns a tuple with the AllowInsecureCertificates field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetAllowInsecureCertificatesOk() (*bool, bool) {
if o == nil || o.AllowInsecureCertificates == nil {
return nil, false
}
return o.AllowInsecureCertificates, true
}
// HasAllowInsecureCertificates returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasAllowInsecureCertificates() bool {
return o != nil && o.AllowInsecureCertificates != nil
}
// SetAllowInsecureCertificates gets a reference to the given bool and assigns it to the AllowInsecureCertificates field.
func (o *SyntheticsCITest) SetAllowInsecureCertificates(v bool) {
o.AllowInsecureCertificates = &v
}
// GetBasicAuth returns the BasicAuth field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetBasicAuth() SyntheticsBasicAuth {
if o == nil || o.BasicAuth == nil {
var ret SyntheticsBasicAuth
return ret
}
return *o.BasicAuth
}
// GetBasicAuthOk returns a tuple with the BasicAuth field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetBasicAuthOk() (*SyntheticsBasicAuth, bool) {
if o == nil || o.BasicAuth == nil {
return nil, false
}
return o.BasicAuth, true
}
// HasBasicAuth returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasBasicAuth() bool {
return o != nil && o.BasicAuth != nil
}
// SetBasicAuth gets a reference to the given SyntheticsBasicAuth and assigns it to the BasicAuth field.
func (o *SyntheticsCITest) SetBasicAuth(v SyntheticsBasicAuth) {
o.BasicAuth = &v
}
// GetBody returns the Body field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetBody() string {
if o == nil || o.Body == nil {
var ret string
return ret
}
return *o.Body
}
// GetBodyOk returns a tuple with the Body field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetBodyOk() (*string, bool) {
if o == nil || o.Body == nil {
return nil, false
}
return o.Body, true
}
// HasBody returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasBody() bool {
return o != nil && o.Body != nil
}
// SetBody gets a reference to the given string and assigns it to the Body field.
func (o *SyntheticsCITest) SetBody(v string) {
o.Body = &v
}
// GetBodyType returns the BodyType field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetBodyType() string {
if o == nil || o.BodyType == nil {
var ret string
return ret
}
return *o.BodyType
}
// GetBodyTypeOk returns a tuple with the BodyType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetBodyTypeOk() (*string, bool) {
if o == nil || o.BodyType == nil {
return nil, false
}
return o.BodyType, true
}
// HasBodyType returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasBodyType() bool {
return o != nil && o.BodyType != nil
}
// SetBodyType gets a reference to the given string and assigns it to the BodyType field.
func (o *SyntheticsCITest) SetBodyType(v string) {
o.BodyType = &v
}
// GetCookies returns the Cookies field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetCookies() string {
if o == nil || o.Cookies == nil {
var ret string
return ret
}
return *o.Cookies
}
// GetCookiesOk returns a tuple with the Cookies field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetCookiesOk() (*string, bool) {
if o == nil || o.Cookies == nil {
return nil, false
}
return o.Cookies, true
}
// HasCookies returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasCookies() bool {
return o != nil && o.Cookies != nil
}
// SetCookies gets a reference to the given string and assigns it to the Cookies field.
func (o *SyntheticsCITest) SetCookies(v string) {
o.Cookies = &v
}
// GetDeviceIds returns the DeviceIds field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetDeviceIds() []SyntheticsDeviceID {
if o == nil || o.DeviceIds == nil {
var ret []SyntheticsDeviceID
return ret
}
return o.DeviceIds
}
// GetDeviceIdsOk returns a tuple with the DeviceIds field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetDeviceIdsOk() (*[]SyntheticsDeviceID, bool) {
if o == nil || o.DeviceIds == nil {
return nil, false
}
return &o.DeviceIds, true
}
// HasDeviceIds returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasDeviceIds() bool {
return o != nil && o.DeviceIds != nil
}
// SetDeviceIds gets a reference to the given []SyntheticsDeviceID and assigns it to the DeviceIds field.
func (o *SyntheticsCITest) SetDeviceIds(v []SyntheticsDeviceID) {
o.DeviceIds = v
}
// GetFollowRedirects returns the FollowRedirects field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetFollowRedirects() bool {
if o == nil || o.FollowRedirects == nil {
var ret bool
return ret
}
return *o.FollowRedirects
}
// GetFollowRedirectsOk returns a tuple with the FollowRedirects field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetFollowRedirectsOk() (*bool, bool) {
if o == nil || o.FollowRedirects == nil {
return nil, false
}
return o.FollowRedirects, true
}
// HasFollowRedirects returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasFollowRedirects() bool {
return o != nil && o.FollowRedirects != nil
}
// SetFollowRedirects gets a reference to the given bool and assigns it to the FollowRedirects field.
func (o *SyntheticsCITest) SetFollowRedirects(v bool) {
o.FollowRedirects = &v
}
// GetHeaders returns the Headers field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetHeaders() map[string]string {
if o == nil || o.Headers == nil {
var ret map[string]string
return ret
}
return o.Headers
}
// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetHeadersOk() (*map[string]string, bool) {
if o == nil || o.Headers == nil {
return nil, false
}
return &o.Headers, true
}
// HasHeaders returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasHeaders() bool {
return o != nil && o.Headers != nil
}
// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field.
func (o *SyntheticsCITest) SetHeaders(v map[string]string) {
o.Headers = v
}
// GetLocations returns the Locations field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetLocations() []string {
if o == nil || o.Locations == nil {
var ret []string
return ret
}
return o.Locations
}
// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetLocationsOk() (*[]string, bool) {
if o == nil || o.Locations == nil {
return nil, false
}
return &o.Locations, true
}
// HasLocations returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasLocations() bool {
return o != nil && o.Locations != nil
}
// SetLocations gets a reference to the given []string and assigns it to the Locations field.
func (o *SyntheticsCITest) SetLocations(v []string) {
o.Locations = v
}
// GetMetadata returns the Metadata field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetMetadata() SyntheticsCIBatchMetadata {
if o == nil || o.Metadata == nil {
var ret SyntheticsCIBatchMetadata
return ret
}
return *o.Metadata
}
// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetMetadataOk() (*SyntheticsCIBatchMetadata, bool) {
if o == nil || o.Metadata == nil {
return nil, false
}
return o.Metadata, true
}
// HasMetadata returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasMetadata() bool {
return o != nil && o.Metadata != nil
}
// SetMetadata gets a reference to the given SyntheticsCIBatchMetadata and assigns it to the Metadata field.
func (o *SyntheticsCITest) SetMetadata(v SyntheticsCIBatchMetadata) {
o.Metadata = &v
}
// GetPublicId returns the PublicId field value.
func (o *SyntheticsCITest) GetPublicId() string {
if o == nil {
var ret string
return ret
}
return o.PublicId
}
// GetPublicIdOk returns a tuple with the PublicId field value
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetPublicIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.PublicId, true
}
// SetPublicId sets field value.
func (o *SyntheticsCITest) SetPublicId(v string) {
o.PublicId = v
}
// GetRetry returns the Retry field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetRetry() SyntheticsTestOptionsRetry {
if o == nil || o.Retry == nil {
var ret SyntheticsTestOptionsRetry
return ret
}
return *o.Retry
}
// GetRetryOk returns a tuple with the Retry field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetRetryOk() (*SyntheticsTestOptionsRetry, bool) {
if o == nil || o.Retry == nil {
return nil, false
}
return o.Retry, true
}
// HasRetry returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasRetry() bool {
return o != nil && o.Retry != nil
}
// SetRetry gets a reference to the given SyntheticsTestOptionsRetry and assigns it to the Retry field.
func (o *SyntheticsCITest) SetRetry(v SyntheticsTestOptionsRetry) {
o.Retry = &v
}
// GetStartUrl returns the StartUrl field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetStartUrl() string {
if o == nil || o.StartUrl == nil {
var ret string
return ret
}
return *o.StartUrl
}
// GetStartUrlOk returns a tuple with the StartUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetStartUrlOk() (*string, bool) {
if o == nil || o.StartUrl == nil {
return nil, false
}
return o.StartUrl, true
}
// HasStartUrl returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasStartUrl() bool {
return o != nil && o.StartUrl != nil
}
// SetStartUrl gets a reference to the given string and assigns it to the StartUrl field.
func (o *SyntheticsCITest) SetStartUrl(v string) {
o.StartUrl = &v
}
// GetVariables returns the Variables field value if set, zero value otherwise.
func (o *SyntheticsCITest) GetVariables() map[string]string {
if o == nil || o.Variables == nil {
var ret map[string]string
return ret
}
return o.Variables
}
// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsCITest) GetVariablesOk() (*map[string]string, bool) {
if o == nil || o.Variables == nil {
return nil, false
}
return &o.Variables, true
}
// HasVariables returns a boolean if a field has been set.
func (o *SyntheticsCITest) HasVariables() bool {
return o != nil && o.Variables != nil
}
// SetVariables gets a reference to the given map[string]string and assigns it to the Variables field.
func (o *SyntheticsCITest) SetVariables(v map[string]string) {
o.Variables = v
}
// MarshalJSON serializes the struct using spec logic.
func (o SyntheticsCITest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.AllowInsecureCertificates != nil {
toSerialize["allowInsecureCertificates"] = o.AllowInsecureCertificates
}
if o.BasicAuth != nil {
toSerialize["basicAuth"] = o.BasicAuth
}
if o.Body != nil {
toSerialize["body"] = o.Body
}
if o.BodyType != nil {
toSerialize["bodyType"] = o.BodyType
}
if o.Cookies != nil {
toSerialize["cookies"] = o.Cookies
}
if o.DeviceIds != nil {
toSerialize["deviceIds"] = o.DeviceIds
}
if o.FollowRedirects != nil {
toSerialize["followRedirects"] = o.FollowRedirects
}
if o.Headers != nil {
toSerialize["headers"] = o.Headers
}
if o.Locations != nil {
toSerialize["locations"] = o.Locations
}
if o.Metadata != nil {
toSerialize["metadata"] = o.Metadata
}
toSerialize["public_id"] = o.PublicId
if o.Retry != nil {
toSerialize["retry"] = o.Retry
}
if o.StartUrl != nil {
toSerialize["startUrl"] = o.StartUrl
}
if o.Variables != nil {
toSerialize["variables"] = o.Variables
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
AllowInsecureCertificates *bool `json:"allowInsecureCertificates,omitempty"`
BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"`
Body *string `json:"body,omitempty"`
BodyType *string `json:"bodyType,omitempty"`
Cookies *string `json:"cookies,omitempty"`
DeviceIds []SyntheticsDeviceID `json:"deviceIds,omitempty"`
FollowRedirects *bool `json:"followRedirects,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Locations []string `json:"locations,omitempty"`
Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"`
PublicId *string `json:"public_id"`
Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"`
StartUrl *string `json:"startUrl,omitempty"`
Variables map[string]string `json:"variables,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.PublicId == nil {
return fmt.Errorf("required field public_id missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"allowInsecureCertificates", "basicAuth", "body", "bodyType", "cookies", "deviceIds", "followRedirects", "headers", "locations", "metadata", "public_id", "retry", "startUrl", "variables"})
} else {
return err
}
hasInvalidField := false
o.AllowInsecureCertificates = all.AllowInsecureCertificates
o.BasicAuth = all.BasicAuth
o.Body = all.Body
o.BodyType = all.BodyType
o.Cookies = all.Cookies
o.DeviceIds = all.DeviceIds
o.FollowRedirects = all.FollowRedirects
o.Headers = all.Headers
o.Locations = all.Locations
if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Metadata = all.Metadata
o.PublicId = *all.PublicId
if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Retry = all.Retry
o.StartUrl = all.StartUrl
o.Variables = all.Variables
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}