-
Notifications
You must be signed in to change notification settings - Fork 54
/
model_finding_attributes.go
402 lines (354 loc) · 12.9 KB
/
model_finding_attributes.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 datadogV2
import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// FindingAttributes The JSON:API attributes of the finding.
type FindingAttributes struct {
// The evaluation of the finding.
Evaluation *FindingEvaluation `json:"evaluation,omitempty"`
// The date on which the evaluation for this finding changed (Unix ms).
EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"`
// Information about the mute status of this finding.
Mute *FindingMute `json:"mute,omitempty"`
// The resource name of this finding.
Resource *string `json:"resource,omitempty"`
// The date on which the resource was discovered (Unix ms).
ResourceDiscoveryDate *int64 `json:"resource_discovery_date,omitempty"`
// The resource type of this finding.
ResourceType *string `json:"resource_type,omitempty"`
// The rule that triggered this finding.
Rule *FindingRule `json:"rule,omitempty"`
// The status of the finding.
Status *FindingStatus `json:"status,omitempty"`
// The tags associated with this finding.
Tags []string `json:"tags,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{}
}
// NewFindingAttributes instantiates a new FindingAttributes 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 NewFindingAttributes() *FindingAttributes {
this := FindingAttributes{}
return &this
}
// NewFindingAttributesWithDefaults instantiates a new FindingAttributes 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 NewFindingAttributesWithDefaults() *FindingAttributes {
this := FindingAttributes{}
return &this
}
// GetEvaluation returns the Evaluation field value if set, zero value otherwise.
func (o *FindingAttributes) GetEvaluation() FindingEvaluation {
if o == nil || o.Evaluation == nil {
var ret FindingEvaluation
return ret
}
return *o.Evaluation
}
// GetEvaluationOk returns a tuple with the Evaluation field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FindingAttributes) GetEvaluationOk() (*FindingEvaluation, bool) {
if o == nil || o.Evaluation == nil {
return nil, false
}
return o.Evaluation, true
}
// HasEvaluation returns a boolean if a field has been set.
func (o *FindingAttributes) HasEvaluation() bool {
return o != nil && o.Evaluation != nil
}
// SetEvaluation gets a reference to the given FindingEvaluation and assigns it to the Evaluation field.
func (o *FindingAttributes) SetEvaluation(v FindingEvaluation) {
o.Evaluation = &v
}
// GetEvaluationChangedAt returns the EvaluationChangedAt field value if set, zero value otherwise.
func (o *FindingAttributes) GetEvaluationChangedAt() int64 {
if o == nil || o.EvaluationChangedAt == nil {
var ret int64
return ret
}
return *o.EvaluationChangedAt
}
// GetEvaluationChangedAtOk returns a tuple with the EvaluationChangedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FindingAttributes) GetEvaluationChangedAtOk() (*int64, bool) {
if o == nil || o.EvaluationChangedAt == nil {
return nil, false
}
return o.EvaluationChangedAt, true
}
// HasEvaluationChangedAt returns a boolean if a field has been set.
func (o *FindingAttributes) HasEvaluationChangedAt() bool {
return o != nil && o.EvaluationChangedAt != nil
}
// SetEvaluationChangedAt gets a reference to the given int64 and assigns it to the EvaluationChangedAt field.
func (o *FindingAttributes) SetEvaluationChangedAt(v int64) {
o.EvaluationChangedAt = &v
}
// GetMute returns the Mute field value if set, zero value otherwise.
func (o *FindingAttributes) GetMute() FindingMute {
if o == nil || o.Mute == nil {
var ret FindingMute
return ret
}
return *o.Mute
}
// GetMuteOk returns a tuple with the Mute field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FindingAttributes) GetMuteOk() (*FindingMute, bool) {
if o == nil || o.Mute == nil {
return nil, false
}
return o.Mute, true
}
// HasMute returns a boolean if a field has been set.
func (o *FindingAttributes) HasMute() bool {
return o != nil && o.Mute != nil
}
// SetMute gets a reference to the given FindingMute and assigns it to the Mute field.
func (o *FindingAttributes) SetMute(v FindingMute) {
o.Mute = &v
}
// GetResource returns the Resource field value if set, zero value otherwise.
func (o *FindingAttributes) GetResource() string {
if o == nil || o.Resource == nil {
var ret string
return ret
}
return *o.Resource
}
// GetResourceOk returns a tuple with the Resource field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FindingAttributes) GetResourceOk() (*string, bool) {
if o == nil || o.Resource == nil {
return nil, false
}
return o.Resource, true
}
// HasResource returns a boolean if a field has been set.
func (o *FindingAttributes) HasResource() bool {
return o != nil && o.Resource != nil
}
// SetResource gets a reference to the given string and assigns it to the Resource field.
func (o *FindingAttributes) SetResource(v string) {
o.Resource = &v
}
// GetResourceDiscoveryDate returns the ResourceDiscoveryDate field value if set, zero value otherwise.
func (o *FindingAttributes) GetResourceDiscoveryDate() int64 {
if o == nil || o.ResourceDiscoveryDate == nil {
var ret int64
return ret
}
return *o.ResourceDiscoveryDate
}
// GetResourceDiscoveryDateOk returns a tuple with the ResourceDiscoveryDate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FindingAttributes) GetResourceDiscoveryDateOk() (*int64, bool) {
if o == nil || o.ResourceDiscoveryDate == nil {
return nil, false
}
return o.ResourceDiscoveryDate, true
}
// HasResourceDiscoveryDate returns a boolean if a field has been set.
func (o *FindingAttributes) HasResourceDiscoveryDate() bool {
return o != nil && o.ResourceDiscoveryDate != nil
}
// SetResourceDiscoveryDate gets a reference to the given int64 and assigns it to the ResourceDiscoveryDate field.
func (o *FindingAttributes) SetResourceDiscoveryDate(v int64) {
o.ResourceDiscoveryDate = &v
}
// GetResourceType returns the ResourceType field value if set, zero value otherwise.
func (o *FindingAttributes) GetResourceType() string {
if o == nil || o.ResourceType == nil {
var ret string
return ret
}
return *o.ResourceType
}
// GetResourceTypeOk returns a tuple with the ResourceType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FindingAttributes) GetResourceTypeOk() (*string, bool) {
if o == nil || o.ResourceType == nil {
return nil, false
}
return o.ResourceType, true
}
// HasResourceType returns a boolean if a field has been set.
func (o *FindingAttributes) HasResourceType() bool {
return o != nil && o.ResourceType != nil
}
// SetResourceType gets a reference to the given string and assigns it to the ResourceType field.
func (o *FindingAttributes) SetResourceType(v string) {
o.ResourceType = &v
}
// GetRule returns the Rule field value if set, zero value otherwise.
func (o *FindingAttributes) GetRule() FindingRule {
if o == nil || o.Rule == nil {
var ret FindingRule
return ret
}
return *o.Rule
}
// GetRuleOk returns a tuple with the Rule field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FindingAttributes) GetRuleOk() (*FindingRule, bool) {
if o == nil || o.Rule == nil {
return nil, false
}
return o.Rule, true
}
// HasRule returns a boolean if a field has been set.
func (o *FindingAttributes) HasRule() bool {
return o != nil && o.Rule != nil
}
// SetRule gets a reference to the given FindingRule and assigns it to the Rule field.
func (o *FindingAttributes) SetRule(v FindingRule) {
o.Rule = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *FindingAttributes) GetStatus() FindingStatus {
if o == nil || o.Status == nil {
var ret FindingStatus
return ret
}
return *o.Status
}
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *FindingAttributes) GetStatusOk() (*FindingStatus, bool) {
if o == nil || o.Status == nil {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *FindingAttributes) HasStatus() bool {
return o != nil && o.Status != nil
}
// SetStatus gets a reference to the given FindingStatus and assigns it to the Status field.
func (o *FindingAttributes) SetStatus(v FindingStatus) {
o.Status = &v
}
// GetTags returns the Tags field value if set, zero value otherwise.
func (o *FindingAttributes) 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 *FindingAttributes) 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 *FindingAttributes) HasTags() bool {
return o != nil && o.Tags != nil
}
// SetTags gets a reference to the given []string and assigns it to the Tags field.
func (o *FindingAttributes) SetTags(v []string) {
o.Tags = v
}
// MarshalJSON serializes the struct using spec logic.
func (o FindingAttributes) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Evaluation != nil {
toSerialize["evaluation"] = o.Evaluation
}
if o.EvaluationChangedAt != nil {
toSerialize["evaluation_changed_at"] = o.EvaluationChangedAt
}
if o.Mute != nil {
toSerialize["mute"] = o.Mute
}
if o.Resource != nil {
toSerialize["resource"] = o.Resource
}
if o.ResourceDiscoveryDate != nil {
toSerialize["resource_discovery_date"] = o.ResourceDiscoveryDate
}
if o.ResourceType != nil {
toSerialize["resource_type"] = o.ResourceType
}
if o.Rule != nil {
toSerialize["rule"] = o.Rule
}
if o.Status != nil {
toSerialize["status"] = o.Status
}
if o.Tags != nil {
toSerialize["tags"] = o.Tags
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Evaluation *FindingEvaluation `json:"evaluation,omitempty"`
EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"`
Mute *FindingMute `json:"mute,omitempty"`
Resource *string `json:"resource,omitempty"`
ResourceDiscoveryDate *int64 `json:"resource_discovery_date,omitempty"`
ResourceType *string `json:"resource_type,omitempty"`
Rule *FindingRule `json:"rule,omitempty"`
Status *FindingStatus `json:"status,omitempty"`
Tags []string `json:"tags,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{"evaluation", "evaluation_changed_at", "mute", "resource", "resource_discovery_date", "resource_type", "rule", "status", "tags"})
} else {
return err
}
hasInvalidField := false
if all.Evaluation != nil && !all.Evaluation.IsValid() {
hasInvalidField = true
} else {
o.Evaluation = all.Evaluation
}
o.EvaluationChangedAt = all.EvaluationChangedAt
if all.Mute != nil && all.Mute.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Mute = all.Mute
o.Resource = all.Resource
o.ResourceDiscoveryDate = all.ResourceDiscoveryDate
o.ResourceType = all.ResourceType
if all.Rule != nil && all.Rule.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Rule = all.Rule
if all.Status != nil && !all.Status.IsValid() {
hasInvalidField = true
} else {
o.Status = all.Status
}
o.Tags = all.Tags
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}