## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
212 lines
6.5 KiB
Go
212 lines
6.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"
|
|
)
|
|
|
|
// checks if the WafConfig type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &WafConfig{}
|
|
|
|
/*
|
|
types and functions for enabledRuleIds
|
|
*/
|
|
|
|
// isArray
|
|
type WafConfigGetEnabledRuleIdsAttributeType = *[]string
|
|
type WafConfigGetEnabledRuleIdsArgType = []string
|
|
type WafConfigGetEnabledRuleIdsRetType = []string
|
|
|
|
func getWafConfigGetEnabledRuleIdsAttributeTypeOk(arg WafConfigGetEnabledRuleIdsAttributeType) (ret WafConfigGetEnabledRuleIdsRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setWafConfigGetEnabledRuleIdsAttributeType(arg *WafConfigGetEnabledRuleIdsAttributeType, val WafConfigGetEnabledRuleIdsRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for mode
|
|
*/
|
|
|
|
// isEnumRef
|
|
type WafConfigGetModeAttributeType = *WafMode
|
|
type WafConfigGetModeArgType = WafMode
|
|
type WafConfigGetModeRetType = WafMode
|
|
|
|
func getWafConfigGetModeAttributeTypeOk(arg WafConfigGetModeAttributeType) (ret WafConfigGetModeRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setWafConfigGetModeAttributeType(arg *WafConfigGetModeAttributeType, val WafConfigGetModeRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for type
|
|
*/
|
|
|
|
// isEnumRef
|
|
type WafConfigGetTypeAttributeType = *WafType
|
|
type WafConfigGetTypeArgType = WafType
|
|
type WafConfigGetTypeRetType = WafType
|
|
|
|
func getWafConfigGetTypeAttributeTypeOk(arg WafConfigGetTypeAttributeType) (ret WafConfigGetTypeRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setWafConfigGetTypeAttributeType(arg *WafConfigGetTypeAttributeType, val WafConfigGetTypeRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
// WafConfig Configuration of the WAF of a distribution
|
|
type WafConfig struct {
|
|
// Ids of the WAF rules that are **explicitly** enabled for this distribution. If this rule is in a disabled / log Only RuleGroup or Collection, it will be enabled regardless as `enabledRuleIds` overrides those in specificity. Do note that rules can also be enabled because a Rulegroup or Collection is enabled. **DO NOT** use this property to find all active rules. Instead, pass `?withWafStatus=true` as a query parameter to `GetDistribution` or `ListDistributions`. This will expose the `waf` Property on distribution Level. From there you can `$.waf.enabledRules.map(e => e.id)` to get a list of all enabled rules.
|
|
// REQUIRED
|
|
EnabledRuleIds WafConfigGetEnabledRuleIdsAttributeType `json:"enabledRuleIds" required:"true"`
|
|
// REQUIRED
|
|
Mode WafConfigGetModeAttributeType `json:"mode" required:"true"`
|
|
// REQUIRED
|
|
Type WafConfigGetTypeAttributeType `json:"type" required:"true"`
|
|
}
|
|
|
|
type _WafConfig WafConfig
|
|
|
|
// NewWafConfig instantiates a new WafConfig 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 NewWafConfig(enabledRuleIds WafConfigGetEnabledRuleIdsArgType, mode WafConfigGetModeArgType, types WafConfigGetTypeArgType) *WafConfig {
|
|
this := WafConfig{}
|
|
setWafConfigGetEnabledRuleIdsAttributeType(&this.EnabledRuleIds, enabledRuleIds)
|
|
setWafConfigGetModeAttributeType(&this.Mode, mode)
|
|
setWafConfigGetTypeAttributeType(&this.Type, types)
|
|
return &this
|
|
}
|
|
|
|
// NewWafConfigWithDefaults instantiates a new WafConfig 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 NewWafConfigWithDefaults() *WafConfig {
|
|
this := WafConfig{}
|
|
return &this
|
|
}
|
|
|
|
// GetEnabledRuleIds returns the EnabledRuleIds field value
|
|
func (o *WafConfig) GetEnabledRuleIds() (ret WafConfigGetEnabledRuleIdsRetType) {
|
|
ret, _ = o.GetEnabledRuleIdsOk()
|
|
return ret
|
|
}
|
|
|
|
// GetEnabledRuleIdsOk returns a tuple with the EnabledRuleIds field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *WafConfig) GetEnabledRuleIdsOk() (ret WafConfigGetEnabledRuleIdsRetType, ok bool) {
|
|
return getWafConfigGetEnabledRuleIdsAttributeTypeOk(o.EnabledRuleIds)
|
|
}
|
|
|
|
// SetEnabledRuleIds sets field value
|
|
func (o *WafConfig) SetEnabledRuleIds(v WafConfigGetEnabledRuleIdsRetType) {
|
|
setWafConfigGetEnabledRuleIdsAttributeType(&o.EnabledRuleIds, v)
|
|
}
|
|
|
|
// GetMode returns the Mode field value
|
|
func (o *WafConfig) GetMode() (ret WafConfigGetModeRetType) {
|
|
ret, _ = o.GetModeOk()
|
|
return ret
|
|
}
|
|
|
|
// GetModeOk returns a tuple with the Mode field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *WafConfig) GetModeOk() (ret WafConfigGetModeRetType, ok bool) {
|
|
return getWafConfigGetModeAttributeTypeOk(o.Mode)
|
|
}
|
|
|
|
// SetMode sets field value
|
|
func (o *WafConfig) SetMode(v WafConfigGetModeRetType) {
|
|
setWafConfigGetModeAttributeType(&o.Mode, v)
|
|
}
|
|
|
|
// GetType returns the Type field value
|
|
func (o *WafConfig) GetType() (ret WafConfigGetTypeRetType) {
|
|
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 *WafConfig) GetTypeOk() (ret WafConfigGetTypeRetType, ok bool) {
|
|
return getWafConfigGetTypeAttributeTypeOk(o.Type)
|
|
}
|
|
|
|
// SetType sets field value
|
|
func (o *WafConfig) SetType(v WafConfigGetTypeRetType) {
|
|
setWafConfigGetTypeAttributeType(&o.Type, v)
|
|
}
|
|
|
|
func (o WafConfig) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if val, ok := getWafConfigGetEnabledRuleIdsAttributeTypeOk(o.EnabledRuleIds); ok {
|
|
toSerialize["EnabledRuleIds"] = val
|
|
}
|
|
if val, ok := getWafConfigGetModeAttributeTypeOk(o.Mode); ok {
|
|
toSerialize["Mode"] = val
|
|
}
|
|
if val, ok := getWafConfigGetTypeAttributeTypeOk(o.Type); ok {
|
|
toSerialize["Type"] = val
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
type NullableWafConfig struct {
|
|
value *WafConfig
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableWafConfig) Get() *WafConfig {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableWafConfig) Set(val *WafConfig) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableWafConfig) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableWafConfig) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableWafConfig(val *WafConfig) *NullableWafConfig {
|
|
return &NullableWafConfig{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableWafConfig) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableWafConfig) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|