|
| 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 | + "fmt" |
| 9 | + |
| 10 | + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" |
| 11 | +) |
| 12 | + |
| 13 | +// ObservabilityPipelineEnrichmentTableFieldSecretLookup Looks up a value stored as a pipeline secret. |
| 14 | +type ObservabilityPipelineEnrichmentTableFieldSecretLookup struct { |
| 15 | + // The name of the secret containing the lookup key value. |
| 16 | + Secret string `json:"secret"` |
| 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 | +// NewObservabilityPipelineEnrichmentTableFieldSecretLookup instantiates a new ObservabilityPipelineEnrichmentTableFieldSecretLookup 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 NewObservabilityPipelineEnrichmentTableFieldSecretLookup(secret string) *ObservabilityPipelineEnrichmentTableFieldSecretLookup { |
| 27 | + this := ObservabilityPipelineEnrichmentTableFieldSecretLookup{} |
| 28 | + this.Secret = secret |
| 29 | + return &this |
| 30 | +} |
| 31 | + |
| 32 | +// NewObservabilityPipelineEnrichmentTableFieldSecretLookupWithDefaults instantiates a new ObservabilityPipelineEnrichmentTableFieldSecretLookup object. |
| 33 | +// This constructor will only assign default values to properties that have it defined, |
| 34 | +// but it doesn't guarantee that properties required by API are set. |
| 35 | +func NewObservabilityPipelineEnrichmentTableFieldSecretLookupWithDefaults() *ObservabilityPipelineEnrichmentTableFieldSecretLookup { |
| 36 | + this := ObservabilityPipelineEnrichmentTableFieldSecretLookup{} |
| 37 | + return &this |
| 38 | +} |
| 39 | + |
| 40 | +// GetSecret returns the Secret field value. |
| 41 | +func (o *ObservabilityPipelineEnrichmentTableFieldSecretLookup) GetSecret() string { |
| 42 | + if o == nil { |
| 43 | + var ret string |
| 44 | + return ret |
| 45 | + } |
| 46 | + return o.Secret |
| 47 | +} |
| 48 | + |
| 49 | +// GetSecretOk returns a tuple with the Secret field value |
| 50 | +// and a boolean to check if the value has been set. |
| 51 | +func (o *ObservabilityPipelineEnrichmentTableFieldSecretLookup) GetSecretOk() (*string, bool) { |
| 52 | + if o == nil { |
| 53 | + return nil, false |
| 54 | + } |
| 55 | + return &o.Secret, true |
| 56 | +} |
| 57 | + |
| 58 | +// SetSecret sets field value. |
| 59 | +func (o *ObservabilityPipelineEnrichmentTableFieldSecretLookup) SetSecret(v string) { |
| 60 | + o.Secret = v |
| 61 | +} |
| 62 | + |
| 63 | +// MarshalJSON serializes the struct using spec logic. |
| 64 | +func (o ObservabilityPipelineEnrichmentTableFieldSecretLookup) MarshalJSON() ([]byte, error) { |
| 65 | + toSerialize := map[string]interface{}{} |
| 66 | + if o.UnparsedObject != nil { |
| 67 | + return datadog.Marshal(o.UnparsedObject) |
| 68 | + } |
| 69 | + toSerialize["secret"] = o.Secret |
| 70 | + |
| 71 | + for key, value := range o.AdditionalProperties { |
| 72 | + toSerialize[key] = value |
| 73 | + } |
| 74 | + return datadog.Marshal(toSerialize) |
| 75 | +} |
| 76 | + |
| 77 | +// UnmarshalJSON deserializes the given payload. |
| 78 | +func (o *ObservabilityPipelineEnrichmentTableFieldSecretLookup) UnmarshalJSON(bytes []byte) (err error) { |
| 79 | + all := struct { |
| 80 | + Secret *string `json:"secret"` |
| 81 | + }{} |
| 82 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 83 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 84 | + } |
| 85 | + if all.Secret == nil { |
| 86 | + return fmt.Errorf("required field secret missing") |
| 87 | + } |
| 88 | + additionalProperties := make(map[string]interface{}) |
| 89 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 90 | + datadog.DeleteKeys(additionalProperties, &[]string{"secret"}) |
| 91 | + } else { |
| 92 | + return err |
| 93 | + } |
| 94 | + o.Secret = *all.Secret |
| 95 | + |
| 96 | + if len(additionalProperties) > 0 { |
| 97 | + o.AdditionalProperties = additionalProperties |
| 98 | + } |
| 99 | + |
| 100 | + return nil |
| 101 | +} |
0 commit comments