## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
385 lines
11 KiB
Go
385 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 VPNTunnels type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &VPNTunnels{}
|
|
|
|
/*
|
|
types and functions for bgpStatus
|
|
*/
|
|
|
|
// isModel
|
|
type VPNTunnelsGetBgpStatusAttributeType = *NullableBGPStatus
|
|
type VPNTunnelsGetBgpStatusArgType = *NullableBGPStatus
|
|
type VPNTunnelsGetBgpStatusRetType = *NullableBGPStatus
|
|
|
|
func getVPNTunnelsGetBgpStatusAttributeTypeOk(arg VPNTunnelsGetBgpStatusAttributeType) (ret VPNTunnelsGetBgpStatusRetType, ok bool) {
|
|
if arg == nil {
|
|
return nil, false
|
|
}
|
|
return arg, true
|
|
}
|
|
|
|
func setVPNTunnelsGetBgpStatusAttributeType(arg *VPNTunnelsGetBgpStatusAttributeType, val VPNTunnelsGetBgpStatusRetType) {
|
|
*arg = val
|
|
}
|
|
|
|
/*
|
|
types and functions for instanceState
|
|
*/
|
|
|
|
// isEnumRef
|
|
type VPNTunnelsGetInstanceStateAttributeType = *GatewayStatus
|
|
type VPNTunnelsGetInstanceStateArgType = GatewayStatus
|
|
type VPNTunnelsGetInstanceStateRetType = GatewayStatus
|
|
|
|
func getVPNTunnelsGetInstanceStateAttributeTypeOk(arg VPNTunnelsGetInstanceStateAttributeType) (ret VPNTunnelsGetInstanceStateRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setVPNTunnelsGetInstanceStateAttributeType(arg *VPNTunnelsGetInstanceStateAttributeType, val VPNTunnelsGetInstanceStateRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for name
|
|
*/
|
|
|
|
// isEnum
|
|
|
|
// VPNTunnelsName the model 'VPNTunnels'
|
|
// value type for enums
|
|
type VPNTunnelsName string
|
|
|
|
// List of Name
|
|
const (
|
|
VPNTUNNELSNAME_TUNNEL1 VPNTunnelsName = "tunnel1"
|
|
VPNTUNNELSNAME_TUNNEL2 VPNTunnelsName = "tunnel2"
|
|
)
|
|
|
|
// All allowed values of VPNTunnels enum
|
|
var AllowedVPNTunnelsNameEnumValues = []VPNTunnelsName{
|
|
"tunnel1",
|
|
"tunnel2",
|
|
}
|
|
|
|
func (v *VPNTunnelsName) 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 VPNTunnelsName
|
|
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 := VPNTunnelsName(value)
|
|
for _, existing := range AllowedVPNTunnelsNameEnumValues {
|
|
if existing == enumTypeValue {
|
|
*v = enumTypeValue
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return fmt.Errorf("%+v is not a valid VPNTunnels", value)
|
|
}
|
|
|
|
// NewVPNTunnelsNameFromValue returns a pointer to a valid VPNTunnelsName
|
|
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
|
func NewVPNTunnelsNameFromValue(v VPNTunnelsName) (*VPNTunnelsName, error) {
|
|
ev := VPNTunnelsName(v)
|
|
if ev.IsValid() {
|
|
return &ev, nil
|
|
} else {
|
|
return nil, fmt.Errorf("invalid value '%v' for VPNTunnelsName: valid values are %v", v, AllowedVPNTunnelsNameEnumValues)
|
|
}
|
|
}
|
|
|
|
// IsValid return true if the value is valid for the enum, false otherwise
|
|
func (v VPNTunnelsName) IsValid() bool {
|
|
for _, existing := range AllowedVPNTunnelsNameEnumValues {
|
|
if existing == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Ptr returns reference to NameName value
|
|
func (v VPNTunnelsName) Ptr() *VPNTunnelsName {
|
|
return &v
|
|
}
|
|
|
|
type NullableVPNTunnelsName struct {
|
|
value *VPNTunnelsName
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableVPNTunnelsName) Get() *VPNTunnelsName {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableVPNTunnelsName) Set(val *VPNTunnelsName) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableVPNTunnelsName) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableVPNTunnelsName) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableVPNTunnelsName(val *VPNTunnelsName) *NullableVPNTunnelsName {
|
|
return &NullableVPNTunnelsName{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableVPNTunnelsName) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableVPNTunnelsName) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
type VPNTunnelsGetNameAttributeType = *VPNTunnelsName
|
|
type VPNTunnelsGetNameArgType = VPNTunnelsName
|
|
type VPNTunnelsGetNameRetType = VPNTunnelsName
|
|
|
|
func getVPNTunnelsGetNameAttributeTypeOk(arg VPNTunnelsGetNameAttributeType) (ret VPNTunnelsGetNameRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setVPNTunnelsGetNameAttributeType(arg *VPNTunnelsGetNameAttributeType, val VPNTunnelsGetNameRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for publicIP
|
|
*/
|
|
|
|
// isNotNullableString
|
|
type VPNTunnelsGetPublicIPAttributeType = *string
|
|
|
|
func getVPNTunnelsGetPublicIPAttributeTypeOk(arg VPNTunnelsGetPublicIPAttributeType) (ret VPNTunnelsGetPublicIPRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setVPNTunnelsGetPublicIPAttributeType(arg *VPNTunnelsGetPublicIPAttributeType, val VPNTunnelsGetPublicIPRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
type VPNTunnelsGetPublicIPArgType = string
|
|
type VPNTunnelsGetPublicIPRetType = string
|
|
|
|
// VPNTunnels List all available tunnels with public IP and status
|
|
type VPNTunnels struct {
|
|
BgpStatus VPNTunnelsGetBgpStatusAttributeType `json:"bgpStatus,omitempty"`
|
|
InstanceState VPNTunnelsGetInstanceStateAttributeType `json:"instanceState,omitempty"`
|
|
Name VPNTunnelsGetNameAttributeType `json:"name,omitempty"`
|
|
PublicIP VPNTunnelsGetPublicIPAttributeType `json:"publicIP,omitempty"`
|
|
}
|
|
|
|
// NewVPNTunnels instantiates a new VPNTunnels 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 NewVPNTunnels() *VPNTunnels {
|
|
this := VPNTunnels{}
|
|
return &this
|
|
}
|
|
|
|
// NewVPNTunnelsWithDefaults instantiates a new VPNTunnels 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 NewVPNTunnelsWithDefaults() *VPNTunnels {
|
|
this := VPNTunnels{}
|
|
return &this
|
|
}
|
|
|
|
// GetBgpStatus returns the BgpStatus field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *VPNTunnels) GetBgpStatus() (res VPNTunnelsGetBgpStatusRetType) {
|
|
res, _ = o.GetBgpStatusOk()
|
|
return
|
|
}
|
|
|
|
// GetBgpStatusOk returns a tuple with the BgpStatus field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *VPNTunnels) GetBgpStatusOk() (ret VPNTunnelsGetBgpStatusRetType, ok bool) {
|
|
return getVPNTunnelsGetBgpStatusAttributeTypeOk(o.BgpStatus)
|
|
}
|
|
|
|
// HasBgpStatus returns a boolean if a field has been set.
|
|
func (o *VPNTunnels) HasBgpStatus() bool {
|
|
_, ok := o.GetBgpStatusOk()
|
|
return ok
|
|
}
|
|
|
|
// SetBgpStatus gets a reference to the given BGPStatus and assigns it to the BgpStatus field.
|
|
func (o *VPNTunnels) SetBgpStatus(v VPNTunnelsGetBgpStatusRetType) {
|
|
setVPNTunnelsGetBgpStatusAttributeType(&o.BgpStatus, v)
|
|
}
|
|
|
|
// SetBgpStatusNil sets the value for BgpStatus to be an explicit nil
|
|
func (o *VPNTunnels) SetBgpStatusNil() {
|
|
o.BgpStatus = nil
|
|
}
|
|
|
|
// UnsetBgpStatus ensures that no value is present for BgpStatus, not even an explicit nil
|
|
func (o *VPNTunnels) UnsetBgpStatus() {
|
|
o.BgpStatus = nil
|
|
}
|
|
|
|
// GetInstanceState returns the InstanceState field value if set, zero value otherwise.
|
|
func (o *VPNTunnels) GetInstanceState() (res VPNTunnelsGetInstanceStateRetType) {
|
|
res, _ = o.GetInstanceStateOk()
|
|
return
|
|
}
|
|
|
|
// GetInstanceStateOk returns a tuple with the InstanceState field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *VPNTunnels) GetInstanceStateOk() (ret VPNTunnelsGetInstanceStateRetType, ok bool) {
|
|
return getVPNTunnelsGetInstanceStateAttributeTypeOk(o.InstanceState)
|
|
}
|
|
|
|
// HasInstanceState returns a boolean if a field has been set.
|
|
func (o *VPNTunnels) HasInstanceState() bool {
|
|
_, ok := o.GetInstanceStateOk()
|
|
return ok
|
|
}
|
|
|
|
// SetInstanceState gets a reference to the given GatewayStatus and assigns it to the InstanceState field.
|
|
func (o *VPNTunnels) SetInstanceState(v VPNTunnelsGetInstanceStateRetType) {
|
|
setVPNTunnelsGetInstanceStateAttributeType(&o.InstanceState, v)
|
|
}
|
|
|
|
// GetName returns the Name field value if set, zero value otherwise.
|
|
func (o *VPNTunnels) GetName() (res VPNTunnelsGetNameRetType) {
|
|
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 *VPNTunnels) GetNameOk() (ret VPNTunnelsGetNameRetType, ok bool) {
|
|
return getVPNTunnelsGetNameAttributeTypeOk(o.Name)
|
|
}
|
|
|
|
// HasName returns a boolean if a field has been set.
|
|
func (o *VPNTunnels) HasName() bool {
|
|
_, ok := o.GetNameOk()
|
|
return ok
|
|
}
|
|
|
|
// SetName gets a reference to the given string and assigns it to the Name field.
|
|
func (o *VPNTunnels) SetName(v VPNTunnelsGetNameRetType) {
|
|
setVPNTunnelsGetNameAttributeType(&o.Name, v)
|
|
}
|
|
|
|
// GetPublicIP returns the PublicIP field value if set, zero value otherwise.
|
|
func (o *VPNTunnels) GetPublicIP() (res VPNTunnelsGetPublicIPRetType) {
|
|
res, _ = o.GetPublicIPOk()
|
|
return
|
|
}
|
|
|
|
// GetPublicIPOk returns a tuple with the PublicIP field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *VPNTunnels) GetPublicIPOk() (ret VPNTunnelsGetPublicIPRetType, ok bool) {
|
|
return getVPNTunnelsGetPublicIPAttributeTypeOk(o.PublicIP)
|
|
}
|
|
|
|
// HasPublicIP returns a boolean if a field has been set.
|
|
func (o *VPNTunnels) HasPublicIP() bool {
|
|
_, ok := o.GetPublicIPOk()
|
|
return ok
|
|
}
|
|
|
|
// SetPublicIP gets a reference to the given string and assigns it to the PublicIP field.
|
|
func (o *VPNTunnels) SetPublicIP(v VPNTunnelsGetPublicIPRetType) {
|
|
setVPNTunnelsGetPublicIPAttributeType(&o.PublicIP, v)
|
|
}
|
|
|
|
func (o VPNTunnels) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if val, ok := getVPNTunnelsGetBgpStatusAttributeTypeOk(o.BgpStatus); ok {
|
|
toSerialize["BgpStatus"] = val
|
|
}
|
|
if val, ok := getVPNTunnelsGetInstanceStateAttributeTypeOk(o.InstanceState); ok {
|
|
toSerialize["InstanceState"] = val
|
|
}
|
|
if val, ok := getVPNTunnelsGetNameAttributeTypeOk(o.Name); ok {
|
|
toSerialize["Name"] = val
|
|
}
|
|
if val, ok := getVPNTunnelsGetPublicIPAttributeTypeOk(o.PublicIP); ok {
|
|
toSerialize["PublicIP"] = val
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
type NullableVPNTunnels struct {
|
|
value *VPNTunnels
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableVPNTunnels) Get() *VPNTunnels {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableVPNTunnels) Set(val *VPNTunnels) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableVPNTunnels) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableVPNTunnels) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableVPNTunnels(val *VPNTunnels) *NullableVPNTunnels {
|
|
return &NullableVPNTunnels{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableVPNTunnels) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableVPNTunnels) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|