516 lines
16 KiB
Go
516 lines
16 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"
|
|
)
|
|
|
|
// checks if the Config type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &Config{}
|
|
|
|
/*
|
|
types and functions for backend
|
|
*/
|
|
|
|
// isModel
|
|
type ConfigGetBackendAttributeType = *ConfigBackend
|
|
type ConfigGetBackendArgType = ConfigBackend
|
|
type ConfigGetBackendRetType = ConfigBackend
|
|
|
|
func getConfigGetBackendAttributeTypeOk(arg ConfigGetBackendAttributeType) (ret ConfigGetBackendRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setConfigGetBackendAttributeType(arg *ConfigGetBackendAttributeType, val ConfigGetBackendRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for blockedCountries
|
|
*/
|
|
|
|
// isArray
|
|
type ConfigGetBlockedCountriesAttributeType = *[]string
|
|
type ConfigGetBlockedCountriesArgType = []string
|
|
type ConfigGetBlockedCountriesRetType = []string
|
|
|
|
func getConfigGetBlockedCountriesAttributeTypeOk(arg ConfigGetBlockedCountriesAttributeType) (ret ConfigGetBlockedCountriesRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setConfigGetBlockedCountriesAttributeType(arg *ConfigGetBlockedCountriesAttributeType, val ConfigGetBlockedCountriesRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for blockedIps
|
|
*/
|
|
|
|
// isArray
|
|
type ConfigGetBlockedIpsAttributeType = *[]string
|
|
type ConfigGetBlockedIpsArgType = []string
|
|
type ConfigGetBlockedIpsRetType = []string
|
|
|
|
func getConfigGetBlockedIpsAttributeTypeOk(arg ConfigGetBlockedIpsAttributeType) (ret ConfigGetBlockedIpsRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setConfigGetBlockedIpsAttributeType(arg *ConfigGetBlockedIpsAttributeType, val ConfigGetBlockedIpsRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for defaultCacheDuration
|
|
*/
|
|
|
|
// isNullableString
|
|
type ConfigGetDefaultCacheDurationAttributeType = *NullableString
|
|
|
|
func getConfigGetDefaultCacheDurationAttributeTypeOk(arg ConfigGetDefaultCacheDurationAttributeType) (ret ConfigGetDefaultCacheDurationRetType, ok bool) {
|
|
if arg == nil {
|
|
return nil, false
|
|
}
|
|
return arg.Get(), true
|
|
}
|
|
|
|
func setConfigGetDefaultCacheDurationAttributeType(arg *ConfigGetDefaultCacheDurationAttributeType, val ConfigGetDefaultCacheDurationRetType) {
|
|
if IsNil(*arg) {
|
|
*arg = NewNullableString(val)
|
|
} else {
|
|
(*arg).Set(val)
|
|
}
|
|
}
|
|
|
|
type ConfigGetDefaultCacheDurationArgType = *string
|
|
type ConfigGetDefaultCacheDurationRetType = *string
|
|
|
|
/*
|
|
types and functions for logSink
|
|
*/
|
|
|
|
// isModel
|
|
type ConfigGetLogSinkAttributeType = *ConfigLogSink
|
|
type ConfigGetLogSinkArgType = ConfigLogSink
|
|
type ConfigGetLogSinkRetType = ConfigLogSink
|
|
|
|
func getConfigGetLogSinkAttributeTypeOk(arg ConfigGetLogSinkAttributeType) (ret ConfigGetLogSinkRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setConfigGetLogSinkAttributeType(arg *ConfigGetLogSinkAttributeType, val ConfigGetLogSinkRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for monthlyLimitBytes
|
|
*/
|
|
|
|
// isLong
|
|
type ConfigGetMonthlyLimitBytesAttributeType = *int64
|
|
type ConfigGetMonthlyLimitBytesArgType = *int64
|
|
type ConfigGetMonthlyLimitBytesRetType = *int64
|
|
|
|
func getConfigGetMonthlyLimitBytesAttributeTypeOk(arg ConfigGetMonthlyLimitBytesAttributeType) (ret ConfigGetMonthlyLimitBytesRetType, ok bool) {
|
|
if arg == nil {
|
|
return nil, false
|
|
}
|
|
return arg, true
|
|
}
|
|
|
|
func setConfigGetMonthlyLimitBytesAttributeType(arg *ConfigGetMonthlyLimitBytesAttributeType, val ConfigGetMonthlyLimitBytesRetType) {
|
|
*arg = val
|
|
}
|
|
|
|
/*
|
|
types and functions for optimizer
|
|
*/
|
|
|
|
// isModel
|
|
type ConfigGetOptimizerAttributeType = *Optimizer
|
|
type ConfigGetOptimizerArgType = Optimizer
|
|
type ConfigGetOptimizerRetType = Optimizer
|
|
|
|
func getConfigGetOptimizerAttributeTypeOk(arg ConfigGetOptimizerAttributeType) (ret ConfigGetOptimizerRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setConfigGetOptimizerAttributeType(arg *ConfigGetOptimizerAttributeType, val ConfigGetOptimizerRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for regions
|
|
*/
|
|
|
|
// isArray
|
|
type ConfigGetRegionsAttributeType = *[]Region
|
|
type ConfigGetRegionsArgType = []Region
|
|
type ConfigGetRegionsRetType = []Region
|
|
|
|
func getConfigGetRegionsAttributeTypeOk(arg ConfigGetRegionsAttributeType) (ret ConfigGetRegionsRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setConfigGetRegionsAttributeType(arg *ConfigGetRegionsAttributeType, val ConfigGetRegionsRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for waf
|
|
*/
|
|
|
|
// isModel
|
|
type ConfigGetWafAttributeType = *WafConfig
|
|
type ConfigGetWafArgType = WafConfig
|
|
type ConfigGetWafRetType = WafConfig
|
|
|
|
func getConfigGetWafAttributeTypeOk(arg ConfigGetWafAttributeType) (ret ConfigGetWafRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setConfigGetWafAttributeType(arg *ConfigGetWafAttributeType, val ConfigGetWafRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
// Config struct for Config
|
|
type Config struct {
|
|
// REQUIRED
|
|
Backend ConfigGetBackendAttributeType `json:"backend" required:"true"`
|
|
// Restricts access to your content based on country. We use the ISO 3166-1 alpha-2 standard for country codes (e.g. DE, ES, GB). This setting blocks users from the specified countries.
|
|
// REQUIRED
|
|
BlockedCountries ConfigGetBlockedCountriesAttributeType `json:"blockedCountries" required:"true"`
|
|
// Restricts access to your content by specifying a list of blocked IPv4 addresses. This feature enhances security and privacy by preventing these addresses from accessing your distribution.
|
|
// REQUIRED
|
|
BlockedIps ConfigGetBlockedIpsAttributeType `json:"blockedIps" required:"true"`
|
|
// Sets the default cache duration for the distribution. The default cache duration is applied when a 'Cache-Control' header is not presented in the origin's response. We use ISO8601 duration format for cache duration (e.g. P1DT2H30M)
|
|
DefaultCacheDuration ConfigGetDefaultCacheDurationAttributeType `json:"defaultCacheDuration,omitempty"`
|
|
LogSink ConfigGetLogSinkAttributeType `json:"logSink,omitempty"`
|
|
// Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use.
|
|
MonthlyLimitBytes ConfigGetMonthlyLimitBytesAttributeType `json:"monthlyLimitBytes,omitempty"`
|
|
Optimizer ConfigGetOptimizerAttributeType `json:"optimizer,omitempty"`
|
|
// REQUIRED
|
|
Regions ConfigGetRegionsAttributeType `json:"regions" required:"true"`
|
|
// REQUIRED
|
|
Waf ConfigGetWafAttributeType `json:"waf" required:"true"`
|
|
}
|
|
|
|
type _Config Config
|
|
|
|
// NewConfig instantiates a new Config 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 NewConfig(backend ConfigGetBackendArgType, blockedCountries ConfigGetBlockedCountriesArgType, blockedIps ConfigGetBlockedIpsArgType, regions ConfigGetRegionsArgType, waf ConfigGetWafArgType) *Config {
|
|
this := Config{}
|
|
setConfigGetBackendAttributeType(&this.Backend, backend)
|
|
setConfigGetBlockedCountriesAttributeType(&this.BlockedCountries, blockedCountries)
|
|
setConfigGetBlockedIpsAttributeType(&this.BlockedIps, blockedIps)
|
|
setConfigGetRegionsAttributeType(&this.Regions, regions)
|
|
setConfigGetWafAttributeType(&this.Waf, waf)
|
|
return &this
|
|
}
|
|
|
|
// NewConfigWithDefaults instantiates a new Config 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 NewConfigWithDefaults() *Config {
|
|
this := Config{}
|
|
return &this
|
|
}
|
|
|
|
// GetBackend returns the Backend field value
|
|
func (o *Config) GetBackend() (ret ConfigGetBackendRetType) {
|
|
ret, _ = o.GetBackendOk()
|
|
return ret
|
|
}
|
|
|
|
// GetBackendOk returns a tuple with the Backend field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Config) GetBackendOk() (ret ConfigGetBackendRetType, ok bool) {
|
|
return getConfigGetBackendAttributeTypeOk(o.Backend)
|
|
}
|
|
|
|
// SetBackend sets field value
|
|
func (o *Config) SetBackend(v ConfigGetBackendRetType) {
|
|
setConfigGetBackendAttributeType(&o.Backend, v)
|
|
}
|
|
|
|
// GetBlockedCountries returns the BlockedCountries field value
|
|
func (o *Config) GetBlockedCountries() (ret ConfigGetBlockedCountriesRetType) {
|
|
ret, _ = o.GetBlockedCountriesOk()
|
|
return ret
|
|
}
|
|
|
|
// GetBlockedCountriesOk returns a tuple with the BlockedCountries field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Config) GetBlockedCountriesOk() (ret ConfigGetBlockedCountriesRetType, ok bool) {
|
|
return getConfigGetBlockedCountriesAttributeTypeOk(o.BlockedCountries)
|
|
}
|
|
|
|
// SetBlockedCountries sets field value
|
|
func (o *Config) SetBlockedCountries(v ConfigGetBlockedCountriesRetType) {
|
|
setConfigGetBlockedCountriesAttributeType(&o.BlockedCountries, v)
|
|
}
|
|
|
|
// GetBlockedIps returns the BlockedIps field value
|
|
func (o *Config) GetBlockedIps() (ret ConfigGetBlockedIpsRetType) {
|
|
ret, _ = o.GetBlockedIpsOk()
|
|
return ret
|
|
}
|
|
|
|
// GetBlockedIpsOk returns a tuple with the BlockedIps field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Config) GetBlockedIpsOk() (ret ConfigGetBlockedIpsRetType, ok bool) {
|
|
return getConfigGetBlockedIpsAttributeTypeOk(o.BlockedIps)
|
|
}
|
|
|
|
// SetBlockedIps sets field value
|
|
func (o *Config) SetBlockedIps(v ConfigGetBlockedIpsRetType) {
|
|
setConfigGetBlockedIpsAttributeType(&o.BlockedIps, v)
|
|
}
|
|
|
|
// GetDefaultCacheDuration returns the DefaultCacheDuration field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *Config) GetDefaultCacheDuration() (res ConfigGetDefaultCacheDurationRetType) {
|
|
res, _ = o.GetDefaultCacheDurationOk()
|
|
return
|
|
}
|
|
|
|
// GetDefaultCacheDurationOk returns a tuple with the DefaultCacheDuration field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *Config) GetDefaultCacheDurationOk() (ret ConfigGetDefaultCacheDurationRetType, ok bool) {
|
|
return getConfigGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration)
|
|
}
|
|
|
|
// HasDefaultCacheDuration returns a boolean if a field has been set.
|
|
func (o *Config) HasDefaultCacheDuration() bool {
|
|
_, ok := o.GetDefaultCacheDurationOk()
|
|
return ok
|
|
}
|
|
|
|
// SetDefaultCacheDuration gets a reference to the given string and assigns it to the DefaultCacheDuration field.
|
|
func (o *Config) SetDefaultCacheDuration(v ConfigGetDefaultCacheDurationRetType) {
|
|
setConfigGetDefaultCacheDurationAttributeType(&o.DefaultCacheDuration, v)
|
|
}
|
|
|
|
// SetDefaultCacheDurationNil sets the value for DefaultCacheDuration to be an explicit nil
|
|
func (o *Config) SetDefaultCacheDurationNil() {
|
|
o.DefaultCacheDuration = nil
|
|
}
|
|
|
|
// UnsetDefaultCacheDuration ensures that no value is present for DefaultCacheDuration, not even an explicit nil
|
|
func (o *Config) UnsetDefaultCacheDuration() {
|
|
o.DefaultCacheDuration = nil
|
|
}
|
|
|
|
// GetLogSink returns the LogSink field value if set, zero value otherwise.
|
|
func (o *Config) GetLogSink() (res ConfigGetLogSinkRetType) {
|
|
res, _ = o.GetLogSinkOk()
|
|
return
|
|
}
|
|
|
|
// GetLogSinkOk returns a tuple with the LogSink field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Config) GetLogSinkOk() (ret ConfigGetLogSinkRetType, ok bool) {
|
|
return getConfigGetLogSinkAttributeTypeOk(o.LogSink)
|
|
}
|
|
|
|
// HasLogSink returns a boolean if a field has been set.
|
|
func (o *Config) HasLogSink() bool {
|
|
_, ok := o.GetLogSinkOk()
|
|
return ok
|
|
}
|
|
|
|
// SetLogSink gets a reference to the given ConfigLogSink and assigns it to the LogSink field.
|
|
func (o *Config) SetLogSink(v ConfigGetLogSinkRetType) {
|
|
setConfigGetLogSinkAttributeType(&o.LogSink, v)
|
|
}
|
|
|
|
// GetMonthlyLimitBytes returns the MonthlyLimitBytes field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *Config) GetMonthlyLimitBytes() (res ConfigGetMonthlyLimitBytesRetType) {
|
|
res, _ = o.GetMonthlyLimitBytesOk()
|
|
return
|
|
}
|
|
|
|
// GetMonthlyLimitBytesOk returns a tuple with the MonthlyLimitBytes field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *Config) GetMonthlyLimitBytesOk() (ret ConfigGetMonthlyLimitBytesRetType, ok bool) {
|
|
return getConfigGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes)
|
|
}
|
|
|
|
// HasMonthlyLimitBytes returns a boolean if a field has been set.
|
|
func (o *Config) HasMonthlyLimitBytes() bool {
|
|
_, ok := o.GetMonthlyLimitBytesOk()
|
|
return ok
|
|
}
|
|
|
|
// SetMonthlyLimitBytes gets a reference to the given int64 and assigns it to the MonthlyLimitBytes field.
|
|
func (o *Config) SetMonthlyLimitBytes(v ConfigGetMonthlyLimitBytesRetType) {
|
|
setConfigGetMonthlyLimitBytesAttributeType(&o.MonthlyLimitBytes, v)
|
|
}
|
|
|
|
// SetMonthlyLimitBytesNil sets the value for MonthlyLimitBytes to be an explicit nil
|
|
func (o *Config) SetMonthlyLimitBytesNil() {
|
|
o.MonthlyLimitBytes = nil
|
|
}
|
|
|
|
// UnsetMonthlyLimitBytes ensures that no value is present for MonthlyLimitBytes, not even an explicit nil
|
|
func (o *Config) UnsetMonthlyLimitBytes() {
|
|
o.MonthlyLimitBytes = nil
|
|
}
|
|
|
|
// GetOptimizer returns the Optimizer field value if set, zero value otherwise.
|
|
func (o *Config) GetOptimizer() (res ConfigGetOptimizerRetType) {
|
|
res, _ = o.GetOptimizerOk()
|
|
return
|
|
}
|
|
|
|
// GetOptimizerOk returns a tuple with the Optimizer field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Config) GetOptimizerOk() (ret ConfigGetOptimizerRetType, ok bool) {
|
|
return getConfigGetOptimizerAttributeTypeOk(o.Optimizer)
|
|
}
|
|
|
|
// HasOptimizer returns a boolean if a field has been set.
|
|
func (o *Config) HasOptimizer() bool {
|
|
_, ok := o.GetOptimizerOk()
|
|
return ok
|
|
}
|
|
|
|
// SetOptimizer gets a reference to the given Optimizer and assigns it to the Optimizer field.
|
|
func (o *Config) SetOptimizer(v ConfigGetOptimizerRetType) {
|
|
setConfigGetOptimizerAttributeType(&o.Optimizer, v)
|
|
}
|
|
|
|
// GetRegions returns the Regions field value
|
|
func (o *Config) GetRegions() (ret ConfigGetRegionsRetType) {
|
|
ret, _ = o.GetRegionsOk()
|
|
return ret
|
|
}
|
|
|
|
// GetRegionsOk returns a tuple with the Regions field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Config) GetRegionsOk() (ret ConfigGetRegionsRetType, ok bool) {
|
|
return getConfigGetRegionsAttributeTypeOk(o.Regions)
|
|
}
|
|
|
|
// SetRegions sets field value
|
|
func (o *Config) SetRegions(v ConfigGetRegionsRetType) {
|
|
setConfigGetRegionsAttributeType(&o.Regions, v)
|
|
}
|
|
|
|
// GetWaf returns the Waf field value
|
|
func (o *Config) GetWaf() (ret ConfigGetWafRetType) {
|
|
ret, _ = o.GetWafOk()
|
|
return ret
|
|
}
|
|
|
|
// GetWafOk returns a tuple with the Waf field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *Config) GetWafOk() (ret ConfigGetWafRetType, ok bool) {
|
|
return getConfigGetWafAttributeTypeOk(o.Waf)
|
|
}
|
|
|
|
// SetWaf sets field value
|
|
func (o *Config) SetWaf(v ConfigGetWafRetType) {
|
|
setConfigGetWafAttributeType(&o.Waf, v)
|
|
}
|
|
|
|
func (o Config) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if val, ok := getConfigGetBackendAttributeTypeOk(o.Backend); ok {
|
|
toSerialize["Backend"] = val
|
|
}
|
|
if val, ok := getConfigGetBlockedCountriesAttributeTypeOk(o.BlockedCountries); ok {
|
|
toSerialize["BlockedCountries"] = val
|
|
}
|
|
if val, ok := getConfigGetBlockedIpsAttributeTypeOk(o.BlockedIps); ok {
|
|
toSerialize["BlockedIps"] = val
|
|
}
|
|
if val, ok := getConfigGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration); ok {
|
|
toSerialize["DefaultCacheDuration"] = val
|
|
}
|
|
if val, ok := getConfigGetLogSinkAttributeTypeOk(o.LogSink); ok {
|
|
toSerialize["LogSink"] = val
|
|
}
|
|
if val, ok := getConfigGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes); ok {
|
|
toSerialize["MonthlyLimitBytes"] = val
|
|
}
|
|
if val, ok := getConfigGetOptimizerAttributeTypeOk(o.Optimizer); ok {
|
|
toSerialize["Optimizer"] = val
|
|
}
|
|
if val, ok := getConfigGetRegionsAttributeTypeOk(o.Regions); ok {
|
|
toSerialize["Regions"] = val
|
|
}
|
|
if val, ok := getConfigGetWafAttributeTypeOk(o.Waf); ok {
|
|
toSerialize["Waf"] = val
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
type NullableConfig struct {
|
|
value *Config
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableConfig) Get() *Config {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableConfig) Set(val *Config) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableConfig) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableConfig) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableConfig(val *Config) *NullableConfig {
|
|
return &NullableConfig{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableConfig) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableConfig) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|