-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_incident_response_relationships.go
385 lines (339 loc) · 14.9 KB
/
model_incident_response_relationships.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
// 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 datadogV2
import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// IncidentResponseRelationships The incident's relationships from a response.
type IncidentResponseRelationships struct {
// A relationship reference for attachments.
Attachments *RelationshipToIncidentAttachment `json:"attachments,omitempty"`
// Relationship to user.
CommanderUser NullableNullableRelationshipToUser `json:"commander_user,omitempty"`
// Relationship to user.
CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"`
// Relationship to impacts.
Impacts *RelationshipToIncidentImpacts `json:"impacts,omitempty"`
// A relationship reference for multiple integration metadata objects.
Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"`
// Relationship to user.
LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"`
// Relationship to incident responders.
Responders *RelationshipToIncidentResponders `json:"responders,omitempty"`
// Relationship to incident user defined fields.
UserDefinedFields *RelationshipToIncidentUserDefinedFields `json:"user_defined_fields,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{}
}
// NewIncidentResponseRelationships instantiates a new IncidentResponseRelationships 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 NewIncidentResponseRelationships() *IncidentResponseRelationships {
this := IncidentResponseRelationships{}
return &this
}
// NewIncidentResponseRelationshipsWithDefaults instantiates a new IncidentResponseRelationships 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 NewIncidentResponseRelationshipsWithDefaults() *IncidentResponseRelationships {
this := IncidentResponseRelationships{}
return &this
}
// GetAttachments returns the Attachments field value if set, zero value otherwise.
func (o *IncidentResponseRelationships) GetAttachments() RelationshipToIncidentAttachment {
if o == nil || o.Attachments == nil {
var ret RelationshipToIncidentAttachment
return ret
}
return *o.Attachments
}
// GetAttachmentsOk returns a tuple with the Attachments field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IncidentResponseRelationships) GetAttachmentsOk() (*RelationshipToIncidentAttachment, bool) {
if o == nil || o.Attachments == nil {
return nil, false
}
return o.Attachments, true
}
// HasAttachments returns a boolean if a field has been set.
func (o *IncidentResponseRelationships) HasAttachments() bool {
return o != nil && o.Attachments != nil
}
// SetAttachments gets a reference to the given RelationshipToIncidentAttachment and assigns it to the Attachments field.
func (o *IncidentResponseRelationships) SetAttachments(v RelationshipToIncidentAttachment) {
o.Attachments = &v
}
// GetCommanderUser returns the CommanderUser field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *IncidentResponseRelationships) GetCommanderUser() NullableRelationshipToUser {
if o == nil || o.CommanderUser.Get() == nil {
var ret NullableRelationshipToUser
return ret
}
return *o.CommanderUser.Get()
}
// GetCommanderUserOk returns a tuple with the CommanderUser 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 *IncidentResponseRelationships) GetCommanderUserOk() (*NullableRelationshipToUser, bool) {
if o == nil {
return nil, false
}
return o.CommanderUser.Get(), o.CommanderUser.IsSet()
}
// HasCommanderUser returns a boolean if a field has been set.
func (o *IncidentResponseRelationships) HasCommanderUser() bool {
return o != nil && o.CommanderUser.IsSet()
}
// SetCommanderUser gets a reference to the given NullableNullableRelationshipToUser and assigns it to the CommanderUser field.
func (o *IncidentResponseRelationships) SetCommanderUser(v NullableRelationshipToUser) {
o.CommanderUser.Set(&v)
}
// SetCommanderUserNil sets the value for CommanderUser to be an explicit nil.
func (o *IncidentResponseRelationships) SetCommanderUserNil() {
o.CommanderUser.Set(nil)
}
// UnsetCommanderUser ensures that no value is present for CommanderUser, not even an explicit nil.
func (o *IncidentResponseRelationships) UnsetCommanderUser() {
o.CommanderUser.Unset()
}
// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise.
func (o *IncidentResponseRelationships) GetCreatedByUser() RelationshipToUser {
if o == nil || o.CreatedByUser == nil {
var ret RelationshipToUser
return ret
}
return *o.CreatedByUser
}
// GetCreatedByUserOk returns a tuple with the CreatedByUser field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IncidentResponseRelationships) GetCreatedByUserOk() (*RelationshipToUser, bool) {
if o == nil || o.CreatedByUser == nil {
return nil, false
}
return o.CreatedByUser, true
}
// HasCreatedByUser returns a boolean if a field has been set.
func (o *IncidentResponseRelationships) HasCreatedByUser() bool {
return o != nil && o.CreatedByUser != nil
}
// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field.
func (o *IncidentResponseRelationships) SetCreatedByUser(v RelationshipToUser) {
o.CreatedByUser = &v
}
// GetImpacts returns the Impacts field value if set, zero value otherwise.
func (o *IncidentResponseRelationships) GetImpacts() RelationshipToIncidentImpacts {
if o == nil || o.Impacts == nil {
var ret RelationshipToIncidentImpacts
return ret
}
return *o.Impacts
}
// GetImpactsOk returns a tuple with the Impacts field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IncidentResponseRelationships) GetImpactsOk() (*RelationshipToIncidentImpacts, bool) {
if o == nil || o.Impacts == nil {
return nil, false
}
return o.Impacts, true
}
// HasImpacts returns a boolean if a field has been set.
func (o *IncidentResponseRelationships) HasImpacts() bool {
return o != nil && o.Impacts != nil
}
// SetImpacts gets a reference to the given RelationshipToIncidentImpacts and assigns it to the Impacts field.
func (o *IncidentResponseRelationships) SetImpacts(v RelationshipToIncidentImpacts) {
o.Impacts = &v
}
// GetIntegrations returns the Integrations field value if set, zero value otherwise.
func (o *IncidentResponseRelationships) GetIntegrations() RelationshipToIncidentIntegrationMetadatas {
if o == nil || o.Integrations == nil {
var ret RelationshipToIncidentIntegrationMetadatas
return ret
}
return *o.Integrations
}
// GetIntegrationsOk returns a tuple with the Integrations field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IncidentResponseRelationships) GetIntegrationsOk() (*RelationshipToIncidentIntegrationMetadatas, bool) {
if o == nil || o.Integrations == nil {
return nil, false
}
return o.Integrations, true
}
// HasIntegrations returns a boolean if a field has been set.
func (o *IncidentResponseRelationships) HasIntegrations() bool {
return o != nil && o.Integrations != nil
}
// SetIntegrations gets a reference to the given RelationshipToIncidentIntegrationMetadatas and assigns it to the Integrations field.
func (o *IncidentResponseRelationships) SetIntegrations(v RelationshipToIncidentIntegrationMetadatas) {
o.Integrations = &v
}
// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise.
func (o *IncidentResponseRelationships) GetLastModifiedByUser() RelationshipToUser {
if o == nil || o.LastModifiedByUser == nil {
var ret RelationshipToUser
return ret
}
return *o.LastModifiedByUser
}
// GetLastModifiedByUserOk returns a tuple with the LastModifiedByUser field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IncidentResponseRelationships) GetLastModifiedByUserOk() (*RelationshipToUser, bool) {
if o == nil || o.LastModifiedByUser == nil {
return nil, false
}
return o.LastModifiedByUser, true
}
// HasLastModifiedByUser returns a boolean if a field has been set.
func (o *IncidentResponseRelationships) HasLastModifiedByUser() bool {
return o != nil && o.LastModifiedByUser != nil
}
// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field.
func (o *IncidentResponseRelationships) SetLastModifiedByUser(v RelationshipToUser) {
o.LastModifiedByUser = &v
}
// GetResponders returns the Responders field value if set, zero value otherwise.
func (o *IncidentResponseRelationships) GetResponders() RelationshipToIncidentResponders {
if o == nil || o.Responders == nil {
var ret RelationshipToIncidentResponders
return ret
}
return *o.Responders
}
// GetRespondersOk returns a tuple with the Responders field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IncidentResponseRelationships) GetRespondersOk() (*RelationshipToIncidentResponders, bool) {
if o == nil || o.Responders == nil {
return nil, false
}
return o.Responders, true
}
// HasResponders returns a boolean if a field has been set.
func (o *IncidentResponseRelationships) HasResponders() bool {
return o != nil && o.Responders != nil
}
// SetResponders gets a reference to the given RelationshipToIncidentResponders and assigns it to the Responders field.
func (o *IncidentResponseRelationships) SetResponders(v RelationshipToIncidentResponders) {
o.Responders = &v
}
// GetUserDefinedFields returns the UserDefinedFields field value if set, zero value otherwise.
func (o *IncidentResponseRelationships) GetUserDefinedFields() RelationshipToIncidentUserDefinedFields {
if o == nil || o.UserDefinedFields == nil {
var ret RelationshipToIncidentUserDefinedFields
return ret
}
return *o.UserDefinedFields
}
// GetUserDefinedFieldsOk returns a tuple with the UserDefinedFields field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IncidentResponseRelationships) GetUserDefinedFieldsOk() (*RelationshipToIncidentUserDefinedFields, bool) {
if o == nil || o.UserDefinedFields == nil {
return nil, false
}
return o.UserDefinedFields, true
}
// HasUserDefinedFields returns a boolean if a field has been set.
func (o *IncidentResponseRelationships) HasUserDefinedFields() bool {
return o != nil && o.UserDefinedFields != nil
}
// SetUserDefinedFields gets a reference to the given RelationshipToIncidentUserDefinedFields and assigns it to the UserDefinedFields field.
func (o *IncidentResponseRelationships) SetUserDefinedFields(v RelationshipToIncidentUserDefinedFields) {
o.UserDefinedFields = &v
}
// MarshalJSON serializes the struct using spec logic.
func (o IncidentResponseRelationships) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Attachments != nil {
toSerialize["attachments"] = o.Attachments
}
if o.CommanderUser.IsSet() {
toSerialize["commander_user"] = o.CommanderUser.Get()
}
if o.CreatedByUser != nil {
toSerialize["created_by_user"] = o.CreatedByUser
}
if o.Impacts != nil {
toSerialize["impacts"] = o.Impacts
}
if o.Integrations != nil {
toSerialize["integrations"] = o.Integrations
}
if o.LastModifiedByUser != nil {
toSerialize["last_modified_by_user"] = o.LastModifiedByUser
}
if o.Responders != nil {
toSerialize["responders"] = o.Responders
}
if o.UserDefinedFields != nil {
toSerialize["user_defined_fields"] = o.UserDefinedFields
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *IncidentResponseRelationships) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Attachments *RelationshipToIncidentAttachment `json:"attachments,omitempty"`
CommanderUser NullableNullableRelationshipToUser `json:"commander_user,omitempty"`
CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"`
Impacts *RelationshipToIncidentImpacts `json:"impacts,omitempty"`
Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"`
LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"`
Responders *RelationshipToIncidentResponders `json:"responders,omitempty"`
UserDefinedFields *RelationshipToIncidentUserDefinedFields `json:"user_defined_fields,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{"attachments", "commander_user", "created_by_user", "impacts", "integrations", "last_modified_by_user", "responders", "user_defined_fields"})
} else {
return err
}
hasInvalidField := false
if all.Attachments != nil && all.Attachments.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Attachments = all.Attachments
o.CommanderUser = all.CommanderUser
if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.CreatedByUser = all.CreatedByUser
if all.Impacts != nil && all.Impacts.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Impacts = all.Impacts
if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Integrations = all.Integrations
if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.LastModifiedByUser = all.LastModifiedByUser
if all.Responders != nil && all.Responders.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Responders = all.Responders
if all.UserDefinedFields != nil && all.UserDefinedFields.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.UserDefinedFields = all.UserDefinedFields
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}