From 992dea79a12b6b93f9b14762aacc8479fece1550 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 16 Jul 2026 08:56:16 +0000 Subject: [PATCH] Generate vpn --- services/vpn/oas_commit | 2 +- .../model_create_gateway_payload.go | 39 +- services/vpn/v1alpha1api/model_gateway.go | 39 +- .../vpn/v1alpha1api/model_gateway_response.go | 39 +- .../vpn/v1alpha1api/model_network_config.go | 192 ++ .../model_update_gateway_payload.go | 39 +- services/vpn/v1api/api_default.go | 2880 ++++++++++++++--- services/vpn/v1api/api_default_mock.go | 229 ++ .../v1api/model_api_error_detail_reason.go | 4 +- services/vpn/v1api/model_bgp_filter.go | 205 ++ services/vpn/v1api/model_bgp_filter_list.go | 166 + services/vpn/v1api/model_bgp_filter_rule.go | 316 ++ .../vpn/v1api/model_bgp_filter_rule_action.go | 113 + .../vpn/v1api/model_bgp_filter_rule_list.go | 166 + .../vpn/v1api/model_bgp_filter_rule_match.go | 382 +++ .../vpn/v1api/model_bgp_filter_rule_set.go | 154 + services/vpn/v1api/model_bgp_tunnel_config.go | 49 + ...model_create_gateway_bgp_filter_payload.go | 205 ++ ..._create_gateway_bgp_filter_rule_payload.go | 316 ++ ..._gateway_bgp_filter_rule_payload_action.go | 113 + ...e_gateway_bgp_filter_rule_payload_match.go | 382 +++ ...ate_gateway_bgp_filter_rule_payload_set.go | 154 + .../vpn/v1api/model_create_gateway_payload.go | 39 +- services/vpn/v1api/model_gateway.go | 39 +- services/vpn/v1api/model_gateway_response.go | 39 +- services/vpn/v1api/model_network_config.go | 192 ++ ...model_update_gateway_bgp_filter_payload.go | 205 ++ ..._update_gateway_bgp_filter_rule_payload.go | 316 ++ ..._gateway_bgp_filter_rule_payload_action.go | 113 + ...e_gateway_bgp_filter_rule_payload_match.go | 382 +++ ...ate_gateway_bgp_filter_rule_payload_set.go | 154 + .../vpn/v1api/model_update_gateway_payload.go | 39 +- .../model_create_gateway_payload.go | 39 +- services/vpn/v1beta1api/model_gateway.go | 39 +- .../vpn/v1beta1api/model_gateway_response.go | 39 +- .../vpn/v1beta1api/model_network_config.go | 192 ++ .../model_update_gateway_payload.go | 39 +- 37 files changed, 7653 insertions(+), 397 deletions(-) create mode 100644 services/vpn/v1alpha1api/model_network_config.go create mode 100644 services/vpn/v1api/model_bgp_filter.go create mode 100644 services/vpn/v1api/model_bgp_filter_list.go create mode 100644 services/vpn/v1api/model_bgp_filter_rule.go create mode 100644 services/vpn/v1api/model_bgp_filter_rule_action.go create mode 100644 services/vpn/v1api/model_bgp_filter_rule_list.go create mode 100644 services/vpn/v1api/model_bgp_filter_rule_match.go create mode 100644 services/vpn/v1api/model_bgp_filter_rule_set.go create mode 100644 services/vpn/v1api/model_create_gateway_bgp_filter_payload.go create mode 100644 services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload.go create mode 100644 services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_action.go create mode 100644 services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_match.go create mode 100644 services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_set.go create mode 100644 services/vpn/v1api/model_network_config.go create mode 100644 services/vpn/v1api/model_update_gateway_bgp_filter_payload.go create mode 100644 services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload.go create mode 100644 services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_action.go create mode 100644 services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_match.go create mode 100644 services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_set.go create mode 100644 services/vpn/v1beta1api/model_network_config.go diff --git a/services/vpn/oas_commit b/services/vpn/oas_commit index ffaaf3db1..f4e71ced1 100644 --- a/services/vpn/oas_commit +++ b/services/vpn/oas_commit @@ -1 +1 @@ -18e00f0b26b2cd1f3403bbf0c2e64e7fe333b4d1 +beeb2da62f7e0fe249320b50f07e328653c67055 diff --git a/services/vpn/v1alpha1api/model_create_gateway_payload.go b/services/vpn/v1alpha1api/model_create_gateway_payload.go index b21102b04..f6c99ada3 100644 --- a/services/vpn/v1alpha1api/model_create_gateway_payload.go +++ b/services/vpn/v1alpha1api/model_create_gateway_payload.go @@ -25,7 +25,8 @@ type CreateGatewayPayload struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkArea *NetworkConfig `json:"networkArea,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *CreateGatewayPayload) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkArea returns the NetworkArea field value if set, zero value otherwise. +func (o *CreateGatewayPayload) GetNetworkArea() NetworkConfig { + if o == nil || IsNil(o.NetworkArea) { + var ret NetworkConfig + return ret + } + return *o.NetworkArea +} + +// GetNetworkAreaOk returns a tuple with the NetworkArea field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayPayload) GetNetworkAreaOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkArea) { + return nil, false + } + return o.NetworkArea, true +} + +// HasNetworkArea returns a boolean if a field has been set. +func (o *CreateGatewayPayload) HasNetworkArea() bool { + if o != nil && !IsNil(o.NetworkArea) { + return true + } + + return false +} + +// SetNetworkArea gets a reference to the given NetworkConfig and assigns it to the NetworkArea field. +func (o *CreateGatewayPayload) SetNetworkArea(v NetworkConfig) { + o.NetworkArea = &v +} + // GetPlanId returns the PlanId field value func (o *CreateGatewayPayload) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o CreateGatewayPayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkArea) { + toSerialize["networkArea"] = o.NetworkArea + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *CreateGatewayPayload) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkArea") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties diff --git a/services/vpn/v1alpha1api/model_gateway.go b/services/vpn/v1alpha1api/model_gateway.go index 41212fece..329e5ee68 100644 --- a/services/vpn/v1alpha1api/model_gateway.go +++ b/services/vpn/v1alpha1api/model_gateway.go @@ -25,7 +25,8 @@ type Gateway struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkArea *NetworkConfig `json:"networkArea,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *Gateway) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkArea returns the NetworkArea field value if set, zero value otherwise. +func (o *Gateway) GetNetworkArea() NetworkConfig { + if o == nil || IsNil(o.NetworkArea) { + var ret NetworkConfig + return ret + } + return *o.NetworkArea +} + +// GetNetworkAreaOk returns a tuple with the NetworkArea field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetNetworkAreaOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkArea) { + return nil, false + } + return o.NetworkArea, true +} + +// HasNetworkArea returns a boolean if a field has been set. +func (o *Gateway) HasNetworkArea() bool { + if o != nil && !IsNil(o.NetworkArea) { + return true + } + + return false +} + +// SetNetworkArea gets a reference to the given NetworkConfig and assigns it to the NetworkArea field. +func (o *Gateway) SetNetworkArea(v NetworkConfig) { + o.NetworkArea = &v +} + // GetPlanId returns the PlanId field value func (o *Gateway) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o Gateway) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkArea) { + toSerialize["networkArea"] = o.NetworkArea + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *Gateway) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkArea") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties diff --git a/services/vpn/v1alpha1api/model_gateway_response.go b/services/vpn/v1alpha1api/model_gateway_response.go index e6cab23a7..b4038c68d 100644 --- a/services/vpn/v1alpha1api/model_gateway_response.go +++ b/services/vpn/v1alpha1api/model_gateway_response.go @@ -25,7 +25,8 @@ type GatewayResponse struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkArea *NetworkConfig `json:"networkArea,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -170,6 +171,38 @@ func (o *GatewayResponse) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkArea returns the NetworkArea field value if set, zero value otherwise. +func (o *GatewayResponse) GetNetworkArea() NetworkConfig { + if o == nil || IsNil(o.NetworkArea) { + var ret NetworkConfig + return ret + } + return *o.NetworkArea +} + +// GetNetworkAreaOk returns a tuple with the NetworkArea field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetNetworkAreaOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkArea) { + return nil, false + } + return o.NetworkArea, true +} + +// HasNetworkArea returns a boolean if a field has been set. +func (o *GatewayResponse) HasNetworkArea() bool { + if o != nil && !IsNil(o.NetworkArea) { + return true + } + + return false +} + +// SetNetworkArea gets a reference to the given NetworkConfig and assigns it to the NetworkArea field. +func (o *GatewayResponse) SetNetworkArea(v NetworkConfig) { + o.NetworkArea = &v +} + // GetPlanId returns the PlanId field value func (o *GatewayResponse) GetPlanId() string { if o == nil { @@ -300,6 +333,9 @@ func (o GatewayResponse) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkArea) { + toSerialize["networkArea"] = o.NetworkArea + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType if !IsNil(o.Id) { @@ -358,6 +394,7 @@ func (o *GatewayResponse) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkArea") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") delete(additionalProperties, "id") diff --git a/services/vpn/v1alpha1api/model_network_config.go b/services/vpn/v1alpha1api/model_network_config.go new file mode 100644 index 000000000..b83d9d00b --- /dev/null +++ b/services/vpn/v1alpha1api/model_network_config.go @@ -0,0 +1,192 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "encoding/json" +) + +// checks if the NetworkConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkConfig{} + +// NetworkConfig struct for NetworkConfig +type NetworkConfig struct { + // The IPv4 network prefix (CIDR notation) allocated for the VPN gateway. Must have a prefix length of /28 or larger. Once the gateway is created, is not possible to change this attribute. + PredefinedNetworkPrefix []string `json:"predefinedNetworkPrefix,omitempty"` + // Custom routing table ID for the VPN gateway + RoutingTableId *string `json:"routingTableId,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _NetworkConfig NetworkConfig + +// NewNetworkConfig instantiates a new NetworkConfig 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 NewNetworkConfig() *NetworkConfig { + this := NetworkConfig{} + return &this +} + +// NewNetworkConfigWithDefaults instantiates a new NetworkConfig 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 NewNetworkConfigWithDefaults() *NetworkConfig { + this := NetworkConfig{} + return &this +} + +// GetPredefinedNetworkPrefix returns the PredefinedNetworkPrefix field value if set, zero value otherwise. +func (o *NetworkConfig) GetPredefinedNetworkPrefix() []string { + if o == nil || IsNil(o.PredefinedNetworkPrefix) { + var ret []string + return ret + } + return o.PredefinedNetworkPrefix +} + +// GetPredefinedNetworkPrefixOk returns a tuple with the PredefinedNetworkPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkConfig) GetPredefinedNetworkPrefixOk() ([]string, bool) { + if o == nil || IsNil(o.PredefinedNetworkPrefix) { + return nil, false + } + return o.PredefinedNetworkPrefix, true +} + +// HasPredefinedNetworkPrefix returns a boolean if a field has been set. +func (o *NetworkConfig) HasPredefinedNetworkPrefix() bool { + if o != nil && !IsNil(o.PredefinedNetworkPrefix) { + return true + } + + return false +} + +// SetPredefinedNetworkPrefix gets a reference to the given []string and assigns it to the PredefinedNetworkPrefix field. +func (o *NetworkConfig) SetPredefinedNetworkPrefix(v []string) { + o.PredefinedNetworkPrefix = v +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *NetworkConfig) GetRoutingTableId() string { + if o == nil || IsNil(o.RoutingTableId) { + var ret string + return ret + } + return *o.RoutingTableId +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkConfig) GetRoutingTableIdOk() (*string, bool) { + if o == nil || IsNil(o.RoutingTableId) { + return nil, false + } + return o.RoutingTableId, true +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *NetworkConfig) HasRoutingTableId() bool { + if o != nil && !IsNil(o.RoutingTableId) { + return true + } + + return false +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *NetworkConfig) SetRoutingTableId(v string) { + o.RoutingTableId = &v +} + +func (o NetworkConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PredefinedNetworkPrefix) { + toSerialize["predefinedNetworkPrefix"] = o.PredefinedNetworkPrefix + } + if !IsNil(o.RoutingTableId) { + toSerialize["routingTableId"] = o.RoutingTableId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *NetworkConfig) UnmarshalJSON(data []byte) (err error) { + varNetworkConfig := _NetworkConfig{} + + err = json.Unmarshal(data, &varNetworkConfig) + + if err != nil { + return err + } + + *o = NetworkConfig(varNetworkConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "predefinedNetworkPrefix") + delete(additionalProperties, "routingTableId") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNetworkConfig struct { + value *NetworkConfig + isSet bool +} + +func (v NullableNetworkConfig) Get() *NetworkConfig { + return v.value +} + +func (v *NullableNetworkConfig) Set(val *NetworkConfig) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkConfig(val *NetworkConfig) *NullableNetworkConfig { + return &NullableNetworkConfig{value: val, isSet: true} +} + +func (v NullableNetworkConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1alpha1api/model_update_gateway_payload.go b/services/vpn/v1alpha1api/model_update_gateway_payload.go index 606a0c719..0a422e9b7 100644 --- a/services/vpn/v1alpha1api/model_update_gateway_payload.go +++ b/services/vpn/v1alpha1api/model_update_gateway_payload.go @@ -25,7 +25,8 @@ type UpdateGatewayPayload struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkArea *NetworkConfig `json:"networkArea,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *UpdateGatewayPayload) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkArea returns the NetworkArea field value if set, zero value otherwise. +func (o *UpdateGatewayPayload) GetNetworkArea() NetworkConfig { + if o == nil || IsNil(o.NetworkArea) { + var ret NetworkConfig + return ret + } + return *o.NetworkArea +} + +// GetNetworkAreaOk returns a tuple with the NetworkArea field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayPayload) GetNetworkAreaOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkArea) { + return nil, false + } + return o.NetworkArea, true +} + +// HasNetworkArea returns a boolean if a field has been set. +func (o *UpdateGatewayPayload) HasNetworkArea() bool { + if o != nil && !IsNil(o.NetworkArea) { + return true + } + + return false +} + +// SetNetworkArea gets a reference to the given NetworkConfig and assigns it to the NetworkArea field. +func (o *UpdateGatewayPayload) SetNetworkArea(v NetworkConfig) { + o.NetworkArea = &v +} + // GetPlanId returns the PlanId field value func (o *UpdateGatewayPayload) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o UpdateGatewayPayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkArea) { + toSerialize["networkArea"] = o.NetworkArea + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *UpdateGatewayPayload) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkArea") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties diff --git a/services/vpn/v1api/api_default.go b/services/vpn/v1api/api_default.go index 93185d86f..f87da1181 100644 --- a/services/vpn/v1api/api_default.go +++ b/services/vpn/v1api/api_default.go @@ -39,6 +39,41 @@ type DefaultAPI interface { // @return GatewayResponse CreateGatewayExecute(r ApiCreateGatewayRequest) (*GatewayResponse, error) + /* + CreateGatewayBGPFilter Create a new empty BGP filter. + + Creates the filter metadata. Rules are managed via the nested /rules sub-resource. + NOTE: an empty filter attached to a tunnel denies all incoming routes (implicit DENY). + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @return ApiCreateGatewayBGPFilterRequest + */ + CreateGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string) ApiCreateGatewayBGPFilterRequest + + // CreateGatewayBGPFilterExecute executes the request + // @return BGPFilter + CreateGatewayBGPFilterExecute(r ApiCreateGatewayBGPFilterRequest) (*BGPFilter, error) + + /* + CreateGatewayBGPFilterRule Add a new rule to a BGP filter. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @return ApiCreateGatewayBGPFilterRuleRequest + */ + CreateGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiCreateGatewayBGPFilterRuleRequest + + // CreateGatewayBGPFilterRuleExecute executes the request + // @return BGPFilterRule + CreateGatewayBGPFilterRuleExecute(r ApiCreateGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) + /* CreateGatewayConnection Create a new connection on an existing VPN gateway. @@ -74,6 +109,43 @@ type DefaultAPI interface { // DeleteGatewayExecute executes the request DeleteGatewayExecute(r ApiDeleteGatewayRequest) error + /* + DeleteGatewayBGPFilter Delete a BGP filter. + + Fails with 409 Conflict if the filter is referenced by any connection's tunnel.bgp.inboundFilterId. + The error response body's details[] contains one entry per referencing connection with metadata + { connectionId, displayName, tunnel: 'tunnel1'|'tunnel2' } and reason RESOURCE_IN_USE so the caller + can detach them first. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @return ApiDeleteGatewayBGPFilterRequest + */ + DeleteGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiDeleteGatewayBGPFilterRequest + + // DeleteGatewayBGPFilterExecute executes the request + DeleteGatewayBGPFilterExecute(r ApiDeleteGatewayBGPFilterRequest) error + + /* + DeleteGatewayBGPFilterRule Delete a specific rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @param ruleId + @return ApiDeleteGatewayBGPFilterRuleRequest + */ + DeleteGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiDeleteGatewayBGPFilterRuleRequest + + // DeleteGatewayBGPFilterRuleExecute executes the request + DeleteGatewayBGPFilterRuleExecute(r ApiDeleteGatewayBGPFilterRuleRequest) error + /* DeleteGatewayConnection Delete a certain connection from an existing VPN gateway. @@ -108,6 +180,39 @@ type DefaultAPI interface { // @return GatewayResponse GetGatewayExecute(r ApiGetGatewayRequest) (*GatewayResponse, error) + /* + GetGatewayBGPFilter Get BGP filter metadata. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @return ApiGetGatewayBGPFilterRequest + */ + GetGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiGetGatewayBGPFilterRequest + + // GetGatewayBGPFilterExecute executes the request + // @return BGPFilter + GetGatewayBGPFilterExecute(r ApiGetGatewayBGPFilterRequest) (*BGPFilter, error) + + /* + GetGatewayBGPFilterRule Get a specific rule from a BGP filter. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @param ruleId + @return ApiGetGatewayBGPFilterRuleRequest + */ + GetGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiGetGatewayBGPFilterRuleRequest + + // GetGatewayBGPFilterRuleExecute executes the request + // @return BGPFilterRule + GetGatewayBGPFilterRuleExecute(r ApiGetGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) + /* GetGatewayConnection Get a certain connection for an existing VPN gateway. @@ -161,6 +266,37 @@ type DefaultAPI interface { // @return GatewayStatusResponse GetGatewayStatusExecute(r ApiGetGatewayStatusRequest) (*GatewayStatusResponse, error) + /* + ListGatewayBGPFilterRules List all rules inside a specific BGP filter. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @return ApiListGatewayBGPFilterRulesRequest + */ + ListGatewayBGPFilterRules(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiListGatewayBGPFilterRulesRequest + + // ListGatewayBGPFilterRulesExecute executes the request + // @return BGPFilterRuleList + ListGatewayBGPFilterRulesExecute(r ApiListGatewayBGPFilterRulesRequest) (*BGPFilterRuleList, error) + + /* + ListGatewayBGPFilters List BGP filters for a gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @return ApiListGatewayBGPFiltersRequest + */ + ListGatewayBGPFilters(ctx context.Context, projectId string, region string, gatewayId string) ApiListGatewayBGPFiltersRequest + + // ListGatewayBGPFiltersExecute executes the request + // @return BGPFilterList + ListGatewayBGPFiltersExecute(r ApiListGatewayBGPFiltersRequest) (*BGPFilterList, error) + /* ListGatewayConnections List connections for an existing VPN gateway. @@ -249,6 +385,41 @@ type DefaultAPI interface { // @return GatewayResponse UpdateGatewayExecute(r ApiUpdateGatewayRequest) (*GatewayResponse, error) + /* + UpdateGatewayBGPFilter Update BGP filter metadata (name, description). + + Rules are managed via the nested /rules sub-resource and are not modified by this endpoint. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @return ApiUpdateGatewayBGPFilterRequest + */ + UpdateGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiUpdateGatewayBGPFilterRequest + + // UpdateGatewayBGPFilterExecute executes the request + // @return BGPFilter + UpdateGatewayBGPFilterExecute(r ApiUpdateGatewayBGPFilterRequest) (*BGPFilter, error) + + /* + UpdateGatewayBGPFilterRule Update a specific rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @param ruleId + @return ApiUpdateGatewayBGPFilterRuleRequest + */ + UpdateGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiUpdateGatewayBGPFilterRuleRequest + + // UpdateGatewayBGPFilterRuleExecute executes the request + // @return BGPFilterRule + UpdateGatewayBGPFilterRuleExecute(r ApiUpdateGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) + /* UpdateGatewayConnection Update a connection on an existing VPN gateway. @@ -455,37 +626,38 @@ func (a *DefaultAPIService) CreateGatewayExecute(r ApiCreateGatewayRequest) (*Ga return localVarReturnValue, nil } -type ApiCreateGatewayConnectionRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - gatewayId string - createGatewayConnectionPayload *CreateGatewayConnectionPayload +type ApiCreateGatewayBGPFilterRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + createGatewayBGPFilterPayload *CreateGatewayBGPFilterPayload } -func (r ApiCreateGatewayConnectionRequest) CreateGatewayConnectionPayload(createGatewayConnectionPayload CreateGatewayConnectionPayload) ApiCreateGatewayConnectionRequest { - r.createGatewayConnectionPayload = &createGatewayConnectionPayload +func (r ApiCreateGatewayBGPFilterRequest) CreateGatewayBGPFilterPayload(createGatewayBGPFilterPayload CreateGatewayBGPFilterPayload) ApiCreateGatewayBGPFilterRequest { + r.createGatewayBGPFilterPayload = &createGatewayBGPFilterPayload return r } -func (r ApiCreateGatewayConnectionRequest) Execute() (*ConnectionResponse, error) { - return r.ApiService.CreateGatewayConnectionExecute(r) +func (r ApiCreateGatewayBGPFilterRequest) Execute() (*BGPFilter, error) { + return r.ApiService.CreateGatewayBGPFilterExecute(r) } /* -CreateGatewayConnection Create a new connection on an existing VPN gateway. +CreateGatewayBGPFilter Create a new empty BGP filter. -Create a new connection on an existing VPN gateway. +Creates the filter metadata. Rules are managed via the nested /rules sub-resource. +NOTE: an empty filter attached to a tunnel denies all incoming routes (implicit DENY). @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region @param gatewayId - @return ApiCreateGatewayConnectionRequest + @return ApiCreateGatewayBGPFilterRequest */ -func (a *DefaultAPIService) CreateGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string) ApiCreateGatewayConnectionRequest { - return ApiCreateGatewayConnectionRequest{ +func (a *DefaultAPIService) CreateGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string) ApiCreateGatewayBGPFilterRequest { + return ApiCreateGatewayBGPFilterRequest{ ApiService: a, ctx: ctx, projectId: projectId, @@ -496,21 +668,21 @@ func (a *DefaultAPIService) CreateGatewayConnection(ctx context.Context, project // Execute executes the request // -// @return ConnectionResponse -func (a *DefaultAPIService) CreateGatewayConnectionExecute(r ApiCreateGatewayConnectionRequest) (*ConnectionResponse, error) { +// @return BGPFilter +func (a *DefaultAPIService) CreateGatewayBGPFilterExecute(r ApiCreateGatewayBGPFilterRequest) (*BGPFilter, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ConnectionResponse + localVarReturnValue *BGPFilter ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateGatewayConnection") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateGatewayBGPFilter") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) @@ -518,6 +690,9 @@ func (a *DefaultAPIService) CreateGatewayConnectionExecute(r ApiCreateGatewayCon localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.createGatewayBGPFilterPayload == nil { + return localVarReturnValue, reportError("createGatewayBGPFilterPayload is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -537,7 +712,7 @@ func (a *DefaultAPIService) CreateGatewayConnectionExecute(r ApiCreateGatewayCon localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createGatewayConnectionPayload + localVarPostBody = r.createGatewayBGPFilterPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -614,6 +789,28 @@ func (a *DefaultAPIService) CreateGatewayConnectionExecute(r ApiCreateGatewayCon newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -640,64 +837,77 @@ func (a *DefaultAPIService) CreateGatewayConnectionExecute(r ApiCreateGatewayCon return localVarReturnValue, nil } -type ApiDeleteGatewayRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - gatewayId string +type ApiCreateGatewayBGPFilterRuleRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + filterId string + createGatewayBGPFilterRulePayload *CreateGatewayBGPFilterRulePayload } -func (r ApiDeleteGatewayRequest) Execute() error { - return r.ApiService.DeleteGatewayExecute(r) +func (r ApiCreateGatewayBGPFilterRuleRequest) CreateGatewayBGPFilterRulePayload(createGatewayBGPFilterRulePayload CreateGatewayBGPFilterRulePayload) ApiCreateGatewayBGPFilterRuleRequest { + r.createGatewayBGPFilterRulePayload = &createGatewayBGPFilterRulePayload + return r } -/* -DeleteGateway Delete a existing VPN gateway in a project. +func (r ApiCreateGatewayBGPFilterRuleRequest) Execute() (*BGPFilterRule, error) { + return r.ApiService.CreateGatewayBGPFilterRuleExecute(r) +} -Permanently remove a VPN gateway and all its associated connections. -This operation is irreversible. +/* +CreateGatewayBGPFilterRule Add a new rule to a BGP filter. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region @param gatewayId - @return ApiDeleteGatewayRequest + @param filterId + @return ApiCreateGatewayBGPFilterRuleRequest */ -func (a *DefaultAPIService) DeleteGateway(ctx context.Context, projectId string, region string, gatewayId string) ApiDeleteGatewayRequest { - return ApiDeleteGatewayRequest{ +func (a *DefaultAPIService) CreateGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiCreateGatewayBGPFilterRuleRequest { + return ApiCreateGatewayBGPFilterRuleRequest{ ApiService: a, ctx: ctx, projectId: projectId, region: region, gatewayId: gatewayId, + filterId: filterId, } } // Execute executes the request -func (a *DefaultAPIService) DeleteGatewayExecute(r ApiDeleteGatewayRequest) error { +// +// @return BGPFilterRule +func (a *DefaultAPIService) CreateGatewayBGPFilterRuleExecute(r ApiCreateGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BGPFilterRule ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteGateway") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateGatewayBGPFilterRule") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters/{filterId}/rules" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filterId"+"}", url.PathEscape(parameterValueToString(r.filterId, "filterId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.createGatewayBGPFilterRulePayload == nil { + return localVarReturnValue, reportError("createGatewayBGPFilterRulePayload is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -713,9 +923,11 @@ func (a *DefaultAPIService) DeleteGatewayExecute(r ApiDeleteGatewayRequest) erro if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createGatewayBGPFilterRulePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -729,14 +941,14 @@ func (a *DefaultAPIService) DeleteGatewayExecute(r ApiDeleteGatewayRequest) erro *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -750,104 +962,1928 @@ func (a *DefaultAPIService) DeleteGatewayExecute(r ApiDeleteGatewayRequest) erro err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil -} + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } -type ApiDeleteGatewayConnectionRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - gatewayId string - connectionId string + return localVarReturnValue, nil } -func (r ApiDeleteGatewayConnectionRequest) Execute() error { - return r.ApiService.DeleteGatewayConnectionExecute(r) +type ApiCreateGatewayConnectionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + createGatewayConnectionPayload *CreateGatewayConnectionPayload } -/* +func (r ApiCreateGatewayConnectionRequest) CreateGatewayConnectionPayload(createGatewayConnectionPayload CreateGatewayConnectionPayload) ApiCreateGatewayConnectionRequest { + r.createGatewayConnectionPayload = &createGatewayConnectionPayload + return r +} + +func (r ApiCreateGatewayConnectionRequest) Execute() (*ConnectionResponse, error) { + return r.ApiService.CreateGatewayConnectionExecute(r) +} + +/* +CreateGatewayConnection Create a new connection on an existing VPN gateway. + +Create a new connection on an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @return ApiCreateGatewayConnectionRequest +*/ +func (a *DefaultAPIService) CreateGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string) ApiCreateGatewayConnectionRequest { + return ApiCreateGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// Execute executes the request +// +// @return ConnectionResponse +func (a *DefaultAPIService) CreateGatewayConnectionExecute(r ApiCreateGatewayConnectionRequest) (*ConnectionResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConnectionResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createGatewayConnectionPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiDeleteGatewayRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string +} + +func (r ApiDeleteGatewayRequest) Execute() error { + return r.ApiService.DeleteGatewayExecute(r) +} + +/* +DeleteGateway Delete a existing VPN gateway in a project. + +Permanently remove a VPN gateway and all its associated connections. +This operation is irreversible. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @return ApiDeleteGatewayRequest +*/ +func (a *DefaultAPIService) DeleteGateway(ctx context.Context, projectId string, region string, gatewayId string) ApiDeleteGatewayRequest { + return ApiDeleteGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteGatewayExecute(r ApiDeleteGatewayRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteGateway") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiDeleteGatewayBGPFilterRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + filterId string +} + +func (r ApiDeleteGatewayBGPFilterRequest) Execute() error { + return r.ApiService.DeleteGatewayBGPFilterExecute(r) +} + +/* +DeleteGatewayBGPFilter Delete a BGP filter. + +Fails with 409 Conflict if the filter is referenced by any connection's tunnel.bgp.inboundFilterId. +The error response body's details[] contains one entry per referencing connection with metadata +{ connectionId, displayName, tunnel: 'tunnel1'|'tunnel2' } and reason RESOURCE_IN_USE so the caller +can detach them first. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @return ApiDeleteGatewayBGPFilterRequest +*/ +func (a *DefaultAPIService) DeleteGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiDeleteGatewayBGPFilterRequest { + return ApiDeleteGatewayBGPFilterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteGatewayBGPFilterExecute(r ApiDeleteGatewayBGPFilterRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteGatewayBGPFilter") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters/{filterId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filterId"+"}", url.PathEscape(parameterValueToString(r.filterId, "filterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiDeleteGatewayBGPFilterRuleRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + filterId string + ruleId string +} + +func (r ApiDeleteGatewayBGPFilterRuleRequest) Execute() error { + return r.ApiService.DeleteGatewayBGPFilterRuleExecute(r) +} + +/* +DeleteGatewayBGPFilterRule Delete a specific rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @param ruleId + @return ApiDeleteGatewayBGPFilterRuleRequest +*/ +func (a *DefaultAPIService) DeleteGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiDeleteGatewayBGPFilterRuleRequest { + return ApiDeleteGatewayBGPFilterRuleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + ruleId: ruleId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteGatewayBGPFilterRuleExecute(r ApiDeleteGatewayBGPFilterRuleRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteGatewayBGPFilterRule") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters/{filterId}/rules/{ruleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filterId"+"}", url.PathEscape(parameterValueToString(r.filterId, "filterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", url.PathEscape(parameterValueToString(r.ruleId, "ruleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiDeleteGatewayConnectionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + connectionId string +} + +func (r ApiDeleteGatewayConnectionRequest) Execute() error { + return r.ApiService.DeleteGatewayConnectionExecute(r) +} + +/* DeleteGatewayConnection Delete a certain connection from an existing VPN gateway. -Delete a certain connection from an existing VPN gateway. +Delete a certain connection from an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param connectionId + @return ApiDeleteGatewayConnectionRequest +*/ +func (a *DefaultAPIService) DeleteGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiDeleteGatewayConnectionRequest { + return ApiDeleteGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + connectionId: connectionId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteGatewayConnectionExecute(r ApiDeleteGatewayConnectionRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteGatewayConnection") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionId"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiGetGatewayRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string +} + +func (r ApiGetGatewayRequest) Execute() (*GatewayResponse, error) { + return r.ApiService.GetGatewayExecute(r) +} + +/* +GetGateway Get details of a VPN Gateway in a project. + +Get details of a VPN Gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @return ApiGetGatewayRequest +*/ +func (a *DefaultAPIService) GetGateway(ctx context.Context, projectId string, region string, gatewayId string) ApiGetGatewayRequest { + return ApiGetGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// Execute executes the request +// +// @return GatewayResponse +func (a *DefaultAPIService) GetGatewayExecute(r ApiGetGatewayRequest) (*GatewayResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGateway") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetGatewayBGPFilterRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + filterId string +} + +func (r ApiGetGatewayBGPFilterRequest) Execute() (*BGPFilter, error) { + return r.ApiService.GetGatewayBGPFilterExecute(r) +} + +/* +GetGatewayBGPFilter Get BGP filter metadata. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @return ApiGetGatewayBGPFilterRequest +*/ +func (a *DefaultAPIService) GetGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiGetGatewayBGPFilterRequest { + return ApiGetGatewayBGPFilterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + } +} + +// Execute executes the request +// +// @return BGPFilter +func (a *DefaultAPIService) GetGatewayBGPFilterExecute(r ApiGetGatewayBGPFilterRequest) (*BGPFilter, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BGPFilter + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayBGPFilter") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters/{filterId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filterId"+"}", url.PathEscape(parameterValueToString(r.filterId, "filterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetGatewayBGPFilterRuleRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + filterId string + ruleId string +} + +func (r ApiGetGatewayBGPFilterRuleRequest) Execute() (*BGPFilterRule, error) { + return r.ApiService.GetGatewayBGPFilterRuleExecute(r) +} + +/* +GetGatewayBGPFilterRule Get a specific rule from a BGP filter. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param filterId + @param ruleId + @return ApiGetGatewayBGPFilterRuleRequest +*/ +func (a *DefaultAPIService) GetGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiGetGatewayBGPFilterRuleRequest { + return ApiGetGatewayBGPFilterRuleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + ruleId: ruleId, + } +} + +// Execute executes the request +// +// @return BGPFilterRule +func (a *DefaultAPIService) GetGatewayBGPFilterRuleExecute(r ApiGetGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BGPFilterRule + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayBGPFilterRule") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters/{filterId}/rules/{ruleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filterId"+"}", url.PathEscape(parameterValueToString(r.filterId, "filterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", url.PathEscape(parameterValueToString(r.ruleId, "ruleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetGatewayConnectionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + connectionId string +} + +func (r ApiGetGatewayConnectionRequest) Execute() (*ConnectionResponse, error) { + return r.ApiService.GetGatewayConnectionExecute(r) +} + +/* +GetGatewayConnection Get a certain connection for an existing VPN gateway. + +Get a certain connection for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param connectionId + @return ApiGetGatewayConnectionRequest +*/ +func (a *DefaultAPIService) GetGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiGetGatewayConnectionRequest { + return ApiGetGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return ConnectionResponse +func (a *DefaultAPIService) GetGatewayConnectionExecute(r ApiGetGatewayConnectionRequest) (*ConnectionResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConnectionResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionId"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetGatewayConnectionStatusRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + connectionId string +} + +func (r ApiGetGatewayConnectionStatusRequest) Execute() (*ConnectionStatusResponse, error) { + return r.ApiService.GetGatewayConnectionStatusExecute(r) +} + +/* +GetGatewayConnectionStatus Gets the status for a specific connection. + +Get the status for a specific connection. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayId + @param connectionId + @return ApiGetGatewayConnectionStatusRequest +*/ +func (a *DefaultAPIService) GetGatewayConnectionStatus(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiGetGatewayConnectionStatusRequest { + return ApiGetGatewayConnectionStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return ConnectionStatusResponse +func (a *DefaultAPIService) GetGatewayConnectionStatusExecute(r ApiGetGatewayConnectionStatusRequest) (*ConnectionStatusResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConnectionStatusResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayConnectionStatus") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}/status" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionId"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetGatewayStatusRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string +} + +func (r ApiGetGatewayStatusRequest) Execute() (*GatewayStatusResponse, error) { + return r.ApiService.GetGatewayStatusExecute(r) +} + +/* +GetGatewayStatus Get the status of a VPN gateway in a project. + +Get the status of a VPN gateway in a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region @param gatewayId - @param connectionId - @return ApiDeleteGatewayConnectionRequest + @return ApiGetGatewayStatusRequest */ -func (a *DefaultAPIService) DeleteGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiDeleteGatewayConnectionRequest { - return ApiDeleteGatewayConnectionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - gatewayId: gatewayId, - connectionId: connectionId, +func (a *DefaultAPIService) GetGatewayStatus(ctx context.Context, projectId string, region string, gatewayId string) ApiGetGatewayStatusRequest { + return ApiGetGatewayStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, } } // Execute executes the request -func (a *DefaultAPIService) DeleteGatewayConnectionExecute(r ApiDeleteGatewayConnectionRequest) error { +// +// @return GatewayStatusResponse +func (a *DefaultAPIService) GetGatewayStatusExecute(r ApiGetGatewayStatusRequest) (*GatewayStatusResponse, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayStatusResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteGatewayConnection") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayStatus") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/status" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"connectionId"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -872,7 +2908,7 @@ func (a *DefaultAPIService) DeleteGatewayConnectionExecute(r ApiDeleteGatewayCon } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -886,14 +2922,14 @@ func (a *DefaultAPIService) DeleteGatewayConnectionExecute(r ApiDeleteGatewayCon *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -907,114 +2943,126 @@ func (a *DefaultAPIService) DeleteGatewayConnectionExecute(r ApiDeleteGatewayCon err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 401 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 403 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 404 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil } -type ApiGetGatewayRequest struct { +type ApiListGatewayBGPFilterRulesRequest struct { ctx context.Context ApiService DefaultAPI projectId string region string gatewayId string + filterId string } -func (r ApiGetGatewayRequest) Execute() (*GatewayResponse, error) { - return r.ApiService.GetGatewayExecute(r) +func (r ApiListGatewayBGPFilterRulesRequest) Execute() (*BGPFilterRuleList, error) { + return r.ApiService.ListGatewayBGPFilterRulesExecute(r) } /* -GetGateway Get details of a VPN Gateway in a project. - -Get details of a VPN Gateway in a project. +ListGatewayBGPFilterRules List all rules inside a specific BGP filter. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region @param gatewayId - @return ApiGetGatewayRequest + @param filterId + @return ApiListGatewayBGPFilterRulesRequest */ -func (a *DefaultAPIService) GetGateway(ctx context.Context, projectId string, region string, gatewayId string) ApiGetGatewayRequest { - return ApiGetGatewayRequest{ +func (a *DefaultAPIService) ListGatewayBGPFilterRules(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiListGatewayBGPFilterRulesRequest { + return ApiListGatewayBGPFilterRulesRequest{ ApiService: a, ctx: ctx, projectId: projectId, region: region, gatewayId: gatewayId, + filterId: filterId, } } // Execute executes the request // -// @return GatewayResponse -func (a *DefaultAPIService) GetGatewayExecute(r ApiGetGatewayRequest) (*GatewayResponse, error) { +// @return BGPFilterRuleList +func (a *DefaultAPIService) ListGatewayBGPFilterRulesExecute(r ApiListGatewayBGPFilterRulesRequest) (*BGPFilterRuleList, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GatewayResponse + localVarReturnValue *BGPFilterRuleList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGateway") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGatewayBGPFilterRules") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters/{filterId}/rules" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filterId"+"}", url.PathEscape(parameterValueToString(r.filterId, "filterId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1139,63 +3187,57 @@ func (a *DefaultAPIService) GetGatewayExecute(r ApiGetGatewayRequest) (*GatewayR return localVarReturnValue, nil } -type ApiGetGatewayConnectionRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - gatewayId string - connectionId string +type ApiListGatewayBGPFiltersRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string } -func (r ApiGetGatewayConnectionRequest) Execute() (*ConnectionResponse, error) { - return r.ApiService.GetGatewayConnectionExecute(r) +func (r ApiListGatewayBGPFiltersRequest) Execute() (*BGPFilterList, error) { + return r.ApiService.ListGatewayBGPFiltersExecute(r) } /* -GetGatewayConnection Get a certain connection for an existing VPN gateway. - -Get a certain connection for an existing VPN gateway. +ListGatewayBGPFilters List BGP filters for a gateway. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region @param gatewayId - @param connectionId - @return ApiGetGatewayConnectionRequest + @return ApiListGatewayBGPFiltersRequest */ -func (a *DefaultAPIService) GetGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiGetGatewayConnectionRequest { - return ApiGetGatewayConnectionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - gatewayId: gatewayId, - connectionId: connectionId, +func (a *DefaultAPIService) ListGatewayBGPFilters(ctx context.Context, projectId string, region string, gatewayId string) ApiListGatewayBGPFiltersRequest { + return ApiListGatewayBGPFiltersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, } } // Execute executes the request // -// @return ConnectionResponse -func (a *DefaultAPIService) GetGatewayConnectionExecute(r ApiGetGatewayConnectionRequest) (*ConnectionResponse, error) { +// @return BGPFilterList +func (a *DefaultAPIService) ListGatewayBGPFiltersExecute(r ApiListGatewayBGPFiltersRequest) (*BGPFilterList, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ConnectionResponse + localVarReturnValue *BGPFilterList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayConnection") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGatewayBGPFilters") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"connectionId"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1320,68 +3362,74 @@ func (a *DefaultAPIService) GetGatewayConnectionExecute(r ApiGetGatewayConnectio return localVarReturnValue, nil } -type ApiGetGatewayConnectionStatusRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - gatewayId string - connectionId string +type ApiListGatewayConnectionsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + labelSelector *map[string]string } -func (r ApiGetGatewayConnectionStatusRequest) Execute() (*ConnectionStatusResponse, error) { - return r.ApiService.GetGatewayConnectionStatusExecute(r) +// Filter resources by labels. +func (r ApiListGatewayConnectionsRequest) LabelSelector(labelSelector map[string]string) ApiListGatewayConnectionsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListGatewayConnectionsRequest) Execute() (*ConnectionList, error) { + return r.ApiService.ListGatewayConnectionsExecute(r) } /* -GetGatewayConnectionStatus Gets the status for a specific connection. +ListGatewayConnections List connections for an existing VPN gateway. -Get the status for a specific connection. +List connections for an existing VPN gateway. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region @param gatewayId - @param connectionId - @return ApiGetGatewayConnectionStatusRequest + @return ApiListGatewayConnectionsRequest */ -func (a *DefaultAPIService) GetGatewayConnectionStatus(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiGetGatewayConnectionStatusRequest { - return ApiGetGatewayConnectionStatusRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - gatewayId: gatewayId, - connectionId: connectionId, +func (a *DefaultAPIService) ListGatewayConnections(ctx context.Context, projectId string, region string, gatewayId string) ApiListGatewayConnectionsRequest { + return ApiListGatewayConnectionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, } } // Execute executes the request // -// @return ConnectionStatusResponse -func (a *DefaultAPIService) GetGatewayConnectionStatusExecute(r ApiGetGatewayConnectionStatusRequest) (*ConnectionStatusResponse, error) { +// @return ConnectionList +func (a *DefaultAPIService) ListGatewayConnectionsExecute(r ApiListGatewayConnectionsRequest) (*ConnectionList, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ConnectionStatusResponse + localVarReturnValue *ConnectionList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayConnectionStatus") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGatewayConnections") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}/status" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"connectionId"+"}", url.PathEscape(parameterValueToString(r.connectionId, "connectionId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "deepObject", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1501,64 +3549,71 @@ func (a *DefaultAPIService) GetGatewayConnectionStatusExecute(r ApiGetGatewayCon return localVarReturnValue, nil } -type ApiGetGatewayStatusRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - gatewayId string +type ApiListGatewaysRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + labelSelector *map[string]string } -func (r ApiGetGatewayStatusRequest) Execute() (*GatewayStatusResponse, error) { - return r.ApiService.GetGatewayStatusExecute(r) +// Filter resources by labels. +func (r ApiListGatewaysRequest) LabelSelector(labelSelector map[string]string) ApiListGatewaysRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListGatewaysRequest) Execute() (*GatewayList, error) { + return r.ApiService.ListGatewaysExecute(r) } /* -GetGatewayStatus Get the status of a VPN gateway in a project. +ListGateways List VPN gateways in a project with label filtering -Get the status of a VPN gateway in a project. +Retrieve a list of all VPN gateways in a project. +Filter the results using the `label_selector` query parameter. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region - @param gatewayId - @return ApiGetGatewayStatusRequest + @return ApiListGatewaysRequest */ -func (a *DefaultAPIService) GetGatewayStatus(ctx context.Context, projectId string, region string, gatewayId string) ApiGetGatewayStatusRequest { - return ApiGetGatewayStatusRequest{ +func (a *DefaultAPIService) ListGateways(ctx context.Context, projectId string, region string) ApiListGatewaysRequest { + return ApiListGatewaysRequest{ ApiService: a, ctx: ctx, projectId: projectId, region: region, - gatewayId: gatewayId, } } // Execute executes the request // -// @return GatewayStatusResponse -func (a *DefaultAPIService) GetGatewayStatusExecute(r ApiGetGatewayStatusRequest) (*GatewayStatusResponse, error) { +// @return GatewayList +func (a *DefaultAPIService) ListGatewaysExecute(r ApiListGatewaysRequest) (*GatewayList, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GatewayStatusResponse + localVarReturnValue *GatewayList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayStatus") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGateways") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/status" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "deepObject", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1641,17 +3696,6 @@ func (a *DefaultAPIService) GetGatewayStatusExecute(r ApiGetGatewayStatusRequest newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } if localVarHTTPResponse.StatusCode == 500 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1678,74 +3722,57 @@ func (a *DefaultAPIService) GetGatewayStatusExecute(r ApiGetGatewayStatusRequest return localVarReturnValue, nil } -type ApiListGatewayConnectionsRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - gatewayId string - labelSelector *map[string]string -} - -// Filter resources by labels. -func (r ApiListGatewayConnectionsRequest) LabelSelector(labelSelector map[string]string) ApiListGatewayConnectionsRequest { - r.labelSelector = &labelSelector - return r +type ApiListPlansRequest struct { + ctx context.Context + ApiService DefaultAPI + region string } -func (r ApiListGatewayConnectionsRequest) Execute() (*ConnectionList, error) { - return r.ApiService.ListGatewayConnectionsExecute(r) +func (r ApiListPlansRequest) Execute() (*PlanList, error) { + return r.ApiService.ListPlansExecute(r) } /* -ListGatewayConnections List connections for an existing VPN gateway. +ListPlans List available service plans for a project. -List connections for an existing VPN gateway. +Retrieve a list of available service plans available for provisioning a VPN in a specific `region`. +Use this to identify the `planId` required for gateway creation. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId @param region - @param gatewayId - @return ApiListGatewayConnectionsRequest + @return ApiListPlansRequest */ -func (a *DefaultAPIService) ListGatewayConnections(ctx context.Context, projectId string, region string, gatewayId string) ApiListGatewayConnectionsRequest { - return ApiListGatewayConnectionsRequest{ +func (a *DefaultAPIService) ListPlans(ctx context.Context, region string) ApiListPlansRequest { + return ApiListPlansRequest{ ApiService: a, ctx: ctx, - projectId: projectId, region: region, - gatewayId: gatewayId, } } // Execute executes the request // -// @return ConnectionList -func (a *DefaultAPIService) ListGatewayConnectionsExecute(r ApiListGatewayConnectionsRequest) (*ConnectionList, error) { +// @return PlanList +func (a *DefaultAPIService) ListPlansExecute(r ApiListPlansRequest) (*PlanList, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ConnectionList + localVarReturnValue *PlanList ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGatewayConnections") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListPlans") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath := localBasePath + "/v1/regions/{region}/plans" localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "deepObject", "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1815,39 +3842,6 @@ func (a *DefaultAPIService) ListGatewayConnectionsExecute(r ApiListGatewayConnec } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v APIErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v } return localVarReturnValue, newErr } @@ -1865,37 +3859,29 @@ func (a *DefaultAPIService) ListGatewayConnectionsExecute(r ApiListGatewayConnec return localVarReturnValue, nil } -type ApiListGatewaysRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - labelSelector *map[string]string -} - -// Filter resources by labels. -func (r ApiListGatewaysRequest) LabelSelector(labelSelector map[string]string) ApiListGatewaysRequest { - r.labelSelector = &labelSelector - return r +type ApiListQuotasRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string } -func (r ApiListGatewaysRequest) Execute() (*GatewayList, error) { - return r.ApiService.ListGatewaysExecute(r) +func (r ApiListQuotasRequest) Execute() (*QuotaListResponse, error) { + return r.ApiService.ListQuotasExecute(r) } /* -ListGateways List VPN gateways in a project with label filtering +ListQuotas List project quotas. -Retrieve a list of all VPN gateways in a project. -Filter the results using the `label_selector` query parameter. +Retrieve the resource quotas and current usage for STACKIT VPN within a specific project and region. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region - @return ApiListGatewaysRequest + @return ApiListQuotasRequest */ -func (a *DefaultAPIService) ListGateways(ctx context.Context, projectId string, region string) ApiListGatewaysRequest { - return ApiListGatewaysRequest{ +func (a *DefaultAPIService) ListQuotas(ctx context.Context, projectId string, region string) ApiListQuotasRequest { + return ApiListQuotasRequest{ ApiService: a, ctx: ctx, projectId: projectId, @@ -1905,21 +3891,21 @@ func (a *DefaultAPIService) ListGateways(ctx context.Context, projectId string, // Execute executes the request // -// @return GatewayList -func (a *DefaultAPIService) ListGatewaysExecute(r ApiListGatewaysRequest) (*GatewayList, error) { +// @return QuotaListResponse +func (a *DefaultAPIService) ListQuotasExecute(r ApiListQuotasRequest) (*QuotaListResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GatewayList + localVarReturnValue *QuotaListResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGateways") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListQuotas") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/quotas" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) @@ -1927,9 +3913,6 @@ func (a *DefaultAPIService) ListGatewaysExecute(r ApiListGatewaysRequest) (*Gate localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.labelSelector != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "deepObject", "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1999,28 +3982,6 @@ func (a *DefaultAPIService) ListGatewaysExecute(r ApiListGatewaysRequest) (*Gate } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v APIErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v } return localVarReturnValue, newErr } @@ -2038,59 +3999,76 @@ func (a *DefaultAPIService) ListGatewaysExecute(r ApiListGatewaysRequest) (*Gate return localVarReturnValue, nil } -type ApiListPlansRequest struct { - ctx context.Context - ApiService DefaultAPI - region string +type ApiUpdateGatewayRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + updateGatewayPayload *UpdateGatewayPayload } -func (r ApiListPlansRequest) Execute() (*PlanList, error) { - return r.ApiService.ListPlansExecute(r) +func (r ApiUpdateGatewayRequest) UpdateGatewayPayload(updateGatewayPayload UpdateGatewayPayload) ApiUpdateGatewayRequest { + r.updateGatewayPayload = &updateGatewayPayload + return r +} + +func (r ApiUpdateGatewayRequest) Execute() (*GatewayResponse, error) { + return r.ApiService.UpdateGatewayExecute(r) } /* -ListPlans List available service plans for a project. +UpdateGateway Update a VPN gateway in a project. -Retrieve a list of available service plans available for provisioning a VPN in a specific `region`. -Use this to identify the `planId` required for gateway creation. +Modify the configuration of an existing VPN gateway. +Certain changes may trigger infrastructure updates or temporary connection re-negotiations. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId @param region - @return ApiListPlansRequest + @param gatewayId + @return ApiUpdateGatewayRequest */ -func (a *DefaultAPIService) ListPlans(ctx context.Context, region string) ApiListPlansRequest { - return ApiListPlansRequest{ +func (a *DefaultAPIService) UpdateGateway(ctx context.Context, projectId string, region string, gatewayId string) ApiUpdateGatewayRequest { + return ApiUpdateGatewayRequest{ ApiService: a, ctx: ctx, + projectId: projectId, region: region, + gatewayId: gatewayId, } } // Execute executes the request // -// @return PlanList -func (a *DefaultAPIService) ListPlansExecute(r ApiListPlansRequest) (*PlanList, error) { +// @return GatewayResponse +func (a *DefaultAPIService) UpdateGatewayExecute(r ApiUpdateGatewayRequest) (*GatewayResponse, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *PlanList + localVarReturnValue *GatewayResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListPlans") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateGateway") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/regions/{region}/plans" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.updateGatewayPayload == nil { + return localVarReturnValue, reportError("updateGatewayPayload is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2106,6 +4084,8 @@ func (a *DefaultAPIService) ListPlansExecute(r ApiListPlansRequest) (*PlanList, if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.updateGatewayPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2158,6 +4138,39 @@ func (a *DefaultAPIService) ListPlansExecute(r ApiListPlansRequest) (*PlanList, } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v } return localVarReturnValue, newErr } @@ -2175,62 +4188,79 @@ func (a *DefaultAPIService) ListPlansExecute(r ApiListPlansRequest) (*PlanList, return localVarReturnValue, nil } -type ApiListQuotasRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string +type ApiUpdateGatewayBGPFilterRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + filterId string + updateGatewayBGPFilterPayload *UpdateGatewayBGPFilterPayload } -func (r ApiListQuotasRequest) Execute() (*QuotaListResponse, error) { - return r.ApiService.ListQuotasExecute(r) +func (r ApiUpdateGatewayBGPFilterRequest) UpdateGatewayBGPFilterPayload(updateGatewayBGPFilterPayload UpdateGatewayBGPFilterPayload) ApiUpdateGatewayBGPFilterRequest { + r.updateGatewayBGPFilterPayload = &updateGatewayBGPFilterPayload + return r +} + +func (r ApiUpdateGatewayBGPFilterRequest) Execute() (*BGPFilter, error) { + return r.ApiService.UpdateGatewayBGPFilterExecute(r) } /* -ListQuotas List project quotas. +UpdateGatewayBGPFilter Update BGP filter metadata (name, description). -Retrieve the resource quotas and current usage for STACKIT VPN within a specific project and region. +Rules are managed via the nested /rules sub-resource and are not modified by this endpoint. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region - @return ApiListQuotasRequest + @param gatewayId + @param filterId + @return ApiUpdateGatewayBGPFilterRequest */ -func (a *DefaultAPIService) ListQuotas(ctx context.Context, projectId string, region string) ApiListQuotasRequest { - return ApiListQuotasRequest{ +func (a *DefaultAPIService) UpdateGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiUpdateGatewayBGPFilterRequest { + return ApiUpdateGatewayBGPFilterRequest{ ApiService: a, ctx: ctx, projectId: projectId, region: region, + gatewayId: gatewayId, + filterId: filterId, } } // Execute executes the request // -// @return QuotaListResponse -func (a *DefaultAPIService) ListQuotasExecute(r ApiListQuotasRequest) (*QuotaListResponse, error) { +// @return BGPFilter +func (a *DefaultAPIService) UpdateGatewayBGPFilterExecute(r ApiUpdateGatewayBGPFilterRequest) (*BGPFilter, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *QuotaListResponse + localVarReturnValue *BGPFilter ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListQuotas") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateGatewayBGPFilter") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/quotas" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters/{filterId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filterId"+"}", url.PathEscape(parameterValueToString(r.filterId, "filterId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.updateGatewayBGPFilterPayload == nil { + return localVarReturnValue, reportError("updateGatewayBGPFilterPayload is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2246,6 +4276,8 @@ func (a *DefaultAPIService) ListQuotasExecute(r ApiListQuotasRequest) (*QuotaLis if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.updateGatewayBGPFilterPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2298,6 +4330,61 @@ func (a *DefaultAPIService) ListQuotasExecute(r ApiListQuotasRequest) (*QuotaLis } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v } return localVarReturnValue, newErr } @@ -2315,72 +4402,77 @@ func (a *DefaultAPIService) ListQuotasExecute(r ApiListQuotasRequest) (*QuotaLis return localVarReturnValue, nil } -type ApiUpdateGatewayRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - gatewayId string - updateGatewayPayload *UpdateGatewayPayload +type ApiUpdateGatewayBGPFilterRuleRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + gatewayId string + filterId string + ruleId string + updateGatewayBGPFilterRulePayload *UpdateGatewayBGPFilterRulePayload } -func (r ApiUpdateGatewayRequest) UpdateGatewayPayload(updateGatewayPayload UpdateGatewayPayload) ApiUpdateGatewayRequest { - r.updateGatewayPayload = &updateGatewayPayload +func (r ApiUpdateGatewayBGPFilterRuleRequest) UpdateGatewayBGPFilterRulePayload(updateGatewayBGPFilterRulePayload UpdateGatewayBGPFilterRulePayload) ApiUpdateGatewayBGPFilterRuleRequest { + r.updateGatewayBGPFilterRulePayload = &updateGatewayBGPFilterRulePayload return r } -func (r ApiUpdateGatewayRequest) Execute() (*GatewayResponse, error) { - return r.ApiService.UpdateGatewayExecute(r) +func (r ApiUpdateGatewayBGPFilterRuleRequest) Execute() (*BGPFilterRule, error) { + return r.ApiService.UpdateGatewayBGPFilterRuleExecute(r) } /* -UpdateGateway Update a VPN gateway in a project. - -Modify the configuration of an existing VPN gateway. -Certain changes may trigger infrastructure updates or temporary connection re-negotiations. +UpdateGatewayBGPFilterRule Update a specific rule. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @param region @param gatewayId - @return ApiUpdateGatewayRequest + @param filterId + @param ruleId + @return ApiUpdateGatewayBGPFilterRuleRequest */ -func (a *DefaultAPIService) UpdateGateway(ctx context.Context, projectId string, region string, gatewayId string) ApiUpdateGatewayRequest { - return ApiUpdateGatewayRequest{ +func (a *DefaultAPIService) UpdateGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiUpdateGatewayBGPFilterRuleRequest { + return ApiUpdateGatewayBGPFilterRuleRequest{ ApiService: a, ctx: ctx, projectId: projectId, region: region, gatewayId: gatewayId, + filterId: filterId, + ruleId: ruleId, } } // Execute executes the request // -// @return GatewayResponse -func (a *DefaultAPIService) UpdateGatewayExecute(r ApiUpdateGatewayRequest) (*GatewayResponse, error) { +// @return BGPFilterRule +func (a *DefaultAPIService) UpdateGatewayBGPFilterRuleExecute(r ApiUpdateGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GatewayResponse + localVarReturnValue *BGPFilterRule ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateGateway") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateGatewayBGPFilterRule") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}" + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/bgp-filters/{filterId}/rules/{ruleId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) localVarPath = strings.Replace(localVarPath, "{"+"gatewayId"+"}", url.PathEscape(parameterValueToString(r.gatewayId, "gatewayId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filterId"+"}", url.PathEscape(parameterValueToString(r.filterId, "filterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", url.PathEscape(parameterValueToString(r.ruleId, "ruleId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.updateGatewayPayload == nil { - return localVarReturnValue, reportError("updateGatewayPayload is required and must be specified") + if r.updateGatewayBGPFilterRulePayload == nil { + return localVarReturnValue, reportError("updateGatewayBGPFilterRulePayload is required and must be specified") } // to determine the Content-Type header @@ -2401,7 +4493,7 @@ func (a *DefaultAPIService) UpdateGatewayExecute(r ApiUpdateGatewayRequest) (*Ga localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.updateGatewayPayload + localVarPostBody = r.updateGatewayBGPFilterRulePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2467,6 +4559,17 @@ func (a *DefaultAPIService) UpdateGatewayExecute(r ApiUpdateGatewayRequest) (*Ga newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 409 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2478,6 +4581,17 @@ func (a *DefaultAPIService) UpdateGatewayExecute(r ApiUpdateGatewayRequest) (*Ga newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) diff --git a/services/vpn/v1api/api_default_mock.go b/services/vpn/v1api/api_default_mock.go index 73308db1e..1e209e810 100644 --- a/services/vpn/v1api/api_default_mock.go +++ b/services/vpn/v1api/api_default_mock.go @@ -22,20 +22,36 @@ var _ DefaultAPI = &DefaultAPIServiceMock{} type DefaultAPIServiceMock struct { // CreateGatewayExecuteMock can be populated to implement the behavior of the CreateGatewayExecute function of this mock CreateGatewayExecuteMock *func(r ApiCreateGatewayRequest) (*GatewayResponse, error) + // CreateGatewayBGPFilterExecuteMock can be populated to implement the behavior of the CreateGatewayBGPFilterExecute function of this mock + CreateGatewayBGPFilterExecuteMock *func(r ApiCreateGatewayBGPFilterRequest) (*BGPFilter, error) + // CreateGatewayBGPFilterRuleExecuteMock can be populated to implement the behavior of the CreateGatewayBGPFilterRuleExecute function of this mock + CreateGatewayBGPFilterRuleExecuteMock *func(r ApiCreateGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) // CreateGatewayConnectionExecuteMock can be populated to implement the behavior of the CreateGatewayConnectionExecute function of this mock CreateGatewayConnectionExecuteMock *func(r ApiCreateGatewayConnectionRequest) (*ConnectionResponse, error) // DeleteGatewayExecuteMock can be populated to implement the behavior of the DeleteGatewayExecute function of this mock DeleteGatewayExecuteMock *func(r ApiDeleteGatewayRequest) error + // DeleteGatewayBGPFilterExecuteMock can be populated to implement the behavior of the DeleteGatewayBGPFilterExecute function of this mock + DeleteGatewayBGPFilterExecuteMock *func(r ApiDeleteGatewayBGPFilterRequest) error + // DeleteGatewayBGPFilterRuleExecuteMock can be populated to implement the behavior of the DeleteGatewayBGPFilterRuleExecute function of this mock + DeleteGatewayBGPFilterRuleExecuteMock *func(r ApiDeleteGatewayBGPFilterRuleRequest) error // DeleteGatewayConnectionExecuteMock can be populated to implement the behavior of the DeleteGatewayConnectionExecute function of this mock DeleteGatewayConnectionExecuteMock *func(r ApiDeleteGatewayConnectionRequest) error // GetGatewayExecuteMock can be populated to implement the behavior of the GetGatewayExecute function of this mock GetGatewayExecuteMock *func(r ApiGetGatewayRequest) (*GatewayResponse, error) + // GetGatewayBGPFilterExecuteMock can be populated to implement the behavior of the GetGatewayBGPFilterExecute function of this mock + GetGatewayBGPFilterExecuteMock *func(r ApiGetGatewayBGPFilterRequest) (*BGPFilter, error) + // GetGatewayBGPFilterRuleExecuteMock can be populated to implement the behavior of the GetGatewayBGPFilterRuleExecute function of this mock + GetGatewayBGPFilterRuleExecuteMock *func(r ApiGetGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) // GetGatewayConnectionExecuteMock can be populated to implement the behavior of the GetGatewayConnectionExecute function of this mock GetGatewayConnectionExecuteMock *func(r ApiGetGatewayConnectionRequest) (*ConnectionResponse, error) // GetGatewayConnectionStatusExecuteMock can be populated to implement the behavior of the GetGatewayConnectionStatusExecute function of this mock GetGatewayConnectionStatusExecuteMock *func(r ApiGetGatewayConnectionStatusRequest) (*ConnectionStatusResponse, error) // GetGatewayStatusExecuteMock can be populated to implement the behavior of the GetGatewayStatusExecute function of this mock GetGatewayStatusExecuteMock *func(r ApiGetGatewayStatusRequest) (*GatewayStatusResponse, error) + // ListGatewayBGPFilterRulesExecuteMock can be populated to implement the behavior of the ListGatewayBGPFilterRulesExecute function of this mock + ListGatewayBGPFilterRulesExecuteMock *func(r ApiListGatewayBGPFilterRulesRequest) (*BGPFilterRuleList, error) + // ListGatewayBGPFiltersExecuteMock can be populated to implement the behavior of the ListGatewayBGPFiltersExecute function of this mock + ListGatewayBGPFiltersExecuteMock *func(r ApiListGatewayBGPFiltersRequest) (*BGPFilterList, error) // ListGatewayConnectionsExecuteMock can be populated to implement the behavior of the ListGatewayConnectionsExecute function of this mock ListGatewayConnectionsExecuteMock *func(r ApiListGatewayConnectionsRequest) (*ConnectionList, error) // ListGatewaysExecuteMock can be populated to implement the behavior of the ListGatewaysExecute function of this mock @@ -46,6 +62,10 @@ type DefaultAPIServiceMock struct { ListQuotasExecuteMock *func(r ApiListQuotasRequest) (*QuotaListResponse, error) // UpdateGatewayExecuteMock can be populated to implement the behavior of the UpdateGatewayExecute function of this mock UpdateGatewayExecuteMock *func(r ApiUpdateGatewayRequest) (*GatewayResponse, error) + // UpdateGatewayBGPFilterExecuteMock can be populated to implement the behavior of the UpdateGatewayBGPFilterExecute function of this mock + UpdateGatewayBGPFilterExecuteMock *func(r ApiUpdateGatewayBGPFilterRequest) (*BGPFilter, error) + // UpdateGatewayBGPFilterRuleExecuteMock can be populated to implement the behavior of the UpdateGatewayBGPFilterRuleExecute function of this mock + UpdateGatewayBGPFilterRuleExecuteMock *func(r ApiUpdateGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) // UpdateGatewayConnectionExecuteMock can be populated to implement the behavior of the UpdateGatewayConnectionExecute function of this mock UpdateGatewayConnectionExecuteMock *func(r ApiUpdateGatewayConnectionRequest) (*ConnectionResponse, error) } @@ -69,6 +89,47 @@ func (a DefaultAPIServiceMock) CreateGatewayExecute(r ApiCreateGatewayRequest) ( return (*a.CreateGatewayExecuteMock)(r) } +func (a DefaultAPIServiceMock) CreateGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string) ApiCreateGatewayBGPFilterRequest { + return ApiCreateGatewayBGPFilterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// CreateGatewayBGPFilterExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateGatewayBGPFilterExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateGatewayBGPFilterExecute(r ApiCreateGatewayBGPFilterRequest) (*BGPFilter, error) { + if a.CreateGatewayBGPFilterExecuteMock == nil { + var localVarReturnValue *BGPFilter + return localVarReturnValue, nil + } + + return (*a.CreateGatewayBGPFilterExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiCreateGatewayBGPFilterRuleRequest { + return ApiCreateGatewayBGPFilterRuleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + } +} + +// CreateGatewayBGPFilterRuleExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateGatewayBGPFilterRuleExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateGatewayBGPFilterRuleExecute(r ApiCreateGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) { + if a.CreateGatewayBGPFilterRuleExecuteMock == nil { + var localVarReturnValue *BGPFilterRule + return localVarReturnValue, nil + } + + return (*a.CreateGatewayBGPFilterRuleExecuteMock)(r) +} + func (a DefaultAPIServiceMock) CreateGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string) ApiCreateGatewayConnectionRequest { return ApiCreateGatewayConnectionRequest{ ApiService: a, @@ -108,6 +169,47 @@ func (a DefaultAPIServiceMock) DeleteGatewayExecute(r ApiDeleteGatewayRequest) e return (*a.DeleteGatewayExecuteMock)(r) } +func (a DefaultAPIServiceMock) DeleteGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiDeleteGatewayBGPFilterRequest { + return ApiDeleteGatewayBGPFilterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + } +} + +// DeleteGatewayBGPFilterExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteGatewayBGPFilterExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteGatewayBGPFilterExecute(r ApiDeleteGatewayBGPFilterRequest) error { + if a.DeleteGatewayBGPFilterExecuteMock == nil { + return nil + } + + return (*a.DeleteGatewayBGPFilterExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiDeleteGatewayBGPFilterRuleRequest { + return ApiDeleteGatewayBGPFilterRuleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + ruleId: ruleId, + } +} + +// DeleteGatewayBGPFilterRuleExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteGatewayBGPFilterRuleExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteGatewayBGPFilterRuleExecute(r ApiDeleteGatewayBGPFilterRuleRequest) error { + if a.DeleteGatewayBGPFilterRuleExecuteMock == nil { + return nil + } + + return (*a.DeleteGatewayBGPFilterRuleExecuteMock)(r) +} + func (a DefaultAPIServiceMock) DeleteGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiDeleteGatewayConnectionRequest { return ApiDeleteGatewayConnectionRequest{ ApiService: a, @@ -148,6 +250,49 @@ func (a DefaultAPIServiceMock) GetGatewayExecute(r ApiGetGatewayRequest) (*Gatew return (*a.GetGatewayExecuteMock)(r) } +func (a DefaultAPIServiceMock) GetGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiGetGatewayBGPFilterRequest { + return ApiGetGatewayBGPFilterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + } +} + +// GetGatewayBGPFilterExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetGatewayBGPFilterExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetGatewayBGPFilterExecute(r ApiGetGatewayBGPFilterRequest) (*BGPFilter, error) { + if a.GetGatewayBGPFilterExecuteMock == nil { + var localVarReturnValue *BGPFilter + return localVarReturnValue, nil + } + + return (*a.GetGatewayBGPFilterExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiGetGatewayBGPFilterRuleRequest { + return ApiGetGatewayBGPFilterRuleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + ruleId: ruleId, + } +} + +// GetGatewayBGPFilterRuleExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetGatewayBGPFilterRuleExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetGatewayBGPFilterRuleExecute(r ApiGetGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) { + if a.GetGatewayBGPFilterRuleExecuteMock == nil { + var localVarReturnValue *BGPFilterRule + return localVarReturnValue, nil + } + + return (*a.GetGatewayBGPFilterRuleExecuteMock)(r) +} + func (a DefaultAPIServiceMock) GetGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiGetGatewayConnectionRequest { return ApiGetGatewayConnectionRequest{ ApiService: a, @@ -210,6 +355,47 @@ func (a DefaultAPIServiceMock) GetGatewayStatusExecute(r ApiGetGatewayStatusRequ return (*a.GetGatewayStatusExecuteMock)(r) } +func (a DefaultAPIServiceMock) ListGatewayBGPFilterRules(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiListGatewayBGPFilterRulesRequest { + return ApiListGatewayBGPFilterRulesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + } +} + +// ListGatewayBGPFilterRulesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListGatewayBGPFilterRulesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListGatewayBGPFilterRulesExecute(r ApiListGatewayBGPFilterRulesRequest) (*BGPFilterRuleList, error) { + if a.ListGatewayBGPFilterRulesExecuteMock == nil { + var localVarReturnValue *BGPFilterRuleList + return localVarReturnValue, nil + } + + return (*a.ListGatewayBGPFilterRulesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListGatewayBGPFilters(ctx context.Context, projectId string, region string, gatewayId string) ApiListGatewayBGPFiltersRequest { + return ApiListGatewayBGPFiltersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// ListGatewayBGPFiltersExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListGatewayBGPFiltersExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListGatewayBGPFiltersExecute(r ApiListGatewayBGPFiltersRequest) (*BGPFilterList, error) { + if a.ListGatewayBGPFiltersExecuteMock == nil { + var localVarReturnValue *BGPFilterList + return localVarReturnValue, nil + } + + return (*a.ListGatewayBGPFiltersExecuteMock)(r) +} + func (a DefaultAPIServiceMock) ListGatewayConnections(ctx context.Context, projectId string, region string, gatewayId string) ApiListGatewayConnectionsRequest { return ApiListGatewayConnectionsRequest{ ApiService: a, @@ -306,6 +492,49 @@ func (a DefaultAPIServiceMock) UpdateGatewayExecute(r ApiUpdateGatewayRequest) ( return (*a.UpdateGatewayExecuteMock)(r) } +func (a DefaultAPIServiceMock) UpdateGatewayBGPFilter(ctx context.Context, projectId string, region string, gatewayId string, filterId string) ApiUpdateGatewayBGPFilterRequest { + return ApiUpdateGatewayBGPFilterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + } +} + +// UpdateGatewayBGPFilterExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateGatewayBGPFilterExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateGatewayBGPFilterExecute(r ApiUpdateGatewayBGPFilterRequest) (*BGPFilter, error) { + if a.UpdateGatewayBGPFilterExecuteMock == nil { + var localVarReturnValue *BGPFilter + return localVarReturnValue, nil + } + + return (*a.UpdateGatewayBGPFilterExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateGatewayBGPFilterRule(ctx context.Context, projectId string, region string, gatewayId string, filterId string, ruleId string) ApiUpdateGatewayBGPFilterRuleRequest { + return ApiUpdateGatewayBGPFilterRuleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + filterId: filterId, + ruleId: ruleId, + } +} + +// UpdateGatewayBGPFilterRuleExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateGatewayBGPFilterRuleExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateGatewayBGPFilterRuleExecute(r ApiUpdateGatewayBGPFilterRuleRequest) (*BGPFilterRule, error) { + if a.UpdateGatewayBGPFilterRuleExecuteMock == nil { + var localVarReturnValue *BGPFilterRule + return localVarReturnValue, nil + } + + return (*a.UpdateGatewayBGPFilterRuleExecuteMock)(r) +} + func (a DefaultAPIServiceMock) UpdateGatewayConnection(ctx context.Context, projectId string, region string, gatewayId string, connectionId string) ApiUpdateGatewayConnectionRequest { return ApiUpdateGatewayConnectionRequest{ ApiService: a, diff --git a/services/vpn/v1api/model_api_error_detail_reason.go b/services/vpn/v1api/model_api_error_detail_reason.go index c4443bb73..723bbb233 100644 --- a/services/vpn/v1api/model_api_error_detail_reason.go +++ b/services/vpn/v1api/model_api_error_detail_reason.go @@ -15,13 +15,14 @@ import ( "fmt" ) -// APIErrorDetailReason The reason why the error occurs. +// APIErrorDetailReason The reason why the error occurs. RESOURCE_IN_USE is returned when a referenced resource cannot be deleted; the 'metadata.references' field then lists the referencing resources (e.g. connection IDs and displayNames pointing at a BGPFilter on DELETE). type APIErrorDetailReason string // List of APIErrorDetail_reason const ( APIERRORDETAILREASON_INVALID_FIELD APIErrorDetailReason = "INVALID_FIELD" APIERRORDETAILREASON_INVALID_PATH_PARAMETER APIErrorDetailReason = "INVALID_PATH_PARAMETER" + APIERRORDETAILREASON_RESOURCE_IN_USE APIErrorDetailReason = "RESOURCE_IN_USE" APIERRORDETAILREASON_UNKNOWN_DEFAULT_OPEN_API APIErrorDetailReason = "unknown_default_open_api" ) @@ -29,6 +30,7 @@ const ( var AllowedAPIErrorDetailReasonEnumValues = []APIErrorDetailReason{ "INVALID_FIELD", "INVALID_PATH_PARAMETER", + "RESOURCE_IN_USE", "unknown_default_open_api", } diff --git a/services/vpn/v1api/model_bgp_filter.go b/services/vpn/v1api/model_bgp_filter.go new file mode 100644 index 000000000..bf6cff92d --- /dev/null +++ b/services/vpn/v1api/model_bgp_filter.go @@ -0,0 +1,205 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the BGPFilter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPFilter{} + +// BGPFilter A named BGP route filter. Internally a BGPFilter holds an ordered set of rules (managed via the nested /rules sub-resource); a route is evaluated against each rule in 'sequence' order and the first match decides the outcome. An implicit DENY is applied after the last rule, so a route that matches no PERMIT rule is dropped. Attaching an empty filter to a tunnel therefore denies every route. Resource limits: the maximum number of filters per gateway equals the gateway plan's maxConnections value; the maximum number of rules per filter is 10. +type BGPFilter struct { + // A user-friendly name for the filter. Display only — not enforced unique across a gateway. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` + // The server-generated UUID of the filter. + Id *string `json:"id,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BGPFilter BGPFilter + +// NewBGPFilter instantiates a new BGPFilter 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 NewBGPFilter(displayName string) *BGPFilter { + this := BGPFilter{} + this.DisplayName = displayName + return &this +} + +// NewBGPFilterWithDefaults instantiates a new BGPFilter 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 NewBGPFilterWithDefaults() *BGPFilter { + this := BGPFilter{} + return &this +} + +// GetDisplayName returns the DisplayName field value +func (o *BGPFilter) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *BGPFilter) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *BGPFilter) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BGPFilter) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilter) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BGPFilter) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BGPFilter) SetId(v string) { + o.Id = &v +} + +func (o BGPFilter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPFilter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPFilter) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBGPFilter := _BGPFilter{} + + err = json.Unmarshal(data, &varBGPFilter) + + if err != nil { + return err + } + + *o = BGPFilter(varBGPFilter) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPFilter struct { + value *BGPFilter + isSet bool +} + +func (v NullableBGPFilter) Get() *BGPFilter { + return v.value +} + +func (v *NullableBGPFilter) Set(val *BGPFilter) { + v.value = val + v.isSet = true +} + +func (v NullableBGPFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPFilter(val *BGPFilter) *NullableBGPFilter { + return &NullableBGPFilter{value: val, isSet: true} +} + +func (v NullableBGPFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_bgp_filter_list.go b/services/vpn/v1api/model_bgp_filter_list.go new file mode 100644 index 000000000..cecd3f7aa --- /dev/null +++ b/services/vpn/v1api/model_bgp_filter_list.go @@ -0,0 +1,166 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the BGPFilterList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPFilterList{} + +// BGPFilterList Response wrapper for listing BGP filters. +type BGPFilterList struct { + BgpFilters []BGPFilter `json:"bgpFilters"` + AdditionalProperties map[string]interface{} +} + +type _BGPFilterList BGPFilterList + +// NewBGPFilterList instantiates a new BGPFilterList 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 NewBGPFilterList(bgpFilters []BGPFilter) *BGPFilterList { + this := BGPFilterList{} + this.BgpFilters = bgpFilters + return &this +} + +// NewBGPFilterListWithDefaults instantiates a new BGPFilterList 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 NewBGPFilterListWithDefaults() *BGPFilterList { + this := BGPFilterList{} + return &this +} + +// GetBgpFilters returns the BgpFilters field value +func (o *BGPFilterList) GetBgpFilters() []BGPFilter { + if o == nil { + var ret []BGPFilter + return ret + } + + return o.BgpFilters +} + +// GetBgpFiltersOk returns a tuple with the BgpFilters field value +// and a boolean to check if the value has been set. +func (o *BGPFilterList) GetBgpFiltersOk() ([]BGPFilter, bool) { + if o == nil { + return nil, false + } + return o.BgpFilters, true +} + +// SetBgpFilters sets field value +func (o *BGPFilterList) SetBgpFilters(v []BGPFilter) { + o.BgpFilters = v +} + +func (o BGPFilterList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPFilterList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bgpFilters"] = o.BgpFilters + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPFilterList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "bgpFilters", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBGPFilterList := _BGPFilterList{} + + err = json.Unmarshal(data, &varBGPFilterList) + + if err != nil { + return err + } + + *o = BGPFilterList(varBGPFilterList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgpFilters") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPFilterList struct { + value *BGPFilterList + isSet bool +} + +func (v NullableBGPFilterList) Get() *BGPFilterList { + return v.value +} + +func (v *NullableBGPFilterList) Set(val *BGPFilterList) { + v.value = val + v.isSet = true +} + +func (v NullableBGPFilterList) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPFilterList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPFilterList(val *BGPFilterList) *NullableBGPFilterList { + return &NullableBGPFilterList{value: val, isSet: true} +} + +func (v NullableBGPFilterList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPFilterList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_bgp_filter_rule.go b/services/vpn/v1api/model_bgp_filter_rule.go new file mode 100644 index 000000000..9617f7267 --- /dev/null +++ b/services/vpn/v1api/model_bgp_filter_rule.go @@ -0,0 +1,316 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the BGPFilterRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPFilterRule{} + +// BGPFilterRule A single rule within a BGPFilter. All non-empty fields within the 'match' block are AND-combined. Rules within a filter are evaluated in 'sequence' order; the first matching rule decides the outcome (logical OR across rules). An implicit DENY follows the last rule. +type BGPFilterRule struct { + Action BGPFilterRuleAction `json:"action"` + // The server-generated UUID of the specific rule. + Id *string `json:"id,omitempty"` + Match *BGPFilterRuleMatch `json:"match,omitempty"` + // The evaluation order of the rule. Lower numbers are evaluated first. Must be unique within a filter. On POST, this field is optional: when omitted the server auto-assigns max(existing)+10 (the first rule starts at 10). On PUT this field is required — sending a partial update without 'sequence' returns 400. + Sequence *int32 `json:"sequence,omitempty"` + Set *BGPFilterRuleSet `json:"set,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BGPFilterRule BGPFilterRule + +// NewBGPFilterRule instantiates a new BGPFilterRule 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 NewBGPFilterRule(action BGPFilterRuleAction) *BGPFilterRule { + this := BGPFilterRule{} + this.Action = action + return &this +} + +// NewBGPFilterRuleWithDefaults instantiates a new BGPFilterRule 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 NewBGPFilterRuleWithDefaults() *BGPFilterRule { + this := BGPFilterRule{} + return &this +} + +// GetAction returns the Action field value +func (o *BGPFilterRule) GetAction() BGPFilterRuleAction { + if o == nil { + var ret BGPFilterRuleAction + return ret + } + + return o.Action +} + +// GetActionOk returns a tuple with the Action field value +// and a boolean to check if the value has been set. +func (o *BGPFilterRule) GetActionOk() (*BGPFilterRuleAction, bool) { + if o == nil { + return nil, false + } + return &o.Action, true +} + +// SetAction sets field value +func (o *BGPFilterRule) SetAction(v BGPFilterRuleAction) { + o.Action = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BGPFilterRule) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRule) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BGPFilterRule) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BGPFilterRule) SetId(v string) { + o.Id = &v +} + +// GetMatch returns the Match field value if set, zero value otherwise. +func (o *BGPFilterRule) GetMatch() BGPFilterRuleMatch { + if o == nil || IsNil(o.Match) { + var ret BGPFilterRuleMatch + return ret + } + return *o.Match +} + +// GetMatchOk returns a tuple with the Match field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRule) GetMatchOk() (*BGPFilterRuleMatch, bool) { + if o == nil || IsNil(o.Match) { + return nil, false + } + return o.Match, true +} + +// HasMatch returns a boolean if a field has been set. +func (o *BGPFilterRule) HasMatch() bool { + if o != nil && !IsNil(o.Match) { + return true + } + + return false +} + +// SetMatch gets a reference to the given BGPFilterRuleMatch and assigns it to the Match field. +func (o *BGPFilterRule) SetMatch(v BGPFilterRuleMatch) { + o.Match = &v +} + +// GetSequence returns the Sequence field value if set, zero value otherwise. +func (o *BGPFilterRule) GetSequence() int32 { + if o == nil || IsNil(o.Sequence) { + var ret int32 + return ret + } + return *o.Sequence +} + +// GetSequenceOk returns a tuple with the Sequence field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRule) GetSequenceOk() (*int32, bool) { + if o == nil || IsNil(o.Sequence) { + return nil, false + } + return o.Sequence, true +} + +// HasSequence returns a boolean if a field has been set. +func (o *BGPFilterRule) HasSequence() bool { + if o != nil && !IsNil(o.Sequence) { + return true + } + + return false +} + +// SetSequence gets a reference to the given int32 and assigns it to the Sequence field. +func (o *BGPFilterRule) SetSequence(v int32) { + o.Sequence = &v +} + +// GetSet returns the Set field value if set, zero value otherwise. +func (o *BGPFilterRule) GetSet() BGPFilterRuleSet { + if o == nil || IsNil(o.Set) { + var ret BGPFilterRuleSet + return ret + } + return *o.Set +} + +// GetSetOk returns a tuple with the Set field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRule) GetSetOk() (*BGPFilterRuleSet, bool) { + if o == nil || IsNil(o.Set) { + return nil, false + } + return o.Set, true +} + +// HasSet returns a boolean if a field has been set. +func (o *BGPFilterRule) HasSet() bool { + if o != nil && !IsNil(o.Set) { + return true + } + + return false +} + +// SetSet gets a reference to the given BGPFilterRuleSet and assigns it to the Set field. +func (o *BGPFilterRule) SetSet(v BGPFilterRuleSet) { + o.Set = &v +} + +func (o BGPFilterRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPFilterRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Match) { + toSerialize["match"] = o.Match + } + if !IsNil(o.Sequence) { + toSerialize["sequence"] = o.Sequence + } + if !IsNil(o.Set) { + toSerialize["set"] = o.Set + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPFilterRule) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBGPFilterRule := _BGPFilterRule{} + + err = json.Unmarshal(data, &varBGPFilterRule) + + if err != nil { + return err + } + + *o = BGPFilterRule(varBGPFilterRule) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "action") + delete(additionalProperties, "id") + delete(additionalProperties, "match") + delete(additionalProperties, "sequence") + delete(additionalProperties, "set") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPFilterRule struct { + value *BGPFilterRule + isSet bool +} + +func (v NullableBGPFilterRule) Get() *BGPFilterRule { + return v.value +} + +func (v *NullableBGPFilterRule) Set(val *BGPFilterRule) { + v.value = val + v.isSet = true +} + +func (v NullableBGPFilterRule) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPFilterRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPFilterRule(val *BGPFilterRule) *NullableBGPFilterRule { + return &NullableBGPFilterRule{value: val, isSet: true} +} + +func (v NullableBGPFilterRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPFilterRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_bgp_filter_rule_action.go b/services/vpn/v1api/model_bgp_filter_rule_action.go new file mode 100644 index 000000000..ad811d70a --- /dev/null +++ b/services/vpn/v1api/model_bgp_filter_rule_action.go @@ -0,0 +1,113 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// BGPFilterRuleAction The action to take if the route matches all criteria. Case-sensitive. +type BGPFilterRuleAction string + +// List of BGPFilterRule_action +const ( + BGPFILTERRULEACTION_PERMIT BGPFilterRuleAction = "PERMIT" + BGPFILTERRULEACTION_DENY BGPFilterRuleAction = "DENY" + BGPFILTERRULEACTION_UNKNOWN_DEFAULT_OPEN_API BGPFilterRuleAction = "unknown_default_open_api" +) + +// All allowed values of BGPFilterRuleAction enum +var AllowedBGPFilterRuleActionEnumValues = []BGPFilterRuleAction{ + "PERMIT", + "DENY", + "unknown_default_open_api", +} + +func (v *BGPFilterRuleAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := BGPFilterRuleAction(value) + for _, existing := range AllowedBGPFilterRuleActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = BGPFILTERRULEACTION_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewBGPFilterRuleActionFromValue returns a pointer to a valid BGPFilterRuleAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBGPFilterRuleActionFromValue(v string) (*BGPFilterRuleAction, error) { + ev := BGPFilterRuleAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BGPFilterRuleAction: valid values are %v", v, AllowedBGPFilterRuleActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BGPFilterRuleAction) IsValid() bool { + for _, existing := range AllowedBGPFilterRuleActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to BGPFilterRule_action value +func (v BGPFilterRuleAction) Ptr() *BGPFilterRuleAction { + return &v +} + +type NullableBGPFilterRuleAction struct { + value *BGPFilterRuleAction + isSet bool +} + +func (v NullableBGPFilterRuleAction) Get() *BGPFilterRuleAction { + return v.value +} + +func (v *NullableBGPFilterRuleAction) Set(val *BGPFilterRuleAction) { + v.value = val + v.isSet = true +} + +func (v NullableBGPFilterRuleAction) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPFilterRuleAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPFilterRuleAction(val *BGPFilterRuleAction) *NullableBGPFilterRuleAction { + return &NullableBGPFilterRuleAction{value: val, isSet: true} +} + +func (v NullableBGPFilterRuleAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPFilterRuleAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_bgp_filter_rule_list.go b/services/vpn/v1api/model_bgp_filter_rule_list.go new file mode 100644 index 000000000..79d73980c --- /dev/null +++ b/services/vpn/v1api/model_bgp_filter_rule_list.go @@ -0,0 +1,166 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the BGPFilterRuleList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPFilterRuleList{} + +// BGPFilterRuleList Response wrapper for listing rules within a BGP filter. +type BGPFilterRuleList struct { + Rules []BGPFilterRule `json:"rules"` + AdditionalProperties map[string]interface{} +} + +type _BGPFilterRuleList BGPFilterRuleList + +// NewBGPFilterRuleList instantiates a new BGPFilterRuleList 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 NewBGPFilterRuleList(rules []BGPFilterRule) *BGPFilterRuleList { + this := BGPFilterRuleList{} + this.Rules = rules + return &this +} + +// NewBGPFilterRuleListWithDefaults instantiates a new BGPFilterRuleList 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 NewBGPFilterRuleListWithDefaults() *BGPFilterRuleList { + this := BGPFilterRuleList{} + return &this +} + +// GetRules returns the Rules field value +func (o *BGPFilterRuleList) GetRules() []BGPFilterRule { + if o == nil { + var ret []BGPFilterRule + return ret + } + + return o.Rules +} + +// GetRulesOk returns a tuple with the Rules field value +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleList) GetRulesOk() ([]BGPFilterRule, bool) { + if o == nil { + return nil, false + } + return o.Rules, true +} + +// SetRules sets field value +func (o *BGPFilterRuleList) SetRules(v []BGPFilterRule) { + o.Rules = v +} + +func (o BGPFilterRuleList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPFilterRuleList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["rules"] = o.Rules + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPFilterRuleList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "rules", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBGPFilterRuleList := _BGPFilterRuleList{} + + err = json.Unmarshal(data, &varBGPFilterRuleList) + + if err != nil { + return err + } + + *o = BGPFilterRuleList(varBGPFilterRuleList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rules") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPFilterRuleList struct { + value *BGPFilterRuleList + isSet bool +} + +func (v NullableBGPFilterRuleList) Get() *BGPFilterRuleList { + return v.value +} + +func (v *NullableBGPFilterRuleList) Set(val *BGPFilterRuleList) { + v.value = val + v.isSet = true +} + +func (v NullableBGPFilterRuleList) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPFilterRuleList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPFilterRuleList(val *BGPFilterRuleList) *NullableBGPFilterRuleList { + return &NullableBGPFilterRuleList{value: val, isSet: true} +} + +func (v NullableBGPFilterRuleList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPFilterRuleList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_bgp_filter_rule_match.go b/services/vpn/v1api/model_bgp_filter_rule_match.go new file mode 100644 index 000000000..69512906d --- /dev/null +++ b/services/vpn/v1api/model_bgp_filter_rule_match.go @@ -0,0 +1,382 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the BGPFilterRuleMatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPFilterRuleMatch{} + +// BGPFilterRuleMatch Optional matching criteria. If omitted entirely, the rule acts as match-all. All non-empty fields in this block must match (logical AND). +type BGPFilterRuleMatch struct { + // Matches if the AS-PATH contains any one of the listed ASNs (logical OR within the list). Treated as an unordered set; ordering is not preserved by the storage layer. When combined with firstASN, both conditions must hold (logical AND, consistent with the rest of the match block). If firstASN is also listed here, its presence as the first hop is sufficient to satisfy this list; no duplicate hop is required. + AsPathContainsAny []int64 `json:"asPathContainsAny,omitempty"` + // Matches if the route carries any one of these BGP standard communities (logical OR within the list). Format is 'asn:value' per RFC 1997 (both halves must fit in a uint32, i.e. 0..4294967295). Extended, large and well-known communities are not supported. + Communities []string `json:"communities,omitempty"` + // Matches if the first ASN (immediate neighbor) in the AS-PATH equals this ASN. Combines with asPathContainsAny using logical AND: when both are set, the first ASN must equal firstASN AND the path must additionally contain at least one ASN from asPathContainsAny. + FirstASN *int64 `json:"firstASN,omitempty"` + // Maximum subnet mask length for matched prefixes. May be set together with 'prefixes' (narrows matches to subnets at most this long) or alone (matches any IPv4 route with a mask length <= this value, equivalent to implicit 'prefixes: [0.0.0.0/0]'). + MaxPrefixLength *int32 `json:"maxPrefixLength,omitempty"` + // Minimum subnet mask length for matched prefixes. May be set together with 'prefixes' (narrows matches to subnets at least this long) or alone (matches any IPv4 route with a mask length >= this value, equivalent to implicit 'prefixes: [0.0.0.0/0]'). If both minPrefixLength and maxPrefixLength are set, minPrefixLength must be <= maxPrefixLength. + MinPrefixLength *int32 `json:"minPrefixLength,omitempty"` + // Matches the exact IPv4 address of the BGP neighbor that advertised the route. Useful when the same filter is attached to multiple tunnels with different neighbor IPs (allows per-peer rules in a shared filter). When a filter is attached to a single tunnel, this field is effectively a no-op because the route-map is already neighbor-scoped. + Peer *string `json:"peer,omitempty" validate:"regexp=^((25[0-5]|(2[0-4]|1\\\\d|[1-9]|)\\\\d)\\\\.?\\\\b){4}$"` + // List of IPv4 networks to match. A route's prefix matches if it equals one of these (subject to minPrefixLength/maxPrefixLength refinement). If omitted, an implicit 0.0.0.0/0 base is used when minPrefixLength or maxPrefixLength is set; if all three are omitted, prefix matching is not performed at all. Each entry must parse as a valid IPv4 CIDR; the network portion is normalised (10.0.0.5/24 → 10.0.0.0/24). + Prefixes []string `json:"prefixes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BGPFilterRuleMatch BGPFilterRuleMatch + +// NewBGPFilterRuleMatch instantiates a new BGPFilterRuleMatch 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 NewBGPFilterRuleMatch() *BGPFilterRuleMatch { + this := BGPFilterRuleMatch{} + return &this +} + +// NewBGPFilterRuleMatchWithDefaults instantiates a new BGPFilterRuleMatch 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 NewBGPFilterRuleMatchWithDefaults() *BGPFilterRuleMatch { + this := BGPFilterRuleMatch{} + return &this +} + +// GetAsPathContainsAny returns the AsPathContainsAny field value if set, zero value otherwise. +func (o *BGPFilterRuleMatch) GetAsPathContainsAny() []int64 { + if o == nil || IsNil(o.AsPathContainsAny) { + var ret []int64 + return ret + } + return o.AsPathContainsAny +} + +// GetAsPathContainsAnyOk returns a tuple with the AsPathContainsAny field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleMatch) GetAsPathContainsAnyOk() ([]int64, bool) { + if o == nil || IsNil(o.AsPathContainsAny) { + return nil, false + } + return o.AsPathContainsAny, true +} + +// HasAsPathContainsAny returns a boolean if a field has been set. +func (o *BGPFilterRuleMatch) HasAsPathContainsAny() bool { + if o != nil && !IsNil(o.AsPathContainsAny) { + return true + } + + return false +} + +// SetAsPathContainsAny gets a reference to the given []int64 and assigns it to the AsPathContainsAny field. +func (o *BGPFilterRuleMatch) SetAsPathContainsAny(v []int64) { + o.AsPathContainsAny = v +} + +// GetCommunities returns the Communities field value if set, zero value otherwise. +func (o *BGPFilterRuleMatch) GetCommunities() []string { + if o == nil || IsNil(o.Communities) { + var ret []string + return ret + } + return o.Communities +} + +// GetCommunitiesOk returns a tuple with the Communities field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleMatch) GetCommunitiesOk() ([]string, bool) { + if o == nil || IsNil(o.Communities) { + return nil, false + } + return o.Communities, true +} + +// HasCommunities returns a boolean if a field has been set. +func (o *BGPFilterRuleMatch) HasCommunities() bool { + if o != nil && !IsNil(o.Communities) { + return true + } + + return false +} + +// SetCommunities gets a reference to the given []string and assigns it to the Communities field. +func (o *BGPFilterRuleMatch) SetCommunities(v []string) { + o.Communities = v +} + +// GetFirstASN returns the FirstASN field value if set, zero value otherwise. +func (o *BGPFilterRuleMatch) GetFirstASN() int64 { + if o == nil || IsNil(o.FirstASN) { + var ret int64 + return ret + } + return *o.FirstASN +} + +// GetFirstASNOk returns a tuple with the FirstASN field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleMatch) GetFirstASNOk() (*int64, bool) { + if o == nil || IsNil(o.FirstASN) { + return nil, false + } + return o.FirstASN, true +} + +// HasFirstASN returns a boolean if a field has been set. +func (o *BGPFilterRuleMatch) HasFirstASN() bool { + if o != nil && !IsNil(o.FirstASN) { + return true + } + + return false +} + +// SetFirstASN gets a reference to the given int64 and assigns it to the FirstASN field. +func (o *BGPFilterRuleMatch) SetFirstASN(v int64) { + o.FirstASN = &v +} + +// GetMaxPrefixLength returns the MaxPrefixLength field value if set, zero value otherwise. +func (o *BGPFilterRuleMatch) GetMaxPrefixLength() int32 { + if o == nil || IsNil(o.MaxPrefixLength) { + var ret int32 + return ret + } + return *o.MaxPrefixLength +} + +// GetMaxPrefixLengthOk returns a tuple with the MaxPrefixLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleMatch) GetMaxPrefixLengthOk() (*int32, bool) { + if o == nil || IsNil(o.MaxPrefixLength) { + return nil, false + } + return o.MaxPrefixLength, true +} + +// HasMaxPrefixLength returns a boolean if a field has been set. +func (o *BGPFilterRuleMatch) HasMaxPrefixLength() bool { + if o != nil && !IsNil(o.MaxPrefixLength) { + return true + } + + return false +} + +// SetMaxPrefixLength gets a reference to the given int32 and assigns it to the MaxPrefixLength field. +func (o *BGPFilterRuleMatch) SetMaxPrefixLength(v int32) { + o.MaxPrefixLength = &v +} + +// GetMinPrefixLength returns the MinPrefixLength field value if set, zero value otherwise. +func (o *BGPFilterRuleMatch) GetMinPrefixLength() int32 { + if o == nil || IsNil(o.MinPrefixLength) { + var ret int32 + return ret + } + return *o.MinPrefixLength +} + +// GetMinPrefixLengthOk returns a tuple with the MinPrefixLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleMatch) GetMinPrefixLengthOk() (*int32, bool) { + if o == nil || IsNil(o.MinPrefixLength) { + return nil, false + } + return o.MinPrefixLength, true +} + +// HasMinPrefixLength returns a boolean if a field has been set. +func (o *BGPFilterRuleMatch) HasMinPrefixLength() bool { + if o != nil && !IsNil(o.MinPrefixLength) { + return true + } + + return false +} + +// SetMinPrefixLength gets a reference to the given int32 and assigns it to the MinPrefixLength field. +func (o *BGPFilterRuleMatch) SetMinPrefixLength(v int32) { + o.MinPrefixLength = &v +} + +// GetPeer returns the Peer field value if set, zero value otherwise. +func (o *BGPFilterRuleMatch) GetPeer() string { + if o == nil || IsNil(o.Peer) { + var ret string + return ret + } + return *o.Peer +} + +// GetPeerOk returns a tuple with the Peer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleMatch) GetPeerOk() (*string, bool) { + if o == nil || IsNil(o.Peer) { + return nil, false + } + return o.Peer, true +} + +// HasPeer returns a boolean if a field has been set. +func (o *BGPFilterRuleMatch) HasPeer() bool { + if o != nil && !IsNil(o.Peer) { + return true + } + + return false +} + +// SetPeer gets a reference to the given string and assigns it to the Peer field. +func (o *BGPFilterRuleMatch) SetPeer(v string) { + o.Peer = &v +} + +// GetPrefixes returns the Prefixes field value if set, zero value otherwise. +func (o *BGPFilterRuleMatch) GetPrefixes() []string { + if o == nil || IsNil(o.Prefixes) { + var ret []string + return ret + } + return o.Prefixes +} + +// GetPrefixesOk returns a tuple with the Prefixes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleMatch) GetPrefixesOk() ([]string, bool) { + if o == nil || IsNil(o.Prefixes) { + return nil, false + } + return o.Prefixes, true +} + +// HasPrefixes returns a boolean if a field has been set. +func (o *BGPFilterRuleMatch) HasPrefixes() bool { + if o != nil && !IsNil(o.Prefixes) { + return true + } + + return false +} + +// SetPrefixes gets a reference to the given []string and assigns it to the Prefixes field. +func (o *BGPFilterRuleMatch) SetPrefixes(v []string) { + o.Prefixes = v +} + +func (o BGPFilterRuleMatch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPFilterRuleMatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AsPathContainsAny) { + toSerialize["asPathContainsAny"] = o.AsPathContainsAny + } + if !IsNil(o.Communities) { + toSerialize["communities"] = o.Communities + } + if !IsNil(o.FirstASN) { + toSerialize["firstASN"] = o.FirstASN + } + if !IsNil(o.MaxPrefixLength) { + toSerialize["maxPrefixLength"] = o.MaxPrefixLength + } + if !IsNil(o.MinPrefixLength) { + toSerialize["minPrefixLength"] = o.MinPrefixLength + } + if !IsNil(o.Peer) { + toSerialize["peer"] = o.Peer + } + if !IsNil(o.Prefixes) { + toSerialize["prefixes"] = o.Prefixes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPFilterRuleMatch) UnmarshalJSON(data []byte) (err error) { + varBGPFilterRuleMatch := _BGPFilterRuleMatch{} + + err = json.Unmarshal(data, &varBGPFilterRuleMatch) + + if err != nil { + return err + } + + *o = BGPFilterRuleMatch(varBGPFilterRuleMatch) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "asPathContainsAny") + delete(additionalProperties, "communities") + delete(additionalProperties, "firstASN") + delete(additionalProperties, "maxPrefixLength") + delete(additionalProperties, "minPrefixLength") + delete(additionalProperties, "peer") + delete(additionalProperties, "prefixes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPFilterRuleMatch struct { + value *BGPFilterRuleMatch + isSet bool +} + +func (v NullableBGPFilterRuleMatch) Get() *BGPFilterRuleMatch { + return v.value +} + +func (v *NullableBGPFilterRuleMatch) Set(val *BGPFilterRuleMatch) { + v.value = val + v.isSet = true +} + +func (v NullableBGPFilterRuleMatch) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPFilterRuleMatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPFilterRuleMatch(val *BGPFilterRuleMatch) *NullableBGPFilterRuleMatch { + return &NullableBGPFilterRuleMatch{value: val, isSet: true} +} + +func (v NullableBGPFilterRuleMatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPFilterRuleMatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_bgp_filter_rule_set.go b/services/vpn/v1api/model_bgp_filter_rule_set.go new file mode 100644 index 000000000..343d262b8 --- /dev/null +++ b/services/vpn/v1api/model_bgp_filter_rule_set.go @@ -0,0 +1,154 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the BGPFilterRuleSet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPFilterRuleSet{} + +// BGPFilterRuleSet Optional BGP attributes to apply when 'action' is PERMIT. Ignored for DENY rules. +type BGPFilterRuleSet struct { + // BGP LOCAL_PREF to set on the route. Higher values are preferred during best-path selection. Default BGP LOCAL_PREF is 100; any value here overrides. + LocalPreference *int32 `json:"localPreference,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BGPFilterRuleSet BGPFilterRuleSet + +// NewBGPFilterRuleSet instantiates a new BGPFilterRuleSet 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 NewBGPFilterRuleSet() *BGPFilterRuleSet { + this := BGPFilterRuleSet{} + return &this +} + +// NewBGPFilterRuleSetWithDefaults instantiates a new BGPFilterRuleSet 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 NewBGPFilterRuleSetWithDefaults() *BGPFilterRuleSet { + this := BGPFilterRuleSet{} + return &this +} + +// GetLocalPreference returns the LocalPreference field value if set, zero value otherwise. +func (o *BGPFilterRuleSet) GetLocalPreference() int32 { + if o == nil || IsNil(o.LocalPreference) { + var ret int32 + return ret + } + return *o.LocalPreference +} + +// GetLocalPreferenceOk returns a tuple with the LocalPreference field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPFilterRuleSet) GetLocalPreferenceOk() (*int32, bool) { + if o == nil || IsNil(o.LocalPreference) { + return nil, false + } + return o.LocalPreference, true +} + +// HasLocalPreference returns a boolean if a field has been set. +func (o *BGPFilterRuleSet) HasLocalPreference() bool { + if o != nil && !IsNil(o.LocalPreference) { + return true + } + + return false +} + +// SetLocalPreference gets a reference to the given int32 and assigns it to the LocalPreference field. +func (o *BGPFilterRuleSet) SetLocalPreference(v int32) { + o.LocalPreference = &v +} + +func (o BGPFilterRuleSet) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPFilterRuleSet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LocalPreference) { + toSerialize["localPreference"] = o.LocalPreference + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPFilterRuleSet) UnmarshalJSON(data []byte) (err error) { + varBGPFilterRuleSet := _BGPFilterRuleSet{} + + err = json.Unmarshal(data, &varBGPFilterRuleSet) + + if err != nil { + return err + } + + *o = BGPFilterRuleSet(varBGPFilterRuleSet) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "localPreference") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPFilterRuleSet struct { + value *BGPFilterRuleSet + isSet bool +} + +func (v NullableBGPFilterRuleSet) Get() *BGPFilterRuleSet { + return v.value +} + +func (v *NullableBGPFilterRuleSet) Set(val *BGPFilterRuleSet) { + v.value = val + v.isSet = true +} + +func (v NullableBGPFilterRuleSet) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPFilterRuleSet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPFilterRuleSet(val *BGPFilterRuleSet) *NullableBGPFilterRuleSet { + return &NullableBGPFilterRuleSet{value: val, isSet: true} +} + +func (v NullableBGPFilterRuleSet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPFilterRuleSet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_bgp_tunnel_config.go b/services/vpn/v1api/model_bgp_tunnel_config.go index 17f686308..5859506ec 100644 --- a/services/vpn/v1api/model_bgp_tunnel_config.go +++ b/services/vpn/v1api/model_bgp_tunnel_config.go @@ -20,6 +20,8 @@ var _ MappedNullable = &BGPTunnelConfig{} // BGPTunnelConfig struct for BGPTunnelConfig type BGPTunnelConfig struct { + // UUID of the BGPFilter to apply to incoming routes from this tunnel's BGP neighbor. The filter must exist in the same gateway. Multiple tunnels may reference the same BGPFilter; in that case the rules' 'match.peer' field can be used to scope behavior per neighbor. Outbound filtering is not yet supported; use gateway.bgp.overrideAdvertisedRoutes to control what is advertised. + InboundFilterId NullableString `json:"inboundFilterId,omitempty"` // ASN for private use (reserved by IANA), both 16Bit and 32Bit ranges are valid (RFC 6996). RemoteAsn int64 `json:"remoteAsn"` AdditionalProperties map[string]interface{} @@ -45,6 +47,49 @@ func NewBGPTunnelConfigWithDefaults() *BGPTunnelConfig { return &this } +// GetInboundFilterId returns the InboundFilterId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BGPTunnelConfig) GetInboundFilterId() string { + if o == nil || IsNil(o.InboundFilterId.Get()) { + var ret string + return ret + } + return *o.InboundFilterId.Get() +} + +// GetInboundFilterIdOk returns a tuple with the InboundFilterId 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 *BGPTunnelConfig) GetInboundFilterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.InboundFilterId.Get(), o.InboundFilterId.IsSet() +} + +// HasInboundFilterId returns a boolean if a field has been set. +func (o *BGPTunnelConfig) HasInboundFilterId() bool { + if o != nil && o.InboundFilterId.IsSet() { + return true + } + + return false +} + +// SetInboundFilterId gets a reference to the given NullableString and assigns it to the InboundFilterId field. +func (o *BGPTunnelConfig) SetInboundFilterId(v string) { + o.InboundFilterId.Set(&v) +} + +// SetInboundFilterIdNil sets the value for InboundFilterId to be an explicit nil +func (o *BGPTunnelConfig) SetInboundFilterIdNil() { + o.InboundFilterId.Set(nil) +} + +// UnsetInboundFilterId ensures that no value is present for InboundFilterId, not even an explicit nil +func (o *BGPTunnelConfig) UnsetInboundFilterId() { + o.InboundFilterId.Unset() +} + // GetRemoteAsn returns the RemoteAsn field value func (o *BGPTunnelConfig) GetRemoteAsn() int64 { if o == nil { @@ -79,6 +124,9 @@ func (o BGPTunnelConfig) MarshalJSON() ([]byte, error) { func (o BGPTunnelConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if o.InboundFilterId.IsSet() { + toSerialize["inboundFilterId"] = o.InboundFilterId.Get() + } toSerialize["remoteAsn"] = o.RemoteAsn for key, value := range o.AdditionalProperties { @@ -123,6 +171,7 @@ func (o *BGPTunnelConfig) UnmarshalJSON(data []byte) (err error) { additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "inboundFilterId") delete(additionalProperties, "remoteAsn") o.AdditionalProperties = additionalProperties } diff --git a/services/vpn/v1api/model_create_gateway_bgp_filter_payload.go b/services/vpn/v1api/model_create_gateway_bgp_filter_payload.go new file mode 100644 index 000000000..0ceeff920 --- /dev/null +++ b/services/vpn/v1api/model_create_gateway_bgp_filter_payload.go @@ -0,0 +1,205 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateGatewayBGPFilterPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateGatewayBGPFilterPayload{} + +// CreateGatewayBGPFilterPayload A named BGP route filter. Internally a BGPFilter holds an ordered set of rules (managed via the nested /rules sub-resource); a route is evaluated against each rule in 'sequence' order and the first match decides the outcome. An implicit DENY is applied after the last rule, so a route that matches no PERMIT rule is dropped. Attaching an empty filter to a tunnel therefore denies every route. Resource limits: the maximum number of filters per gateway equals the gateway plan's maxConnections value; the maximum number of rules per filter is 10. +type CreateGatewayBGPFilterPayload struct { + // A user-friendly name for the filter. Display only — not enforced unique across a gateway. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` + // The server-generated UUID of the filter. + Id *string `json:"id,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateGatewayBGPFilterPayload CreateGatewayBGPFilterPayload + +// NewCreateGatewayBGPFilterPayload instantiates a new CreateGatewayBGPFilterPayload 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 NewCreateGatewayBGPFilterPayload(displayName string) *CreateGatewayBGPFilterPayload { + this := CreateGatewayBGPFilterPayload{} + this.DisplayName = displayName + return &this +} + +// NewCreateGatewayBGPFilterPayloadWithDefaults instantiates a new CreateGatewayBGPFilterPayload 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 NewCreateGatewayBGPFilterPayloadWithDefaults() *CreateGatewayBGPFilterPayload { + this := CreateGatewayBGPFilterPayload{} + return &this +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateGatewayBGPFilterPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateGatewayBGPFilterPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterPayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateGatewayBGPFilterPayload) SetId(v string) { + o.Id = &v +} + +func (o CreateGatewayBGPFilterPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateGatewayBGPFilterPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateGatewayBGPFilterPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateGatewayBGPFilterPayload := _CreateGatewayBGPFilterPayload{} + + err = json.Unmarshal(data, &varCreateGatewayBGPFilterPayload) + + if err != nil { + return err + } + + *o = CreateGatewayBGPFilterPayload(varCreateGatewayBGPFilterPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateGatewayBGPFilterPayload struct { + value *CreateGatewayBGPFilterPayload + isSet bool +} + +func (v NullableCreateGatewayBGPFilterPayload) Get() *CreateGatewayBGPFilterPayload { + return v.value +} + +func (v *NullableCreateGatewayBGPFilterPayload) Set(val *CreateGatewayBGPFilterPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGatewayBGPFilterPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGatewayBGPFilterPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGatewayBGPFilterPayload(val *CreateGatewayBGPFilterPayload) *NullableCreateGatewayBGPFilterPayload { + return &NullableCreateGatewayBGPFilterPayload{value: val, isSet: true} +} + +func (v NullableCreateGatewayBGPFilterPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGatewayBGPFilterPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload.go b/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload.go new file mode 100644 index 000000000..6afc2120f --- /dev/null +++ b/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload.go @@ -0,0 +1,316 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateGatewayBGPFilterRulePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateGatewayBGPFilterRulePayload{} + +// CreateGatewayBGPFilterRulePayload A single rule within a BGPFilter. All non-empty fields within the 'match' block are AND-combined. Rules within a filter are evaluated in 'sequence' order; the first matching rule decides the outcome (logical OR across rules). An implicit DENY follows the last rule. +type CreateGatewayBGPFilterRulePayload struct { + Action CreateGatewayBGPFilterRulePayloadAction `json:"action"` + // The server-generated UUID of the specific rule. + Id *string `json:"id,omitempty"` + Match *CreateGatewayBGPFilterRulePayloadMatch `json:"match,omitempty"` + // The evaluation order of the rule. Lower numbers are evaluated first. Must be unique within a filter. On POST, this field is optional: when omitted the server auto-assigns max(existing)+10 (the first rule starts at 10). On PUT this field is required — sending a partial update without 'sequence' returns 400. + Sequence *int32 `json:"sequence,omitempty"` + Set *CreateGatewayBGPFilterRulePayloadSet `json:"set,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateGatewayBGPFilterRulePayload CreateGatewayBGPFilterRulePayload + +// NewCreateGatewayBGPFilterRulePayload instantiates a new CreateGatewayBGPFilterRulePayload 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 NewCreateGatewayBGPFilterRulePayload(action CreateGatewayBGPFilterRulePayloadAction) *CreateGatewayBGPFilterRulePayload { + this := CreateGatewayBGPFilterRulePayload{} + this.Action = action + return &this +} + +// NewCreateGatewayBGPFilterRulePayloadWithDefaults instantiates a new CreateGatewayBGPFilterRulePayload 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 NewCreateGatewayBGPFilterRulePayloadWithDefaults() *CreateGatewayBGPFilterRulePayload { + this := CreateGatewayBGPFilterRulePayload{} + return &this +} + +// GetAction returns the Action field value +func (o *CreateGatewayBGPFilterRulePayload) GetAction() CreateGatewayBGPFilterRulePayloadAction { + if o == nil { + var ret CreateGatewayBGPFilterRulePayloadAction + return ret + } + + return o.Action +} + +// GetActionOk returns a tuple with the Action field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayload) GetActionOk() (*CreateGatewayBGPFilterRulePayloadAction, bool) { + if o == nil { + return nil, false + } + return &o.Action, true +} + +// SetAction sets field value +func (o *CreateGatewayBGPFilterRulePayload) SetAction(v CreateGatewayBGPFilterRulePayloadAction) { + o.Action = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateGatewayBGPFilterRulePayload) SetId(v string) { + o.Id = &v +} + +// GetMatch returns the Match field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayload) GetMatch() CreateGatewayBGPFilterRulePayloadMatch { + if o == nil || IsNil(o.Match) { + var ret CreateGatewayBGPFilterRulePayloadMatch + return ret + } + return *o.Match +} + +// GetMatchOk returns a tuple with the Match field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayload) GetMatchOk() (*CreateGatewayBGPFilterRulePayloadMatch, bool) { + if o == nil || IsNil(o.Match) { + return nil, false + } + return o.Match, true +} + +// HasMatch returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayload) HasMatch() bool { + if o != nil && !IsNil(o.Match) { + return true + } + + return false +} + +// SetMatch gets a reference to the given CreateGatewayBGPFilterRulePayloadMatch and assigns it to the Match field. +func (o *CreateGatewayBGPFilterRulePayload) SetMatch(v CreateGatewayBGPFilterRulePayloadMatch) { + o.Match = &v +} + +// GetSequence returns the Sequence field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayload) GetSequence() int32 { + if o == nil || IsNil(o.Sequence) { + var ret int32 + return ret + } + return *o.Sequence +} + +// GetSequenceOk returns a tuple with the Sequence field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayload) GetSequenceOk() (*int32, bool) { + if o == nil || IsNil(o.Sequence) { + return nil, false + } + return o.Sequence, true +} + +// HasSequence returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayload) HasSequence() bool { + if o != nil && !IsNil(o.Sequence) { + return true + } + + return false +} + +// SetSequence gets a reference to the given int32 and assigns it to the Sequence field. +func (o *CreateGatewayBGPFilterRulePayload) SetSequence(v int32) { + o.Sequence = &v +} + +// GetSet returns the Set field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayload) GetSet() CreateGatewayBGPFilterRulePayloadSet { + if o == nil || IsNil(o.Set) { + var ret CreateGatewayBGPFilterRulePayloadSet + return ret + } + return *o.Set +} + +// GetSetOk returns a tuple with the Set field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayload) GetSetOk() (*CreateGatewayBGPFilterRulePayloadSet, bool) { + if o == nil || IsNil(o.Set) { + return nil, false + } + return o.Set, true +} + +// HasSet returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayload) HasSet() bool { + if o != nil && !IsNil(o.Set) { + return true + } + + return false +} + +// SetSet gets a reference to the given CreateGatewayBGPFilterRulePayloadSet and assigns it to the Set field. +func (o *CreateGatewayBGPFilterRulePayload) SetSet(v CreateGatewayBGPFilterRulePayloadSet) { + o.Set = &v +} + +func (o CreateGatewayBGPFilterRulePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateGatewayBGPFilterRulePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Match) { + toSerialize["match"] = o.Match + } + if !IsNil(o.Sequence) { + toSerialize["sequence"] = o.Sequence + } + if !IsNil(o.Set) { + toSerialize["set"] = o.Set + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateGatewayBGPFilterRulePayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateGatewayBGPFilterRulePayload := _CreateGatewayBGPFilterRulePayload{} + + err = json.Unmarshal(data, &varCreateGatewayBGPFilterRulePayload) + + if err != nil { + return err + } + + *o = CreateGatewayBGPFilterRulePayload(varCreateGatewayBGPFilterRulePayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "action") + delete(additionalProperties, "id") + delete(additionalProperties, "match") + delete(additionalProperties, "sequence") + delete(additionalProperties, "set") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateGatewayBGPFilterRulePayload struct { + value *CreateGatewayBGPFilterRulePayload + isSet bool +} + +func (v NullableCreateGatewayBGPFilterRulePayload) Get() *CreateGatewayBGPFilterRulePayload { + return v.value +} + +func (v *NullableCreateGatewayBGPFilterRulePayload) Set(val *CreateGatewayBGPFilterRulePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGatewayBGPFilterRulePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGatewayBGPFilterRulePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGatewayBGPFilterRulePayload(val *CreateGatewayBGPFilterRulePayload) *NullableCreateGatewayBGPFilterRulePayload { + return &NullableCreateGatewayBGPFilterRulePayload{value: val, isSet: true} +} + +func (v NullableCreateGatewayBGPFilterRulePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGatewayBGPFilterRulePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_action.go b/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_action.go new file mode 100644 index 000000000..24b9969f5 --- /dev/null +++ b/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_action.go @@ -0,0 +1,113 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// CreateGatewayBGPFilterRulePayloadAction The action to take if the route matches all criteria. Case-sensitive. +type CreateGatewayBGPFilterRulePayloadAction string + +// List of CreateGatewayBGPFilterRulePayload_action +const ( + CREATEGATEWAYBGPFILTERRULEPAYLOADACTION_PERMIT CreateGatewayBGPFilterRulePayloadAction = "PERMIT" + CREATEGATEWAYBGPFILTERRULEPAYLOADACTION_DENY CreateGatewayBGPFilterRulePayloadAction = "DENY" + CREATEGATEWAYBGPFILTERRULEPAYLOADACTION_UNKNOWN_DEFAULT_OPEN_API CreateGatewayBGPFilterRulePayloadAction = "unknown_default_open_api" +) + +// All allowed values of CreateGatewayBGPFilterRulePayloadAction enum +var AllowedCreateGatewayBGPFilterRulePayloadActionEnumValues = []CreateGatewayBGPFilterRulePayloadAction{ + "PERMIT", + "DENY", + "unknown_default_open_api", +} + +func (v *CreateGatewayBGPFilterRulePayloadAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := CreateGatewayBGPFilterRulePayloadAction(value) + for _, existing := range AllowedCreateGatewayBGPFilterRulePayloadActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = CREATEGATEWAYBGPFILTERRULEPAYLOADACTION_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewCreateGatewayBGPFilterRulePayloadActionFromValue returns a pointer to a valid CreateGatewayBGPFilterRulePayloadAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateGatewayBGPFilterRulePayloadActionFromValue(v string) (*CreateGatewayBGPFilterRulePayloadAction, error) { + ev := CreateGatewayBGPFilterRulePayloadAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateGatewayBGPFilterRulePayloadAction: valid values are %v", v, AllowedCreateGatewayBGPFilterRulePayloadActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateGatewayBGPFilterRulePayloadAction) IsValid() bool { + for _, existing := range AllowedCreateGatewayBGPFilterRulePayloadActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CreateGatewayBGPFilterRulePayload_action value +func (v CreateGatewayBGPFilterRulePayloadAction) Ptr() *CreateGatewayBGPFilterRulePayloadAction { + return &v +} + +type NullableCreateGatewayBGPFilterRulePayloadAction struct { + value *CreateGatewayBGPFilterRulePayloadAction + isSet bool +} + +func (v NullableCreateGatewayBGPFilterRulePayloadAction) Get() *CreateGatewayBGPFilterRulePayloadAction { + return v.value +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadAction) Set(val *CreateGatewayBGPFilterRulePayloadAction) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGatewayBGPFilterRulePayloadAction) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGatewayBGPFilterRulePayloadAction(val *CreateGatewayBGPFilterRulePayloadAction) *NullableCreateGatewayBGPFilterRulePayloadAction { + return &NullableCreateGatewayBGPFilterRulePayloadAction{value: val, isSet: true} +} + +func (v NullableCreateGatewayBGPFilterRulePayloadAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_match.go b/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_match.go new file mode 100644 index 000000000..c78078ad2 --- /dev/null +++ b/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_match.go @@ -0,0 +1,382 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the CreateGatewayBGPFilterRulePayloadMatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateGatewayBGPFilterRulePayloadMatch{} + +// CreateGatewayBGPFilterRulePayloadMatch Optional matching criteria. If omitted entirely, the rule acts as match-all. All non-empty fields in this block must match (logical AND). +type CreateGatewayBGPFilterRulePayloadMatch struct { + // Matches if the AS-PATH contains any one of the listed ASNs (logical OR within the list). Treated as an unordered set; ordering is not preserved by the storage layer. When combined with firstASN, both conditions must hold (logical AND, consistent with the rest of the match block). If firstASN is also listed here, its presence as the first hop is sufficient to satisfy this list; no duplicate hop is required. + AsPathContainsAny []int64 `json:"asPathContainsAny,omitempty"` + // Matches if the route carries any one of these BGP standard communities (logical OR within the list). Format is 'asn:value' per RFC 1997 (both halves must fit in a uint32, i.e. 0..4294967295). Extended, large and well-known communities are not supported. + Communities []string `json:"communities,omitempty"` + // Matches if the first ASN (immediate neighbor) in the AS-PATH equals this ASN. Combines with asPathContainsAny using logical AND: when both are set, the first ASN must equal firstASN AND the path must additionally contain at least one ASN from asPathContainsAny. + FirstASN *int64 `json:"firstASN,omitempty"` + // Maximum subnet mask length for matched prefixes. May be set together with 'prefixes' (narrows matches to subnets at most this long) or alone (matches any IPv4 route with a mask length <= this value, equivalent to implicit 'prefixes: [0.0.0.0/0]'). + MaxPrefixLength *int32 `json:"maxPrefixLength,omitempty"` + // Minimum subnet mask length for matched prefixes. May be set together with 'prefixes' (narrows matches to subnets at least this long) or alone (matches any IPv4 route with a mask length >= this value, equivalent to implicit 'prefixes: [0.0.0.0/0]'). If both minPrefixLength and maxPrefixLength are set, minPrefixLength must be <= maxPrefixLength. + MinPrefixLength *int32 `json:"minPrefixLength,omitempty"` + // Matches the exact IPv4 address of the BGP neighbor that advertised the route. Useful when the same filter is attached to multiple tunnels with different neighbor IPs (allows per-peer rules in a shared filter). When a filter is attached to a single tunnel, this field is effectively a no-op because the route-map is already neighbor-scoped. + Peer *string `json:"peer,omitempty" validate:"regexp=^((25[0-5]|(2[0-4]|1\\\\d|[1-9]|)\\\\d)\\\\.?\\\\b){4}$"` + // List of IPv4 networks to match. A route's prefix matches if it equals one of these (subject to minPrefixLength/maxPrefixLength refinement). If omitted, an implicit 0.0.0.0/0 base is used when minPrefixLength or maxPrefixLength is set; if all three are omitted, prefix matching is not performed at all. Each entry must parse as a valid IPv4 CIDR; the network portion is normalised (10.0.0.5/24 → 10.0.0.0/24). + Prefixes []string `json:"prefixes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateGatewayBGPFilterRulePayloadMatch CreateGatewayBGPFilterRulePayloadMatch + +// NewCreateGatewayBGPFilterRulePayloadMatch instantiates a new CreateGatewayBGPFilterRulePayloadMatch 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 NewCreateGatewayBGPFilterRulePayloadMatch() *CreateGatewayBGPFilterRulePayloadMatch { + this := CreateGatewayBGPFilterRulePayloadMatch{} + return &this +} + +// NewCreateGatewayBGPFilterRulePayloadMatchWithDefaults instantiates a new CreateGatewayBGPFilterRulePayloadMatch 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 NewCreateGatewayBGPFilterRulePayloadMatchWithDefaults() *CreateGatewayBGPFilterRulePayloadMatch { + this := CreateGatewayBGPFilterRulePayloadMatch{} + return &this +} + +// GetAsPathContainsAny returns the AsPathContainsAny field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetAsPathContainsAny() []int64 { + if o == nil || IsNil(o.AsPathContainsAny) { + var ret []int64 + return ret + } + return o.AsPathContainsAny +} + +// GetAsPathContainsAnyOk returns a tuple with the AsPathContainsAny field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetAsPathContainsAnyOk() ([]int64, bool) { + if o == nil || IsNil(o.AsPathContainsAny) { + return nil, false + } + return o.AsPathContainsAny, true +} + +// HasAsPathContainsAny returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) HasAsPathContainsAny() bool { + if o != nil && !IsNil(o.AsPathContainsAny) { + return true + } + + return false +} + +// SetAsPathContainsAny gets a reference to the given []int64 and assigns it to the AsPathContainsAny field. +func (o *CreateGatewayBGPFilterRulePayloadMatch) SetAsPathContainsAny(v []int64) { + o.AsPathContainsAny = v +} + +// GetCommunities returns the Communities field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetCommunities() []string { + if o == nil || IsNil(o.Communities) { + var ret []string + return ret + } + return o.Communities +} + +// GetCommunitiesOk returns a tuple with the Communities field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetCommunitiesOk() ([]string, bool) { + if o == nil || IsNil(o.Communities) { + return nil, false + } + return o.Communities, true +} + +// HasCommunities returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) HasCommunities() bool { + if o != nil && !IsNil(o.Communities) { + return true + } + + return false +} + +// SetCommunities gets a reference to the given []string and assigns it to the Communities field. +func (o *CreateGatewayBGPFilterRulePayloadMatch) SetCommunities(v []string) { + o.Communities = v +} + +// GetFirstASN returns the FirstASN field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetFirstASN() int64 { + if o == nil || IsNil(o.FirstASN) { + var ret int64 + return ret + } + return *o.FirstASN +} + +// GetFirstASNOk returns a tuple with the FirstASN field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetFirstASNOk() (*int64, bool) { + if o == nil || IsNil(o.FirstASN) { + return nil, false + } + return o.FirstASN, true +} + +// HasFirstASN returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) HasFirstASN() bool { + if o != nil && !IsNil(o.FirstASN) { + return true + } + + return false +} + +// SetFirstASN gets a reference to the given int64 and assigns it to the FirstASN field. +func (o *CreateGatewayBGPFilterRulePayloadMatch) SetFirstASN(v int64) { + o.FirstASN = &v +} + +// GetMaxPrefixLength returns the MaxPrefixLength field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetMaxPrefixLength() int32 { + if o == nil || IsNil(o.MaxPrefixLength) { + var ret int32 + return ret + } + return *o.MaxPrefixLength +} + +// GetMaxPrefixLengthOk returns a tuple with the MaxPrefixLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetMaxPrefixLengthOk() (*int32, bool) { + if o == nil || IsNil(o.MaxPrefixLength) { + return nil, false + } + return o.MaxPrefixLength, true +} + +// HasMaxPrefixLength returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) HasMaxPrefixLength() bool { + if o != nil && !IsNil(o.MaxPrefixLength) { + return true + } + + return false +} + +// SetMaxPrefixLength gets a reference to the given int32 and assigns it to the MaxPrefixLength field. +func (o *CreateGatewayBGPFilterRulePayloadMatch) SetMaxPrefixLength(v int32) { + o.MaxPrefixLength = &v +} + +// GetMinPrefixLength returns the MinPrefixLength field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetMinPrefixLength() int32 { + if o == nil || IsNil(o.MinPrefixLength) { + var ret int32 + return ret + } + return *o.MinPrefixLength +} + +// GetMinPrefixLengthOk returns a tuple with the MinPrefixLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetMinPrefixLengthOk() (*int32, bool) { + if o == nil || IsNil(o.MinPrefixLength) { + return nil, false + } + return o.MinPrefixLength, true +} + +// HasMinPrefixLength returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) HasMinPrefixLength() bool { + if o != nil && !IsNil(o.MinPrefixLength) { + return true + } + + return false +} + +// SetMinPrefixLength gets a reference to the given int32 and assigns it to the MinPrefixLength field. +func (o *CreateGatewayBGPFilterRulePayloadMatch) SetMinPrefixLength(v int32) { + o.MinPrefixLength = &v +} + +// GetPeer returns the Peer field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetPeer() string { + if o == nil || IsNil(o.Peer) { + var ret string + return ret + } + return *o.Peer +} + +// GetPeerOk returns a tuple with the Peer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetPeerOk() (*string, bool) { + if o == nil || IsNil(o.Peer) { + return nil, false + } + return o.Peer, true +} + +// HasPeer returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) HasPeer() bool { + if o != nil && !IsNil(o.Peer) { + return true + } + + return false +} + +// SetPeer gets a reference to the given string and assigns it to the Peer field. +func (o *CreateGatewayBGPFilterRulePayloadMatch) SetPeer(v string) { + o.Peer = &v +} + +// GetPrefixes returns the Prefixes field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetPrefixes() []string { + if o == nil || IsNil(o.Prefixes) { + var ret []string + return ret + } + return o.Prefixes +} + +// GetPrefixesOk returns a tuple with the Prefixes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) GetPrefixesOk() ([]string, bool) { + if o == nil || IsNil(o.Prefixes) { + return nil, false + } + return o.Prefixes, true +} + +// HasPrefixes returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayloadMatch) HasPrefixes() bool { + if o != nil && !IsNil(o.Prefixes) { + return true + } + + return false +} + +// SetPrefixes gets a reference to the given []string and assigns it to the Prefixes field. +func (o *CreateGatewayBGPFilterRulePayloadMatch) SetPrefixes(v []string) { + o.Prefixes = v +} + +func (o CreateGatewayBGPFilterRulePayloadMatch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateGatewayBGPFilterRulePayloadMatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AsPathContainsAny) { + toSerialize["asPathContainsAny"] = o.AsPathContainsAny + } + if !IsNil(o.Communities) { + toSerialize["communities"] = o.Communities + } + if !IsNil(o.FirstASN) { + toSerialize["firstASN"] = o.FirstASN + } + if !IsNil(o.MaxPrefixLength) { + toSerialize["maxPrefixLength"] = o.MaxPrefixLength + } + if !IsNil(o.MinPrefixLength) { + toSerialize["minPrefixLength"] = o.MinPrefixLength + } + if !IsNil(o.Peer) { + toSerialize["peer"] = o.Peer + } + if !IsNil(o.Prefixes) { + toSerialize["prefixes"] = o.Prefixes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateGatewayBGPFilterRulePayloadMatch) UnmarshalJSON(data []byte) (err error) { + varCreateGatewayBGPFilterRulePayloadMatch := _CreateGatewayBGPFilterRulePayloadMatch{} + + err = json.Unmarshal(data, &varCreateGatewayBGPFilterRulePayloadMatch) + + if err != nil { + return err + } + + *o = CreateGatewayBGPFilterRulePayloadMatch(varCreateGatewayBGPFilterRulePayloadMatch) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "asPathContainsAny") + delete(additionalProperties, "communities") + delete(additionalProperties, "firstASN") + delete(additionalProperties, "maxPrefixLength") + delete(additionalProperties, "minPrefixLength") + delete(additionalProperties, "peer") + delete(additionalProperties, "prefixes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateGatewayBGPFilterRulePayloadMatch struct { + value *CreateGatewayBGPFilterRulePayloadMatch + isSet bool +} + +func (v NullableCreateGatewayBGPFilterRulePayloadMatch) Get() *CreateGatewayBGPFilterRulePayloadMatch { + return v.value +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadMatch) Set(val *CreateGatewayBGPFilterRulePayloadMatch) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGatewayBGPFilterRulePayloadMatch) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadMatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGatewayBGPFilterRulePayloadMatch(val *CreateGatewayBGPFilterRulePayloadMatch) *NullableCreateGatewayBGPFilterRulePayloadMatch { + return &NullableCreateGatewayBGPFilterRulePayloadMatch{value: val, isSet: true} +} + +func (v NullableCreateGatewayBGPFilterRulePayloadMatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadMatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_set.go b/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_set.go new file mode 100644 index 000000000..a84b5c9b9 --- /dev/null +++ b/services/vpn/v1api/model_create_gateway_bgp_filter_rule_payload_set.go @@ -0,0 +1,154 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the CreateGatewayBGPFilterRulePayloadSet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateGatewayBGPFilterRulePayloadSet{} + +// CreateGatewayBGPFilterRulePayloadSet Optional BGP attributes to apply when 'action' is PERMIT. Ignored for DENY rules. +type CreateGatewayBGPFilterRulePayloadSet struct { + // BGP LOCAL_PREF to set on the route. Higher values are preferred during best-path selection. Default BGP LOCAL_PREF is 100; any value here overrides. + LocalPreference *int32 `json:"localPreference,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateGatewayBGPFilterRulePayloadSet CreateGatewayBGPFilterRulePayloadSet + +// NewCreateGatewayBGPFilterRulePayloadSet instantiates a new CreateGatewayBGPFilterRulePayloadSet 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 NewCreateGatewayBGPFilterRulePayloadSet() *CreateGatewayBGPFilterRulePayloadSet { + this := CreateGatewayBGPFilterRulePayloadSet{} + return &this +} + +// NewCreateGatewayBGPFilterRulePayloadSetWithDefaults instantiates a new CreateGatewayBGPFilterRulePayloadSet 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 NewCreateGatewayBGPFilterRulePayloadSetWithDefaults() *CreateGatewayBGPFilterRulePayloadSet { + this := CreateGatewayBGPFilterRulePayloadSet{} + return &this +} + +// GetLocalPreference returns the LocalPreference field value if set, zero value otherwise. +func (o *CreateGatewayBGPFilterRulePayloadSet) GetLocalPreference() int32 { + if o == nil || IsNil(o.LocalPreference) { + var ret int32 + return ret + } + return *o.LocalPreference +} + +// GetLocalPreferenceOk returns a tuple with the LocalPreference field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayBGPFilterRulePayloadSet) GetLocalPreferenceOk() (*int32, bool) { + if o == nil || IsNil(o.LocalPreference) { + return nil, false + } + return o.LocalPreference, true +} + +// HasLocalPreference returns a boolean if a field has been set. +func (o *CreateGatewayBGPFilterRulePayloadSet) HasLocalPreference() bool { + if o != nil && !IsNil(o.LocalPreference) { + return true + } + + return false +} + +// SetLocalPreference gets a reference to the given int32 and assigns it to the LocalPreference field. +func (o *CreateGatewayBGPFilterRulePayloadSet) SetLocalPreference(v int32) { + o.LocalPreference = &v +} + +func (o CreateGatewayBGPFilterRulePayloadSet) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateGatewayBGPFilterRulePayloadSet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LocalPreference) { + toSerialize["localPreference"] = o.LocalPreference + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateGatewayBGPFilterRulePayloadSet) UnmarshalJSON(data []byte) (err error) { + varCreateGatewayBGPFilterRulePayloadSet := _CreateGatewayBGPFilterRulePayloadSet{} + + err = json.Unmarshal(data, &varCreateGatewayBGPFilterRulePayloadSet) + + if err != nil { + return err + } + + *o = CreateGatewayBGPFilterRulePayloadSet(varCreateGatewayBGPFilterRulePayloadSet) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "localPreference") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateGatewayBGPFilterRulePayloadSet struct { + value *CreateGatewayBGPFilterRulePayloadSet + isSet bool +} + +func (v NullableCreateGatewayBGPFilterRulePayloadSet) Get() *CreateGatewayBGPFilterRulePayloadSet { + return v.value +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadSet) Set(val *CreateGatewayBGPFilterRulePayloadSet) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGatewayBGPFilterRulePayloadSet) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadSet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGatewayBGPFilterRulePayloadSet(val *CreateGatewayBGPFilterRulePayloadSet) *NullableCreateGatewayBGPFilterRulePayloadSet { + return &NullableCreateGatewayBGPFilterRulePayloadSet{value: val, isSet: true} +} + +func (v NullableCreateGatewayBGPFilterRulePayloadSet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGatewayBGPFilterRulePayloadSet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_create_gateway_payload.go b/services/vpn/v1api/model_create_gateway_payload.go index 0fdde5de5..dc4503156 100644 --- a/services/vpn/v1api/model_create_gateway_payload.go +++ b/services/vpn/v1api/model_create_gateway_payload.go @@ -25,7 +25,8 @@ type CreateGatewayPayload struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkConfig *NetworkConfig `json:"networkConfig,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *CreateGatewayPayload) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkConfig returns the NetworkConfig field value if set, zero value otherwise. +func (o *CreateGatewayPayload) GetNetworkConfig() NetworkConfig { + if o == nil || IsNil(o.NetworkConfig) { + var ret NetworkConfig + return ret + } + return *o.NetworkConfig +} + +// GetNetworkConfigOk returns a tuple with the NetworkConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayPayload) GetNetworkConfigOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkConfig) { + return nil, false + } + return o.NetworkConfig, true +} + +// HasNetworkConfig returns a boolean if a field has been set. +func (o *CreateGatewayPayload) HasNetworkConfig() bool { + if o != nil && !IsNil(o.NetworkConfig) { + return true + } + + return false +} + +// SetNetworkConfig gets a reference to the given NetworkConfig and assigns it to the NetworkConfig field. +func (o *CreateGatewayPayload) SetNetworkConfig(v NetworkConfig) { + o.NetworkConfig = &v +} + // GetPlanId returns the PlanId field value func (o *CreateGatewayPayload) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o CreateGatewayPayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkConfig) { + toSerialize["networkConfig"] = o.NetworkConfig + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *CreateGatewayPayload) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkConfig") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties diff --git a/services/vpn/v1api/model_gateway.go b/services/vpn/v1api/model_gateway.go index 1e705b006..20b03e51e 100644 --- a/services/vpn/v1api/model_gateway.go +++ b/services/vpn/v1api/model_gateway.go @@ -25,7 +25,8 @@ type Gateway struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkConfig *NetworkConfig `json:"networkConfig,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *Gateway) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkConfig returns the NetworkConfig field value if set, zero value otherwise. +func (o *Gateway) GetNetworkConfig() NetworkConfig { + if o == nil || IsNil(o.NetworkConfig) { + var ret NetworkConfig + return ret + } + return *o.NetworkConfig +} + +// GetNetworkConfigOk returns a tuple with the NetworkConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetNetworkConfigOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkConfig) { + return nil, false + } + return o.NetworkConfig, true +} + +// HasNetworkConfig returns a boolean if a field has been set. +func (o *Gateway) HasNetworkConfig() bool { + if o != nil && !IsNil(o.NetworkConfig) { + return true + } + + return false +} + +// SetNetworkConfig gets a reference to the given NetworkConfig and assigns it to the NetworkConfig field. +func (o *Gateway) SetNetworkConfig(v NetworkConfig) { + o.NetworkConfig = &v +} + // GetPlanId returns the PlanId field value func (o *Gateway) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o Gateway) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkConfig) { + toSerialize["networkConfig"] = o.NetworkConfig + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *Gateway) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkConfig") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties diff --git a/services/vpn/v1api/model_gateway_response.go b/services/vpn/v1api/model_gateway_response.go index 395a4dffa..dac2ab883 100644 --- a/services/vpn/v1api/model_gateway_response.go +++ b/services/vpn/v1api/model_gateway_response.go @@ -25,7 +25,8 @@ type GatewayResponse struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkConfig *NetworkConfig `json:"networkConfig,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -170,6 +171,38 @@ func (o *GatewayResponse) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkConfig returns the NetworkConfig field value if set, zero value otherwise. +func (o *GatewayResponse) GetNetworkConfig() NetworkConfig { + if o == nil || IsNil(o.NetworkConfig) { + var ret NetworkConfig + return ret + } + return *o.NetworkConfig +} + +// GetNetworkConfigOk returns a tuple with the NetworkConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetNetworkConfigOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkConfig) { + return nil, false + } + return o.NetworkConfig, true +} + +// HasNetworkConfig returns a boolean if a field has been set. +func (o *GatewayResponse) HasNetworkConfig() bool { + if o != nil && !IsNil(o.NetworkConfig) { + return true + } + + return false +} + +// SetNetworkConfig gets a reference to the given NetworkConfig and assigns it to the NetworkConfig field. +func (o *GatewayResponse) SetNetworkConfig(v NetworkConfig) { + o.NetworkConfig = &v +} + // GetPlanId returns the PlanId field value func (o *GatewayResponse) GetPlanId() string { if o == nil { @@ -300,6 +333,9 @@ func (o GatewayResponse) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkConfig) { + toSerialize["networkConfig"] = o.NetworkConfig + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType if !IsNil(o.Id) { @@ -358,6 +394,7 @@ func (o *GatewayResponse) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkConfig") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") delete(additionalProperties, "id") diff --git a/services/vpn/v1api/model_network_config.go b/services/vpn/v1api/model_network_config.go new file mode 100644 index 000000000..083e10de8 --- /dev/null +++ b/services/vpn/v1api/model_network_config.go @@ -0,0 +1,192 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the NetworkConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkConfig{} + +// NetworkConfig struct for NetworkConfig +type NetworkConfig struct { + // The IPv4 network prefix (CIDR notation) allocated for the VPN gateway. Must have a prefix length of /28 or larger. Once the gateway is created, is not possible to change this attribute. + PredefinedNetworkPrefix []string `json:"predefinedNetworkPrefix,omitempty"` + // Custom routing table ID for the VPN gateway + RoutingTableId *string `json:"routingTableId,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _NetworkConfig NetworkConfig + +// NewNetworkConfig instantiates a new NetworkConfig 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 NewNetworkConfig() *NetworkConfig { + this := NetworkConfig{} + return &this +} + +// NewNetworkConfigWithDefaults instantiates a new NetworkConfig 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 NewNetworkConfigWithDefaults() *NetworkConfig { + this := NetworkConfig{} + return &this +} + +// GetPredefinedNetworkPrefix returns the PredefinedNetworkPrefix field value if set, zero value otherwise. +func (o *NetworkConfig) GetPredefinedNetworkPrefix() []string { + if o == nil || IsNil(o.PredefinedNetworkPrefix) { + var ret []string + return ret + } + return o.PredefinedNetworkPrefix +} + +// GetPredefinedNetworkPrefixOk returns a tuple with the PredefinedNetworkPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkConfig) GetPredefinedNetworkPrefixOk() ([]string, bool) { + if o == nil || IsNil(o.PredefinedNetworkPrefix) { + return nil, false + } + return o.PredefinedNetworkPrefix, true +} + +// HasPredefinedNetworkPrefix returns a boolean if a field has been set. +func (o *NetworkConfig) HasPredefinedNetworkPrefix() bool { + if o != nil && !IsNil(o.PredefinedNetworkPrefix) { + return true + } + + return false +} + +// SetPredefinedNetworkPrefix gets a reference to the given []string and assigns it to the PredefinedNetworkPrefix field. +func (o *NetworkConfig) SetPredefinedNetworkPrefix(v []string) { + o.PredefinedNetworkPrefix = v +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *NetworkConfig) GetRoutingTableId() string { + if o == nil || IsNil(o.RoutingTableId) { + var ret string + return ret + } + return *o.RoutingTableId +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkConfig) GetRoutingTableIdOk() (*string, bool) { + if o == nil || IsNil(o.RoutingTableId) { + return nil, false + } + return o.RoutingTableId, true +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *NetworkConfig) HasRoutingTableId() bool { + if o != nil && !IsNil(o.RoutingTableId) { + return true + } + + return false +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *NetworkConfig) SetRoutingTableId(v string) { + o.RoutingTableId = &v +} + +func (o NetworkConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PredefinedNetworkPrefix) { + toSerialize["predefinedNetworkPrefix"] = o.PredefinedNetworkPrefix + } + if !IsNil(o.RoutingTableId) { + toSerialize["routingTableId"] = o.RoutingTableId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *NetworkConfig) UnmarshalJSON(data []byte) (err error) { + varNetworkConfig := _NetworkConfig{} + + err = json.Unmarshal(data, &varNetworkConfig) + + if err != nil { + return err + } + + *o = NetworkConfig(varNetworkConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "predefinedNetworkPrefix") + delete(additionalProperties, "routingTableId") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNetworkConfig struct { + value *NetworkConfig + isSet bool +} + +func (v NullableNetworkConfig) Get() *NetworkConfig { + return v.value +} + +func (v *NullableNetworkConfig) Set(val *NetworkConfig) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkConfig(val *NetworkConfig) *NullableNetworkConfig { + return &NullableNetworkConfig{value: val, isSet: true} +} + +func (v NullableNetworkConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_update_gateway_bgp_filter_payload.go b/services/vpn/v1api/model_update_gateway_bgp_filter_payload.go new file mode 100644 index 000000000..b3fec37cd --- /dev/null +++ b/services/vpn/v1api/model_update_gateway_bgp_filter_payload.go @@ -0,0 +1,205 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateGatewayBGPFilterPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGatewayBGPFilterPayload{} + +// UpdateGatewayBGPFilterPayload A named BGP route filter. Internally a BGPFilter holds an ordered set of rules (managed via the nested /rules sub-resource); a route is evaluated against each rule in 'sequence' order and the first match decides the outcome. An implicit DENY is applied after the last rule, so a route that matches no PERMIT rule is dropped. Attaching an empty filter to a tunnel therefore denies every route. Resource limits: the maximum number of filters per gateway equals the gateway plan's maxConnections value; the maximum number of rules per filter is 10. +type UpdateGatewayBGPFilterPayload struct { + // A user-friendly name for the filter. Display only — not enforced unique across a gateway. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` + // The server-generated UUID of the filter. + Id *string `json:"id,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGatewayBGPFilterPayload UpdateGatewayBGPFilterPayload + +// NewUpdateGatewayBGPFilterPayload instantiates a new UpdateGatewayBGPFilterPayload 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 NewUpdateGatewayBGPFilterPayload(displayName string) *UpdateGatewayBGPFilterPayload { + this := UpdateGatewayBGPFilterPayload{} + this.DisplayName = displayName + return &this +} + +// NewUpdateGatewayBGPFilterPayloadWithDefaults instantiates a new UpdateGatewayBGPFilterPayload 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 NewUpdateGatewayBGPFilterPayloadWithDefaults() *UpdateGatewayBGPFilterPayload { + this := UpdateGatewayBGPFilterPayload{} + return &this +} + +// GetDisplayName returns the DisplayName field value +func (o *UpdateGatewayBGPFilterPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *UpdateGatewayBGPFilterPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterPayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateGatewayBGPFilterPayload) SetId(v string) { + o.Id = &v +} + +func (o UpdateGatewayBGPFilterPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGatewayBGPFilterPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGatewayBGPFilterPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateGatewayBGPFilterPayload := _UpdateGatewayBGPFilterPayload{} + + err = json.Unmarshal(data, &varUpdateGatewayBGPFilterPayload) + + if err != nil { + return err + } + + *o = UpdateGatewayBGPFilterPayload(varUpdateGatewayBGPFilterPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGatewayBGPFilterPayload struct { + value *UpdateGatewayBGPFilterPayload + isSet bool +} + +func (v NullableUpdateGatewayBGPFilterPayload) Get() *UpdateGatewayBGPFilterPayload { + return v.value +} + +func (v *NullableUpdateGatewayBGPFilterPayload) Set(val *UpdateGatewayBGPFilterPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGatewayBGPFilterPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGatewayBGPFilterPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGatewayBGPFilterPayload(val *UpdateGatewayBGPFilterPayload) *NullableUpdateGatewayBGPFilterPayload { + return &NullableUpdateGatewayBGPFilterPayload{value: val, isSet: true} +} + +func (v NullableUpdateGatewayBGPFilterPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGatewayBGPFilterPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload.go b/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload.go new file mode 100644 index 000000000..d5b7176da --- /dev/null +++ b/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload.go @@ -0,0 +1,316 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateGatewayBGPFilterRulePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGatewayBGPFilterRulePayload{} + +// UpdateGatewayBGPFilterRulePayload A single rule within a BGPFilter. All non-empty fields within the 'match' block are AND-combined. Rules within a filter are evaluated in 'sequence' order; the first matching rule decides the outcome (logical OR across rules). An implicit DENY follows the last rule. +type UpdateGatewayBGPFilterRulePayload struct { + Action UpdateGatewayBGPFilterRulePayloadAction `json:"action"` + // The server-generated UUID of the specific rule. + Id *string `json:"id,omitempty"` + Match *UpdateGatewayBGPFilterRulePayloadMatch `json:"match,omitempty"` + // The evaluation order of the rule. Lower numbers are evaluated first. Must be unique within a filter. On POST, this field is optional: when omitted the server auto-assigns max(existing)+10 (the first rule starts at 10). On PUT this field is required — sending a partial update without 'sequence' returns 400. + Sequence *int32 `json:"sequence,omitempty"` + Set *UpdateGatewayBGPFilterRulePayloadSet `json:"set,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGatewayBGPFilterRulePayload UpdateGatewayBGPFilterRulePayload + +// NewUpdateGatewayBGPFilterRulePayload instantiates a new UpdateGatewayBGPFilterRulePayload 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 NewUpdateGatewayBGPFilterRulePayload(action UpdateGatewayBGPFilterRulePayloadAction) *UpdateGatewayBGPFilterRulePayload { + this := UpdateGatewayBGPFilterRulePayload{} + this.Action = action + return &this +} + +// NewUpdateGatewayBGPFilterRulePayloadWithDefaults instantiates a new UpdateGatewayBGPFilterRulePayload 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 NewUpdateGatewayBGPFilterRulePayloadWithDefaults() *UpdateGatewayBGPFilterRulePayload { + this := UpdateGatewayBGPFilterRulePayload{} + return &this +} + +// GetAction returns the Action field value +func (o *UpdateGatewayBGPFilterRulePayload) GetAction() UpdateGatewayBGPFilterRulePayloadAction { + if o == nil { + var ret UpdateGatewayBGPFilterRulePayloadAction + return ret + } + + return o.Action +} + +// GetActionOk returns a tuple with the Action field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayload) GetActionOk() (*UpdateGatewayBGPFilterRulePayloadAction, bool) { + if o == nil { + return nil, false + } + return &o.Action, true +} + +// SetAction sets field value +func (o *UpdateGatewayBGPFilterRulePayload) SetAction(v UpdateGatewayBGPFilterRulePayloadAction) { + o.Action = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateGatewayBGPFilterRulePayload) SetId(v string) { + o.Id = &v +} + +// GetMatch returns the Match field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayload) GetMatch() UpdateGatewayBGPFilterRulePayloadMatch { + if o == nil || IsNil(o.Match) { + var ret UpdateGatewayBGPFilterRulePayloadMatch + return ret + } + return *o.Match +} + +// GetMatchOk returns a tuple with the Match field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayload) GetMatchOk() (*UpdateGatewayBGPFilterRulePayloadMatch, bool) { + if o == nil || IsNil(o.Match) { + return nil, false + } + return o.Match, true +} + +// HasMatch returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayload) HasMatch() bool { + if o != nil && !IsNil(o.Match) { + return true + } + + return false +} + +// SetMatch gets a reference to the given UpdateGatewayBGPFilterRulePayloadMatch and assigns it to the Match field. +func (o *UpdateGatewayBGPFilterRulePayload) SetMatch(v UpdateGatewayBGPFilterRulePayloadMatch) { + o.Match = &v +} + +// GetSequence returns the Sequence field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayload) GetSequence() int32 { + if o == nil || IsNil(o.Sequence) { + var ret int32 + return ret + } + return *o.Sequence +} + +// GetSequenceOk returns a tuple with the Sequence field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayload) GetSequenceOk() (*int32, bool) { + if o == nil || IsNil(o.Sequence) { + return nil, false + } + return o.Sequence, true +} + +// HasSequence returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayload) HasSequence() bool { + if o != nil && !IsNil(o.Sequence) { + return true + } + + return false +} + +// SetSequence gets a reference to the given int32 and assigns it to the Sequence field. +func (o *UpdateGatewayBGPFilterRulePayload) SetSequence(v int32) { + o.Sequence = &v +} + +// GetSet returns the Set field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayload) GetSet() UpdateGatewayBGPFilterRulePayloadSet { + if o == nil || IsNil(o.Set) { + var ret UpdateGatewayBGPFilterRulePayloadSet + return ret + } + return *o.Set +} + +// GetSetOk returns a tuple with the Set field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayload) GetSetOk() (*UpdateGatewayBGPFilterRulePayloadSet, bool) { + if o == nil || IsNil(o.Set) { + return nil, false + } + return o.Set, true +} + +// HasSet returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayload) HasSet() bool { + if o != nil && !IsNil(o.Set) { + return true + } + + return false +} + +// SetSet gets a reference to the given UpdateGatewayBGPFilterRulePayloadSet and assigns it to the Set field. +func (o *UpdateGatewayBGPFilterRulePayload) SetSet(v UpdateGatewayBGPFilterRulePayloadSet) { + o.Set = &v +} + +func (o UpdateGatewayBGPFilterRulePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGatewayBGPFilterRulePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["action"] = o.Action + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Match) { + toSerialize["match"] = o.Match + } + if !IsNil(o.Sequence) { + toSerialize["sequence"] = o.Sequence + } + if !IsNil(o.Set) { + toSerialize["set"] = o.Set + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGatewayBGPFilterRulePayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "action", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateGatewayBGPFilterRulePayload := _UpdateGatewayBGPFilterRulePayload{} + + err = json.Unmarshal(data, &varUpdateGatewayBGPFilterRulePayload) + + if err != nil { + return err + } + + *o = UpdateGatewayBGPFilterRulePayload(varUpdateGatewayBGPFilterRulePayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "action") + delete(additionalProperties, "id") + delete(additionalProperties, "match") + delete(additionalProperties, "sequence") + delete(additionalProperties, "set") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGatewayBGPFilterRulePayload struct { + value *UpdateGatewayBGPFilterRulePayload + isSet bool +} + +func (v NullableUpdateGatewayBGPFilterRulePayload) Get() *UpdateGatewayBGPFilterRulePayload { + return v.value +} + +func (v *NullableUpdateGatewayBGPFilterRulePayload) Set(val *UpdateGatewayBGPFilterRulePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGatewayBGPFilterRulePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGatewayBGPFilterRulePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGatewayBGPFilterRulePayload(val *UpdateGatewayBGPFilterRulePayload) *NullableUpdateGatewayBGPFilterRulePayload { + return &NullableUpdateGatewayBGPFilterRulePayload{value: val, isSet: true} +} + +func (v NullableUpdateGatewayBGPFilterRulePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGatewayBGPFilterRulePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_action.go b/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_action.go new file mode 100644 index 000000000..cdf417c8a --- /dev/null +++ b/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_action.go @@ -0,0 +1,113 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// UpdateGatewayBGPFilterRulePayloadAction The action to take if the route matches all criteria. Case-sensitive. +type UpdateGatewayBGPFilterRulePayloadAction string + +// List of UpdateGatewayBGPFilterRulePayload_action +const ( + UPDATEGATEWAYBGPFILTERRULEPAYLOADACTION_PERMIT UpdateGatewayBGPFilterRulePayloadAction = "PERMIT" + UPDATEGATEWAYBGPFILTERRULEPAYLOADACTION_DENY UpdateGatewayBGPFilterRulePayloadAction = "DENY" + UPDATEGATEWAYBGPFILTERRULEPAYLOADACTION_UNKNOWN_DEFAULT_OPEN_API UpdateGatewayBGPFilterRulePayloadAction = "unknown_default_open_api" +) + +// All allowed values of UpdateGatewayBGPFilterRulePayloadAction enum +var AllowedUpdateGatewayBGPFilterRulePayloadActionEnumValues = []UpdateGatewayBGPFilterRulePayloadAction{ + "PERMIT", + "DENY", + "unknown_default_open_api", +} + +func (v *UpdateGatewayBGPFilterRulePayloadAction) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := UpdateGatewayBGPFilterRulePayloadAction(value) + for _, existing := range AllowedUpdateGatewayBGPFilterRulePayloadActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = UPDATEGATEWAYBGPFILTERRULEPAYLOADACTION_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewUpdateGatewayBGPFilterRulePayloadActionFromValue returns a pointer to a valid UpdateGatewayBGPFilterRulePayloadAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateGatewayBGPFilterRulePayloadActionFromValue(v string) (*UpdateGatewayBGPFilterRulePayloadAction, error) { + ev := UpdateGatewayBGPFilterRulePayloadAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateGatewayBGPFilterRulePayloadAction: valid values are %v", v, AllowedUpdateGatewayBGPFilterRulePayloadActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateGatewayBGPFilterRulePayloadAction) IsValid() bool { + for _, existing := range AllowedUpdateGatewayBGPFilterRulePayloadActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UpdateGatewayBGPFilterRulePayload_action value +func (v UpdateGatewayBGPFilterRulePayloadAction) Ptr() *UpdateGatewayBGPFilterRulePayloadAction { + return &v +} + +type NullableUpdateGatewayBGPFilterRulePayloadAction struct { + value *UpdateGatewayBGPFilterRulePayloadAction + isSet bool +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadAction) Get() *UpdateGatewayBGPFilterRulePayloadAction { + return v.value +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadAction) Set(val *UpdateGatewayBGPFilterRulePayloadAction) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadAction) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGatewayBGPFilterRulePayloadAction(val *UpdateGatewayBGPFilterRulePayloadAction) *NullableUpdateGatewayBGPFilterRulePayloadAction { + return &NullableUpdateGatewayBGPFilterRulePayloadAction{value: val, isSet: true} +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_match.go b/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_match.go new file mode 100644 index 000000000..fa39a80b0 --- /dev/null +++ b/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_match.go @@ -0,0 +1,382 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the UpdateGatewayBGPFilterRulePayloadMatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGatewayBGPFilterRulePayloadMatch{} + +// UpdateGatewayBGPFilterRulePayloadMatch Optional matching criteria. If omitted entirely, the rule acts as match-all. All non-empty fields in this block must match (logical AND). +type UpdateGatewayBGPFilterRulePayloadMatch struct { + // Matches if the AS-PATH contains any one of the listed ASNs (logical OR within the list). Treated as an unordered set; ordering is not preserved by the storage layer. When combined with firstASN, both conditions must hold (logical AND, consistent with the rest of the match block). If firstASN is also listed here, its presence as the first hop is sufficient to satisfy this list; no duplicate hop is required. + AsPathContainsAny []int64 `json:"asPathContainsAny,omitempty"` + // Matches if the route carries any one of these BGP standard communities (logical OR within the list). Format is 'asn:value' per RFC 1997 (both halves must fit in a uint32, i.e. 0..4294967295). Extended, large and well-known communities are not supported. + Communities []string `json:"communities,omitempty"` + // Matches if the first ASN (immediate neighbor) in the AS-PATH equals this ASN. Combines with asPathContainsAny using logical AND: when both are set, the first ASN must equal firstASN AND the path must additionally contain at least one ASN from asPathContainsAny. + FirstASN *int64 `json:"firstASN,omitempty"` + // Maximum subnet mask length for matched prefixes. May be set together with 'prefixes' (narrows matches to subnets at most this long) or alone (matches any IPv4 route with a mask length <= this value, equivalent to implicit 'prefixes: [0.0.0.0/0]'). + MaxPrefixLength *int32 `json:"maxPrefixLength,omitempty"` + // Minimum subnet mask length for matched prefixes. May be set together with 'prefixes' (narrows matches to subnets at least this long) or alone (matches any IPv4 route with a mask length >= this value, equivalent to implicit 'prefixes: [0.0.0.0/0]'). If both minPrefixLength and maxPrefixLength are set, minPrefixLength must be <= maxPrefixLength. + MinPrefixLength *int32 `json:"minPrefixLength,omitempty"` + // Matches the exact IPv4 address of the BGP neighbor that advertised the route. Useful when the same filter is attached to multiple tunnels with different neighbor IPs (allows per-peer rules in a shared filter). When a filter is attached to a single tunnel, this field is effectively a no-op because the route-map is already neighbor-scoped. + Peer *string `json:"peer,omitempty" validate:"regexp=^((25[0-5]|(2[0-4]|1\\\\d|[1-9]|)\\\\d)\\\\.?\\\\b){4}$"` + // List of IPv4 networks to match. A route's prefix matches if it equals one of these (subject to minPrefixLength/maxPrefixLength refinement). If omitted, an implicit 0.0.0.0/0 base is used when minPrefixLength or maxPrefixLength is set; if all three are omitted, prefix matching is not performed at all. Each entry must parse as a valid IPv4 CIDR; the network portion is normalised (10.0.0.5/24 → 10.0.0.0/24). + Prefixes []string `json:"prefixes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGatewayBGPFilterRulePayloadMatch UpdateGatewayBGPFilterRulePayloadMatch + +// NewUpdateGatewayBGPFilterRulePayloadMatch instantiates a new UpdateGatewayBGPFilterRulePayloadMatch 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 NewUpdateGatewayBGPFilterRulePayloadMatch() *UpdateGatewayBGPFilterRulePayloadMatch { + this := UpdateGatewayBGPFilterRulePayloadMatch{} + return &this +} + +// NewUpdateGatewayBGPFilterRulePayloadMatchWithDefaults instantiates a new UpdateGatewayBGPFilterRulePayloadMatch 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 NewUpdateGatewayBGPFilterRulePayloadMatchWithDefaults() *UpdateGatewayBGPFilterRulePayloadMatch { + this := UpdateGatewayBGPFilterRulePayloadMatch{} + return &this +} + +// GetAsPathContainsAny returns the AsPathContainsAny field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetAsPathContainsAny() []int64 { + if o == nil || IsNil(o.AsPathContainsAny) { + var ret []int64 + return ret + } + return o.AsPathContainsAny +} + +// GetAsPathContainsAnyOk returns a tuple with the AsPathContainsAny field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetAsPathContainsAnyOk() ([]int64, bool) { + if o == nil || IsNil(o.AsPathContainsAny) { + return nil, false + } + return o.AsPathContainsAny, true +} + +// HasAsPathContainsAny returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) HasAsPathContainsAny() bool { + if o != nil && !IsNil(o.AsPathContainsAny) { + return true + } + + return false +} + +// SetAsPathContainsAny gets a reference to the given []int64 and assigns it to the AsPathContainsAny field. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) SetAsPathContainsAny(v []int64) { + o.AsPathContainsAny = v +} + +// GetCommunities returns the Communities field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetCommunities() []string { + if o == nil || IsNil(o.Communities) { + var ret []string + return ret + } + return o.Communities +} + +// GetCommunitiesOk returns a tuple with the Communities field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetCommunitiesOk() ([]string, bool) { + if o == nil || IsNil(o.Communities) { + return nil, false + } + return o.Communities, true +} + +// HasCommunities returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) HasCommunities() bool { + if o != nil && !IsNil(o.Communities) { + return true + } + + return false +} + +// SetCommunities gets a reference to the given []string and assigns it to the Communities field. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) SetCommunities(v []string) { + o.Communities = v +} + +// GetFirstASN returns the FirstASN field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetFirstASN() int64 { + if o == nil || IsNil(o.FirstASN) { + var ret int64 + return ret + } + return *o.FirstASN +} + +// GetFirstASNOk returns a tuple with the FirstASN field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetFirstASNOk() (*int64, bool) { + if o == nil || IsNil(o.FirstASN) { + return nil, false + } + return o.FirstASN, true +} + +// HasFirstASN returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) HasFirstASN() bool { + if o != nil && !IsNil(o.FirstASN) { + return true + } + + return false +} + +// SetFirstASN gets a reference to the given int64 and assigns it to the FirstASN field. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) SetFirstASN(v int64) { + o.FirstASN = &v +} + +// GetMaxPrefixLength returns the MaxPrefixLength field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetMaxPrefixLength() int32 { + if o == nil || IsNil(o.MaxPrefixLength) { + var ret int32 + return ret + } + return *o.MaxPrefixLength +} + +// GetMaxPrefixLengthOk returns a tuple with the MaxPrefixLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetMaxPrefixLengthOk() (*int32, bool) { + if o == nil || IsNil(o.MaxPrefixLength) { + return nil, false + } + return o.MaxPrefixLength, true +} + +// HasMaxPrefixLength returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) HasMaxPrefixLength() bool { + if o != nil && !IsNil(o.MaxPrefixLength) { + return true + } + + return false +} + +// SetMaxPrefixLength gets a reference to the given int32 and assigns it to the MaxPrefixLength field. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) SetMaxPrefixLength(v int32) { + o.MaxPrefixLength = &v +} + +// GetMinPrefixLength returns the MinPrefixLength field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetMinPrefixLength() int32 { + if o == nil || IsNil(o.MinPrefixLength) { + var ret int32 + return ret + } + return *o.MinPrefixLength +} + +// GetMinPrefixLengthOk returns a tuple with the MinPrefixLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetMinPrefixLengthOk() (*int32, bool) { + if o == nil || IsNil(o.MinPrefixLength) { + return nil, false + } + return o.MinPrefixLength, true +} + +// HasMinPrefixLength returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) HasMinPrefixLength() bool { + if o != nil && !IsNil(o.MinPrefixLength) { + return true + } + + return false +} + +// SetMinPrefixLength gets a reference to the given int32 and assigns it to the MinPrefixLength field. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) SetMinPrefixLength(v int32) { + o.MinPrefixLength = &v +} + +// GetPeer returns the Peer field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetPeer() string { + if o == nil || IsNil(o.Peer) { + var ret string + return ret + } + return *o.Peer +} + +// GetPeerOk returns a tuple with the Peer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetPeerOk() (*string, bool) { + if o == nil || IsNil(o.Peer) { + return nil, false + } + return o.Peer, true +} + +// HasPeer returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) HasPeer() bool { + if o != nil && !IsNil(o.Peer) { + return true + } + + return false +} + +// SetPeer gets a reference to the given string and assigns it to the Peer field. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) SetPeer(v string) { + o.Peer = &v +} + +// GetPrefixes returns the Prefixes field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetPrefixes() []string { + if o == nil || IsNil(o.Prefixes) { + var ret []string + return ret + } + return o.Prefixes +} + +// GetPrefixesOk returns a tuple with the Prefixes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) GetPrefixesOk() ([]string, bool) { + if o == nil || IsNil(o.Prefixes) { + return nil, false + } + return o.Prefixes, true +} + +// HasPrefixes returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) HasPrefixes() bool { + if o != nil && !IsNil(o.Prefixes) { + return true + } + + return false +} + +// SetPrefixes gets a reference to the given []string and assigns it to the Prefixes field. +func (o *UpdateGatewayBGPFilterRulePayloadMatch) SetPrefixes(v []string) { + o.Prefixes = v +} + +func (o UpdateGatewayBGPFilterRulePayloadMatch) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGatewayBGPFilterRulePayloadMatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AsPathContainsAny) { + toSerialize["asPathContainsAny"] = o.AsPathContainsAny + } + if !IsNil(o.Communities) { + toSerialize["communities"] = o.Communities + } + if !IsNil(o.FirstASN) { + toSerialize["firstASN"] = o.FirstASN + } + if !IsNil(o.MaxPrefixLength) { + toSerialize["maxPrefixLength"] = o.MaxPrefixLength + } + if !IsNil(o.MinPrefixLength) { + toSerialize["minPrefixLength"] = o.MinPrefixLength + } + if !IsNil(o.Peer) { + toSerialize["peer"] = o.Peer + } + if !IsNil(o.Prefixes) { + toSerialize["prefixes"] = o.Prefixes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGatewayBGPFilterRulePayloadMatch) UnmarshalJSON(data []byte) (err error) { + varUpdateGatewayBGPFilterRulePayloadMatch := _UpdateGatewayBGPFilterRulePayloadMatch{} + + err = json.Unmarshal(data, &varUpdateGatewayBGPFilterRulePayloadMatch) + + if err != nil { + return err + } + + *o = UpdateGatewayBGPFilterRulePayloadMatch(varUpdateGatewayBGPFilterRulePayloadMatch) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "asPathContainsAny") + delete(additionalProperties, "communities") + delete(additionalProperties, "firstASN") + delete(additionalProperties, "maxPrefixLength") + delete(additionalProperties, "minPrefixLength") + delete(additionalProperties, "peer") + delete(additionalProperties, "prefixes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGatewayBGPFilterRulePayloadMatch struct { + value *UpdateGatewayBGPFilterRulePayloadMatch + isSet bool +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadMatch) Get() *UpdateGatewayBGPFilterRulePayloadMatch { + return v.value +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadMatch) Set(val *UpdateGatewayBGPFilterRulePayloadMatch) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadMatch) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadMatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGatewayBGPFilterRulePayloadMatch(val *UpdateGatewayBGPFilterRulePayloadMatch) *NullableUpdateGatewayBGPFilterRulePayloadMatch { + return &NullableUpdateGatewayBGPFilterRulePayloadMatch{value: val, isSet: true} +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadMatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadMatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_set.go b/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_set.go new file mode 100644 index 000000000..fb3107ee0 --- /dev/null +++ b/services/vpn/v1api/model_update_gateway_bgp_filter_rule_payload_set.go @@ -0,0 +1,154 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the UpdateGatewayBGPFilterRulePayloadSet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGatewayBGPFilterRulePayloadSet{} + +// UpdateGatewayBGPFilterRulePayloadSet Optional BGP attributes to apply when 'action' is PERMIT. Ignored for DENY rules. +type UpdateGatewayBGPFilterRulePayloadSet struct { + // BGP LOCAL_PREF to set on the route. Higher values are preferred during best-path selection. Default BGP LOCAL_PREF is 100; any value here overrides. + LocalPreference *int32 `json:"localPreference,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGatewayBGPFilterRulePayloadSet UpdateGatewayBGPFilterRulePayloadSet + +// NewUpdateGatewayBGPFilterRulePayloadSet instantiates a new UpdateGatewayBGPFilterRulePayloadSet 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 NewUpdateGatewayBGPFilterRulePayloadSet() *UpdateGatewayBGPFilterRulePayloadSet { + this := UpdateGatewayBGPFilterRulePayloadSet{} + return &this +} + +// NewUpdateGatewayBGPFilterRulePayloadSetWithDefaults instantiates a new UpdateGatewayBGPFilterRulePayloadSet 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 NewUpdateGatewayBGPFilterRulePayloadSetWithDefaults() *UpdateGatewayBGPFilterRulePayloadSet { + this := UpdateGatewayBGPFilterRulePayloadSet{} + return &this +} + +// GetLocalPreference returns the LocalPreference field value if set, zero value otherwise. +func (o *UpdateGatewayBGPFilterRulePayloadSet) GetLocalPreference() int32 { + if o == nil || IsNil(o.LocalPreference) { + var ret int32 + return ret + } + return *o.LocalPreference +} + +// GetLocalPreferenceOk returns a tuple with the LocalPreference field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayBGPFilterRulePayloadSet) GetLocalPreferenceOk() (*int32, bool) { + if o == nil || IsNil(o.LocalPreference) { + return nil, false + } + return o.LocalPreference, true +} + +// HasLocalPreference returns a boolean if a field has been set. +func (o *UpdateGatewayBGPFilterRulePayloadSet) HasLocalPreference() bool { + if o != nil && !IsNil(o.LocalPreference) { + return true + } + + return false +} + +// SetLocalPreference gets a reference to the given int32 and assigns it to the LocalPreference field. +func (o *UpdateGatewayBGPFilterRulePayloadSet) SetLocalPreference(v int32) { + o.LocalPreference = &v +} + +func (o UpdateGatewayBGPFilterRulePayloadSet) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGatewayBGPFilterRulePayloadSet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LocalPreference) { + toSerialize["localPreference"] = o.LocalPreference + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGatewayBGPFilterRulePayloadSet) UnmarshalJSON(data []byte) (err error) { + varUpdateGatewayBGPFilterRulePayloadSet := _UpdateGatewayBGPFilterRulePayloadSet{} + + err = json.Unmarshal(data, &varUpdateGatewayBGPFilterRulePayloadSet) + + if err != nil { + return err + } + + *o = UpdateGatewayBGPFilterRulePayloadSet(varUpdateGatewayBGPFilterRulePayloadSet) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "localPreference") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGatewayBGPFilterRulePayloadSet struct { + value *UpdateGatewayBGPFilterRulePayloadSet + isSet bool +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadSet) Get() *UpdateGatewayBGPFilterRulePayloadSet { + return v.value +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadSet) Set(val *UpdateGatewayBGPFilterRulePayloadSet) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadSet) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadSet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGatewayBGPFilterRulePayloadSet(val *UpdateGatewayBGPFilterRulePayloadSet) *NullableUpdateGatewayBGPFilterRulePayloadSet { + return &NullableUpdateGatewayBGPFilterRulePayloadSet{value: val, isSet: true} +} + +func (v NullableUpdateGatewayBGPFilterRulePayloadSet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGatewayBGPFilterRulePayloadSet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1api/model_update_gateway_payload.go b/services/vpn/v1api/model_update_gateway_payload.go index f7ce82748..5de700f58 100644 --- a/services/vpn/v1api/model_update_gateway_payload.go +++ b/services/vpn/v1api/model_update_gateway_payload.go @@ -25,7 +25,8 @@ type UpdateGatewayPayload struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkConfig *NetworkConfig `json:"networkConfig,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *UpdateGatewayPayload) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkConfig returns the NetworkConfig field value if set, zero value otherwise. +func (o *UpdateGatewayPayload) GetNetworkConfig() NetworkConfig { + if o == nil || IsNil(o.NetworkConfig) { + var ret NetworkConfig + return ret + } + return *o.NetworkConfig +} + +// GetNetworkConfigOk returns a tuple with the NetworkConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayPayload) GetNetworkConfigOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkConfig) { + return nil, false + } + return o.NetworkConfig, true +} + +// HasNetworkConfig returns a boolean if a field has been set. +func (o *UpdateGatewayPayload) HasNetworkConfig() bool { + if o != nil && !IsNil(o.NetworkConfig) { + return true + } + + return false +} + +// SetNetworkConfig gets a reference to the given NetworkConfig and assigns it to the NetworkConfig field. +func (o *UpdateGatewayPayload) SetNetworkConfig(v NetworkConfig) { + o.NetworkConfig = &v +} + // GetPlanId returns the PlanId field value func (o *UpdateGatewayPayload) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o UpdateGatewayPayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkConfig) { + toSerialize["networkConfig"] = o.NetworkConfig + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *UpdateGatewayPayload) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkConfig") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties diff --git a/services/vpn/v1beta1api/model_create_gateway_payload.go b/services/vpn/v1beta1api/model_create_gateway_payload.go index 734acc063..9f54e1a42 100644 --- a/services/vpn/v1beta1api/model_create_gateway_payload.go +++ b/services/vpn/v1beta1api/model_create_gateway_payload.go @@ -25,7 +25,8 @@ type CreateGatewayPayload struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkArea *NetworkConfig `json:"networkArea,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *CreateGatewayPayload) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkArea returns the NetworkArea field value if set, zero value otherwise. +func (o *CreateGatewayPayload) GetNetworkArea() NetworkConfig { + if o == nil || IsNil(o.NetworkArea) { + var ret NetworkConfig + return ret + } + return *o.NetworkArea +} + +// GetNetworkAreaOk returns a tuple with the NetworkArea field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayPayload) GetNetworkAreaOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkArea) { + return nil, false + } + return o.NetworkArea, true +} + +// HasNetworkArea returns a boolean if a field has been set. +func (o *CreateGatewayPayload) HasNetworkArea() bool { + if o != nil && !IsNil(o.NetworkArea) { + return true + } + + return false +} + +// SetNetworkArea gets a reference to the given NetworkConfig and assigns it to the NetworkArea field. +func (o *CreateGatewayPayload) SetNetworkArea(v NetworkConfig) { + o.NetworkArea = &v +} + // GetPlanId returns the PlanId field value func (o *CreateGatewayPayload) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o CreateGatewayPayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkArea) { + toSerialize["networkArea"] = o.NetworkArea + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *CreateGatewayPayload) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkArea") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties diff --git a/services/vpn/v1beta1api/model_gateway.go b/services/vpn/v1beta1api/model_gateway.go index d100cd417..9b908b5a0 100644 --- a/services/vpn/v1beta1api/model_gateway.go +++ b/services/vpn/v1beta1api/model_gateway.go @@ -25,7 +25,8 @@ type Gateway struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkArea *NetworkConfig `json:"networkArea,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *Gateway) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkArea returns the NetworkArea field value if set, zero value otherwise. +func (o *Gateway) GetNetworkArea() NetworkConfig { + if o == nil || IsNil(o.NetworkArea) { + var ret NetworkConfig + return ret + } + return *o.NetworkArea +} + +// GetNetworkAreaOk returns a tuple with the NetworkArea field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetNetworkAreaOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkArea) { + return nil, false + } + return o.NetworkArea, true +} + +// HasNetworkArea returns a boolean if a field has been set. +func (o *Gateway) HasNetworkArea() bool { + if o != nil && !IsNil(o.NetworkArea) { + return true + } + + return false +} + +// SetNetworkArea gets a reference to the given NetworkConfig and assigns it to the NetworkArea field. +func (o *Gateway) SetNetworkArea(v NetworkConfig) { + o.NetworkArea = &v +} + // GetPlanId returns the PlanId field value func (o *Gateway) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o Gateway) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkArea) { + toSerialize["networkArea"] = o.NetworkArea + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *Gateway) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkArea") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties diff --git a/services/vpn/v1beta1api/model_gateway_response.go b/services/vpn/v1beta1api/model_gateway_response.go index 549bec031..1ccbe7028 100644 --- a/services/vpn/v1beta1api/model_gateway_response.go +++ b/services/vpn/v1beta1api/model_gateway_response.go @@ -25,7 +25,8 @@ type GatewayResponse struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkArea *NetworkConfig `json:"networkArea,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -170,6 +171,38 @@ func (o *GatewayResponse) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkArea returns the NetworkArea field value if set, zero value otherwise. +func (o *GatewayResponse) GetNetworkArea() NetworkConfig { + if o == nil || IsNil(o.NetworkArea) { + var ret NetworkConfig + return ret + } + return *o.NetworkArea +} + +// GetNetworkAreaOk returns a tuple with the NetworkArea field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetNetworkAreaOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkArea) { + return nil, false + } + return o.NetworkArea, true +} + +// HasNetworkArea returns a boolean if a field has been set. +func (o *GatewayResponse) HasNetworkArea() bool { + if o != nil && !IsNil(o.NetworkArea) { + return true + } + + return false +} + +// SetNetworkArea gets a reference to the given NetworkConfig and assigns it to the NetworkArea field. +func (o *GatewayResponse) SetNetworkArea(v NetworkConfig) { + o.NetworkArea = &v +} + // GetPlanId returns the PlanId field value func (o *GatewayResponse) GetPlanId() string { if o == nil { @@ -300,6 +333,9 @@ func (o GatewayResponse) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkArea) { + toSerialize["networkArea"] = o.NetworkArea + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType if !IsNil(o.Id) { @@ -358,6 +394,7 @@ func (o *GatewayResponse) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkArea") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") delete(additionalProperties, "id") diff --git a/services/vpn/v1beta1api/model_network_config.go b/services/vpn/v1beta1api/model_network_config.go new file mode 100644 index 000000000..046bdd371 --- /dev/null +++ b/services/vpn/v1beta1api/model_network_config.go @@ -0,0 +1,192 @@ +/* +STACKIT VPN API + +Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1beta1api + +import ( + "encoding/json" +) + +// checks if the NetworkConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkConfig{} + +// NetworkConfig struct for NetworkConfig +type NetworkConfig struct { + // The IPv4 network prefix (CIDR notation) allocated for the VPN gateway. Must have a prefix length of /28 or larger. Once the gateway is created, is not possible to change this attribute. + PredefinedNetworkPrefix []string `json:"predefinedNetworkPrefix,omitempty"` + // Custom routing table ID for the VPN gateway + RoutingTableId *string `json:"routingTableId,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _NetworkConfig NetworkConfig + +// NewNetworkConfig instantiates a new NetworkConfig 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 NewNetworkConfig() *NetworkConfig { + this := NetworkConfig{} + return &this +} + +// NewNetworkConfigWithDefaults instantiates a new NetworkConfig 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 NewNetworkConfigWithDefaults() *NetworkConfig { + this := NetworkConfig{} + return &this +} + +// GetPredefinedNetworkPrefix returns the PredefinedNetworkPrefix field value if set, zero value otherwise. +func (o *NetworkConfig) GetPredefinedNetworkPrefix() []string { + if o == nil || IsNil(o.PredefinedNetworkPrefix) { + var ret []string + return ret + } + return o.PredefinedNetworkPrefix +} + +// GetPredefinedNetworkPrefixOk returns a tuple with the PredefinedNetworkPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkConfig) GetPredefinedNetworkPrefixOk() ([]string, bool) { + if o == nil || IsNil(o.PredefinedNetworkPrefix) { + return nil, false + } + return o.PredefinedNetworkPrefix, true +} + +// HasPredefinedNetworkPrefix returns a boolean if a field has been set. +func (o *NetworkConfig) HasPredefinedNetworkPrefix() bool { + if o != nil && !IsNil(o.PredefinedNetworkPrefix) { + return true + } + + return false +} + +// SetPredefinedNetworkPrefix gets a reference to the given []string and assigns it to the PredefinedNetworkPrefix field. +func (o *NetworkConfig) SetPredefinedNetworkPrefix(v []string) { + o.PredefinedNetworkPrefix = v +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *NetworkConfig) GetRoutingTableId() string { + if o == nil || IsNil(o.RoutingTableId) { + var ret string + return ret + } + return *o.RoutingTableId +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkConfig) GetRoutingTableIdOk() (*string, bool) { + if o == nil || IsNil(o.RoutingTableId) { + return nil, false + } + return o.RoutingTableId, true +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *NetworkConfig) HasRoutingTableId() bool { + if o != nil && !IsNil(o.RoutingTableId) { + return true + } + + return false +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *NetworkConfig) SetRoutingTableId(v string) { + o.RoutingTableId = &v +} + +func (o NetworkConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PredefinedNetworkPrefix) { + toSerialize["predefinedNetworkPrefix"] = o.PredefinedNetworkPrefix + } + if !IsNil(o.RoutingTableId) { + toSerialize["routingTableId"] = o.RoutingTableId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *NetworkConfig) UnmarshalJSON(data []byte) (err error) { + varNetworkConfig := _NetworkConfig{} + + err = json.Unmarshal(data, &varNetworkConfig) + + if err != nil { + return err + } + + *o = NetworkConfig(varNetworkConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "predefinedNetworkPrefix") + delete(additionalProperties, "routingTableId") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNetworkConfig struct { + value *NetworkConfig + isSet bool +} + +func (v NullableNetworkConfig) Get() *NetworkConfig { + return v.value +} + +func (v *NullableNetworkConfig) Set(val *NetworkConfig) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkConfig(val *NetworkConfig) *NullableNetworkConfig { + return &NullableNetworkConfig{value: val, isSet: true} +} + +func (v NullableNetworkConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_update_gateway_payload.go b/services/vpn/v1beta1api/model_update_gateway_payload.go index 44fb0f58c..6f4a72d58 100644 --- a/services/vpn/v1beta1api/model_update_gateway_payload.go +++ b/services/vpn/v1beta1api/model_update_gateway_payload.go @@ -25,7 +25,8 @@ type UpdateGatewayPayload struct { // A user-friendly name for the VPN gateway. DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` // Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. - Labels *map[string]string `json:"labels,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + NetworkArea *NetworkConfig `json:"networkArea,omitempty"` // The service plan identifier. PlanId string `json:"planId"` RoutingType RoutingType `json:"routingType"` @@ -167,6 +168,38 @@ func (o *UpdateGatewayPayload) SetLabels(v map[string]string) { o.Labels = &v } +// GetNetworkArea returns the NetworkArea field value if set, zero value otherwise. +func (o *UpdateGatewayPayload) GetNetworkArea() NetworkConfig { + if o == nil || IsNil(o.NetworkArea) { + var ret NetworkConfig + return ret + } + return *o.NetworkArea +} + +// GetNetworkAreaOk returns a tuple with the NetworkArea field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayPayload) GetNetworkAreaOk() (*NetworkConfig, bool) { + if o == nil || IsNil(o.NetworkArea) { + return nil, false + } + return o.NetworkArea, true +} + +// HasNetworkArea returns a boolean if a field has been set. +func (o *UpdateGatewayPayload) HasNetworkArea() bool { + if o != nil && !IsNil(o.NetworkArea) { + return true + } + + return false +} + +// SetNetworkArea gets a reference to the given NetworkConfig and assigns it to the NetworkArea field. +func (o *UpdateGatewayPayload) SetNetworkArea(v NetworkConfig) { + o.NetworkArea = &v +} + // GetPlanId returns the PlanId field value func (o *UpdateGatewayPayload) GetPlanId() string { if o == nil { @@ -233,6 +266,9 @@ func (o UpdateGatewayPayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } + if !IsNil(o.NetworkArea) { + toSerialize["networkArea"] = o.NetworkArea + } toSerialize["planId"] = o.PlanId toSerialize["routingType"] = o.RoutingType @@ -285,6 +321,7 @@ func (o *UpdateGatewayPayload) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "bgp") delete(additionalProperties, "displayName") delete(additionalProperties, "labels") + delete(additionalProperties, "networkArea") delete(additionalProperties, "planId") delete(additionalProperties, "routingType") o.AdditionalProperties = additionalProperties