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

127 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"
)
// UserSort the model 'UserSort'
type UserSort string
// List of user.sort
const (
USERSORT_ID_ASC UserSort = "id.asc"
USERSORT_ID_DESC UserSort = "id.desc"
USERSORT_INDEX_DESC UserSort = "index.desc"
USERSORT_INDEX_ASC UserSort = "index.asc"
USERSORT_NAME_DESC UserSort = "name.desc"
USERSORT_NAME_ASC UserSort = "name.asc"
USERSORT_STATUS_DESC UserSort = "status.desc"
USERSORT_STATUS_ASC UserSort = "status.asc"
)
// All allowed values of UserSort enum
var AllowedUserSortEnumValues = []UserSort{
"id.asc",
"id.desc",
"index.desc",
"index.asc",
"name.desc",
"name.asc",
"status.desc",
"status.asc",
}
func (v *UserSort) 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 := UserSort(value)
for _, existing := range AllowedUserSortEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid UserSort", value)
}
// NewUserSortFromValue returns a pointer to a valid UserSort
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewUserSortFromValue(v string) (*UserSort, error) {
ev := UserSort(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for UserSort: valid values are %v", v, AllowedUserSortEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v UserSort) IsValid() bool {
for _, existing := range AllowedUserSortEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to user.sort value
func (v UserSort) Ptr() *UserSort {
return &v
}
type NullableUserSort struct {
value *UserSort
isSet bool
}
func (v NullableUserSort) Get() *UserSort {
return v.value
}
func (v *NullableUserSort) Set(val *UserSort) {
v.value = val
v.isSet = true
}
func (v NullableUserSort) IsSet() bool {
return v.isSet
}
func (v *NullableUserSort) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUserSort(val *UserSort) *NullableUserSort {
return &NullableUserSort{value: val, isSet: true}
}
func (v NullableUserSort) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUserSort) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}