|
| 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 | +// ObservabilityPipelineAmazonS3GenericBatchSettings Event batching settings |
| 12 | +type ObservabilityPipelineAmazonS3GenericBatchSettings struct { |
| 13 | + // Maximum batch size in bytes. |
| 14 | + BatchSize *int64 `json:"batch_size,omitempty"` |
| 15 | + // Maximum number of seconds to wait before flushing the batch. |
| 16 | + TimeoutSecs *int64 `json:"timeout_secs,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 | +// NewObservabilityPipelineAmazonS3GenericBatchSettings instantiates a new ObservabilityPipelineAmazonS3GenericBatchSettings 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 NewObservabilityPipelineAmazonS3GenericBatchSettings() *ObservabilityPipelineAmazonS3GenericBatchSettings { |
| 27 | + this := ObservabilityPipelineAmazonS3GenericBatchSettings{} |
| 28 | + return &this |
| 29 | +} |
| 30 | + |
| 31 | +// NewObservabilityPipelineAmazonS3GenericBatchSettingsWithDefaults instantiates a new ObservabilityPipelineAmazonS3GenericBatchSettings 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 NewObservabilityPipelineAmazonS3GenericBatchSettingsWithDefaults() *ObservabilityPipelineAmazonS3GenericBatchSettings { |
| 35 | + this := ObservabilityPipelineAmazonS3GenericBatchSettings{} |
| 36 | + return &this |
| 37 | +} |
| 38 | + |
| 39 | +// GetBatchSize returns the BatchSize field value if set, zero value otherwise. |
| 40 | +func (o *ObservabilityPipelineAmazonS3GenericBatchSettings) GetBatchSize() int64 { |
| 41 | + if o == nil || o.BatchSize == nil { |
| 42 | + var ret int64 |
| 43 | + return ret |
| 44 | + } |
| 45 | + return *o.BatchSize |
| 46 | +} |
| 47 | + |
| 48 | +// GetBatchSizeOk returns a tuple with the BatchSize field value if set, nil otherwise |
| 49 | +// and a boolean to check if the value has been set. |
| 50 | +func (o *ObservabilityPipelineAmazonS3GenericBatchSettings) GetBatchSizeOk() (*int64, bool) { |
| 51 | + if o == nil || o.BatchSize == nil { |
| 52 | + return nil, false |
| 53 | + } |
| 54 | + return o.BatchSize, true |
| 55 | +} |
| 56 | + |
| 57 | +// HasBatchSize returns a boolean if a field has been set. |
| 58 | +func (o *ObservabilityPipelineAmazonS3GenericBatchSettings) HasBatchSize() bool { |
| 59 | + return o != nil && o.BatchSize != nil |
| 60 | +} |
| 61 | + |
| 62 | +// SetBatchSize gets a reference to the given int64 and assigns it to the BatchSize field. |
| 63 | +func (o *ObservabilityPipelineAmazonS3GenericBatchSettings) SetBatchSize(v int64) { |
| 64 | + o.BatchSize = &v |
| 65 | +} |
| 66 | + |
| 67 | +// GetTimeoutSecs returns the TimeoutSecs field value if set, zero value otherwise. |
| 68 | +func (o *ObservabilityPipelineAmazonS3GenericBatchSettings) GetTimeoutSecs() int64 { |
| 69 | + if o == nil || o.TimeoutSecs == nil { |
| 70 | + var ret int64 |
| 71 | + return ret |
| 72 | + } |
| 73 | + return *o.TimeoutSecs |
| 74 | +} |
| 75 | + |
| 76 | +// GetTimeoutSecsOk returns a tuple with the TimeoutSecs field value if set, nil otherwise |
| 77 | +// and a boolean to check if the value has been set. |
| 78 | +func (o *ObservabilityPipelineAmazonS3GenericBatchSettings) GetTimeoutSecsOk() (*int64, bool) { |
| 79 | + if o == nil || o.TimeoutSecs == nil { |
| 80 | + return nil, false |
| 81 | + } |
| 82 | + return o.TimeoutSecs, true |
| 83 | +} |
| 84 | + |
| 85 | +// HasTimeoutSecs returns a boolean if a field has been set. |
| 86 | +func (o *ObservabilityPipelineAmazonS3GenericBatchSettings) HasTimeoutSecs() bool { |
| 87 | + return o != nil && o.TimeoutSecs != nil |
| 88 | +} |
| 89 | + |
| 90 | +// SetTimeoutSecs gets a reference to the given int64 and assigns it to the TimeoutSecs field. |
| 91 | +func (o *ObservabilityPipelineAmazonS3GenericBatchSettings) SetTimeoutSecs(v int64) { |
| 92 | + o.TimeoutSecs = &v |
| 93 | +} |
| 94 | + |
| 95 | +// MarshalJSON serializes the struct using spec logic. |
| 96 | +func (o ObservabilityPipelineAmazonS3GenericBatchSettings) MarshalJSON() ([]byte, error) { |
| 97 | + toSerialize := map[string]interface{}{} |
| 98 | + if o.UnparsedObject != nil { |
| 99 | + return datadog.Marshal(o.UnparsedObject) |
| 100 | + } |
| 101 | + if o.BatchSize != nil { |
| 102 | + toSerialize["batch_size"] = o.BatchSize |
| 103 | + } |
| 104 | + if o.TimeoutSecs != nil { |
| 105 | + toSerialize["timeout_secs"] = o.TimeoutSecs |
| 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 *ObservabilityPipelineAmazonS3GenericBatchSettings) UnmarshalJSON(bytes []byte) (err error) { |
| 116 | + all := struct { |
| 117 | + BatchSize *int64 `json:"batch_size,omitempty"` |
| 118 | + TimeoutSecs *int64 `json:"timeout_secs,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{"batch_size", "timeout_secs"}) |
| 126 | + } else { |
| 127 | + return err |
| 128 | + } |
| 129 | + o.BatchSize = all.BatchSize |
| 130 | + o.TimeoutSecs = all.TimeoutSecs |
| 131 | + |
| 132 | + if len(additionalProperties) > 0 { |
| 133 | + o.AdditionalProperties = additionalProperties |
| 134 | + } |
| 135 | + |
| 136 | + return nil |
| 137 | +} |
0 commit comments