367 lines
9.5 KiB
Go
367 lines
9.5 KiB
Go
/*
|
|
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 Domain type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &Domain{}
|
|
|
|
/*
|
|
types and functions for errors
|
|
*/
|
|
|
|
// isArray
|
|
type DomainGetErrorsAttributeType = *[]StatusError
|
|
type DomainGetErrorsArgType = []StatusError
|
|
type DomainGetErrorsRetType = []StatusError
|
|
|
|
func getDomainGetErrorsAttributeTypeOk(arg DomainGetErrorsAttributeType) (ret DomainGetErrorsRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setDomainGetErrorsAttributeType(arg *DomainGetErrorsAttributeType, val DomainGetErrorsRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for name
|
|
*/
|
|
|
|
// isNotNullableString
|
|
type DomainGetNameAttributeType = *string
|
|
|
|
func getDomainGetNameAttributeTypeOk(arg DomainGetNameAttributeType) (ret DomainGetNameRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setDomainGetNameAttributeType(arg *DomainGetNameAttributeType, val DomainGetNameRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
type DomainGetNameArgType = string
|
|
type DomainGetNameRetType = string
|
|
|
|
/*
|
|
types and functions for status
|
|
*/
|
|
|
|
// isEnumRef
|
|
type DomainGetStatusAttributeType = *DomainStatus
|
|
type DomainGetStatusArgType = DomainStatus
|
|
type DomainGetStatusRetType = DomainStatus
|
|
|
|
func getDomainGetStatusAttributeTypeOk(arg DomainGetStatusAttributeType) (ret DomainGetStatusRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setDomainGetStatusAttributeType(arg *DomainGetStatusAttributeType, val DomainGetStatusRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for type
|
|
*/
|
|
|
|
// isEnum
|
|
|
|
// DomainTypes Specifies the type of this Domain. Custom Domain can be further queries using the GetCustomDomain Endpoint
|
|
// value type for enums
|
|
type DomainTypes string
|
|
|
|
// List of Type
|
|
const (
|
|
DOMAINTYPE_MANAGED DomainTypes = "managed"
|
|
DOMAINTYPE_CUSTOM DomainTypes = "custom"
|
|
)
|
|
|
|
// All allowed values of Domain enum
|
|
var AllowedDomainTypesEnumValues = []DomainTypes{
|
|
"managed",
|
|
"custom",
|
|
}
|
|
|
|
func (v *DomainTypes) 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 DomainTypes
|
|
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 := DomainTypes(value)
|
|
for _, existing := range AllowedDomainTypesEnumValues {
|
|
if existing == enumTypeValue {
|
|
*v = enumTypeValue
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return fmt.Errorf("%+v is not a valid Domain", value)
|
|
}
|
|
|
|
// NewDomainTypesFromValue returns a pointer to a valid DomainTypes
|
|
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
|
func NewDomainTypesFromValue(v DomainTypes) (*DomainTypes, error) {
|
|
ev := DomainTypes(v)
|
|
if ev.IsValid() {
|
|
return &ev, nil
|
|
} else {
|
|
return nil, fmt.Errorf("invalid value '%v' for DomainTypes: valid values are %v", v, AllowedDomainTypesEnumValues)
|
|
}
|
|
}
|
|
|
|
// IsValid return true if the value is valid for the enum, false otherwise
|
|
func (v DomainTypes) IsValid() bool {
|
|
for _, existing := range AllowedDomainTypesEnumValues {
|
|
if existing == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Ptr returns reference to TypeTypes value
|
|
func (v DomainTypes) Ptr() *DomainTypes {
|
|
return &v
|
|
}
|
|
|
|
type NullableDomainTypes struct {
|
|
value *DomainTypes
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableDomainTypes) Get() *DomainTypes {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableDomainTypes) Set(val *DomainTypes) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableDomainTypes) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableDomainTypes) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableDomainTypes(val *DomainTypes) *NullableDomainTypes {
|
|
return &NullableDomainTypes{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableDomainTypes) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableDomainTypes) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
type DomainGetTypeAttributeType = *DomainTypes
|
|
type DomainGetTypeArgType = DomainTypes
|
|
type DomainGetTypeRetType = DomainTypes
|
|
|
|
func getDomainGetTypeAttributeTypeOk(arg DomainGetTypeAttributeType) (ret DomainGetTypeRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setDomainGetTypeAttributeType(arg *DomainGetTypeAttributeType, val DomainGetTypeRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
// Domain Definition of a custom or managed domain without any certificates or keys
|
|
type Domain struct {
|
|
// This object is present if the custom domain has errors.
|
|
Errors DomainGetErrorsAttributeType `json:"errors,omitempty"`
|
|
// The domain. If this is a custom domain, you can call the GetCustomDomain Endpoint
|
|
// REQUIRED
|
|
Name DomainGetNameAttributeType `json:"name" required:"true"`
|
|
// REQUIRED
|
|
Status DomainGetStatusAttributeType `json:"status" required:"true"`
|
|
// Specifies the type of this Domain. Custom Domain can be further queries using the GetCustomDomain Endpoint
|
|
// REQUIRED
|
|
Type DomainGetTypeAttributeType `json:"type" required:"true"`
|
|
}
|
|
|
|
type _Domain Domain
|
|
|
|
// NewDomain instantiates a new Domain 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 NewDomain(name DomainGetNameArgType, status DomainGetStatusArgType, types DomainGetTypeArgType) *Domain {
|
|
this := Domain{}
|
|
setDomainGetNameAttributeType(&this.Name, name)
|
|
setDomainGetStatusAttributeType(&this.Status, status)
|
|
setDomainGetTypeAttributeType(&this.Type, types)
|
|
return &this
|
|
}
|
|
|
|
// NewDomainWithDefaults instantiates a new Domain 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 NewDomainWithDefaults() *Domain {
|
|
this := Domain{}
|
|
return &this
|
|
}
|
|
|
|
// GetErrors returns the Errors field value if set, zero value otherwise.
|
|
func (o *Domain) GetErrors() (res DomainGetErrorsRetType) {
|
|
res, _ = o.GetErrorsOk()
|
|
return
|
|
}
|
|
|
|
// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Domain) GetErrorsOk() (ret DomainGetErrorsRetType, ok bool) {
|
|
return getDomainGetErrorsAttributeTypeOk(o.Errors)
|
|
}
|
|
|
|
// HasErrors returns a boolean if a field has been set.
|
|
func (o *Domain) HasErrors() bool {
|
|
_, ok := o.GetErrorsOk()
|
|
return ok
|
|
}
|
|
|
|
// SetErrors gets a reference to the given []StatusError and assigns it to the Errors field.
|
|
func (o *Domain) SetErrors(v DomainGetErrorsRetType) {
|
|
setDomainGetErrorsAttributeType(&o.Errors, v)
|
|
}
|
|
|
|
// GetName returns the Name field value
|
|
func (o *Domain) GetName() (ret DomainGetNameRetType) {
|
|
ret, _ = o.GetNameOk()
|
|
return ret
|
|
}
|
|
|
|
// GetNameOk returns a tuple with the Name field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Domain) GetNameOk() (ret DomainGetNameRetType, ok bool) {
|
|
return getDomainGetNameAttributeTypeOk(o.Name)
|
|
}
|
|
|
|
// SetName sets field value
|
|
func (o *Domain) SetName(v DomainGetNameRetType) {
|
|
setDomainGetNameAttributeType(&o.Name, v)
|
|
}
|
|
|
|
// GetStatus returns the Status field value
|
|
func (o *Domain) GetStatus() (ret DomainGetStatusRetType) {
|
|
ret, _ = o.GetStatusOk()
|
|
return ret
|
|
}
|
|
|
|
// GetStatusOk returns a tuple with the Status field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Domain) GetStatusOk() (ret DomainGetStatusRetType, ok bool) {
|
|
return getDomainGetStatusAttributeTypeOk(o.Status)
|
|
}
|
|
|
|
// SetStatus sets field value
|
|
func (o *Domain) SetStatus(v DomainGetStatusRetType) {
|
|
setDomainGetStatusAttributeType(&o.Status, v)
|
|
}
|
|
|
|
// GetType returns the Type field value
|
|
func (o *Domain) GetType() (ret DomainGetTypeRetType) {
|
|
ret, _ = o.GetTypeOk()
|
|
return ret
|
|
}
|
|
|
|
// GetTypeOk returns a tuple with the Type field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Domain) GetTypeOk() (ret DomainGetTypeRetType, ok bool) {
|
|
return getDomainGetTypeAttributeTypeOk(o.Type)
|
|
}
|
|
|
|
// SetType sets field value
|
|
func (o *Domain) SetType(v DomainGetTypeRetType) {
|
|
setDomainGetTypeAttributeType(&o.Type, v)
|
|
}
|
|
|
|
func (o Domain) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if val, ok := getDomainGetErrorsAttributeTypeOk(o.Errors); ok {
|
|
toSerialize["Errors"] = val
|
|
}
|
|
if val, ok := getDomainGetNameAttributeTypeOk(o.Name); ok {
|
|
toSerialize["Name"] = val
|
|
}
|
|
if val, ok := getDomainGetStatusAttributeTypeOk(o.Status); ok {
|
|
toSerialize["Status"] = val
|
|
}
|
|
if val, ok := getDomainGetTypeAttributeTypeOk(o.Type); ok {
|
|
toSerialize["Type"] = val
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
type NullableDomain struct {
|
|
value *Domain
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableDomain) Get() *Domain {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableDomain) Set(val *Domain) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableDomain) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableDomain) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableDomain(val *Domain) *NullableDomain {
|
|
return &NullableDomain{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableDomain) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableDomain) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|