|
| 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 datadogV1 |
| 6 | + |
| 7 | +import ( |
| 8 | + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" |
| 9 | +) |
| 10 | + |
| 11 | +// LogsAPILimitReachedResponse Response returned by the Logs API when the max limit has been reached. |
| 12 | +type LogsAPILimitReachedResponse struct { |
| 13 | + // Error returned by the Logs API |
| 14 | + Error *LogsAPIError `json:"error,omitempty"` |
| 15 | + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct |
| 16 | + UnparsedObject map[string]interface{} `json:"-"` |
| 17 | + AdditionalProperties map[string]interface{} `json:"-"` |
| 18 | +} |
| 19 | + |
| 20 | +// NewLogsAPILimitReachedResponse instantiates a new LogsAPILimitReachedResponse object. |
| 21 | +// This constructor will assign default values to properties that have it defined, |
| 22 | +// and makes sure properties required by API are set, but the set of arguments |
| 23 | +// will change when the set of required properties is changed. |
| 24 | +func NewLogsAPILimitReachedResponse() *LogsAPILimitReachedResponse { |
| 25 | + this := LogsAPILimitReachedResponse{} |
| 26 | + return &this |
| 27 | +} |
| 28 | + |
| 29 | +// NewLogsAPILimitReachedResponseWithDefaults instantiates a new LogsAPILimitReachedResponse object. |
| 30 | +// This constructor will only assign default values to properties that have it defined, |
| 31 | +// but it doesn't guarantee that properties required by API are set. |
| 32 | +func NewLogsAPILimitReachedResponseWithDefaults() *LogsAPILimitReachedResponse { |
| 33 | + this := LogsAPILimitReachedResponse{} |
| 34 | + return &this |
| 35 | +} |
| 36 | + |
| 37 | +// GetError returns the Error field value if set, zero value otherwise. |
| 38 | +func (o *LogsAPILimitReachedResponse) GetError() LogsAPIError { |
| 39 | + if o == nil || o.Error == nil { |
| 40 | + var ret LogsAPIError |
| 41 | + return ret |
| 42 | + } |
| 43 | + return *o.Error |
| 44 | +} |
| 45 | + |
| 46 | +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise |
| 47 | +// and a boolean to check if the value has been set. |
| 48 | +func (o *LogsAPILimitReachedResponse) GetErrorOk() (*LogsAPIError, bool) { |
| 49 | + if o == nil || o.Error == nil { |
| 50 | + return nil, false |
| 51 | + } |
| 52 | + return o.Error, true |
| 53 | +} |
| 54 | + |
| 55 | +// HasError returns a boolean if a field has been set. |
| 56 | +func (o *LogsAPILimitReachedResponse) HasError() bool { |
| 57 | + return o != nil && o.Error != nil |
| 58 | +} |
| 59 | + |
| 60 | +// SetError gets a reference to the given LogsAPIError and assigns it to the Error field. |
| 61 | +func (o *LogsAPILimitReachedResponse) SetError(v LogsAPIError) { |
| 62 | + o.Error = &v |
| 63 | +} |
| 64 | + |
| 65 | +// MarshalJSON serializes the struct using spec logic. |
| 66 | +func (o LogsAPILimitReachedResponse) MarshalJSON() ([]byte, error) { |
| 67 | + toSerialize := map[string]interface{}{} |
| 68 | + if o.UnparsedObject != nil { |
| 69 | + return datadog.Marshal(o.UnparsedObject) |
| 70 | + } |
| 71 | + if o.Error != nil { |
| 72 | + toSerialize["error"] = o.Error |
| 73 | + } |
| 74 | + |
| 75 | + for key, value := range o.AdditionalProperties { |
| 76 | + toSerialize[key] = value |
| 77 | + } |
| 78 | + return datadog.Marshal(toSerialize) |
| 79 | +} |
| 80 | + |
| 81 | +// UnmarshalJSON deserializes the given payload. |
| 82 | +func (o *LogsAPILimitReachedResponse) UnmarshalJSON(bytes []byte) (err error) { |
| 83 | + all := struct { |
| 84 | + Error *LogsAPIError `json:"error,omitempty"` |
| 85 | + }{} |
| 86 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 87 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 88 | + } |
| 89 | + additionalProperties := make(map[string]interface{}) |
| 90 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 91 | + datadog.DeleteKeys(additionalProperties, &[]string{"error"}) |
| 92 | + } else { |
| 93 | + return err |
| 94 | + } |
| 95 | + |
| 96 | + hasInvalidField := false |
| 97 | + if all.Error != nil && all.Error.UnparsedObject != nil && o.UnparsedObject == nil { |
| 98 | + hasInvalidField = true |
| 99 | + } |
| 100 | + o.Error = all.Error |
| 101 | + |
| 102 | + if len(additionalProperties) > 0 { |
| 103 | + o.AdditionalProperties = additionalProperties |
| 104 | + } |
| 105 | + |
| 106 | + if hasInvalidField { |
| 107 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 108 | + } |
| 109 | + |
| 110 | + return nil |
| 111 | +} |
0 commit comments