115 lines
2.3 KiB
Go
115 lines
2.3 KiB
Go
/*
|
|
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"
|
|
)
|
|
|
|
// Replicas How many replicas the instance should have.
|
|
type Replicas int32
|
|
|
|
// List of replicas
|
|
const (
|
|
REPLICAS__1 Replicas = 1
|
|
REPLICAS__3 Replicas = 3
|
|
)
|
|
|
|
// All allowed values of Replicas enum
|
|
var AllowedReplicasEnumValues = []Replicas{
|
|
1,
|
|
3,
|
|
}
|
|
|
|
func (v *Replicas) UnmarshalJSON(src []byte) error {
|
|
var value int32
|
|
err := json.Unmarshal(src, &value)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Allow unmarshalling zero value for testing purposes
|
|
var zeroValue int32
|
|
if value == zeroValue {
|
|
return nil
|
|
}
|
|
enumTypeValue := Replicas(value)
|
|
for _, existing := range AllowedReplicasEnumValues {
|
|
if existing == enumTypeValue {
|
|
*v = enumTypeValue
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return fmt.Errorf("%+v is not a valid Replicas", value)
|
|
}
|
|
|
|
// NewReplicasFromValue returns a pointer to a valid Replicas
|
|
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
|
func NewReplicasFromValue(v int32) (*Replicas, error) {
|
|
ev := Replicas(v)
|
|
if ev.IsValid() {
|
|
return &ev, nil
|
|
} else {
|
|
return nil, fmt.Errorf("invalid value '%v' for Replicas: valid values are %v", v, AllowedReplicasEnumValues)
|
|
}
|
|
}
|
|
|
|
// IsValid return true if the value is valid for the enum, false otherwise
|
|
func (v Replicas) IsValid() bool {
|
|
for _, existing := range AllowedReplicasEnumValues {
|
|
if existing == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Ptr returns reference to replicas value
|
|
func (v Replicas) Ptr() *Replicas {
|
|
return &v
|
|
}
|
|
|
|
type NullableReplicas struct {
|
|
value *Replicas
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableReplicas) Get() *Replicas {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableReplicas) Set(val *Replicas) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableReplicas) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableReplicas) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableReplicas(val *Replicas) *NullableReplicas {
|
|
return &NullableReplicas{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableReplicas) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableReplicas) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|