-
Notifications
You must be signed in to change notification settings - Fork 54
/
model_synthetics_api_test_result_data.go
402 lines (354 loc) · 14.2 KB
/
model_synthetics_api_test_result_data.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
// 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 (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// SyntheticsAPITestResultData Object containing results for your Synthetic API test.
type SyntheticsAPITestResultData struct {
// Object describing the SSL certificate used for a Synthetic test.
Cert *SyntheticsSSLCertificate `json:"cert,omitempty"`
// Status of a Synthetic test.
EventType *SyntheticsTestProcessStatus `json:"eventType,omitempty"`
// The API test failure details.
Failure *SyntheticsApiTestResultFailure `json:"failure,omitempty"`
// The API test HTTP status code.
HttpStatusCode *int64 `json:"httpStatusCode,omitempty"`
// Request header object used for the API test.
RequestHeaders map[string]interface{} `json:"requestHeaders,omitempty"`
// Response body returned for the API test.
ResponseBody *string `json:"responseBody,omitempty"`
// Response headers returned for the API test.
ResponseHeaders map[string]interface{} `json:"responseHeaders,omitempty"`
// Global size in byte of the API test response.
ResponseSize *int64 `json:"responseSize,omitempty"`
// Object containing all metrics and their values collected for a Synthetic API test.
// See the [Synthetic Monitoring Metrics documentation](https://docs.datadoghq.com/synthetics/metrics/).
Timings *SyntheticsTiming `json:"timings,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{}
}
// NewSyntheticsAPITestResultData instantiates a new SyntheticsAPITestResultData 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 NewSyntheticsAPITestResultData() *SyntheticsAPITestResultData {
this := SyntheticsAPITestResultData{}
return &this
}
// NewSyntheticsAPITestResultDataWithDefaults instantiates a new SyntheticsAPITestResultData 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 NewSyntheticsAPITestResultDataWithDefaults() *SyntheticsAPITestResultData {
this := SyntheticsAPITestResultData{}
return &this
}
// GetCert returns the Cert field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetCert() SyntheticsSSLCertificate {
if o == nil || o.Cert == nil {
var ret SyntheticsSSLCertificate
return ret
}
return *o.Cert
}
// GetCertOk returns a tuple with the Cert field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetCertOk() (*SyntheticsSSLCertificate, bool) {
if o == nil || o.Cert == nil {
return nil, false
}
return o.Cert, true
}
// HasCert returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasCert() bool {
return o != nil && o.Cert != nil
}
// SetCert gets a reference to the given SyntheticsSSLCertificate and assigns it to the Cert field.
func (o *SyntheticsAPITestResultData) SetCert(v SyntheticsSSLCertificate) {
o.Cert = &v
}
// GetEventType returns the EventType field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetEventType() SyntheticsTestProcessStatus {
if o == nil || o.EventType == nil {
var ret SyntheticsTestProcessStatus
return ret
}
return *o.EventType
}
// GetEventTypeOk returns a tuple with the EventType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetEventTypeOk() (*SyntheticsTestProcessStatus, bool) {
if o == nil || o.EventType == nil {
return nil, false
}
return o.EventType, true
}
// HasEventType returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasEventType() bool {
return o != nil && o.EventType != nil
}
// SetEventType gets a reference to the given SyntheticsTestProcessStatus and assigns it to the EventType field.
func (o *SyntheticsAPITestResultData) SetEventType(v SyntheticsTestProcessStatus) {
o.EventType = &v
}
// GetFailure returns the Failure field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetFailure() SyntheticsApiTestResultFailure {
if o == nil || o.Failure == nil {
var ret SyntheticsApiTestResultFailure
return ret
}
return *o.Failure
}
// GetFailureOk returns a tuple with the Failure field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetFailureOk() (*SyntheticsApiTestResultFailure, bool) {
if o == nil || o.Failure == nil {
return nil, false
}
return o.Failure, true
}
// HasFailure returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasFailure() bool {
return o != nil && o.Failure != nil
}
// SetFailure gets a reference to the given SyntheticsApiTestResultFailure and assigns it to the Failure field.
func (o *SyntheticsAPITestResultData) SetFailure(v SyntheticsApiTestResultFailure) {
o.Failure = &v
}
// GetHttpStatusCode returns the HttpStatusCode field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetHttpStatusCode() int64 {
if o == nil || o.HttpStatusCode == nil {
var ret int64
return ret
}
return *o.HttpStatusCode
}
// GetHttpStatusCodeOk returns a tuple with the HttpStatusCode field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetHttpStatusCodeOk() (*int64, bool) {
if o == nil || o.HttpStatusCode == nil {
return nil, false
}
return o.HttpStatusCode, true
}
// HasHttpStatusCode returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasHttpStatusCode() bool {
return o != nil && o.HttpStatusCode != nil
}
// SetHttpStatusCode gets a reference to the given int64 and assigns it to the HttpStatusCode field.
func (o *SyntheticsAPITestResultData) SetHttpStatusCode(v int64) {
o.HttpStatusCode = &v
}
// GetRequestHeaders returns the RequestHeaders field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetRequestHeaders() map[string]interface{} {
if o == nil || o.RequestHeaders == nil {
var ret map[string]interface{}
return ret
}
return o.RequestHeaders
}
// GetRequestHeadersOk returns a tuple with the RequestHeaders field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetRequestHeadersOk() (*map[string]interface{}, bool) {
if o == nil || o.RequestHeaders == nil {
return nil, false
}
return &o.RequestHeaders, true
}
// HasRequestHeaders returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasRequestHeaders() bool {
return o != nil && o.RequestHeaders != nil
}
// SetRequestHeaders gets a reference to the given map[string]interface{} and assigns it to the RequestHeaders field.
func (o *SyntheticsAPITestResultData) SetRequestHeaders(v map[string]interface{}) {
o.RequestHeaders = v
}
// GetResponseBody returns the ResponseBody field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetResponseBody() string {
if o == nil || o.ResponseBody == nil {
var ret string
return ret
}
return *o.ResponseBody
}
// GetResponseBodyOk returns a tuple with the ResponseBody field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetResponseBodyOk() (*string, bool) {
if o == nil || o.ResponseBody == nil {
return nil, false
}
return o.ResponseBody, true
}
// HasResponseBody returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasResponseBody() bool {
return o != nil && o.ResponseBody != nil
}
// SetResponseBody gets a reference to the given string and assigns it to the ResponseBody field.
func (o *SyntheticsAPITestResultData) SetResponseBody(v string) {
o.ResponseBody = &v
}
// GetResponseHeaders returns the ResponseHeaders field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetResponseHeaders() map[string]interface{} {
if o == nil || o.ResponseHeaders == nil {
var ret map[string]interface{}
return ret
}
return o.ResponseHeaders
}
// GetResponseHeadersOk returns a tuple with the ResponseHeaders field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetResponseHeadersOk() (*map[string]interface{}, bool) {
if o == nil || o.ResponseHeaders == nil {
return nil, false
}
return &o.ResponseHeaders, true
}
// HasResponseHeaders returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasResponseHeaders() bool {
return o != nil && o.ResponseHeaders != nil
}
// SetResponseHeaders gets a reference to the given map[string]interface{} and assigns it to the ResponseHeaders field.
func (o *SyntheticsAPITestResultData) SetResponseHeaders(v map[string]interface{}) {
o.ResponseHeaders = v
}
// GetResponseSize returns the ResponseSize field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetResponseSize() int64 {
if o == nil || o.ResponseSize == nil {
var ret int64
return ret
}
return *o.ResponseSize
}
// GetResponseSizeOk returns a tuple with the ResponseSize field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetResponseSizeOk() (*int64, bool) {
if o == nil || o.ResponseSize == nil {
return nil, false
}
return o.ResponseSize, true
}
// HasResponseSize returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasResponseSize() bool {
return o != nil && o.ResponseSize != nil
}
// SetResponseSize gets a reference to the given int64 and assigns it to the ResponseSize field.
func (o *SyntheticsAPITestResultData) SetResponseSize(v int64) {
o.ResponseSize = &v
}
// GetTimings returns the Timings field value if set, zero value otherwise.
func (o *SyntheticsAPITestResultData) GetTimings() SyntheticsTiming {
if o == nil || o.Timings == nil {
var ret SyntheticsTiming
return ret
}
return *o.Timings
}
// GetTimingsOk returns a tuple with the Timings field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsAPITestResultData) GetTimingsOk() (*SyntheticsTiming, bool) {
if o == nil || o.Timings == nil {
return nil, false
}
return o.Timings, true
}
// HasTimings returns a boolean if a field has been set.
func (o *SyntheticsAPITestResultData) HasTimings() bool {
return o != nil && o.Timings != nil
}
// SetTimings gets a reference to the given SyntheticsTiming and assigns it to the Timings field.
func (o *SyntheticsAPITestResultData) SetTimings(v SyntheticsTiming) {
o.Timings = &v
}
// MarshalJSON serializes the struct using spec logic.
func (o SyntheticsAPITestResultData) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Cert != nil {
toSerialize["cert"] = o.Cert
}
if o.EventType != nil {
toSerialize["eventType"] = o.EventType
}
if o.Failure != nil {
toSerialize["failure"] = o.Failure
}
if o.HttpStatusCode != nil {
toSerialize["httpStatusCode"] = o.HttpStatusCode
}
if o.RequestHeaders != nil {
toSerialize["requestHeaders"] = o.RequestHeaders
}
if o.ResponseBody != nil {
toSerialize["responseBody"] = o.ResponseBody
}
if o.ResponseHeaders != nil {
toSerialize["responseHeaders"] = o.ResponseHeaders
}
if o.ResponseSize != nil {
toSerialize["responseSize"] = o.ResponseSize
}
if o.Timings != nil {
toSerialize["timings"] = o.Timings
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *SyntheticsAPITestResultData) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Cert *SyntheticsSSLCertificate `json:"cert,omitempty"`
EventType *SyntheticsTestProcessStatus `json:"eventType,omitempty"`
Failure *SyntheticsApiTestResultFailure `json:"failure,omitempty"`
HttpStatusCode *int64 `json:"httpStatusCode,omitempty"`
RequestHeaders map[string]interface{} `json:"requestHeaders,omitempty"`
ResponseBody *string `json:"responseBody,omitempty"`
ResponseHeaders map[string]interface{} `json:"responseHeaders,omitempty"`
ResponseSize *int64 `json:"responseSize,omitempty"`
Timings *SyntheticsTiming `json:"timings,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"cert", "eventType", "failure", "httpStatusCode", "requestHeaders", "responseBody", "responseHeaders", "responseSize", "timings"})
} else {
return err
}
hasInvalidField := false
if all.Cert != nil && all.Cert.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Cert = all.Cert
if all.EventType != nil && !all.EventType.IsValid() {
hasInvalidField = true
} else {
o.EventType = all.EventType
}
if all.Failure != nil && all.Failure.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Failure = all.Failure
o.HttpStatusCode = all.HttpStatusCode
o.RequestHeaders = all.RequestHeaders
o.ResponseBody = all.ResponseBody
o.ResponseHeaders = all.ResponseHeaders
o.ResponseSize = all.ResponseSize
if all.Timings != nil && all.Timings.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Timings = all.Timings
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}