|
| 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 | +// ObservabilityPipelineDatadogLogsDestinationRoute Defines how the `datadog_logs` destination routes matching logs to a Datadog site using a specific API key. |
| 12 | +type ObservabilityPipelineDatadogLogsDestinationRoute struct { |
| 13 | + // Name of the environment variable or secret that stores the Datadog API key used by this route. |
| 14 | + ApiKeyKey *string `json:"api_key_key,omitempty"` |
| 15 | + // A Datadog search query that determines which logs are forwarded using this route. |
| 16 | + Include *string `json:"include,omitempty"` |
| 17 | + // Unique identifier for this route within the destination. |
| 18 | + RouteId *string `json:"route_id,omitempty"` |
| 19 | + // Datadog site where matching logs are sent (for example, `us1`). |
| 20 | + Site *string `json:"site,omitempty"` |
| 21 | + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct |
| 22 | + UnparsedObject map[string]interface{} `json:"-"` |
| 23 | + AdditionalProperties map[string]interface{} `json:"-"` |
| 24 | +} |
| 25 | + |
| 26 | +// NewObservabilityPipelineDatadogLogsDestinationRoute instantiates a new ObservabilityPipelineDatadogLogsDestinationRoute object. |
| 27 | +// This constructor will assign default values to properties that have it defined, |
| 28 | +// and makes sure properties required by API are set, but the set of arguments |
| 29 | +// will change when the set of required properties is changed. |
| 30 | +func NewObservabilityPipelineDatadogLogsDestinationRoute() *ObservabilityPipelineDatadogLogsDestinationRoute { |
| 31 | + this := ObservabilityPipelineDatadogLogsDestinationRoute{} |
| 32 | + return &this |
| 33 | +} |
| 34 | + |
| 35 | +// NewObservabilityPipelineDatadogLogsDestinationRouteWithDefaults instantiates a new ObservabilityPipelineDatadogLogsDestinationRoute 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 NewObservabilityPipelineDatadogLogsDestinationRouteWithDefaults() *ObservabilityPipelineDatadogLogsDestinationRoute { |
| 39 | + this := ObservabilityPipelineDatadogLogsDestinationRoute{} |
| 40 | + return &this |
| 41 | +} |
| 42 | + |
| 43 | +// GetApiKeyKey returns the ApiKeyKey field value if set, zero value otherwise. |
| 44 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) GetApiKeyKey() string { |
| 45 | + if o == nil || o.ApiKeyKey == nil { |
| 46 | + var ret string |
| 47 | + return ret |
| 48 | + } |
| 49 | + return *o.ApiKeyKey |
| 50 | +} |
| 51 | + |
| 52 | +// GetApiKeyKeyOk returns a tuple with the ApiKeyKey field value if set, nil otherwise |
| 53 | +// and a boolean to check if the value has been set. |
| 54 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) GetApiKeyKeyOk() (*string, bool) { |
| 55 | + if o == nil || o.ApiKeyKey == nil { |
| 56 | + return nil, false |
| 57 | + } |
| 58 | + return o.ApiKeyKey, true |
| 59 | +} |
| 60 | + |
| 61 | +// HasApiKeyKey returns a boolean if a field has been set. |
| 62 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) HasApiKeyKey() bool { |
| 63 | + return o != nil && o.ApiKeyKey != nil |
| 64 | +} |
| 65 | + |
| 66 | +// SetApiKeyKey gets a reference to the given string and assigns it to the ApiKeyKey field. |
| 67 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) SetApiKeyKey(v string) { |
| 68 | + o.ApiKeyKey = &v |
| 69 | +} |
| 70 | + |
| 71 | +// GetInclude returns the Include field value if set, zero value otherwise. |
| 72 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) GetInclude() string { |
| 73 | + if o == nil || o.Include == nil { |
| 74 | + var ret string |
| 75 | + return ret |
| 76 | + } |
| 77 | + return *o.Include |
| 78 | +} |
| 79 | + |
| 80 | +// GetIncludeOk returns a tuple with the Include field value if set, nil otherwise |
| 81 | +// and a boolean to check if the value has been set. |
| 82 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) GetIncludeOk() (*string, bool) { |
| 83 | + if o == nil || o.Include == nil { |
| 84 | + return nil, false |
| 85 | + } |
| 86 | + return o.Include, true |
| 87 | +} |
| 88 | + |
| 89 | +// HasInclude returns a boolean if a field has been set. |
| 90 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) HasInclude() bool { |
| 91 | + return o != nil && o.Include != nil |
| 92 | +} |
| 93 | + |
| 94 | +// SetInclude gets a reference to the given string and assigns it to the Include field. |
| 95 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) SetInclude(v string) { |
| 96 | + o.Include = &v |
| 97 | +} |
| 98 | + |
| 99 | +// GetRouteId returns the RouteId field value if set, zero value otherwise. |
| 100 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) GetRouteId() string { |
| 101 | + if o == nil || o.RouteId == nil { |
| 102 | + var ret string |
| 103 | + return ret |
| 104 | + } |
| 105 | + return *o.RouteId |
| 106 | +} |
| 107 | + |
| 108 | +// GetRouteIdOk returns a tuple with the RouteId field value if set, nil otherwise |
| 109 | +// and a boolean to check if the value has been set. |
| 110 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) GetRouteIdOk() (*string, bool) { |
| 111 | + if o == nil || o.RouteId == nil { |
| 112 | + return nil, false |
| 113 | + } |
| 114 | + return o.RouteId, true |
| 115 | +} |
| 116 | + |
| 117 | +// HasRouteId returns a boolean if a field has been set. |
| 118 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) HasRouteId() bool { |
| 119 | + return o != nil && o.RouteId != nil |
| 120 | +} |
| 121 | + |
| 122 | +// SetRouteId gets a reference to the given string and assigns it to the RouteId field. |
| 123 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) SetRouteId(v string) { |
| 124 | + o.RouteId = &v |
| 125 | +} |
| 126 | + |
| 127 | +// GetSite returns the Site field value if set, zero value otherwise. |
| 128 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) GetSite() string { |
| 129 | + if o == nil || o.Site == nil { |
| 130 | + var ret string |
| 131 | + return ret |
| 132 | + } |
| 133 | + return *o.Site |
| 134 | +} |
| 135 | + |
| 136 | +// GetSiteOk returns a tuple with the Site field value if set, nil otherwise |
| 137 | +// and a boolean to check if the value has been set. |
| 138 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) GetSiteOk() (*string, bool) { |
| 139 | + if o == nil || o.Site == nil { |
| 140 | + return nil, false |
| 141 | + } |
| 142 | + return o.Site, true |
| 143 | +} |
| 144 | + |
| 145 | +// HasSite returns a boolean if a field has been set. |
| 146 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) HasSite() bool { |
| 147 | + return o != nil && o.Site != nil |
| 148 | +} |
| 149 | + |
| 150 | +// SetSite gets a reference to the given string and assigns it to the Site field. |
| 151 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) SetSite(v string) { |
| 152 | + o.Site = &v |
| 153 | +} |
| 154 | + |
| 155 | +// MarshalJSON serializes the struct using spec logic. |
| 156 | +func (o ObservabilityPipelineDatadogLogsDestinationRoute) MarshalJSON() ([]byte, error) { |
| 157 | + toSerialize := map[string]interface{}{} |
| 158 | + if o.UnparsedObject != nil { |
| 159 | + return datadog.Marshal(o.UnparsedObject) |
| 160 | + } |
| 161 | + if o.ApiKeyKey != nil { |
| 162 | + toSerialize["api_key_key"] = o.ApiKeyKey |
| 163 | + } |
| 164 | + if o.Include != nil { |
| 165 | + toSerialize["include"] = o.Include |
| 166 | + } |
| 167 | + if o.RouteId != nil { |
| 168 | + toSerialize["route_id"] = o.RouteId |
| 169 | + } |
| 170 | + if o.Site != nil { |
| 171 | + toSerialize["site"] = o.Site |
| 172 | + } |
| 173 | + |
| 174 | + for key, value := range o.AdditionalProperties { |
| 175 | + toSerialize[key] = value |
| 176 | + } |
| 177 | + return datadog.Marshal(toSerialize) |
| 178 | +} |
| 179 | + |
| 180 | +// UnmarshalJSON deserializes the given payload. |
| 181 | +func (o *ObservabilityPipelineDatadogLogsDestinationRoute) UnmarshalJSON(bytes []byte) (err error) { |
| 182 | + all := struct { |
| 183 | + ApiKeyKey *string `json:"api_key_key,omitempty"` |
| 184 | + Include *string `json:"include,omitempty"` |
| 185 | + RouteId *string `json:"route_id,omitempty"` |
| 186 | + Site *string `json:"site,omitempty"` |
| 187 | + }{} |
| 188 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 189 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 190 | + } |
| 191 | + additionalProperties := make(map[string]interface{}) |
| 192 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 193 | + datadog.DeleteKeys(additionalProperties, &[]string{"api_key_key", "include", "route_id", "site"}) |
| 194 | + } else { |
| 195 | + return err |
| 196 | + } |
| 197 | + o.ApiKeyKey = all.ApiKeyKey |
| 198 | + o.Include = all.Include |
| 199 | + o.RouteId = all.RouteId |
| 200 | + o.Site = all.Site |
| 201 | + |
| 202 | + if len(additionalProperties) > 0 { |
| 203 | + o.AdditionalProperties = additionalProperties |
| 204 | + } |
| 205 | + |
| 206 | + return nil |
| 207 | +} |
0 commit comments