|
| 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 | +// DeletedSuiteResponseData |
| 12 | +type DeletedSuiteResponseData struct { |
| 13 | + // |
| 14 | + Attributes *DeletedSuiteResponseDataAttributes `json:"attributes,omitempty"` |
| 15 | + // |
| 16 | + Id *string `json:"id,omitempty"` |
| 17 | + // |
| 18 | + Type *DeletedSuiteType `json:"type,omitempty"` |
| 19 | + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct |
| 20 | + UnparsedObject map[string]interface{} `json:"-"` |
| 21 | + AdditionalProperties map[string]interface{} `json:"-"` |
| 22 | +} |
| 23 | + |
| 24 | +// NewDeletedSuiteResponseData instantiates a new DeletedSuiteResponseData object. |
| 25 | +// This constructor will assign default values to properties that have it defined, |
| 26 | +// and makes sure properties required by API are set, but the set of arguments |
| 27 | +// will change when the set of required properties is changed. |
| 28 | +func NewDeletedSuiteResponseData() *DeletedSuiteResponseData { |
| 29 | + this := DeletedSuiteResponseData{} |
| 30 | + var typeVar DeletedSuiteType = DELETEDSUITETYPE_SUITES |
| 31 | + this.Type = &typeVar |
| 32 | + return &this |
| 33 | +} |
| 34 | + |
| 35 | +// NewDeletedSuiteResponseDataWithDefaults instantiates a new DeletedSuiteResponseData object. |
| 36 | +// This constructor will only assign default values to properties that have it defined, |
| 37 | +// but it doesn't guarantee that properties required by API are set. |
| 38 | +func NewDeletedSuiteResponseDataWithDefaults() *DeletedSuiteResponseData { |
| 39 | + this := DeletedSuiteResponseData{} |
| 40 | + var typeVar DeletedSuiteType = DELETEDSUITETYPE_SUITES |
| 41 | + this.Type = &typeVar |
| 42 | + return &this |
| 43 | +} |
| 44 | + |
| 45 | +// GetAttributes returns the Attributes field value if set, zero value otherwise. |
| 46 | +func (o *DeletedSuiteResponseData) GetAttributes() DeletedSuiteResponseDataAttributes { |
| 47 | + if o == nil || o.Attributes == nil { |
| 48 | + var ret DeletedSuiteResponseDataAttributes |
| 49 | + return ret |
| 50 | + } |
| 51 | + return *o.Attributes |
| 52 | +} |
| 53 | + |
| 54 | +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise |
| 55 | +// and a boolean to check if the value has been set. |
| 56 | +func (o *DeletedSuiteResponseData) GetAttributesOk() (*DeletedSuiteResponseDataAttributes, bool) { |
| 57 | + if o == nil || o.Attributes == nil { |
| 58 | + return nil, false |
| 59 | + } |
| 60 | + return o.Attributes, true |
| 61 | +} |
| 62 | + |
| 63 | +// HasAttributes returns a boolean if a field has been set. |
| 64 | +func (o *DeletedSuiteResponseData) HasAttributes() bool { |
| 65 | + return o != nil && o.Attributes != nil |
| 66 | +} |
| 67 | + |
| 68 | +// SetAttributes gets a reference to the given DeletedSuiteResponseDataAttributes and assigns it to the Attributes field. |
| 69 | +func (o *DeletedSuiteResponseData) SetAttributes(v DeletedSuiteResponseDataAttributes) { |
| 70 | + o.Attributes = &v |
| 71 | +} |
| 72 | + |
| 73 | +// GetId returns the Id field value if set, zero value otherwise. |
| 74 | +func (o *DeletedSuiteResponseData) GetId() string { |
| 75 | + if o == nil || o.Id == nil { |
| 76 | + var ret string |
| 77 | + return ret |
| 78 | + } |
| 79 | + return *o.Id |
| 80 | +} |
| 81 | + |
| 82 | +// GetIdOk returns a tuple with the Id field value if set, nil otherwise |
| 83 | +// and a boolean to check if the value has been set. |
| 84 | +func (o *DeletedSuiteResponseData) GetIdOk() (*string, bool) { |
| 85 | + if o == nil || o.Id == nil { |
| 86 | + return nil, false |
| 87 | + } |
| 88 | + return o.Id, true |
| 89 | +} |
| 90 | + |
| 91 | +// HasId returns a boolean if a field has been set. |
| 92 | +func (o *DeletedSuiteResponseData) HasId() bool { |
| 93 | + return o != nil && o.Id != nil |
| 94 | +} |
| 95 | + |
| 96 | +// SetId gets a reference to the given string and assigns it to the Id field. |
| 97 | +func (o *DeletedSuiteResponseData) SetId(v string) { |
| 98 | + o.Id = &v |
| 99 | +} |
| 100 | + |
| 101 | +// GetType returns the Type field value if set, zero value otherwise. |
| 102 | +func (o *DeletedSuiteResponseData) GetType() DeletedSuiteType { |
| 103 | + if o == nil || o.Type == nil { |
| 104 | + var ret DeletedSuiteType |
| 105 | + return ret |
| 106 | + } |
| 107 | + return *o.Type |
| 108 | +} |
| 109 | + |
| 110 | +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise |
| 111 | +// and a boolean to check if the value has been set. |
| 112 | +func (o *DeletedSuiteResponseData) GetTypeOk() (*DeletedSuiteType, bool) { |
| 113 | + if o == nil || o.Type == nil { |
| 114 | + return nil, false |
| 115 | + } |
| 116 | + return o.Type, true |
| 117 | +} |
| 118 | + |
| 119 | +// HasType returns a boolean if a field has been set. |
| 120 | +func (o *DeletedSuiteResponseData) HasType() bool { |
| 121 | + return o != nil && o.Type != nil |
| 122 | +} |
| 123 | + |
| 124 | +// SetType gets a reference to the given DeletedSuiteType and assigns it to the Type field. |
| 125 | +func (o *DeletedSuiteResponseData) SetType(v DeletedSuiteType) { |
| 126 | + o.Type = &v |
| 127 | +} |
| 128 | + |
| 129 | +// MarshalJSON serializes the struct using spec logic. |
| 130 | +func (o DeletedSuiteResponseData) MarshalJSON() ([]byte, error) { |
| 131 | + toSerialize := map[string]interface{}{} |
| 132 | + if o.UnparsedObject != nil { |
| 133 | + return datadog.Marshal(o.UnparsedObject) |
| 134 | + } |
| 135 | + if o.Attributes != nil { |
| 136 | + toSerialize["attributes"] = o.Attributes |
| 137 | + } |
| 138 | + if o.Id != nil { |
| 139 | + toSerialize["id"] = o.Id |
| 140 | + } |
| 141 | + if o.Type != nil { |
| 142 | + toSerialize["type"] = o.Type |
| 143 | + } |
| 144 | + |
| 145 | + for key, value := range o.AdditionalProperties { |
| 146 | + toSerialize[key] = value |
| 147 | + } |
| 148 | + return datadog.Marshal(toSerialize) |
| 149 | +} |
| 150 | + |
| 151 | +// UnmarshalJSON deserializes the given payload. |
| 152 | +func (o *DeletedSuiteResponseData) UnmarshalJSON(bytes []byte) (err error) { |
| 153 | + all := struct { |
| 154 | + Attributes *DeletedSuiteResponseDataAttributes `json:"attributes,omitempty"` |
| 155 | + Id *string `json:"id,omitempty"` |
| 156 | + Type *DeletedSuiteType `json:"type,omitempty"` |
| 157 | + }{} |
| 158 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 159 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 160 | + } |
| 161 | + additionalProperties := make(map[string]interface{}) |
| 162 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 163 | + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) |
| 164 | + } else { |
| 165 | + return err |
| 166 | + } |
| 167 | + |
| 168 | + hasInvalidField := false |
| 169 | + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { |
| 170 | + hasInvalidField = true |
| 171 | + } |
| 172 | + o.Attributes = all.Attributes |
| 173 | + o.Id = all.Id |
| 174 | + if all.Type != nil && !all.Type.IsValid() { |
| 175 | + hasInvalidField = true |
| 176 | + } else { |
| 177 | + o.Type = all.Type |
| 178 | + } |
| 179 | + |
| 180 | + if len(additionalProperties) > 0 { |
| 181 | + o.AdditionalProperties = additionalProperties |
| 182 | + } |
| 183 | + |
| 184 | + if hasInvalidField { |
| 185 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 186 | + } |
| 187 | + |
| 188 | + return nil |
| 189 | +} |
0 commit comments