terraform-provider-stackitp.../pkg/cdnbeta/model_waf_mode.go
2026-01-21 09:07:29 +01:00

117 lines
2.3 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"
)
// WafMode the model 'WafMode'
type WafMode string
// List of WafMode
const (
WAFMODE_DISABLED WafMode = "DISABLED"
WAFMODE_ENABLED WafMode = "ENABLED"
WAFMODE_LOG_ONLY WafMode = "LOG_ONLY"
)
// All allowed values of WafMode enum
var AllowedWafModeEnumValues = []WafMode{
"DISABLED",
"ENABLED",
"LOG_ONLY",
}
func (v *WafMode) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue string
if value == zeroValue {
return nil
}
enumTypeValue := WafMode(value)
for _, existing := range AllowedWafModeEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid WafMode", value)
}
// NewWafModeFromValue returns a pointer to a valid WafMode
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewWafModeFromValue(v string) (*WafMode, error) {
ev := WafMode(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for WafMode: valid values are %v", v, AllowedWafModeEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v WafMode) IsValid() bool {
for _, existing := range AllowedWafModeEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to WafMode value
func (v WafMode) Ptr() *WafMode {
return &v
}
type NullableWafMode struct {
value *WafMode
isSet bool
}
func (v NullableWafMode) Get() *WafMode {
return v.value
}
func (v *NullableWafMode) Set(val *WafMode) {
v.value = val
v.isSet = true
}
func (v NullableWafMode) IsSet() bool {
return v.isSet
}
func (v *NullableWafMode) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableWafMode(val *WafMode) *NullableWafMode {
return &NullableWafMode{value: val, isSet: true}
}
func (v NullableWafMode) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableWafMode) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}