feat: generating code
This commit is contained in:
parent
c329d58970
commit
51663cd8d0
1221 changed files with 271709 additions and 2444 deletions
329
pkg/cdnbeta/model_status_error.go
Normal file
329
pkg/cdnbeta/model_status_error.go
Normal file
|
|
@ -0,0 +1,329 @@
|
|||
/*
|
||||
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 StatusError type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &StatusError{}
|
||||
|
||||
/*
|
||||
types and functions for de
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type StatusErrorGetDeAttributeType = *string
|
||||
|
||||
func getStatusErrorGetDeAttributeTypeOk(arg StatusErrorGetDeAttributeType) (ret StatusErrorGetDeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setStatusErrorGetDeAttributeType(arg *StatusErrorGetDeAttributeType, val StatusErrorGetDeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type StatusErrorGetDeArgType = string
|
||||
type StatusErrorGetDeRetType = string
|
||||
|
||||
/*
|
||||
types and functions for en
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type StatusErrorGetEnAttributeType = *string
|
||||
|
||||
func getStatusErrorGetEnAttributeTypeOk(arg StatusErrorGetEnAttributeType) (ret StatusErrorGetEnRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setStatusErrorGetEnAttributeType(arg *StatusErrorGetEnAttributeType, val StatusErrorGetEnRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type StatusErrorGetEnArgType = string
|
||||
type StatusErrorGetEnRetType = string
|
||||
|
||||
/*
|
||||
types and functions for key
|
||||
*/
|
||||
|
||||
// isEnum
|
||||
|
||||
// StatusErrorKey An enum value that describes a Status Error.
|
||||
// value type for enums
|
||||
type StatusErrorKey string
|
||||
|
||||
// List of Key
|
||||
const (
|
||||
STATUSERRORKEY_UNKNOWN StatusErrorKey = "UNKNOWN"
|
||||
STATUSERRORKEY_CUSTOM_DOMAIN_CNAME_MISSING StatusErrorKey = "CUSTOM_DOMAIN_CNAME_MISSING"
|
||||
STATUSERRORKEY_CUSTOM_DOMAIN_ALREADY_IN_USE StatusErrorKey = "CUSTOM_DOMAIN_ALREADY_IN_USE"
|
||||
STATUSERRORKEY_PUBLIC_BETA_QUOTA_REACHED StatusErrorKey = "PUBLIC_BETA_QUOTA_REACHED"
|
||||
)
|
||||
|
||||
// All allowed values of StatusError enum
|
||||
var AllowedStatusErrorKeyEnumValues = []StatusErrorKey{
|
||||
"UNKNOWN",
|
||||
"CUSTOM_DOMAIN_CNAME_MISSING",
|
||||
"CUSTOM_DOMAIN_ALREADY_IN_USE",
|
||||
"PUBLIC_BETA_QUOTA_REACHED",
|
||||
}
|
||||
|
||||
func (v *StatusErrorKey) 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 StatusErrorKey
|
||||
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 := StatusErrorKey(value)
|
||||
for _, existing := range AllowedStatusErrorKeyEnumValues {
|
||||
if existing == enumTypeValue {
|
||||
*v = enumTypeValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid StatusError", value)
|
||||
}
|
||||
|
||||
// NewStatusErrorKeyFromValue returns a pointer to a valid StatusErrorKey
|
||||
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
||||
func NewStatusErrorKeyFromValue(v StatusErrorKey) (*StatusErrorKey, error) {
|
||||
ev := StatusErrorKey(v)
|
||||
if ev.IsValid() {
|
||||
return &ev, nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("invalid value '%v' for StatusErrorKey: valid values are %v", v, AllowedStatusErrorKeyEnumValues)
|
||||
}
|
||||
}
|
||||
|
||||
// IsValid return true if the value is valid for the enum, false otherwise
|
||||
func (v StatusErrorKey) IsValid() bool {
|
||||
for _, existing := range AllowedStatusErrorKeyEnumValues {
|
||||
if existing == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Ptr returns reference to KeyKey value
|
||||
func (v StatusErrorKey) Ptr() *StatusErrorKey {
|
||||
return &v
|
||||
}
|
||||
|
||||
type NullableStatusErrorKey struct {
|
||||
value *StatusErrorKey
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableStatusErrorKey) Get() *StatusErrorKey {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableStatusErrorKey) Set(val *StatusErrorKey) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableStatusErrorKey) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableStatusErrorKey) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableStatusErrorKey(val *StatusErrorKey) *NullableStatusErrorKey {
|
||||
return &NullableStatusErrorKey{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableStatusErrorKey) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableStatusErrorKey) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
type StatusErrorGetKeyAttributeType = *StatusErrorKey
|
||||
type StatusErrorGetKeyArgType = StatusErrorKey
|
||||
type StatusErrorGetKeyRetType = StatusErrorKey
|
||||
|
||||
func getStatusErrorGetKeyAttributeTypeOk(arg StatusErrorGetKeyAttributeType) (ret StatusErrorGetKeyRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setStatusErrorGetKeyAttributeType(arg *StatusErrorGetKeyAttributeType, val StatusErrorGetKeyRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// StatusError struct for StatusError
|
||||
type StatusError struct {
|
||||
// A german translation string corresponding to the error key. Note that we do not guarantee german translations are present.
|
||||
De StatusErrorGetDeAttributeType `json:"de,omitempty"`
|
||||
// An english translation string corresponding to the error key. An english translation key is always present.
|
||||
// REQUIRED
|
||||
En StatusErrorGetEnAttributeType `json:"en" required:"true"`
|
||||
// An enum value that describes a Status Error.
|
||||
// REQUIRED
|
||||
Key StatusErrorGetKeyAttributeType `json:"key" required:"true"`
|
||||
}
|
||||
|
||||
type _StatusError StatusError
|
||||
|
||||
// NewStatusError instantiates a new StatusError 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 NewStatusError(en StatusErrorGetEnArgType, key StatusErrorGetKeyArgType) *StatusError {
|
||||
this := StatusError{}
|
||||
setStatusErrorGetEnAttributeType(&this.En, en)
|
||||
setStatusErrorGetKeyAttributeType(&this.Key, key)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewStatusErrorWithDefaults instantiates a new StatusError 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 NewStatusErrorWithDefaults() *StatusError {
|
||||
this := StatusError{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetDe returns the De field value if set, zero value otherwise.
|
||||
func (o *StatusError) GetDe() (res StatusErrorGetDeRetType) {
|
||||
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 *StatusError) GetDeOk() (ret StatusErrorGetDeRetType, ok bool) {
|
||||
return getStatusErrorGetDeAttributeTypeOk(o.De)
|
||||
}
|
||||
|
||||
// HasDe returns a boolean if a field has been set.
|
||||
func (o *StatusError) HasDe() bool {
|
||||
_, ok := o.GetDeOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDe gets a reference to the given string and assigns it to the De field.
|
||||
func (o *StatusError) SetDe(v StatusErrorGetDeRetType) {
|
||||
setStatusErrorGetDeAttributeType(&o.De, v)
|
||||
}
|
||||
|
||||
// GetEn returns the En field value
|
||||
func (o *StatusError) GetEn() (ret StatusErrorGetEnRetType) {
|
||||
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 *StatusError) GetEnOk() (ret StatusErrorGetEnRetType, ok bool) {
|
||||
return getStatusErrorGetEnAttributeTypeOk(o.En)
|
||||
}
|
||||
|
||||
// SetEn sets field value
|
||||
func (o *StatusError) SetEn(v StatusErrorGetEnRetType) {
|
||||
setStatusErrorGetEnAttributeType(&o.En, v)
|
||||
}
|
||||
|
||||
// GetKey returns the Key field value
|
||||
func (o *StatusError) GetKey() (ret StatusErrorGetKeyRetType) {
|
||||
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 *StatusError) GetKeyOk() (ret StatusErrorGetKeyRetType, ok bool) {
|
||||
return getStatusErrorGetKeyAttributeTypeOk(o.Key)
|
||||
}
|
||||
|
||||
// SetKey sets field value
|
||||
func (o *StatusError) SetKey(v StatusErrorGetKeyRetType) {
|
||||
setStatusErrorGetKeyAttributeType(&o.Key, v)
|
||||
}
|
||||
|
||||
func (o StatusError) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getStatusErrorGetDeAttributeTypeOk(o.De); ok {
|
||||
toSerialize["De"] = val
|
||||
}
|
||||
if val, ok := getStatusErrorGetEnAttributeTypeOk(o.En); ok {
|
||||
toSerialize["En"] = val
|
||||
}
|
||||
if val, ok := getStatusErrorGetKeyAttributeTypeOk(o.Key); ok {
|
||||
toSerialize["Key"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableStatusError struct {
|
||||
value *StatusError
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableStatusError) Get() *StatusError {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableStatusError) Set(val *StatusError) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableStatusError) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableStatusError) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableStatusError(val *StatusError) *NullableStatusError {
|
||||
return &NullableStatusError{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableStatusError) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableStatusError) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue