terraform-provider-stackitp.../pkg/sqlserverflexalpha/model_instance_edition.go

117 lines
2.7 KiB
Go

/*
STACKIT MSSQL Service API
This is the documentation for the STACKIT MSSQL service
API version: 3alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package sqlserverflexalpha
import (
"encoding/json"
"fmt"
)
// InstanceEdition Edition of the MSSQL server instance
type InstanceEdition string
// List of instance.edition
const (
INSTANCEEDITION_STANDARD InstanceEdition = "Standard"
INSTANCEEDITION_ENTERPRISE_CORE InstanceEdition = "EnterpriseCore"
INSTANCEEDITION_DEVELOPER InstanceEdition = "developer"
)
// All allowed values of InstanceEdition enum
var AllowedInstanceEditionEnumValues = []InstanceEdition{
"Standard",
"EnterpriseCore",
"developer",
}
func (v *InstanceEdition) 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 := InstanceEdition(value)
for _, existing := range AllowedInstanceEditionEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid InstanceEdition", value)
}
// NewInstanceEditionFromValue returns a pointer to a valid InstanceEdition
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewInstanceEditionFromValue(v string) (*InstanceEdition, error) {
ev := InstanceEdition(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for InstanceEdition: valid values are %v", v, AllowedInstanceEditionEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v InstanceEdition) IsValid() bool {
for _, existing := range AllowedInstanceEditionEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to instance.edition value
func (v InstanceEdition) Ptr() *InstanceEdition {
return &v
}
type NullableInstanceEdition struct {
value *InstanceEdition
isSet bool
}
func (v NullableInstanceEdition) Get() *InstanceEdition {
return v.value
}
func (v *NullableInstanceEdition) Set(val *InstanceEdition) {
v.value = val
v.isSet = true
}
func (v NullableInstanceEdition) IsSet() bool {
return v.isSet
}
func (v *NullableInstanceEdition) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInstanceEdition(val *InstanceEdition) *NullableInstanceEdition {
return &NullableInstanceEdition{value: val, isSet: true}
}
func (v NullableInstanceEdition) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInstanceEdition) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}