/* PostgreSQL Flex API This is the documentation for the STACKIT Postgres Flex service API version: 3alpha1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package postgresflexalpha import ( "encoding/json" "fmt" ) // BackupSort the model 'BackupSort' type BackupSort string // List of backup.sort const ( BACKUPSORT_COMPLETION_TIME_DESC BackupSort = "completion_time.desc" BACKUPSORT_COMPLETION_TIME_ASC BackupSort = "completion_time.asc" BACKUPSORT_END_TIME_DESC BackupSort = "end_time.desc" BACKUPSORT_END_TIME_ASC BackupSort = "end_time.asc" BACKUPSORT_INDEX_DESC BackupSort = "index.desc" BACKUPSORT_INDEX_ASC BackupSort = "index.asc" BACKUPSORT_NAME_DESC BackupSort = "name.desc" BACKUPSORT_NAME_ASC BackupSort = "name.asc" BACKUPSORT_RETAINED_UNTIL_DESC BackupSort = "retained_until.desc" BACKUPSORT_RETAINED_UNTIL_ASC BackupSort = "retained_until.asc" BACKUPSORT_SIZE_DESC BackupSort = "size.desc" BACKUPSORT_SIZE_ASC BackupSort = "size.asc" BACKUPSORT_TYPE_DESC BackupSort = "type.desc" BACKUPSORT_TYPE_ASC BackupSort = "type.asc" ) // All allowed values of BackupSort enum var AllowedBackupSortEnumValues = []BackupSort{ "completion_time.desc", "completion_time.asc", "end_time.desc", "end_time.asc", "index.desc", "index.asc", "name.desc", "name.asc", "retained_until.desc", "retained_until.asc", "size.desc", "size.asc", "type.desc", "type.asc", } func (v *BackupSort) 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 := BackupSort(value) for _, existing := range AllowedBackupSortEnumValues { if existing == enumTypeValue { *v = enumTypeValue return nil } } return fmt.Errorf("%+v is not a valid BackupSort", value) } // NewBackupSortFromValue returns a pointer to a valid BackupSort // for the value passed as argument, or an error if the value passed is not allowed by the enum func NewBackupSortFromValue(v string) (*BackupSort, error) { ev := BackupSort(v) if ev.IsValid() { return &ev, nil } else { return nil, fmt.Errorf("invalid value '%v' for BackupSort: valid values are %v", v, AllowedBackupSortEnumValues) } } // IsValid return true if the value is valid for the enum, false otherwise func (v BackupSort) IsValid() bool { for _, existing := range AllowedBackupSortEnumValues { if existing == v { return true } } return false } // Ptr returns reference to backup.sort value func (v BackupSort) Ptr() *BackupSort { return &v } type NullableBackupSort struct { value *BackupSort isSet bool } func (v NullableBackupSort) Get() *BackupSort { return v.value } func (v *NullableBackupSort) Set(val *BackupSort) { v.value = val v.isSet = true } func (v NullableBackupSort) IsSet() bool { return v.isSet } func (v *NullableBackupSort) Unset() { v.value = nil v.isSet = false } func NewNullableBackupSort(val *BackupSort) *NullableBackupSort { return &NullableBackupSort{value: val, isSet: true} } func (v NullableBackupSort) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableBackupSort) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }