|
| 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 | +// ObservabilityPipelineOpenSearchDestinationDataStream Configuration options for writing to OpenSearch Data Streams instead of a fixed index. |
| 12 | +type ObservabilityPipelineOpenSearchDestinationDataStream struct { |
| 13 | + // The data stream dataset for your logs. This groups logs by their source or application. |
| 14 | + Dataset *string `json:"dataset,omitempty"` |
| 15 | + // The data stream type for your logs. This determines how logs are categorized within the data stream. |
| 16 | + Dtype *string `json:"dtype,omitempty"` |
| 17 | + // The data stream namespace for your logs. This separates logs into different environments or domains. |
| 18 | + Namespace *string `json:"namespace,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 | +// NewObservabilityPipelineOpenSearchDestinationDataStream instantiates a new ObservabilityPipelineOpenSearchDestinationDataStream 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 NewObservabilityPipelineOpenSearchDestinationDataStream() *ObservabilityPipelineOpenSearchDestinationDataStream { |
| 29 | + this := ObservabilityPipelineOpenSearchDestinationDataStream{} |
| 30 | + return &this |
| 31 | +} |
| 32 | + |
| 33 | +// NewObservabilityPipelineOpenSearchDestinationDataStreamWithDefaults instantiates a new ObservabilityPipelineOpenSearchDestinationDataStream object. |
| 34 | +// This constructor will only assign default values to properties that have it defined, |
| 35 | +// but it doesn't guarantee that properties required by API are set. |
| 36 | +func NewObservabilityPipelineOpenSearchDestinationDataStreamWithDefaults() *ObservabilityPipelineOpenSearchDestinationDataStream { |
| 37 | + this := ObservabilityPipelineOpenSearchDestinationDataStream{} |
| 38 | + return &this |
| 39 | +} |
| 40 | + |
| 41 | +// GetDataset returns the Dataset field value if set, zero value otherwise. |
| 42 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetDataset() string { |
| 43 | + if o == nil || o.Dataset == nil { |
| 44 | + var ret string |
| 45 | + return ret |
| 46 | + } |
| 47 | + return *o.Dataset |
| 48 | +} |
| 49 | + |
| 50 | +// GetDatasetOk returns a tuple with the Dataset field value if set, nil otherwise |
| 51 | +// and a boolean to check if the value has been set. |
| 52 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetDatasetOk() (*string, bool) { |
| 53 | + if o == nil || o.Dataset == nil { |
| 54 | + return nil, false |
| 55 | + } |
| 56 | + return o.Dataset, true |
| 57 | +} |
| 58 | + |
| 59 | +// HasDataset returns a boolean if a field has been set. |
| 60 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) HasDataset() bool { |
| 61 | + return o != nil && o.Dataset != nil |
| 62 | +} |
| 63 | + |
| 64 | +// SetDataset gets a reference to the given string and assigns it to the Dataset field. |
| 65 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) SetDataset(v string) { |
| 66 | + o.Dataset = &v |
| 67 | +} |
| 68 | + |
| 69 | +// GetDtype returns the Dtype field value if set, zero value otherwise. |
| 70 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetDtype() string { |
| 71 | + if o == nil || o.Dtype == nil { |
| 72 | + var ret string |
| 73 | + return ret |
| 74 | + } |
| 75 | + return *o.Dtype |
| 76 | +} |
| 77 | + |
| 78 | +// GetDtypeOk returns a tuple with the Dtype field value if set, nil otherwise |
| 79 | +// and a boolean to check if the value has been set. |
| 80 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetDtypeOk() (*string, bool) { |
| 81 | + if o == nil || o.Dtype == nil { |
| 82 | + return nil, false |
| 83 | + } |
| 84 | + return o.Dtype, true |
| 85 | +} |
| 86 | + |
| 87 | +// HasDtype returns a boolean if a field has been set. |
| 88 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) HasDtype() bool { |
| 89 | + return o != nil && o.Dtype != nil |
| 90 | +} |
| 91 | + |
| 92 | +// SetDtype gets a reference to the given string and assigns it to the Dtype field. |
| 93 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) SetDtype(v string) { |
| 94 | + o.Dtype = &v |
| 95 | +} |
| 96 | + |
| 97 | +// GetNamespace returns the Namespace field value if set, zero value otherwise. |
| 98 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetNamespace() string { |
| 99 | + if o == nil || o.Namespace == nil { |
| 100 | + var ret string |
| 101 | + return ret |
| 102 | + } |
| 103 | + return *o.Namespace |
| 104 | +} |
| 105 | + |
| 106 | +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise |
| 107 | +// and a boolean to check if the value has been set. |
| 108 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetNamespaceOk() (*string, bool) { |
| 109 | + if o == nil || o.Namespace == nil { |
| 110 | + return nil, false |
| 111 | + } |
| 112 | + return o.Namespace, true |
| 113 | +} |
| 114 | + |
| 115 | +// HasNamespace returns a boolean if a field has been set. |
| 116 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) HasNamespace() bool { |
| 117 | + return o != nil && o.Namespace != nil |
| 118 | +} |
| 119 | + |
| 120 | +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. |
| 121 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) SetNamespace(v string) { |
| 122 | + o.Namespace = &v |
| 123 | +} |
| 124 | + |
| 125 | +// MarshalJSON serializes the struct using spec logic. |
| 126 | +func (o ObservabilityPipelineOpenSearchDestinationDataStream) MarshalJSON() ([]byte, error) { |
| 127 | + toSerialize := map[string]interface{}{} |
| 128 | + if o.UnparsedObject != nil { |
| 129 | + return datadog.Marshal(o.UnparsedObject) |
| 130 | + } |
| 131 | + if o.Dataset != nil { |
| 132 | + toSerialize["dataset"] = o.Dataset |
| 133 | + } |
| 134 | + if o.Dtype != nil { |
| 135 | + toSerialize["dtype"] = o.Dtype |
| 136 | + } |
| 137 | + if o.Namespace != nil { |
| 138 | + toSerialize["namespace"] = o.Namespace |
| 139 | + } |
| 140 | + |
| 141 | + for key, value := range o.AdditionalProperties { |
| 142 | + toSerialize[key] = value |
| 143 | + } |
| 144 | + return datadog.Marshal(toSerialize) |
| 145 | +} |
| 146 | + |
| 147 | +// UnmarshalJSON deserializes the given payload. |
| 148 | +func (o *ObservabilityPipelineOpenSearchDestinationDataStream) UnmarshalJSON(bytes []byte) (err error) { |
| 149 | + all := struct { |
| 150 | + Dataset *string `json:"dataset,omitempty"` |
| 151 | + Dtype *string `json:"dtype,omitempty"` |
| 152 | + Namespace *string `json:"namespace,omitempty"` |
| 153 | + }{} |
| 154 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 155 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 156 | + } |
| 157 | + additionalProperties := make(map[string]interface{}) |
| 158 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 159 | + datadog.DeleteKeys(additionalProperties, &[]string{"dataset", "dtype", "namespace"}) |
| 160 | + } else { |
| 161 | + return err |
| 162 | + } |
| 163 | + o.Dataset = all.Dataset |
| 164 | + o.Dtype = all.Dtype |
| 165 | + o.Namespace = all.Namespace |
| 166 | + |
| 167 | + if len(additionalProperties) > 0 { |
| 168 | + o.AdditionalProperties = additionalProperties |
| 169 | + } |
| 170 | + |
| 171 | + return nil |
| 172 | +} |
0 commit comments