terraform-provider-stackitp.../pkg/vpnalpha/model_tunnel_status.go
2026-01-21 09:07:29 +01:00

373 lines
11 KiB
Go

/*
STACKIT VPN API
The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project.
API version: 1alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package vpnalpha
import (
"encoding/json"
"fmt"
)
// checks if the TunnelStatus type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TunnelStatus{}
/*
types and functions for established
*/
// isBoolean
type TunnelStatusgetEstablishedAttributeType = *bool
type TunnelStatusgetEstablishedArgType = bool
type TunnelStatusgetEstablishedRetType = bool
func getTunnelStatusgetEstablishedAttributeTypeOk(arg TunnelStatusgetEstablishedAttributeType) (ret TunnelStatusgetEstablishedRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setTunnelStatusgetEstablishedAttributeType(arg *TunnelStatusgetEstablishedAttributeType, val TunnelStatusgetEstablishedRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isEnum
// TunnelStatusName the model 'TunnelStatus'
// value type for enums
type TunnelStatusName string
// List of Name
const (
TUNNELSTATUSNAME_TUNNEL1 TunnelStatusName = "tunnel1"
TUNNELSTATUSNAME_TUNNEL2 TunnelStatusName = "tunnel2"
)
// All allowed values of TunnelStatus enum
var AllowedTunnelStatusNameEnumValues = []TunnelStatusName{
"tunnel1",
"tunnel2",
}
func (v *TunnelStatusName) 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 TunnelStatusName
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 := TunnelStatusName(value)
for _, existing := range AllowedTunnelStatusNameEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid TunnelStatus", value)
}
// NewTunnelStatusNameFromValue returns a pointer to a valid TunnelStatusName
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewTunnelStatusNameFromValue(v TunnelStatusName) (*TunnelStatusName, error) {
ev := TunnelStatusName(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for TunnelStatusName: valid values are %v", v, AllowedTunnelStatusNameEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v TunnelStatusName) IsValid() bool {
for _, existing := range AllowedTunnelStatusNameEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to NameName value
func (v TunnelStatusName) Ptr() *TunnelStatusName {
return &v
}
type NullableTunnelStatusName struct {
value *TunnelStatusName
isSet bool
}
func (v NullableTunnelStatusName) Get() *TunnelStatusName {
return v.value
}
func (v *NullableTunnelStatusName) Set(val *TunnelStatusName) {
v.value = val
v.isSet = true
}
func (v NullableTunnelStatusName) IsSet() bool {
return v.isSet
}
func (v *NullableTunnelStatusName) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTunnelStatusName(val *TunnelStatusName) *NullableTunnelStatusName {
return &NullableTunnelStatusName{value: val, isSet: true}
}
func (v NullableTunnelStatusName) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTunnelStatusName) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type TunnelStatusGetNameAttributeType = *TunnelStatusName
type TunnelStatusGetNameArgType = TunnelStatusName
type TunnelStatusGetNameRetType = TunnelStatusName
func getTunnelStatusGetNameAttributeTypeOk(arg TunnelStatusGetNameAttributeType) (ret TunnelStatusGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setTunnelStatusGetNameAttributeType(arg *TunnelStatusGetNameAttributeType, val TunnelStatusGetNameRetType) {
*arg = &val
}
/*
types and functions for phase1
*/
// isModel
type TunnelStatusGetPhase1AttributeType = *Phase1Status
type TunnelStatusGetPhase1ArgType = Phase1Status
type TunnelStatusGetPhase1RetType = Phase1Status
func getTunnelStatusGetPhase1AttributeTypeOk(arg TunnelStatusGetPhase1AttributeType) (ret TunnelStatusGetPhase1RetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setTunnelStatusGetPhase1AttributeType(arg *TunnelStatusGetPhase1AttributeType, val TunnelStatusGetPhase1RetType) {
*arg = &val
}
/*
types and functions for phase2
*/
// isModel
type TunnelStatusGetPhase2AttributeType = *Phase2Status
type TunnelStatusGetPhase2ArgType = Phase2Status
type TunnelStatusGetPhase2RetType = Phase2Status
func getTunnelStatusGetPhase2AttributeTypeOk(arg TunnelStatusGetPhase2AttributeType) (ret TunnelStatusGetPhase2RetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setTunnelStatusGetPhase2AttributeType(arg *TunnelStatusGetPhase2AttributeType, val TunnelStatusGetPhase2RetType) {
*arg = &val
}
// TunnelStatus Describes the status of the VPN itself.
type TunnelStatus struct {
Established TunnelStatusgetEstablishedAttributeType `json:"established,omitempty"`
Name TunnelStatusGetNameAttributeType `json:"name,omitempty"`
Phase1 TunnelStatusGetPhase1AttributeType `json:"phase1,omitempty"`
Phase2 TunnelStatusGetPhase2AttributeType `json:"phase2,omitempty"`
}
// NewTunnelStatus instantiates a new TunnelStatus 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 NewTunnelStatus() *TunnelStatus {
this := TunnelStatus{}
return &this
}
// NewTunnelStatusWithDefaults instantiates a new TunnelStatus 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 NewTunnelStatusWithDefaults() *TunnelStatus {
this := TunnelStatus{}
return &this
}
// GetEstablished returns the Established field value if set, zero value otherwise.
func (o *TunnelStatus) GetEstablished() (res TunnelStatusgetEstablishedRetType) {
res, _ = o.GetEstablishedOk()
return
}
// GetEstablishedOk returns a tuple with the Established field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TunnelStatus) GetEstablishedOk() (ret TunnelStatusgetEstablishedRetType, ok bool) {
return getTunnelStatusgetEstablishedAttributeTypeOk(o.Established)
}
// HasEstablished returns a boolean if a field has been set.
func (o *TunnelStatus) HasEstablished() bool {
_, ok := o.GetEstablishedOk()
return ok
}
// SetEstablished gets a reference to the given bool and assigns it to the Established field.
func (o *TunnelStatus) SetEstablished(v TunnelStatusgetEstablishedRetType) {
setTunnelStatusgetEstablishedAttributeType(&o.Established, v)
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *TunnelStatus) GetName() (res TunnelStatusGetNameRetType) {
res, _ = o.GetNameOk()
return
}
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TunnelStatus) GetNameOk() (ret TunnelStatusGetNameRetType, ok bool) {
return getTunnelStatusGetNameAttributeTypeOk(o.Name)
}
// HasName returns a boolean if a field has been set.
func (o *TunnelStatus) HasName() bool {
_, ok := o.GetNameOk()
return ok
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *TunnelStatus) SetName(v TunnelStatusGetNameRetType) {
setTunnelStatusGetNameAttributeType(&o.Name, v)
}
// GetPhase1 returns the Phase1 field value if set, zero value otherwise.
func (o *TunnelStatus) GetPhase1() (res TunnelStatusGetPhase1RetType) {
res, _ = o.GetPhase1Ok()
return
}
// GetPhase1Ok returns a tuple with the Phase1 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TunnelStatus) GetPhase1Ok() (ret TunnelStatusGetPhase1RetType, ok bool) {
return getTunnelStatusGetPhase1AttributeTypeOk(o.Phase1)
}
// HasPhase1 returns a boolean if a field has been set.
func (o *TunnelStatus) HasPhase1() bool {
_, ok := o.GetPhase1Ok()
return ok
}
// SetPhase1 gets a reference to the given Phase1Status and assigns it to the Phase1 field.
func (o *TunnelStatus) SetPhase1(v TunnelStatusGetPhase1RetType) {
setTunnelStatusGetPhase1AttributeType(&o.Phase1, v)
}
// GetPhase2 returns the Phase2 field value if set, zero value otherwise.
func (o *TunnelStatus) GetPhase2() (res TunnelStatusGetPhase2RetType) {
res, _ = o.GetPhase2Ok()
return
}
// GetPhase2Ok returns a tuple with the Phase2 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TunnelStatus) GetPhase2Ok() (ret TunnelStatusGetPhase2RetType, ok bool) {
return getTunnelStatusGetPhase2AttributeTypeOk(o.Phase2)
}
// HasPhase2 returns a boolean if a field has been set.
func (o *TunnelStatus) HasPhase2() bool {
_, ok := o.GetPhase2Ok()
return ok
}
// SetPhase2 gets a reference to the given Phase2Status and assigns it to the Phase2 field.
func (o *TunnelStatus) SetPhase2(v TunnelStatusGetPhase2RetType) {
setTunnelStatusGetPhase2AttributeType(&o.Phase2, v)
}
func (o TunnelStatus) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getTunnelStatusgetEstablishedAttributeTypeOk(o.Established); ok {
toSerialize["Established"] = val
}
if val, ok := getTunnelStatusGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getTunnelStatusGetPhase1AttributeTypeOk(o.Phase1); ok {
toSerialize["Phase1"] = val
}
if val, ok := getTunnelStatusGetPhase2AttributeTypeOk(o.Phase2); ok {
toSerialize["Phase2"] = val
}
return toSerialize, nil
}
type NullableTunnelStatus struct {
value *TunnelStatus
isSet bool
}
func (v NullableTunnelStatus) Get() *TunnelStatus {
return v.value
}
func (v *NullableTunnelStatus) Set(val *TunnelStatus) {
v.value = val
v.isSet = true
}
func (v NullableTunnelStatus) IsSet() bool {
return v.isSet
}
func (v *NullableTunnelStatus) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTunnelStatus(val *TunnelStatus) *NullableTunnelStatus {
return &NullableTunnelStatus{value: val, isSet: true}
}
func (v NullableTunnelStatus) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTunnelStatus) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}