233 lines
7.1 KiB
Go
233 lines
7.1 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"
|
|
)
|
|
|
|
// checks if the InstanceNetwork type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &InstanceNetwork{}
|
|
|
|
/*
|
|
types and functions for accessScope
|
|
*/
|
|
|
|
// isEnum
|
|
|
|
// InstanceNetworkAccessScope The access scope of the instance. It defines if the instance is public or airgapped.
|
|
// value type for enums
|
|
type InstanceNetworkAccessScope string
|
|
|
|
// List of AccessScope
|
|
const (
|
|
INSTANCENETWORKACCESS_SCOPE_PUBLIC InstanceNetworkAccessScope = "PUBLIC"
|
|
INSTANCENETWORKACCESS_SCOPE_SNA InstanceNetworkAccessScope = "SNA"
|
|
)
|
|
|
|
// All allowed values of InstanceNetwork enum
|
|
var AllowedInstanceNetworkAccessScopeEnumValues = []InstanceNetworkAccessScope{
|
|
"PUBLIC",
|
|
"SNA",
|
|
}
|
|
|
|
func (v *InstanceNetworkAccessScope) UnmarshalJSON(src []byte) error {
|
|
// use a type alias to prevent infinite recursion during unmarshal,
|
|
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
|
|
type TmpJson InstanceNetworkAccessScope
|
|
var value TmpJson
|
|
err := json.Unmarshal(src, &value)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Allow unmarshalling zero value for testing purposes
|
|
var zeroValue TmpJson
|
|
if value == zeroValue {
|
|
return nil
|
|
}
|
|
enumTypeValue := InstanceNetworkAccessScope(value)
|
|
for _, existing := range AllowedInstanceNetworkAccessScopeEnumValues {
|
|
if existing == enumTypeValue {
|
|
*v = enumTypeValue
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return fmt.Errorf("%+v is not a valid InstanceNetwork", value)
|
|
}
|
|
|
|
// NewInstanceNetworkAccessScopeFromValue returns a pointer to a valid InstanceNetworkAccessScope
|
|
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
|
func NewInstanceNetworkAccessScopeFromValue(v InstanceNetworkAccessScope) (*InstanceNetworkAccessScope, error) {
|
|
ev := InstanceNetworkAccessScope(v)
|
|
if ev.IsValid() {
|
|
return &ev, nil
|
|
} else {
|
|
return nil, fmt.Errorf("invalid value '%v' for InstanceNetworkAccessScope: valid values are %v", v, AllowedInstanceNetworkAccessScopeEnumValues)
|
|
}
|
|
}
|
|
|
|
// IsValid return true if the value is valid for the enum, false otherwise
|
|
func (v InstanceNetworkAccessScope) IsValid() bool {
|
|
for _, existing := range AllowedInstanceNetworkAccessScopeEnumValues {
|
|
if existing == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Ptr returns reference to AccessScopeAccessScope value
|
|
func (v InstanceNetworkAccessScope) Ptr() *InstanceNetworkAccessScope {
|
|
return &v
|
|
}
|
|
|
|
type NullableInstanceNetworkAccessScope struct {
|
|
value *InstanceNetworkAccessScope
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableInstanceNetworkAccessScope) Get() *InstanceNetworkAccessScope {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableInstanceNetworkAccessScope) Set(val *InstanceNetworkAccessScope) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableInstanceNetworkAccessScope) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableInstanceNetworkAccessScope) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableInstanceNetworkAccessScope(val *InstanceNetworkAccessScope) *NullableInstanceNetworkAccessScope {
|
|
return &NullableInstanceNetworkAccessScope{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableInstanceNetworkAccessScope) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableInstanceNetworkAccessScope) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
type InstanceNetworkGetAccessScopeAttributeType = *InstanceNetworkAccessScope
|
|
type InstanceNetworkGetAccessScopeArgType = InstanceNetworkAccessScope
|
|
type InstanceNetworkGetAccessScopeRetType = InstanceNetworkAccessScope
|
|
|
|
func getInstanceNetworkGetAccessScopeAttributeTypeOk(arg InstanceNetworkGetAccessScopeAttributeType) (ret InstanceNetworkGetAccessScopeRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setInstanceNetworkGetAccessScopeAttributeType(arg *InstanceNetworkGetAccessScopeAttributeType, val InstanceNetworkGetAccessScopeRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
// InstanceNetwork The network configuration of the instance. ⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.
|
|
type InstanceNetwork struct {
|
|
// The access scope of the instance. It defines if the instance is public or airgapped.
|
|
// REQUIRED
|
|
AccessScope InstanceNetworkGetAccessScopeAttributeType `json:"accessScope" required:"true"`
|
|
}
|
|
|
|
type _InstanceNetwork InstanceNetwork
|
|
|
|
// NewInstanceNetwork instantiates a new InstanceNetwork object
|
|
// This constructor will assign default values to properties that have it defined,
|
|
// and makes sure properties required by API are set, but the set of arguments
|
|
// will change when the set of required properties is changed
|
|
func NewInstanceNetwork(accessScope InstanceNetworkGetAccessScopeArgType) *InstanceNetwork {
|
|
this := InstanceNetwork{}
|
|
setInstanceNetworkGetAccessScopeAttributeType(&this.AccessScope, accessScope)
|
|
return &this
|
|
}
|
|
|
|
// NewInstanceNetworkWithDefaults instantiates a new InstanceNetwork object
|
|
// This constructor will only assign default values to properties that have it defined,
|
|
// but it doesn't guarantee that properties required by API are set
|
|
func NewInstanceNetworkWithDefaults() *InstanceNetwork {
|
|
this := InstanceNetwork{}
|
|
var accessScope InstanceNetworkAccessScope = "PUBLIC"
|
|
this.AccessScope = &accessScope
|
|
return &this
|
|
}
|
|
|
|
// GetAccessScope returns the AccessScope field value
|
|
func (o *InstanceNetwork) GetAccessScope() (ret InstanceNetworkGetAccessScopeRetType) {
|
|
ret, _ = o.GetAccessScopeOk()
|
|
return ret
|
|
}
|
|
|
|
// GetAccessScopeOk returns a tuple with the AccessScope field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *InstanceNetwork) GetAccessScopeOk() (ret InstanceNetworkGetAccessScopeRetType, ok bool) {
|
|
return getInstanceNetworkGetAccessScopeAttributeTypeOk(o.AccessScope)
|
|
}
|
|
|
|
// SetAccessScope sets field value
|
|
func (o *InstanceNetwork) SetAccessScope(v InstanceNetworkGetAccessScopeRetType) {
|
|
setInstanceNetworkGetAccessScopeAttributeType(&o.AccessScope, v)
|
|
}
|
|
|
|
func (o InstanceNetwork) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if val, ok := getInstanceNetworkGetAccessScopeAttributeTypeOk(o.AccessScope); ok {
|
|
toSerialize["AccessScope"] = val
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
type NullableInstanceNetwork struct {
|
|
value *InstanceNetwork
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableInstanceNetwork) Get() *InstanceNetwork {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableInstanceNetwork) Set(val *InstanceNetwork) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableInstanceNetwork) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableInstanceNetwork) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableInstanceNetwork(val *InstanceNetwork) *NullableInstanceNetwork {
|
|
return &NullableInstanceNetwork{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableInstanceNetwork) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableInstanceNetwork) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|