|
| 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 | +// WebIntegrationAccountCreateRequestAttributes Attributes object for creating a web integration account. |
| 14 | +type WebIntegrationAccountCreateRequestAttributes struct { |
| 15 | + // A human-readable name for the account. Must be unique among accounts of the same integration. |
| 16 | + Name string `json:"name"` |
| 17 | + // Integration-specific secrets. The shape of this object varies by integration. Secrets |
| 18 | + // are write-only and never returned by the API. |
| 19 | + Secrets map[string]interface{} `json:"secrets"` |
| 20 | + // Integration-specific settings. The shape of this object varies by integration. |
| 21 | + Settings map[string]interface{} `json:"settings"` |
| 22 | + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct |
| 23 | + UnparsedObject map[string]interface{} `json:"-"` |
| 24 | + AdditionalProperties map[string]interface{} `json:"-"` |
| 25 | +} |
| 26 | + |
| 27 | +// NewWebIntegrationAccountCreateRequestAttributes instantiates a new WebIntegrationAccountCreateRequestAttributes object. |
| 28 | +// This constructor will assign default values to properties that have it defined, |
| 29 | +// and makes sure properties required by API are set, but the set of arguments |
| 30 | +// will change when the set of required properties is changed. |
| 31 | +func NewWebIntegrationAccountCreateRequestAttributes(name string, secrets map[string]interface{}, settings map[string]interface{}) *WebIntegrationAccountCreateRequestAttributes { |
| 32 | + this := WebIntegrationAccountCreateRequestAttributes{} |
| 33 | + this.Name = name |
| 34 | + this.Secrets = secrets |
| 35 | + this.Settings = settings |
| 36 | + return &this |
| 37 | +} |
| 38 | + |
| 39 | +// NewWebIntegrationAccountCreateRequestAttributesWithDefaults instantiates a new WebIntegrationAccountCreateRequestAttributes object. |
| 40 | +// This constructor will only assign default values to properties that have it defined, |
| 41 | +// but it doesn't guarantee that properties required by API are set. |
| 42 | +func NewWebIntegrationAccountCreateRequestAttributesWithDefaults() *WebIntegrationAccountCreateRequestAttributes { |
| 43 | + this := WebIntegrationAccountCreateRequestAttributes{} |
| 44 | + return &this |
| 45 | +} |
| 46 | + |
| 47 | +// GetName returns the Name field value. |
| 48 | +func (o *WebIntegrationAccountCreateRequestAttributes) GetName() string { |
| 49 | + if o == nil { |
| 50 | + var ret string |
| 51 | + return ret |
| 52 | + } |
| 53 | + return o.Name |
| 54 | +} |
| 55 | + |
| 56 | +// GetNameOk returns a tuple with the Name field value |
| 57 | +// and a boolean to check if the value has been set. |
| 58 | +func (o *WebIntegrationAccountCreateRequestAttributes) GetNameOk() (*string, bool) { |
| 59 | + if o == nil { |
| 60 | + return nil, false |
| 61 | + } |
| 62 | + return &o.Name, true |
| 63 | +} |
| 64 | + |
| 65 | +// SetName sets field value. |
| 66 | +func (o *WebIntegrationAccountCreateRequestAttributes) SetName(v string) { |
| 67 | + o.Name = v |
| 68 | +} |
| 69 | + |
| 70 | +// GetSecrets returns the Secrets field value. |
| 71 | +func (o *WebIntegrationAccountCreateRequestAttributes) GetSecrets() map[string]interface{} { |
| 72 | + if o == nil { |
| 73 | + var ret map[string]interface{} |
| 74 | + return ret |
| 75 | + } |
| 76 | + return o.Secrets |
| 77 | +} |
| 78 | + |
| 79 | +// GetSecretsOk returns a tuple with the Secrets field value |
| 80 | +// and a boolean to check if the value has been set. |
| 81 | +func (o *WebIntegrationAccountCreateRequestAttributes) GetSecretsOk() (*map[string]interface{}, bool) { |
| 82 | + if o == nil { |
| 83 | + return nil, false |
| 84 | + } |
| 85 | + return &o.Secrets, true |
| 86 | +} |
| 87 | + |
| 88 | +// SetSecrets sets field value. |
| 89 | +func (o *WebIntegrationAccountCreateRequestAttributes) SetSecrets(v map[string]interface{}) { |
| 90 | + o.Secrets = v |
| 91 | +} |
| 92 | + |
| 93 | +// GetSettings returns the Settings field value. |
| 94 | +func (o *WebIntegrationAccountCreateRequestAttributes) GetSettings() map[string]interface{} { |
| 95 | + if o == nil { |
| 96 | + var ret map[string]interface{} |
| 97 | + return ret |
| 98 | + } |
| 99 | + return o.Settings |
| 100 | +} |
| 101 | + |
| 102 | +// GetSettingsOk returns a tuple with the Settings field value |
| 103 | +// and a boolean to check if the value has been set. |
| 104 | +func (o *WebIntegrationAccountCreateRequestAttributes) GetSettingsOk() (*map[string]interface{}, bool) { |
| 105 | + if o == nil { |
| 106 | + return nil, false |
| 107 | + } |
| 108 | + return &o.Settings, true |
| 109 | +} |
| 110 | + |
| 111 | +// SetSettings sets field value. |
| 112 | +func (o *WebIntegrationAccountCreateRequestAttributes) SetSettings(v map[string]interface{}) { |
| 113 | + o.Settings = v |
| 114 | +} |
| 115 | + |
| 116 | +// MarshalJSON serializes the struct using spec logic. |
| 117 | +func (o WebIntegrationAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) { |
| 118 | + toSerialize := map[string]interface{}{} |
| 119 | + if o.UnparsedObject != nil { |
| 120 | + return datadog.Marshal(o.UnparsedObject) |
| 121 | + } |
| 122 | + toSerialize["name"] = o.Name |
| 123 | + toSerialize["secrets"] = o.Secrets |
| 124 | + toSerialize["settings"] = o.Settings |
| 125 | + |
| 126 | + for key, value := range o.AdditionalProperties { |
| 127 | + toSerialize[key] = value |
| 128 | + } |
| 129 | + return datadog.Marshal(toSerialize) |
| 130 | +} |
| 131 | + |
| 132 | +// UnmarshalJSON deserializes the given payload. |
| 133 | +func (o *WebIntegrationAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { |
| 134 | + all := struct { |
| 135 | + Name *string `json:"name"` |
| 136 | + Secrets *map[string]interface{} `json:"secrets"` |
| 137 | + Settings *map[string]interface{} `json:"settings"` |
| 138 | + }{} |
| 139 | + if err = datadog.Unmarshal(bytes, &all); err != nil { |
| 140 | + return datadog.Unmarshal(bytes, &o.UnparsedObject) |
| 141 | + } |
| 142 | + if all.Name == nil { |
| 143 | + return fmt.Errorf("required field name missing") |
| 144 | + } |
| 145 | + if all.Secrets == nil { |
| 146 | + return fmt.Errorf("required field secrets missing") |
| 147 | + } |
| 148 | + if all.Settings == nil { |
| 149 | + return fmt.Errorf("required field settings missing") |
| 150 | + } |
| 151 | + additionalProperties := make(map[string]interface{}) |
| 152 | + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { |
| 153 | + datadog.DeleteKeys(additionalProperties, &[]string{"name", "secrets", "settings"}) |
| 154 | + } else { |
| 155 | + return err |
| 156 | + } |
| 157 | + o.Name = *all.Name |
| 158 | + o.Secrets = *all.Secrets |
| 159 | + o.Settings = *all.Settings |
| 160 | + |
| 161 | + if len(additionalProperties) > 0 { |
| 162 | + o.AdditionalProperties = additionalProperties |
| 163 | + } |
| 164 | + |
| 165 | + return nil |
| 166 | +} |
0 commit comments