|
| 1 | +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 2 | +// This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +// Copyright 2019-Present Datadog, Inc. |
| 4 | + |
| 5 | +package datadogV2 |
| 6 | + |
| 7 | +import ( |
| 8 | + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" |
| 9 | +) |
| 10 | + |
| 11 | +// SecurityMonitoringPaginatedSuppressionsResponse Response object containing the available suppression rules with pagination metadata. |
| 12 | +type SecurityMonitoringPaginatedSuppressionsResponse struct { |
| 13 | + // A list of suppressions objects. |
| 14 | + Data []SecurityMonitoringSuppression `json:"data,omitempty"` |
| 15 | + // Metadata for the suppression list response. |
| 16 | + Meta *SecurityMonitoringSuppressionsMeta `json:"meta,omitempty"` |
| 17 | + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct |
| 18 | + UnparsedObject map[string]interface{} `json:"-"` |
| 19 | + AdditionalProperties map[string]interface{} `json:"-"` |
| 20 | +} |
| 21 | + |
| 22 | +// NewSecurityMonitoringPaginatedSuppressionsResponse instantiates a new SecurityMonitoringPaginatedSuppressionsResponse object. |
| 23 | +// This constructor will assign default values to properties that have it defined, |
| 24 | +// and makes sure properties required by API are set, but the set of arguments |
| 25 | +// will change when the set of required properties is changed. |
| 26 | +func NewSecurityMonitoringPaginatedSuppressionsResponse() *SecurityMonitoringPaginatedSuppressionsResponse { |
| 27 | + this := SecurityMonitoringPaginatedSuppressionsResponse{} |
| 28 | + return &this |
| 29 | +} |
| 30 | + |
| 31 | +// NewSecurityMonitoringPaginatedSuppressionsResponseWithDefaults instantiates a new SecurityMonitoringPaginatedSuppressionsResponse object. |
| 32 | +// This constructor will only assign default values to properties that have it defined, |
| 33 | +// but it doesn't guarantee that properties required by API are set. |
| 34 | +func NewSecurityMonitoringPaginatedSuppressionsResponseWithDefaults() *SecurityMonitoringPaginatedSuppressionsResponse { |
| 35 | + this := SecurityMonitoringPaginatedSuppressionsResponse{} |
| 36 | + return &this |
| 37 | +} |
| 38 | + |
| 39 | +// GetData returns the Data field value if set, zero value otherwise. |
| 40 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) GetData() []SecurityMonitoringSuppression { |
| 41 | + if o == nil || o.Data == nil { |
| 42 | + var ret []SecurityMonitoringSuppression |
| 43 | + return ret |
| 44 | + } |
| 45 | + return o.Data |
| 46 | +} |
| 47 | + |
| 48 | +// GetDataOk returns a tuple with the Data field value if set, nil otherwise |
| 49 | +// and a boolean to check if the value has been set. |
| 50 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) GetDataOk() (*[]SecurityMonitoringSuppression, bool) { |
| 51 | + if o == nil || o.Data == nil { |
| 52 | + return nil, false |
| 53 | + } |
| 54 | + return &o.Data, true |
| 55 | +} |
| 56 | + |
| 57 | +// HasData returns a boolean if a field has been set. |
| 58 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) HasData() bool { |
| 59 | + return o != nil && o.Data != nil |
| 60 | +} |
| 61 | + |
| 62 | +// SetData gets a reference to the given []SecurityMonitoringSuppression and assigns it to the Data field. |
| 63 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) SetData(v []SecurityMonitoringSuppression) { |
| 64 | + o.Data = v |
| 65 | +} |
| 66 | + |
| 67 | +// GetMeta returns the Meta field value if set, zero value otherwise. |
| 68 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) GetMeta() SecurityMonitoringSuppressionsMeta { |
| 69 | + if o == nil || o.Meta == nil { |
| 70 | + var ret SecurityMonitoringSuppressionsMeta |
| 71 | + return ret |
| 72 | + } |
| 73 | + return *o.Meta |
| 74 | +} |
| 75 | + |
| 76 | +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise |
| 77 | +// and a boolean to check if the value has been set. |
| 78 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) GetMetaOk() (*SecurityMonitoringSuppressionsMeta, bool) { |
| 79 | + if o == nil || o.Meta == nil { |
| 80 | + return nil, false |
| 81 | + } |
| 82 | + return o.Meta, true |
| 83 | +} |
| 84 | + |
| 85 | +// HasMeta returns a boolean if a field has been set. |
| 86 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) HasMeta() bool { |
| 87 | + return o != nil && o.Meta != nil |
| 88 | +} |
| 89 | + |
| 90 | +// SetMeta gets a reference to the given SecurityMonitoringSuppressionsMeta and assigns it to the Meta field. |
| 91 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) SetMeta(v SecurityMonitoringSuppressionsMeta) { |
| 92 | + o.Meta = &v |
| 93 | +} |
| 94 | + |
| 95 | +// MarshalJSON serializes the struct using spec logic. |
| 96 | +func (o SecurityMonitoringPaginatedSuppressionsResponse) MarshalJSON() ([]byte, error) { |
| 97 | + toSerialize := map[string]interface{}{} |
| 98 | + if o.UnparsedObject != nil { |
| 99 | + return datadog.Marshal(o.UnparsedObject) |
| 100 | + } |
| 101 | + if o.Data != nil { |
| 102 | + toSerialize["data"] = o.Data |
| 103 | + } |
| 104 | + if o.Meta != nil { |
| 105 | + toSerialize["meta"] = o.Meta |
| 106 | + } |
| 107 | + |
| 108 | + for key, value := range o.AdditionalProperties { |
| 109 | + toSerialize[key] = value |
| 110 | + } |
| 111 | + return datadog.Marshal(toSerialize) |
| 112 | +} |
| 113 | + |
| 114 | +// UnmarshalJSON deserializes the given payload. |
| 115 | +func (o *SecurityMonitoringPaginatedSuppressionsResponse) UnmarshalJSON(bytes []byte) (err error) { |
| 116 | + all := struct { |
| 117 | + Data []SecurityMonitoringSuppression `json:"data,omitempty"` |
| 118 | + Meta *SecurityMonitoringSuppressionsMeta `json:"meta,omitempty"` |
| 119 | + }{} |
| 120 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 121 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 122 | + } |
| 123 | + additionalProperties := make(map[string]interface{}) |
| 124 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 125 | + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) |
| 126 | + } else { |
| 127 | + return err |
| 128 | + } |
| 129 | + |
| 130 | + hasInvalidField := false |
| 131 | + o.Data = all.Data |
| 132 | + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { |
| 133 | + hasInvalidField = true |
| 134 | + } |
| 135 | + o.Meta = all.Meta |
| 136 | + |
| 137 | + if len(additionalProperties) > 0 { |
| 138 | + o.AdditionalProperties = additionalProperties |
| 139 | + } |
| 140 | + |
| 141 | + if hasInvalidField { |
| 142 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 143 | + } |
| 144 | + |
| 145 | + return nil |
| 146 | +} |
0 commit comments