/* CDN API API used to create and manage your CDN distributions. API version: 1beta2.0.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package cdnbeta import ( "encoding/json" "fmt" ) // checks if the ErrorDetails type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ErrorDetails{} /* types and functions for de */ // isNotNullableString type ErrorDetailsGetDeAttributeType = *string func getErrorDetailsGetDeAttributeTypeOk(arg ErrorDetailsGetDeAttributeType) (ret ErrorDetailsGetDeRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setErrorDetailsGetDeAttributeType(arg *ErrorDetailsGetDeAttributeType, val ErrorDetailsGetDeRetType) { *arg = &val } type ErrorDetailsGetDeArgType = string type ErrorDetailsGetDeRetType = string /* types and functions for en */ // isNotNullableString type ErrorDetailsGetEnAttributeType = *string func getErrorDetailsGetEnAttributeTypeOk(arg ErrorDetailsGetEnAttributeType) (ret ErrorDetailsGetEnRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setErrorDetailsGetEnAttributeType(arg *ErrorDetailsGetEnAttributeType, val ErrorDetailsGetEnRetType) { *arg = &val } type ErrorDetailsGetEnArgType = string type ErrorDetailsGetEnRetType = string /* types and functions for field */ // isNotNullableString type ErrorDetailsGetFieldAttributeType = *string func getErrorDetailsGetFieldAttributeTypeOk(arg ErrorDetailsGetFieldAttributeType) (ret ErrorDetailsGetFieldRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setErrorDetailsGetFieldAttributeType(arg *ErrorDetailsGetFieldAttributeType, val ErrorDetailsGetFieldRetType) { *arg = &val } type ErrorDetailsGetFieldArgType = string type ErrorDetailsGetFieldRetType = string /* types and functions for key */ // isEnum // ErrorDetailsKey the model 'ErrorDetails' // value type for enums type ErrorDetailsKey string // List of Key const ( ERRORDETAILSKEY_UNKNOWN ErrorDetailsKey = "UNKNOWN" ERRORDETAILSKEY_CUSTOM_DOMAIN_CNAME_MISSING ErrorDetailsKey = "CUSTOM_DOMAIN_CNAME_MISSING" ERRORDETAILSKEY_INVALID_ARGUMENT ErrorDetailsKey = "INVALID_ARGUMENT" ) // All allowed values of ErrorDetails enum var AllowedErrorDetailsKeyEnumValues = []ErrorDetailsKey{ "UNKNOWN", "CUSTOM_DOMAIN_CNAME_MISSING", "INVALID_ARGUMENT", } func (v *ErrorDetailsKey) UnmarshalJSON(src []byte) error { // use a type alias to prevent infinite recursion during unmarshal, // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers type TmpJson ErrorDetailsKey var value TmpJson err := json.Unmarshal(src, &value) if err != nil { return err } // Allow unmarshalling zero value for testing purposes var zeroValue TmpJson if value == zeroValue { return nil } enumTypeValue := ErrorDetailsKey(value) for _, existing := range AllowedErrorDetailsKeyEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil } } return fmt.Errorf("%+v is not a valid ErrorDetails", value) } // NewErrorDetailsKeyFromValue returns a pointer to a valid ErrorDetailsKey // for the value passed as argument, or an error if the value passed is not allowed by the enum func NewErrorDetailsKeyFromValue(v ErrorDetailsKey) (*ErrorDetailsKey, error) { ev := ErrorDetailsKey(v) if ev.IsValid() { return &ev, nil } else { return nil, fmt.Errorf("invalid value '%v' for ErrorDetailsKey: valid values are %v", v, AllowedErrorDetailsKeyEnumValues) } } // IsValid return true if the value is valid for the enum, false otherwise func (v ErrorDetailsKey) IsValid() bool { for _, existing := range AllowedErrorDetailsKeyEnumValues { if existing == v { return true } } return false } // Ptr returns reference to KeyKey value func (v ErrorDetailsKey) Ptr() *ErrorDetailsKey { return &v } type NullableErrorDetailsKey struct { value *ErrorDetailsKey isSet bool } func (v NullableErrorDetailsKey) Get() *ErrorDetailsKey { return v.value } func (v *NullableErrorDetailsKey) Set(val *ErrorDetailsKey) { v.value = val v.isSet = true } func (v NullableErrorDetailsKey) IsSet() bool { return v.isSet } func (v *NullableErrorDetailsKey) Unset() { v.value = nil v.isSet = false } func NewNullableErrorDetailsKey(val *ErrorDetailsKey) *NullableErrorDetailsKey { return &NullableErrorDetailsKey{value: val, isSet: true} } func (v NullableErrorDetailsKey) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableErrorDetailsKey) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } type ErrorDetailsGetKeyAttributeType = *ErrorDetailsKey type ErrorDetailsGetKeyArgType = ErrorDetailsKey type ErrorDetailsGetKeyRetType = ErrorDetailsKey func getErrorDetailsGetKeyAttributeTypeOk(arg ErrorDetailsGetKeyAttributeType) (ret ErrorDetailsGetKeyRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setErrorDetailsGetKeyAttributeType(arg *ErrorDetailsGetKeyAttributeType, val ErrorDetailsGetKeyRetType) { *arg = &val } // ErrorDetails struct for ErrorDetails type ErrorDetails struct { // German description of the error De ErrorDetailsGetDeAttributeType `json:"de,omitempty"` // English description of the error // REQUIRED En ErrorDetailsGetEnAttributeType `json:"en" required:"true"` // Optional field in the request this error detail refers to Field ErrorDetailsGetFieldAttributeType `json:"field,omitempty"` // REQUIRED Key ErrorDetailsGetKeyAttributeType `json:"key" required:"true"` } type _ErrorDetails ErrorDetails // NewErrorDetails instantiates a new ErrorDetails 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 NewErrorDetails(en ErrorDetailsGetEnArgType, key ErrorDetailsGetKeyArgType) *ErrorDetails { this := ErrorDetails{} setErrorDetailsGetEnAttributeType(&this.En, en) setErrorDetailsGetKeyAttributeType(&this.Key, key) return &this } // NewErrorDetailsWithDefaults instantiates a new ErrorDetails 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 NewErrorDetailsWithDefaults() *ErrorDetails { this := ErrorDetails{} return &this } // GetDe returns the De field value if set, zero value otherwise. func (o *ErrorDetails) GetDe() (res ErrorDetailsGetDeRetType) { res, _ = o.GetDeOk() return } // GetDeOk returns a tuple with the De field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorDetails) GetDeOk() (ret ErrorDetailsGetDeRetType, ok bool) { return getErrorDetailsGetDeAttributeTypeOk(o.De) } // HasDe returns a boolean if a field has been set. func (o *ErrorDetails) HasDe() bool { _, ok := o.GetDeOk() return ok } // SetDe gets a reference to the given string and assigns it to the De field. func (o *ErrorDetails) SetDe(v ErrorDetailsGetDeRetType) { setErrorDetailsGetDeAttributeType(&o.De, v) } // GetEn returns the En field value func (o *ErrorDetails) GetEn() (ret ErrorDetailsGetEnRetType) { ret, _ = o.GetEnOk() return ret } // GetEnOk returns a tuple with the En field value // and a boolean to check if the value has been set. func (o *ErrorDetails) GetEnOk() (ret ErrorDetailsGetEnRetType, ok bool) { return getErrorDetailsGetEnAttributeTypeOk(o.En) } // SetEn sets field value func (o *ErrorDetails) SetEn(v ErrorDetailsGetEnRetType) { setErrorDetailsGetEnAttributeType(&o.En, v) } // GetField returns the Field field value if set, zero value otherwise. func (o *ErrorDetails) GetField() (res ErrorDetailsGetFieldRetType) { res, _ = o.GetFieldOk() return } // GetFieldOk returns a tuple with the Field field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ErrorDetails) GetFieldOk() (ret ErrorDetailsGetFieldRetType, ok bool) { return getErrorDetailsGetFieldAttributeTypeOk(o.Field) } // HasField returns a boolean if a field has been set. func (o *ErrorDetails) HasField() bool { _, ok := o.GetFieldOk() return ok } // SetField gets a reference to the given string and assigns it to the Field field. func (o *ErrorDetails) SetField(v ErrorDetailsGetFieldRetType) { setErrorDetailsGetFieldAttributeType(&o.Field, v) } // GetKey returns the Key field value func (o *ErrorDetails) GetKey() (ret ErrorDetailsGetKeyRetType) { ret, _ = o.GetKeyOk() return ret } // GetKeyOk returns a tuple with the Key field value // and a boolean to check if the value has been set. func (o *ErrorDetails) GetKeyOk() (ret ErrorDetailsGetKeyRetType, ok bool) { return getErrorDetailsGetKeyAttributeTypeOk(o.Key) } // SetKey sets field value func (o *ErrorDetails) SetKey(v ErrorDetailsGetKeyRetType) { setErrorDetailsGetKeyAttributeType(&o.Key, v) } func (o ErrorDetails) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getErrorDetailsGetDeAttributeTypeOk(o.De); ok { toSerialize["De"] = val } if val, ok := getErrorDetailsGetEnAttributeTypeOk(o.En); ok { toSerialize["En"] = val } if val, ok := getErrorDetailsGetFieldAttributeTypeOk(o.Field); ok { toSerialize["Field"] = val } if val, ok := getErrorDetailsGetKeyAttributeTypeOk(o.Key); ok { toSerialize["Key"] = val } return toSerialize, nil } type NullableErrorDetails struct { value *ErrorDetails isSet bool } func (v NullableErrorDetails) Get() *ErrorDetails { return v.value } func (v *NullableErrorDetails) Set(val *ErrorDetails) { v.value = val v.isSet = true } func (v NullableErrorDetails) IsSet() bool { return v.isSet } func (v *NullableErrorDetails) Unset() { v.value = nil v.isSet = false } func NewNullableErrorDetails(val *ErrorDetails) *NullableErrorDetails { return &NullableErrorDetails{value: val, isSet: true} } func (v NullableErrorDetails) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableErrorDetails) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }