diff --git a/.apigentools-info b/.apigentools-info index affa9e639f0..4fb0cbd6e17 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.2", - "regenerated": "2022-08-04 14:08:04.711882", - "spec_repo_commit": "43d0c8cf" + "regenerated": "2022-08-04 14:45:29.625822", + "spec_repo_commit": "27b7ba8d" }, "v2": { "apigentools_version": "1.6.2", - "regenerated": "2022-08-04 14:08:04.725381", - "spec_repo_commit": "43d0c8cf" + "regenerated": "2022-08-04 14:45:29.640704", + "spec_repo_commit": "27b7ba8d" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 49d8263a346..7830c028eb0 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -10868,7 +10868,34 @@ components: - $ref: '#/components/schemas/SyntheticsBasicAuthWeb' - $ref: '#/components/schemas/SyntheticsBasicAuthSigv4' - $ref: '#/components/schemas/SyntheticsBasicAuthNTLM' + - $ref: '#/components/schemas/SyntheticsBasicAuthDigest' type: object + SyntheticsBasicAuthDigest: + description: Object to handle digest authentication when performing the test. + properties: + password: + description: Password to use for the digest authentication. + example: PaSSw0RD! + type: string + type: + $ref: '#/components/schemas/SyntheticsBasicAuthDigestType' + username: + description: Username to use for the digest authentication. + example: my_username + type: string + required: + - password + - username + type: object + SyntheticsBasicAuthDigestType: + default: digest + description: The type of basic authentication to use when performing the test. + enum: + - digest + example: digest + type: string + x-enum-varnames: + - DIGEST SyntheticsBasicAuthNTLM: description: Object to handle `NTLM` authentication when performing the test. properties: diff --git a/api/v1/datadog/model_synthetics_basic_auth.go b/api/v1/datadog/model_synthetics_basic_auth.go index 81f266bf02f..f45be6c5a5e 100644 --- a/api/v1/datadog/model_synthetics_basic_auth.go +++ b/api/v1/datadog/model_synthetics_basic_auth.go @@ -10,9 +10,10 @@ import ( // SyntheticsBasicAuth - Object to handle basic authentication when performing the test. type SyntheticsBasicAuth struct { - SyntheticsBasicAuthWeb *SyntheticsBasicAuthWeb - SyntheticsBasicAuthSigv4 *SyntheticsBasicAuthSigv4 - SyntheticsBasicAuthNTLM *SyntheticsBasicAuthNTLM + SyntheticsBasicAuthWeb *SyntheticsBasicAuthWeb + SyntheticsBasicAuthSigv4 *SyntheticsBasicAuthSigv4 + SyntheticsBasicAuthNTLM *SyntheticsBasicAuthNTLM + SyntheticsBasicAuthDigest *SyntheticsBasicAuthDigest // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject interface{} @@ -33,6 +34,11 @@ func SyntheticsBasicAuthNTLMAsSyntheticsBasicAuth(v *SyntheticsBasicAuthNTLM) Sy return SyntheticsBasicAuth{SyntheticsBasicAuthNTLM: v} } +// SyntheticsBasicAuthDigestAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthDigest wrapped in SyntheticsBasicAuth. +func SyntheticsBasicAuthDigestAsSyntheticsBasicAuth(v *SyntheticsBasicAuthDigest) SyntheticsBasicAuth { + return SyntheticsBasicAuth{SyntheticsBasicAuthDigest: v} +} + // UnmarshalJSON turns data into one of the pointers in the struct. func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error { var err error @@ -88,11 +94,29 @@ func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error { obj.SyntheticsBasicAuthNTLM = nil } + // try to unmarshal data into SyntheticsBasicAuthDigest + err = json.Unmarshal(data, &obj.SyntheticsBasicAuthDigest) + if err == nil { + if obj.SyntheticsBasicAuthDigest != nil && obj.SyntheticsBasicAuthDigest.UnparsedObject == nil { + jsonSyntheticsBasicAuthDigest, _ := json.Marshal(obj.SyntheticsBasicAuthDigest) + if string(jsonSyntheticsBasicAuthDigest) == "{}" { // empty struct + obj.SyntheticsBasicAuthDigest = nil + } else { + match++ + } + } else { + obj.SyntheticsBasicAuthDigest = nil + } + } else { + obj.SyntheticsBasicAuthDigest = nil + } + if match != 1 { // more than 1 match // reset to nil obj.SyntheticsBasicAuthWeb = nil obj.SyntheticsBasicAuthSigv4 = nil obj.SyntheticsBasicAuthNTLM = nil + obj.SyntheticsBasicAuthDigest = nil return json.Unmarshal(data, &obj.UnparsedObject) } return nil // exactly one match @@ -112,6 +136,10 @@ func (obj SyntheticsBasicAuth) MarshalJSON() ([]byte, error) { return json.Marshal(&obj.SyntheticsBasicAuthNTLM) } + if obj.SyntheticsBasicAuthDigest != nil { + return json.Marshal(&obj.SyntheticsBasicAuthDigest) + } + if obj.UnparsedObject != nil { return json.Marshal(obj.UnparsedObject) } @@ -132,6 +160,10 @@ func (obj *SyntheticsBasicAuth) GetActualInstance() interface{} { return obj.SyntheticsBasicAuthNTLM } + if obj.SyntheticsBasicAuthDigest != nil { + return obj.SyntheticsBasicAuthDigest + } + // all schemas are nil return nil } diff --git a/api/v1/datadog/model_synthetics_basic_auth_digest.go b/api/v1/datadog/model_synthetics_basic_auth_digest.go new file mode 100644 index 00000000000..3615ee77437 --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_digest.go @@ -0,0 +1,187 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthDigest Object to handle digest authentication when performing the test. +type SyntheticsBasicAuthDigest struct { + // Password to use for the digest authentication. + Password string `json:"password"` + // The type of basic authentication to use when performing the test. + Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` + // Username to use for the digest authentication. + Username string `json:"username"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:-` + AdditionalProperties map[string]interface{} +} + +// NewSyntheticsBasicAuthDigest instantiates a new SyntheticsBasicAuthDigest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSyntheticsBasicAuthDigest(password string, username string) *SyntheticsBasicAuthDigest { + this := SyntheticsBasicAuthDigest{} + this.Password = password + var typeVar SyntheticsBasicAuthDigestType = SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST + this.Type = &typeVar + this.Username = username + return &this +} + +// NewSyntheticsBasicAuthDigestWithDefaults instantiates a new SyntheticsBasicAuthDigest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSyntheticsBasicAuthDigestWithDefaults() *SyntheticsBasicAuthDigest { + this := SyntheticsBasicAuthDigest{} + var typeVar SyntheticsBasicAuthDigestType = SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST + this.Type = &typeVar + return &this +} + +// GetPassword returns the Password field value. +func (o *SyntheticsBasicAuthDigest) GetPassword() string { + if o == nil { + var ret string + return ret + } + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value. +func (o *SyntheticsBasicAuthDigest) SetPassword(v string) { + o.Password = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsBasicAuthDigest) GetType() SyntheticsBasicAuthDigestType { + if o == nil || o.Type == nil { + var ret SyntheticsBasicAuthDigestType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetTypeOk() (*SyntheticsBasicAuthDigestType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsBasicAuthDigest) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsBasicAuthDigestType and assigns it to the Type field. +func (o *SyntheticsBasicAuthDigest) SetType(v SyntheticsBasicAuthDigestType) { + o.Type = &v +} + +// GetUsername returns the Username field value. +func (o *SyntheticsBasicAuthDigest) GetUsername() string { + if o == nil { + var ret string + return ret + } + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBasicAuthDigest) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value. +func (o *SyntheticsBasicAuthDigest) SetUsername(v string) { + o.Username = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyntheticsBasicAuthDigest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + toSerialize["password"] = o.Password + if o.Type != nil { + toSerialize["type"] = o.Type + } + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + required := struct { + Password *string `json:"password"` + Username *string `json:"username"` + }{} + all := struct { + Password string `json:"password"` + Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` + Username string `json:"username"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.Password == nil { + return fmt.Errorf("Required field password missing") + } + if required.Username == nil { + return fmt.Errorf("Required field username missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.Type; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.Password = all.Password + o.Type = all.Type + o.Username = all.Username + return nil +} diff --git a/api/v1/datadog/model_synthetics_basic_auth_digest_type.go b/api/v1/datadog/model_synthetics_basic_auth_digest_type.go new file mode 100644 index 00000000000..f054e3531ad --- /dev/null +++ b/api/v1/datadog/model_synthetics_basic_auth_digest_type.go @@ -0,0 +1,107 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBasicAuthDigestType The type of basic authentication to use when performing the test. +type SyntheticsBasicAuthDigestType string + +// List of SyntheticsBasicAuthDigestType. +const ( + SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST SyntheticsBasicAuthDigestType = "digest" +) + +var allowedSyntheticsBasicAuthDigestTypeEnumValues = []SyntheticsBasicAuthDigestType{ + SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SyntheticsBasicAuthDigestType) GetAllowedValues() []SyntheticsBasicAuthDigestType { + return allowedSyntheticsBasicAuthDigestTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SyntheticsBasicAuthDigestType(value) + return nil +} + +// NewSyntheticsBasicAuthDigestTypeFromValue returns a pointer to a valid SyntheticsBasicAuthDigestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSyntheticsBasicAuthDigestTypeFromValue(v string) (*SyntheticsBasicAuthDigestType, error) { + ev := SyntheticsBasicAuthDigestType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBasicAuthDigestType: valid values are %v", v, allowedSyntheticsBasicAuthDigestTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SyntheticsBasicAuthDigestType) IsValid() bool { + for _, existing := range allowedSyntheticsBasicAuthDigestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBasicAuthDigestType value. +func (v SyntheticsBasicAuthDigestType) Ptr() *SyntheticsBasicAuthDigestType { + return &v +} + +// NullableSyntheticsBasicAuthDigestType handles when a null is used for SyntheticsBasicAuthDigestType. +type NullableSyntheticsBasicAuthDigestType struct { + value *SyntheticsBasicAuthDigestType + isSet bool +} + +// Get returns the associated value. +func (v NullableSyntheticsBasicAuthDigestType) Get() *SyntheticsBasicAuthDigestType { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSyntheticsBasicAuthDigestType) Set(val *SyntheticsBasicAuthDigestType) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSyntheticsBasicAuthDigestType) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSyntheticsBasicAuthDigestType) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSyntheticsBasicAuthDigestType initializes the struct as if Set has been called. +func NewNullableSyntheticsBasicAuthDigestType(val *SyntheticsBasicAuthDigestType) *NullableSyntheticsBasicAuthDigestType { + return &NullableSyntheticsBasicAuthDigestType{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSyntheticsBasicAuthDigestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSyntheticsBasicAuthDigestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}