terraform-provider-stackitp.../pkg/vpnalpha/model_tunnel_configuration_phase2_all_of.go
Marcel S. Henselin 9f41c4da7f
Some checks failed
Publish / Check GoReleaser config (push) Successful in 4s
Release / goreleaser (push) Failing after 29s
Publish / Publish provider (push) Failing after 4m24s
feat: auto generated files and new structure (#4)
## 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>
2026-01-29 14:10:25 +00:00

446 lines
18 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 TunnelConfigurationPhase2AllOf type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TunnelConfigurationPhase2AllOf{}
/*
types and functions for dpdAction
*/
// isEnum
// TunnelConfigurationPhase2AllOfDpdAction Action to perform for this CHILD_SA on DPD timeout. \"clear\": Closes the CHILD_SA and does not take further action. \"trap\": installs a trap policy which will catch matching traffic and tries to re-negotiate the tunnel on-demand). \"restart\": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA.
// value type for enums
type TunnelConfigurationPhase2AllOfDpdAction string
// List of DpdAction
const (
TUNNELCONFIGURATIONPHASE2ALLOFDPD_ACTION_CLEAR TunnelConfigurationPhase2AllOfDpdAction = "clear"
TUNNELCONFIGURATIONPHASE2ALLOFDPD_ACTION_TRAP TunnelConfigurationPhase2AllOfDpdAction = "trap"
TUNNELCONFIGURATIONPHASE2ALLOFDPD_ACTION_RESTART TunnelConfigurationPhase2AllOfDpdAction = "restart"
)
// All allowed values of TunnelConfigurationPhase2AllOf enum
var AllowedTunnelConfigurationPhase2AllOfDpdActionEnumValues = []TunnelConfigurationPhase2AllOfDpdAction{
"clear",
"trap",
"restart",
}
func (v *TunnelConfigurationPhase2AllOfDpdAction) 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 TunnelConfigurationPhase2AllOfDpdAction
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 := TunnelConfigurationPhase2AllOfDpdAction(value)
for _, existing := range AllowedTunnelConfigurationPhase2AllOfDpdActionEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid TunnelConfigurationPhase2AllOf", value)
}
// NewTunnelConfigurationPhase2AllOfDpdActionFromValue returns a pointer to a valid TunnelConfigurationPhase2AllOfDpdAction
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewTunnelConfigurationPhase2AllOfDpdActionFromValue(v TunnelConfigurationPhase2AllOfDpdAction) (*TunnelConfigurationPhase2AllOfDpdAction, error) {
ev := TunnelConfigurationPhase2AllOfDpdAction(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for TunnelConfigurationPhase2AllOfDpdAction: valid values are %v", v, AllowedTunnelConfigurationPhase2AllOfDpdActionEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v TunnelConfigurationPhase2AllOfDpdAction) IsValid() bool {
for _, existing := range AllowedTunnelConfigurationPhase2AllOfDpdActionEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to DpdActionDpdAction value
func (v TunnelConfigurationPhase2AllOfDpdAction) Ptr() *TunnelConfigurationPhase2AllOfDpdAction {
return &v
}
type NullableTunnelConfigurationPhase2AllOfDpdAction struct {
value *TunnelConfigurationPhase2AllOfDpdAction
isSet bool
}
func (v NullableTunnelConfigurationPhase2AllOfDpdAction) Get() *TunnelConfigurationPhase2AllOfDpdAction {
return v.value
}
func (v *NullableTunnelConfigurationPhase2AllOfDpdAction) Set(val *TunnelConfigurationPhase2AllOfDpdAction) {
v.value = val
v.isSet = true
}
func (v NullableTunnelConfigurationPhase2AllOfDpdAction) IsSet() bool {
return v.isSet
}
func (v *NullableTunnelConfigurationPhase2AllOfDpdAction) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTunnelConfigurationPhase2AllOfDpdAction(val *TunnelConfigurationPhase2AllOfDpdAction) *NullableTunnelConfigurationPhase2AllOfDpdAction {
return &NullableTunnelConfigurationPhase2AllOfDpdAction{value: val, isSet: true}
}
func (v NullableTunnelConfigurationPhase2AllOfDpdAction) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTunnelConfigurationPhase2AllOfDpdAction) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type TunnelConfigurationPhase2AllOfGetDpdActionAttributeType = *TunnelConfigurationPhase2AllOfDpdAction
type TunnelConfigurationPhase2AllOfGetDpdActionArgType = TunnelConfigurationPhase2AllOfDpdAction
type TunnelConfigurationPhase2AllOfGetDpdActionRetType = TunnelConfigurationPhase2AllOfDpdAction
func getTunnelConfigurationPhase2AllOfGetDpdActionAttributeTypeOk(arg TunnelConfigurationPhase2AllOfGetDpdActionAttributeType) (ret TunnelConfigurationPhase2AllOfGetDpdActionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setTunnelConfigurationPhase2AllOfGetDpdActionAttributeType(arg *TunnelConfigurationPhase2AllOfGetDpdActionAttributeType, val TunnelConfigurationPhase2AllOfGetDpdActionRetType) {
*arg = &val
}
/*
types and functions for rekeyTime
*/
// isInteger
type TunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType = *int64
type TunnelConfigurationPhase2AllOfGetRekeyTimeArgType = int64
type TunnelConfigurationPhase2AllOfGetRekeyTimeRetType = int64
func getTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeTypeOk(arg TunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType) (ret TunnelConfigurationPhase2AllOfGetRekeyTimeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType(arg *TunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType, val TunnelConfigurationPhase2AllOfGetRekeyTimeRetType) {
*arg = &val
}
/*
types and functions for startAction
*/
// isEnum
// TunnelConfigurationPhase2AllOfStartAction Action to perform after loading the connection configuration. \"none\": The connection will be loaded but needs to be manually initiated. \"trap\": installs a trap policy which triggers the tunnel as soon as matching traffic has been detected. \"start\": initiates the connection actively. \"start|stop\": Immediately initiate a connection for which trap policies have been installed.
// value type for enums
type TunnelConfigurationPhase2AllOfStartAction string
// List of StartAction
const (
TUNNELCONFIGURATIONPHASE2ALLOFSTART_ACTION_NONE TunnelConfigurationPhase2AllOfStartAction = "none"
TUNNELCONFIGURATIONPHASE2ALLOFSTART_ACTION_TRAP TunnelConfigurationPhase2AllOfStartAction = "trap"
TUNNELCONFIGURATIONPHASE2ALLOFSTART_ACTION_START TunnelConfigurationPhase2AllOfStartAction = "start"
TUNNELCONFIGURATIONPHASE2ALLOFSTART_ACTION_TRAP_START TunnelConfigurationPhase2AllOfStartAction = "trap|start"
)
// All allowed values of TunnelConfigurationPhase2AllOf enum
var AllowedTunnelConfigurationPhase2AllOfStartActionEnumValues = []TunnelConfigurationPhase2AllOfStartAction{
"none",
"trap",
"start",
"trap|start",
}
func (v *TunnelConfigurationPhase2AllOfStartAction) 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 TunnelConfigurationPhase2AllOfStartAction
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 := TunnelConfigurationPhase2AllOfStartAction(value)
for _, existing := range AllowedTunnelConfigurationPhase2AllOfStartActionEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid TunnelConfigurationPhase2AllOf", value)
}
// NewTunnelConfigurationPhase2AllOfStartActionFromValue returns a pointer to a valid TunnelConfigurationPhase2AllOfStartAction
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewTunnelConfigurationPhase2AllOfStartActionFromValue(v TunnelConfigurationPhase2AllOfStartAction) (*TunnelConfigurationPhase2AllOfStartAction, error) {
ev := TunnelConfigurationPhase2AllOfStartAction(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for TunnelConfigurationPhase2AllOfStartAction: valid values are %v", v, AllowedTunnelConfigurationPhase2AllOfStartActionEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v TunnelConfigurationPhase2AllOfStartAction) IsValid() bool {
for _, existing := range AllowedTunnelConfigurationPhase2AllOfStartActionEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to StartActionStartAction value
func (v TunnelConfigurationPhase2AllOfStartAction) Ptr() *TunnelConfigurationPhase2AllOfStartAction {
return &v
}
type NullableTunnelConfigurationPhase2AllOfStartAction struct {
value *TunnelConfigurationPhase2AllOfStartAction
isSet bool
}
func (v NullableTunnelConfigurationPhase2AllOfStartAction) Get() *TunnelConfigurationPhase2AllOfStartAction {
return v.value
}
func (v *NullableTunnelConfigurationPhase2AllOfStartAction) Set(val *TunnelConfigurationPhase2AllOfStartAction) {
v.value = val
v.isSet = true
}
func (v NullableTunnelConfigurationPhase2AllOfStartAction) IsSet() bool {
return v.isSet
}
func (v *NullableTunnelConfigurationPhase2AllOfStartAction) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTunnelConfigurationPhase2AllOfStartAction(val *TunnelConfigurationPhase2AllOfStartAction) *NullableTunnelConfigurationPhase2AllOfStartAction {
return &NullableTunnelConfigurationPhase2AllOfStartAction{value: val, isSet: true}
}
func (v NullableTunnelConfigurationPhase2AllOfStartAction) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTunnelConfigurationPhase2AllOfStartAction) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type TunnelConfigurationPhase2AllOfGetStartActionAttributeType = *TunnelConfigurationPhase2AllOfStartAction
type TunnelConfigurationPhase2AllOfGetStartActionArgType = TunnelConfigurationPhase2AllOfStartAction
type TunnelConfigurationPhase2AllOfGetStartActionRetType = TunnelConfigurationPhase2AllOfStartAction
func getTunnelConfigurationPhase2AllOfGetStartActionAttributeTypeOk(arg TunnelConfigurationPhase2AllOfGetStartActionAttributeType) (ret TunnelConfigurationPhase2AllOfGetStartActionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setTunnelConfigurationPhase2AllOfGetStartActionAttributeType(arg *TunnelConfigurationPhase2AllOfGetStartActionAttributeType, val TunnelConfigurationPhase2AllOfGetStartActionRetType) {
*arg = &val
}
// TunnelConfigurationPhase2AllOf struct for TunnelConfigurationPhase2AllOf
type TunnelConfigurationPhase2AllOf struct {
// Action to perform for this CHILD_SA on DPD timeout. \"clear\": Closes the CHILD_SA and does not take further action. \"trap\": installs a trap policy which will catch matching traffic and tries to re-negotiate the tunnel on-demand). \"restart\": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA.
DpdAction TunnelConfigurationPhase2AllOfGetDpdActionAttributeType `json:"dpdAction,omitempty"`
// Time to schedule a Child SA re-keying (in seconds).
// Can be cast to int32 without loss of precision.
RekeyTime TunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType `json:"rekeyTime,omitempty"`
// Action to perform after loading the connection configuration. \"none\": The connection will be loaded but needs to be manually initiated. \"trap\": installs a trap policy which triggers the tunnel as soon as matching traffic has been detected. \"start\": initiates the connection actively. \"start|stop\": Immediately initiate a connection for which trap policies have been installed.
StartAction TunnelConfigurationPhase2AllOfGetStartActionAttributeType `json:"startAction,omitempty"`
}
// NewTunnelConfigurationPhase2AllOf instantiates a new TunnelConfigurationPhase2AllOf 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 NewTunnelConfigurationPhase2AllOf() *TunnelConfigurationPhase2AllOf {
this := TunnelConfigurationPhase2AllOf{}
return &this
}
// NewTunnelConfigurationPhase2AllOfWithDefaults instantiates a new TunnelConfigurationPhase2AllOf 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 NewTunnelConfigurationPhase2AllOfWithDefaults() *TunnelConfigurationPhase2AllOf {
this := TunnelConfigurationPhase2AllOf{}
var dpdAction TunnelConfigurationPhase2AllOfDpdAction = "restart"
this.DpdAction = &dpdAction
var rekeyTime int64 = 3600
this.RekeyTime = &rekeyTime
var startAction TunnelConfigurationPhase2AllOfStartAction = "start"
this.StartAction = &startAction
return &this
}
// GetDpdAction returns the DpdAction field value if set, zero value otherwise.
func (o *TunnelConfigurationPhase2AllOf) GetDpdAction() (res TunnelConfigurationPhase2AllOfGetDpdActionRetType) {
res, _ = o.GetDpdActionOk()
return
}
// GetDpdActionOk returns a tuple with the DpdAction field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TunnelConfigurationPhase2AllOf) GetDpdActionOk() (ret TunnelConfigurationPhase2AllOfGetDpdActionRetType, ok bool) {
return getTunnelConfigurationPhase2AllOfGetDpdActionAttributeTypeOk(o.DpdAction)
}
// HasDpdAction returns a boolean if a field has been set.
func (o *TunnelConfigurationPhase2AllOf) HasDpdAction() bool {
_, ok := o.GetDpdActionOk()
return ok
}
// SetDpdAction gets a reference to the given string and assigns it to the DpdAction field.
func (o *TunnelConfigurationPhase2AllOf) SetDpdAction(v TunnelConfigurationPhase2AllOfGetDpdActionRetType) {
setTunnelConfigurationPhase2AllOfGetDpdActionAttributeType(&o.DpdAction, v)
}
// GetRekeyTime returns the RekeyTime field value if set, zero value otherwise.
func (o *TunnelConfigurationPhase2AllOf) GetRekeyTime() (res TunnelConfigurationPhase2AllOfGetRekeyTimeRetType) {
res, _ = o.GetRekeyTimeOk()
return
}
// GetRekeyTimeOk returns a tuple with the RekeyTime field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TunnelConfigurationPhase2AllOf) GetRekeyTimeOk() (ret TunnelConfigurationPhase2AllOfGetRekeyTimeRetType, ok bool) {
return getTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeTypeOk(o.RekeyTime)
}
// HasRekeyTime returns a boolean if a field has been set.
func (o *TunnelConfigurationPhase2AllOf) HasRekeyTime() bool {
_, ok := o.GetRekeyTimeOk()
return ok
}
// SetRekeyTime gets a reference to the given int64 and assigns it to the RekeyTime field.
func (o *TunnelConfigurationPhase2AllOf) SetRekeyTime(v TunnelConfigurationPhase2AllOfGetRekeyTimeRetType) {
setTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType(&o.RekeyTime, v)
}
// GetStartAction returns the StartAction field value if set, zero value otherwise.
func (o *TunnelConfigurationPhase2AllOf) GetStartAction() (res TunnelConfigurationPhase2AllOfGetStartActionRetType) {
res, _ = o.GetStartActionOk()
return
}
// GetStartActionOk returns a tuple with the StartAction field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TunnelConfigurationPhase2AllOf) GetStartActionOk() (ret TunnelConfigurationPhase2AllOfGetStartActionRetType, ok bool) {
return getTunnelConfigurationPhase2AllOfGetStartActionAttributeTypeOk(o.StartAction)
}
// HasStartAction returns a boolean if a field has been set.
func (o *TunnelConfigurationPhase2AllOf) HasStartAction() bool {
_, ok := o.GetStartActionOk()
return ok
}
// SetStartAction gets a reference to the given string and assigns it to the StartAction field.
func (o *TunnelConfigurationPhase2AllOf) SetStartAction(v TunnelConfigurationPhase2AllOfGetStartActionRetType) {
setTunnelConfigurationPhase2AllOfGetStartActionAttributeType(&o.StartAction, v)
}
func (o TunnelConfigurationPhase2AllOf) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getTunnelConfigurationPhase2AllOfGetDpdActionAttributeTypeOk(o.DpdAction); ok {
toSerialize["DpdAction"] = val
}
if val, ok := getTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeTypeOk(o.RekeyTime); ok {
toSerialize["RekeyTime"] = val
}
if val, ok := getTunnelConfigurationPhase2AllOfGetStartActionAttributeTypeOk(o.StartAction); ok {
toSerialize["StartAction"] = val
}
return toSerialize, nil
}
type NullableTunnelConfigurationPhase2AllOf struct {
value *TunnelConfigurationPhase2AllOf
isSet bool
}
func (v NullableTunnelConfigurationPhase2AllOf) Get() *TunnelConfigurationPhase2AllOf {
return v.value
}
func (v *NullableTunnelConfigurationPhase2AllOf) Set(val *TunnelConfigurationPhase2AllOf) {
v.value = val
v.isSet = true
}
func (v NullableTunnelConfigurationPhase2AllOf) IsSet() bool {
return v.isSet
}
func (v *NullableTunnelConfigurationPhase2AllOf) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTunnelConfigurationPhase2AllOf(val *TunnelConfigurationPhase2AllOf) *NullableTunnelConfigurationPhase2AllOf {
return &NullableTunnelConfigurationPhase2AllOf{value: val, isSet: true}
}
func (v NullableTunnelConfigurationPhase2AllOf) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTunnelConfigurationPhase2AllOf) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}