/* 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 ConfigPatch type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ConfigPatch{} /* types and functions for backend */ // isModel type ConfigPatchGetBackendAttributeType = *ConfigPatchBackend type ConfigPatchGetBackendArgType = ConfigPatchBackend type ConfigPatchGetBackendRetType = ConfigPatchBackend func getConfigPatchGetBackendAttributeTypeOk(arg ConfigPatchGetBackendAttributeType) (ret ConfigPatchGetBackendRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setConfigPatchGetBackendAttributeType(arg *ConfigPatchGetBackendAttributeType, val ConfigPatchGetBackendRetType) { *arg = &val } /* types and functions for blockedCountries */ // isArray type ConfigPatchGetBlockedCountriesAttributeType = *[]string type ConfigPatchGetBlockedCountriesArgType = []string type ConfigPatchGetBlockedCountriesRetType = []string func getConfigPatchGetBlockedCountriesAttributeTypeOk(arg ConfigPatchGetBlockedCountriesAttributeType) (ret ConfigPatchGetBlockedCountriesRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setConfigPatchGetBlockedCountriesAttributeType(arg *ConfigPatchGetBlockedCountriesAttributeType, val ConfigPatchGetBlockedCountriesRetType) { *arg = &val } /* types and functions for blockedIps */ // isArray type ConfigPatchGetBlockedIpsAttributeType = *[]string type ConfigPatchGetBlockedIpsArgType = []string type ConfigPatchGetBlockedIpsRetType = []string func getConfigPatchGetBlockedIpsAttributeTypeOk(arg ConfigPatchGetBlockedIpsAttributeType) (ret ConfigPatchGetBlockedIpsRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setConfigPatchGetBlockedIpsAttributeType(arg *ConfigPatchGetBlockedIpsAttributeType, val ConfigPatchGetBlockedIpsRetType) { *arg = &val } /* types and functions for defaultCacheDuration */ // isNullableString type ConfigPatchGetDefaultCacheDurationAttributeType = *NullableString func getConfigPatchGetDefaultCacheDurationAttributeTypeOk(arg ConfigPatchGetDefaultCacheDurationAttributeType) (ret ConfigPatchGetDefaultCacheDurationRetType, ok bool) { if arg == nil { return nil, false } return arg.Get(), true } func setConfigPatchGetDefaultCacheDurationAttributeType(arg *ConfigPatchGetDefaultCacheDurationAttributeType, val ConfigPatchGetDefaultCacheDurationRetType) { if IsNil(*arg) { *arg = NewNullableString(val) } else { (*arg).Set(val) } } type ConfigPatchGetDefaultCacheDurationArgType = *string type ConfigPatchGetDefaultCacheDurationRetType = *string /* types and functions for logSink */ // isModel type ConfigPatchGetLogSinkAttributeType = *NullableConfigPatchLogSink type ConfigPatchGetLogSinkArgType = *NullableConfigPatchLogSink type ConfigPatchGetLogSinkRetType = *NullableConfigPatchLogSink func getConfigPatchGetLogSinkAttributeTypeOk(arg ConfigPatchGetLogSinkAttributeType) (ret ConfigPatchGetLogSinkRetType, ok bool) { if arg == nil { return nil, false } return arg, true } func setConfigPatchGetLogSinkAttributeType(arg *ConfigPatchGetLogSinkAttributeType, val ConfigPatchGetLogSinkRetType) { *arg = val } /* types and functions for monthlyLimitBytes */ // isLong type ConfigPatchGetMonthlyLimitBytesAttributeType = *int64 type ConfigPatchGetMonthlyLimitBytesArgType = *int64 type ConfigPatchGetMonthlyLimitBytesRetType = *int64 func getConfigPatchGetMonthlyLimitBytesAttributeTypeOk(arg ConfigPatchGetMonthlyLimitBytesAttributeType) (ret ConfigPatchGetMonthlyLimitBytesRetType, ok bool) { if arg == nil { return nil, false } return arg, true } func setConfigPatchGetMonthlyLimitBytesAttributeType(arg *ConfigPatchGetMonthlyLimitBytesAttributeType, val ConfigPatchGetMonthlyLimitBytesRetType) { *arg = val } /* types and functions for optimizer */ // isModel type ConfigPatchGetOptimizerAttributeType = *OptimizerPatch type ConfigPatchGetOptimizerArgType = OptimizerPatch type ConfigPatchGetOptimizerRetType = OptimizerPatch func getConfigPatchGetOptimizerAttributeTypeOk(arg ConfigPatchGetOptimizerAttributeType) (ret ConfigPatchGetOptimizerRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setConfigPatchGetOptimizerAttributeType(arg *ConfigPatchGetOptimizerAttributeType, val ConfigPatchGetOptimizerRetType) { *arg = &val } /* types and functions for regions */ // isArray type ConfigPatchGetRegionsAttributeType = *[]Region type ConfigPatchGetRegionsArgType = []Region type ConfigPatchGetRegionsRetType = []Region func getConfigPatchGetRegionsAttributeTypeOk(arg ConfigPatchGetRegionsAttributeType) (ret ConfigPatchGetRegionsRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setConfigPatchGetRegionsAttributeType(arg *ConfigPatchGetRegionsAttributeType, val ConfigPatchGetRegionsRetType) { *arg = &val } /* types and functions for waf */ // isModel type ConfigPatchGetWafAttributeType = *WafConfigPatch type ConfigPatchGetWafArgType = WafConfigPatch type ConfigPatchGetWafRetType = WafConfigPatch func getConfigPatchGetWafAttributeTypeOk(arg ConfigPatchGetWafAttributeType) (ret ConfigPatchGetWafRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } func setConfigPatchGetWafAttributeType(arg *ConfigPatchGetWafAttributeType, val ConfigPatchGetWafRetType) { *arg = &val } // ConfigPatch struct for ConfigPatch type ConfigPatch struct { Backend ConfigPatchGetBackendAttributeType `json:"backend,omitempty"` // 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. BlockedCountries ConfigPatchGetBlockedCountriesAttributeType `json:"blockedCountries,omitempty"` // 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. BlockedIps ConfigPatchGetBlockedIpsAttributeType `json:"blockedIps,omitempty"` // 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 ConfigPatchGetDefaultCacheDurationAttributeType `json:"defaultCacheDuration,omitempty"` LogSink ConfigPatchGetLogSinkAttributeType `json:"logSink,omitempty"` // Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. MonthlyLimitBytes ConfigPatchGetMonthlyLimitBytesAttributeType `json:"monthlyLimitBytes,omitempty"` Optimizer ConfigPatchGetOptimizerAttributeType `json:"optimizer,omitempty"` Regions ConfigPatchGetRegionsAttributeType `json:"regions,omitempty"` Waf ConfigPatchGetWafAttributeType `json:"waf,omitempty"` } // NewConfigPatch instantiates a new ConfigPatch 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 NewConfigPatch() *ConfigPatch { this := ConfigPatch{} return &this } // NewConfigPatchWithDefaults instantiates a new ConfigPatch 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 NewConfigPatchWithDefaults() *ConfigPatch { this := ConfigPatch{} return &this } // GetBackend returns the Backend field value if set, zero value otherwise. func (o *ConfigPatch) GetBackend() (res ConfigPatchGetBackendRetType) { res, _ = o.GetBackendOk() return } // GetBackendOk returns a tuple with the Backend field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConfigPatch) GetBackendOk() (ret ConfigPatchGetBackendRetType, ok bool) { return getConfigPatchGetBackendAttributeTypeOk(o.Backend) } // HasBackend returns a boolean if a field has been set. func (o *ConfigPatch) HasBackend() bool { _, ok := o.GetBackendOk() return ok } // SetBackend gets a reference to the given ConfigPatchBackend and assigns it to the Backend field. func (o *ConfigPatch) SetBackend(v ConfigPatchGetBackendRetType) { setConfigPatchGetBackendAttributeType(&o.Backend, v) } // GetBlockedCountries returns the BlockedCountries field value if set, zero value otherwise. func (o *ConfigPatch) GetBlockedCountries() (res ConfigPatchGetBlockedCountriesRetType) { res, _ = o.GetBlockedCountriesOk() return } // GetBlockedCountriesOk returns a tuple with the BlockedCountries field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConfigPatch) GetBlockedCountriesOk() (ret ConfigPatchGetBlockedCountriesRetType, ok bool) { return getConfigPatchGetBlockedCountriesAttributeTypeOk(o.BlockedCountries) } // HasBlockedCountries returns a boolean if a field has been set. func (o *ConfigPatch) HasBlockedCountries() bool { _, ok := o.GetBlockedCountriesOk() return ok } // SetBlockedCountries gets a reference to the given []string and assigns it to the BlockedCountries field. func (o *ConfigPatch) SetBlockedCountries(v ConfigPatchGetBlockedCountriesRetType) { setConfigPatchGetBlockedCountriesAttributeType(&o.BlockedCountries, v) } // GetBlockedIps returns the BlockedIps field value if set, zero value otherwise. func (o *ConfigPatch) GetBlockedIps() (res ConfigPatchGetBlockedIpsRetType) { res, _ = o.GetBlockedIpsOk() return } // GetBlockedIpsOk returns a tuple with the BlockedIps field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConfigPatch) GetBlockedIpsOk() (ret ConfigPatchGetBlockedIpsRetType, ok bool) { return getConfigPatchGetBlockedIpsAttributeTypeOk(o.BlockedIps) } // HasBlockedIps returns a boolean if a field has been set. func (o *ConfigPatch) HasBlockedIps() bool { _, ok := o.GetBlockedIpsOk() return ok } // SetBlockedIps gets a reference to the given []string and assigns it to the BlockedIps field. func (o *ConfigPatch) SetBlockedIps(v ConfigPatchGetBlockedIpsRetType) { setConfigPatchGetBlockedIpsAttributeType(&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 *ConfigPatch) GetDefaultCacheDuration() (res ConfigPatchGetDefaultCacheDurationRetType) { 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 *ConfigPatch) GetDefaultCacheDurationOk() (ret ConfigPatchGetDefaultCacheDurationRetType, ok bool) { return getConfigPatchGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration) } // HasDefaultCacheDuration returns a boolean if a field has been set. func (o *ConfigPatch) HasDefaultCacheDuration() bool { _, ok := o.GetDefaultCacheDurationOk() return ok } // SetDefaultCacheDuration gets a reference to the given string and assigns it to the DefaultCacheDuration field. func (o *ConfigPatch) SetDefaultCacheDuration(v ConfigPatchGetDefaultCacheDurationRetType) { setConfigPatchGetDefaultCacheDurationAttributeType(&o.DefaultCacheDuration, v) } // SetDefaultCacheDurationNil sets the value for DefaultCacheDuration to be an explicit nil func (o *ConfigPatch) SetDefaultCacheDurationNil() { o.DefaultCacheDuration = nil } // UnsetDefaultCacheDuration ensures that no value is present for DefaultCacheDuration, not even an explicit nil func (o *ConfigPatch) UnsetDefaultCacheDuration() { o.DefaultCacheDuration = nil } // GetLogSink returns the LogSink field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ConfigPatch) GetLogSink() (res ConfigPatchGetLogSinkRetType) { 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. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *ConfigPatch) GetLogSinkOk() (ret ConfigPatchGetLogSinkRetType, ok bool) { return getConfigPatchGetLogSinkAttributeTypeOk(o.LogSink) } // HasLogSink returns a boolean if a field has been set. func (o *ConfigPatch) HasLogSink() bool { _, ok := o.GetLogSinkOk() return ok } // SetLogSink gets a reference to the given ConfigPatchLogSink and assigns it to the LogSink field. func (o *ConfigPatch) SetLogSink(v ConfigPatchGetLogSinkRetType) { setConfigPatchGetLogSinkAttributeType(&o.LogSink, v) } // SetLogSinkNil sets the value for LogSink to be an explicit nil func (o *ConfigPatch) SetLogSinkNil() { o.LogSink = nil } // UnsetLogSink ensures that no value is present for LogSink, not even an explicit nil func (o *ConfigPatch) UnsetLogSink() { o.LogSink = nil } // GetMonthlyLimitBytes returns the MonthlyLimitBytes field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ConfigPatch) GetMonthlyLimitBytes() (res ConfigPatchGetMonthlyLimitBytesRetType) { 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 *ConfigPatch) GetMonthlyLimitBytesOk() (ret ConfigPatchGetMonthlyLimitBytesRetType, ok bool) { return getConfigPatchGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes) } // HasMonthlyLimitBytes returns a boolean if a field has been set. func (o *ConfigPatch) HasMonthlyLimitBytes() bool { _, ok := o.GetMonthlyLimitBytesOk() return ok } // SetMonthlyLimitBytes gets a reference to the given int64 and assigns it to the MonthlyLimitBytes field. func (o *ConfigPatch) SetMonthlyLimitBytes(v ConfigPatchGetMonthlyLimitBytesRetType) { setConfigPatchGetMonthlyLimitBytesAttributeType(&o.MonthlyLimitBytes, v) } // SetMonthlyLimitBytesNil sets the value for MonthlyLimitBytes to be an explicit nil func (o *ConfigPatch) SetMonthlyLimitBytesNil() { o.MonthlyLimitBytes = nil } // UnsetMonthlyLimitBytes ensures that no value is present for MonthlyLimitBytes, not even an explicit nil func (o *ConfigPatch) UnsetMonthlyLimitBytes() { o.MonthlyLimitBytes = nil } // GetOptimizer returns the Optimizer field value if set, zero value otherwise. func (o *ConfigPatch) GetOptimizer() (res ConfigPatchGetOptimizerRetType) { 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 *ConfigPatch) GetOptimizerOk() (ret ConfigPatchGetOptimizerRetType, ok bool) { return getConfigPatchGetOptimizerAttributeTypeOk(o.Optimizer) } // HasOptimizer returns a boolean if a field has been set. func (o *ConfigPatch) HasOptimizer() bool { _, ok := o.GetOptimizerOk() return ok } // SetOptimizer gets a reference to the given OptimizerPatch and assigns it to the Optimizer field. func (o *ConfigPatch) SetOptimizer(v ConfigPatchGetOptimizerRetType) { setConfigPatchGetOptimizerAttributeType(&o.Optimizer, v) } // GetRegions returns the Regions field value if set, zero value otherwise. func (o *ConfigPatch) GetRegions() (res ConfigPatchGetRegionsRetType) { res, _ = o.GetRegionsOk() return } // GetRegionsOk returns a tuple with the Regions field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConfigPatch) GetRegionsOk() (ret ConfigPatchGetRegionsRetType, ok bool) { return getConfigPatchGetRegionsAttributeTypeOk(o.Regions) } // HasRegions returns a boolean if a field has been set. func (o *ConfigPatch) HasRegions() bool { _, ok := o.GetRegionsOk() return ok } // SetRegions gets a reference to the given []Region and assigns it to the Regions field. func (o *ConfigPatch) SetRegions(v ConfigPatchGetRegionsRetType) { setConfigPatchGetRegionsAttributeType(&o.Regions, v) } // GetWaf returns the Waf field value if set, zero value otherwise. func (o *ConfigPatch) GetWaf() (res ConfigPatchGetWafRetType) { res, _ = o.GetWafOk() return } // GetWafOk returns a tuple with the Waf field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ConfigPatch) GetWafOk() (ret ConfigPatchGetWafRetType, ok bool) { return getConfigPatchGetWafAttributeTypeOk(o.Waf) } // HasWaf returns a boolean if a field has been set. func (o *ConfigPatch) HasWaf() bool { _, ok := o.GetWafOk() return ok } // SetWaf gets a reference to the given WafConfigPatch and assigns it to the Waf field. func (o *ConfigPatch) SetWaf(v ConfigPatchGetWafRetType) { setConfigPatchGetWafAttributeType(&o.Waf, v) } func (o ConfigPatch) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getConfigPatchGetBackendAttributeTypeOk(o.Backend); ok { toSerialize["Backend"] = val } if val, ok := getConfigPatchGetBlockedCountriesAttributeTypeOk(o.BlockedCountries); ok { toSerialize["BlockedCountries"] = val } if val, ok := getConfigPatchGetBlockedIpsAttributeTypeOk(o.BlockedIps); ok { toSerialize["BlockedIps"] = val } if val, ok := getConfigPatchGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration); ok { toSerialize["DefaultCacheDuration"] = val } if val, ok := getConfigPatchGetLogSinkAttributeTypeOk(o.LogSink); ok { toSerialize["LogSink"] = val } if val, ok := getConfigPatchGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes); ok { toSerialize["MonthlyLimitBytes"] = val } if val, ok := getConfigPatchGetOptimizerAttributeTypeOk(o.Optimizer); ok { toSerialize["Optimizer"] = val } if val, ok := getConfigPatchGetRegionsAttributeTypeOk(o.Regions); ok { toSerialize["Regions"] = val } if val, ok := getConfigPatchGetWafAttributeTypeOk(o.Waf); ok { toSerialize["Waf"] = val } return toSerialize, nil } type NullableConfigPatch struct { value *ConfigPatch isSet bool } func (v NullableConfigPatch) Get() *ConfigPatch { return v.value } func (v *NullableConfigPatch) Set(val *ConfigPatch) { v.value = val v.isSet = true } func (v NullableConfigPatch) IsSet() bool { return v.isSet } func (v *NullableConfigPatch) Unset() { v.value = nil v.isSet = false } func NewNullableConfigPatch(val *ConfigPatch) *NullableConfigPatch { return &NullableConfigPatch{value: val, isSet: true} } func (v NullableConfigPatch) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableConfigPatch) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }