/* 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" ) // InstanceVersion The sqlserver version used for the instance. type InstanceVersion string // List of instance.version const ( INSTANCEVERSION__2022 InstanceVersion = "2022" ) // All allowed values of InstanceVersion enum var AllowedInstanceVersionEnumValues = []InstanceVersion{ "2022", } func (v *InstanceVersion) 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 := InstanceVersion(value) for _, existing := range AllowedInstanceVersionEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil } } return fmt.Errorf("%+v is not a valid InstanceVersion", value) } // NewInstanceVersionFromValue returns a pointer to a valid InstanceVersion // for the value passed as argument, or an error if the value passed is not allowed by the enum func NewInstanceVersionFromValue(v string) (*InstanceVersion, error) { ev := InstanceVersion(v) if ev.IsValid() { return &ev, nil } else { return nil, fmt.Errorf("invalid value '%v' for InstanceVersion: valid values are %v", v, AllowedInstanceVersionEnumValues) } } // IsValid return true if the value is valid for the enum, false otherwise func (v InstanceVersion) IsValid() bool { for _, existing := range AllowedInstanceVersionEnumValues { if existing == v { return true } } return false } // Ptr returns reference to instance.version value func (v InstanceVersion) Ptr() *InstanceVersion { return &v } type NullableInstanceVersion struct { value *InstanceVersion isSet bool } func (v NullableInstanceVersion) Get() *InstanceVersion { return v.value } func (v *NullableInstanceVersion) Set(val *InstanceVersion) { v.value = val v.isSet = true } func (v NullableInstanceVersion) IsSet() bool { return v.isSet } func (v *NullableInstanceVersion) Unset() { v.value = nil v.isSet = false } func NewNullableInstanceVersion(val *InstanceVersion) *NullableInstanceVersion { return &NullableInstanceVersion{value: val, isSet: true} } func (v NullableInstanceVersion) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableInstanceVersion) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }