From 007cff5bc98b7e6daea5ef4ec9e7b04c2baf5128 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 19 Mar 2026 15:31:33 +0000 Subject: [PATCH 1/2] Generate vpn --- services/vpn/oas_commit | 2 +- services/vpn/v1beta1api/api_default.go | 2756 +++++++++++++++++ services/vpn/v1beta1api/api_default_mock.go | 328 ++ services/vpn/v1beta1api/client.go | 658 ++++ services/vpn/v1beta1api/configuration.go | 40 + services/vpn/v1beta1api/model_api_error.go | 265 ++ .../vpn/v1beta1api/model_api_error_detail.go | 237 ++ .../v1beta1api/model_api_error_response.go | 166 + .../v1beta1api/model_bgp_gateway_config.go | 192 ++ services/vpn/v1beta1api/model_bgp_status.go | 190 ++ .../vpn/v1beta1api/model_bgp_status_peers.go | 347 +++ .../vpn/v1beta1api/model_bgp_status_routes.go | 285 ++ .../vpn/v1beta1api/model_bgp_tunnel_config.go | 167 + .../vpn/v1beta1api/model_connection_list.go | 166 + .../v1beta1api/model_connection_response.go | 453 +++ .../model_connection_status_response.go | 266 ++ ...model_create_gateway_connection_payload.go | 377 +++ .../model_create_vpn_gateway_payload.go | 330 ++ ..._vpn_gateway_payload_availability_zones.go | 197 ++ services/vpn/v1beta1api/model_gateway.go | 330 ++ .../model_gateway_availability_zones.go | 197 ++ services/vpn/v1beta1api/model_gateway_list.go | 166 + .../vpn/v1beta1api/model_gateway_response.go | 405 +++ .../vpn/v1beta1api/model_gateway_status.go | 114 + .../model_gateway_status_response.go | 303 ++ .../vpn/v1beta1api/model_peering_config.go | 190 ++ services/vpn/v1beta1api/model_phase.go | 233 ++ .../vpn/v1beta1api/model_phase1_status.go | 267 ++ .../vpn/v1beta1api/model_phase2_status.go | 495 +++ services/vpn/v1beta1api/model_plan.go | 306 ++ services/vpn/v1beta1api/model_plan_list.go | 191 ++ services/vpn/v1beta1api/model_quota.go | 195 ++ services/vpn/v1beta1api/model_quota_list.go | 167 + .../v1beta1api/model_quota_list_response.go | 166 + services/vpn/v1beta1api/model_region.go | 110 + services/vpn/v1beta1api/model_routing_type.go | 112 + .../v1beta1api/model_tunnel_configuration.go | 336 ++ .../model_tunnel_configuration_phase1.go | 275 ++ .../model_tunnel_configuration_phase2.go | 359 +++ .../vpn/v1beta1api/model_tunnel_status.go | 264 ++ ...model_update_gateway_connection_payload.go | 377 +++ .../model_update_vpn_gateway_payload.go | 330 ++ ..._vpn_gateway_payload_availability_zones.go | 197 ++ services/vpn/v1beta1api/model_vpn_tunnels.go | 276 ++ services/vpn/v1beta1api/response.go | 47 + services/vpn/v1beta1api/utils.go | 361 +++ 46 files changed, 14190 insertions(+), 1 deletion(-) create mode 100644 services/vpn/v1beta1api/api_default.go create mode 100644 services/vpn/v1beta1api/api_default_mock.go create mode 100644 services/vpn/v1beta1api/client.go create mode 100644 services/vpn/v1beta1api/configuration.go create mode 100644 services/vpn/v1beta1api/model_api_error.go create mode 100644 services/vpn/v1beta1api/model_api_error_detail.go create mode 100644 services/vpn/v1beta1api/model_api_error_response.go create mode 100644 services/vpn/v1beta1api/model_bgp_gateway_config.go create mode 100644 services/vpn/v1beta1api/model_bgp_status.go create mode 100644 services/vpn/v1beta1api/model_bgp_status_peers.go create mode 100644 services/vpn/v1beta1api/model_bgp_status_routes.go create mode 100644 services/vpn/v1beta1api/model_bgp_tunnel_config.go create mode 100644 services/vpn/v1beta1api/model_connection_list.go create mode 100644 services/vpn/v1beta1api/model_connection_response.go create mode 100644 services/vpn/v1beta1api/model_connection_status_response.go create mode 100644 services/vpn/v1beta1api/model_create_gateway_connection_payload.go create mode 100644 services/vpn/v1beta1api/model_create_vpn_gateway_payload.go create mode 100644 services/vpn/v1beta1api/model_create_vpn_gateway_payload_availability_zones.go create mode 100644 services/vpn/v1beta1api/model_gateway.go create mode 100644 services/vpn/v1beta1api/model_gateway_availability_zones.go create mode 100644 services/vpn/v1beta1api/model_gateway_list.go create mode 100644 services/vpn/v1beta1api/model_gateway_response.go create mode 100644 services/vpn/v1beta1api/model_gateway_status.go create mode 100644 services/vpn/v1beta1api/model_gateway_status_response.go create mode 100644 services/vpn/v1beta1api/model_peering_config.go create mode 100644 services/vpn/v1beta1api/model_phase.go create mode 100644 services/vpn/v1beta1api/model_phase1_status.go create mode 100644 services/vpn/v1beta1api/model_phase2_status.go create mode 100644 services/vpn/v1beta1api/model_plan.go create mode 100644 services/vpn/v1beta1api/model_plan_list.go create mode 100644 services/vpn/v1beta1api/model_quota.go create mode 100644 services/vpn/v1beta1api/model_quota_list.go create mode 100644 services/vpn/v1beta1api/model_quota_list_response.go create mode 100644 services/vpn/v1beta1api/model_region.go create mode 100644 services/vpn/v1beta1api/model_routing_type.go create mode 100644 services/vpn/v1beta1api/model_tunnel_configuration.go create mode 100644 services/vpn/v1beta1api/model_tunnel_configuration_phase1.go create mode 100644 services/vpn/v1beta1api/model_tunnel_configuration_phase2.go create mode 100644 services/vpn/v1beta1api/model_tunnel_status.go create mode 100644 services/vpn/v1beta1api/model_update_gateway_connection_payload.go create mode 100644 services/vpn/v1beta1api/model_update_vpn_gateway_payload.go create mode 100644 services/vpn/v1beta1api/model_update_vpn_gateway_payload_availability_zones.go create mode 100644 services/vpn/v1beta1api/model_vpn_tunnels.go create mode 100644 services/vpn/v1beta1api/response.go create mode 100644 services/vpn/v1beta1api/utils.go diff --git a/services/vpn/oas_commit b/services/vpn/oas_commit index e3713dde3..837584ce1 100644 --- a/services/vpn/oas_commit +++ b/services/vpn/oas_commit @@ -1 +1 @@ -0e64886dd0847341800d7191ed193b75413be998 +6211be2b62fe4501869c3a617af6ec10b02ed670 diff --git a/services/vpn/v1beta1api/api_default.go b/services/vpn/v1beta1api/api_default.go new file mode 100644 index 000000000..8f2b98390 --- /dev/null +++ b/services/vpn/v1beta1api/api_default.go @@ -0,0 +1,2756 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + 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 + */ + CreateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string) ApiCreateGatewayConnectionRequest + + // CreateGatewayConnectionExecute executes the request + // @return ConnectionResponse + CreateGatewayConnectionExecute(r ApiCreateGatewayConnectionRequest) (*ConnectionResponse, error) + + /* + CreateVPNGateway Create a VPN gateway in a project. + + Provision a new VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateVPNGatewayRequest + */ + CreateVPNGateway(ctx context.Context, projectId string, region Region) ApiCreateVPNGatewayRequest + + // CreateVPNGatewayExecute executes the request + // @return GatewayResponse + CreateVPNGatewayExecute(r ApiCreateVPNGatewayRequest) (*GatewayResponse, error) + + /* + DeleteGatewayConnection 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 + */ + DeleteGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiDeleteGatewayConnectionRequest + + // DeleteGatewayConnectionExecute executes the request + DeleteGatewayConnectionExecute(r ApiDeleteGatewayConnectionRequest) error + + /* + DeleteVPNGateway 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 ApiDeleteVPNGatewayRequest + */ + DeleteVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiDeleteVPNGatewayRequest + + // DeleteVPNGatewayExecute executes the request + DeleteVPNGatewayExecute(r ApiDeleteVPNGatewayRequest) error + + /* + 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 + */ + GetGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiGetGatewayConnectionRequest + + // GetGatewayConnectionExecute executes the request + // @return ConnectionResponse + GetGatewayConnectionExecute(r ApiGetGatewayConnectionRequest) (*ConnectionResponse, error) + + /* + 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 + */ + GetGatewayConnectionStatus(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiGetGatewayConnectionStatusRequest + + // GetGatewayConnectionStatusExecute executes the request + // @return ConnectionStatusResponse + GetGatewayConnectionStatusExecute(r ApiGetGatewayConnectionStatusRequest) (*ConnectionStatusResponse, error) + + /* + GetVPNGateway 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 ApiGetVPNGatewayRequest + */ + GetVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiGetVPNGatewayRequest + + // GetVPNGatewayExecute executes the request + // @return GatewayResponse + GetVPNGatewayExecute(r ApiGetVPNGatewayRequest) (*GatewayResponse, error) + + /* + GetVPNGatewayStatus 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 + @return ApiGetVPNGatewayStatusRequest + */ + GetVPNGatewayStatus(ctx context.Context, projectId string, region Region, gatewayId string) ApiGetVPNGatewayStatusRequest + + // GetVPNGatewayStatusExecute executes the request + // @return GatewayStatusResponse + GetVPNGatewayStatusExecute(r ApiGetVPNGatewayStatusRequest) (*GatewayStatusResponse, error) + + /* + ListGatewayConnections List connections for an existing VPN gateway. + + 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 + @return ApiListGatewayConnectionsRequest + */ + ListGatewayConnections(ctx context.Context, projectId string, region Region, gatewayId string) ApiListGatewayConnectionsRequest + + // ListGatewayConnectionsExecute executes the request + // @return ConnectionList + ListGatewayConnectionsExecute(r ApiListGatewayConnectionsRequest) (*ConnectionList, error) + + /* + ListPlans List available service plans for 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. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ApiListPlansRequest + */ + ListPlans(ctx context.Context, region Region) ApiListPlansRequest + + // ListPlansExecute executes the request + // @return PlanList + ListPlansExecute(r ApiListPlansRequest) (*PlanList, error) + + /* + ListQuotas List project quotas. + + 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 ApiListQuotasRequest + */ + ListQuotas(ctx context.Context, projectId string, region Region) ApiListQuotasRequest + + // ListQuotasExecute executes the request + // @return QuotaListResponse + ListQuotasExecute(r ApiListQuotasRequest) (*QuotaListResponse, error) + + /* + ListVPNGateways List VPN gateways in a project with label filtering + + 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 + @return ApiListVPNGatewaysRequest + */ + ListVPNGateways(ctx context.Context, projectId string, region Region) ApiListVPNGatewaysRequest + + // ListVPNGatewaysExecute executes the request + // @return GatewayList + ListVPNGatewaysExecute(r ApiListVPNGatewaysRequest) (*GatewayList, error) + + /* + UpdateGatewayConnection Update a connection on an existing VPN gateway. + + Updating the configuration of an existing 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 ApiUpdateGatewayConnectionRequest + */ + UpdateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiUpdateGatewayConnectionRequest + + // UpdateGatewayConnectionExecute executes the request + // @return ConnectionResponse + UpdateGatewayConnectionExecute(r ApiUpdateGatewayConnectionRequest) (*ConnectionResponse, error) + + /* + UpdateVPNGateway 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. + + + @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 ApiUpdateVPNGatewayRequest + */ + UpdateVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiUpdateVPNGatewayRequest + + // UpdateVPNGatewayExecute executes the request + // @return GatewayResponse + UpdateVPNGatewayExecute(r ApiUpdateVPNGatewayRequest) (*GatewayResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateGatewayConnectionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + 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 Region, 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 + "/v1beta1/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 + 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 + 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 + 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 + 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 + } + 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 ApiCreateVPNGatewayRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + createVPNGatewayPayload *CreateVPNGatewayPayload +} + +func (r ApiCreateVPNGatewayRequest) CreateVPNGatewayPayload(createVPNGatewayPayload CreateVPNGatewayPayload) ApiCreateVPNGatewayRequest { + r.createVPNGatewayPayload = &createVPNGatewayPayload + return r +} + +func (r ApiCreateVPNGatewayRequest) Execute() (*GatewayResponse, error) { + return r.ApiService.CreateVPNGatewayExecute(r) +} + +/* +CreateVPNGateway Create a VPN gateway in a project. + +Provision a new VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateVPNGatewayRequest +*/ +func (a *DefaultAPIService) CreateVPNGateway(ctx context.Context, projectId string, region Region) ApiCreateVPNGatewayRequest { + return ApiCreateVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return GatewayResponse +func (a *DefaultAPIService) CreateVPNGatewayExecute(r ApiCreateVPNGatewayRequest) (*GatewayResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateVPNGateway") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createVPNGatewayPayload == nil { + return localVarReturnValue, reportError("createVPNGatewayPayload is required and must be specified") + } + + // 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.createVPNGatewayPayload + 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 + 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 + 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 + 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 + 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 + } + 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 ApiDeleteGatewayConnectionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + 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. + + @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 Region, 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 + "/v1beta1/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 + 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 + 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 + 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 + 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 newErr + } + + return nil +} + +type ApiDeleteVPNGatewayRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + gatewayId string +} + +func (r ApiDeleteVPNGatewayRequest) Execute() error { + return r.ApiService.DeleteVPNGatewayExecute(r) +} + +/* +DeleteVPNGateway 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 ApiDeleteVPNGatewayRequest +*/ +func (a *DefaultAPIService) DeleteVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiDeleteVPNGatewayRequest { + return ApiDeleteVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteVPNGatewayExecute(r ApiDeleteVPNGatewayRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteVPNGateway") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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 + 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 + 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 + 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 newErr + } + + return nil +} + +type ApiGetGatewayConnectionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + 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 Region, 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 + "/v1beta1/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 + 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 + 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 + 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 + 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 + } + 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 Region + 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 Region, 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 + "/v1beta1/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 + 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 + 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 + 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 + 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 + } + 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 ApiGetVPNGatewayRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + gatewayId string +} + +func (r ApiGetVPNGatewayRequest) Execute() (*GatewayResponse, error) { + return r.ApiService.GetVPNGatewayExecute(r) +} + +/* +GetVPNGateway 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 ApiGetVPNGatewayRequest +*/ +func (a *DefaultAPIService) GetVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiGetVPNGatewayRequest { + return ApiGetVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// Execute executes the request +// +// @return GatewayResponse +func (a *DefaultAPIService) GetVPNGatewayExecute(r ApiGetVPNGatewayRequest) (*GatewayResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetVPNGateway") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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 + 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 + 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 + 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 + 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 + } + 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 ApiGetVPNGatewayStatusRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + gatewayId string +} + +func (r ApiGetVPNGatewayStatusRequest) Execute() (*GatewayStatusResponse, error) { + return r.ApiService.GetVPNGatewayStatusExecute(r) +} + +/* +GetVPNGatewayStatus 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 + @return ApiGetVPNGatewayStatusRequest +*/ +func (a *DefaultAPIService) GetVPNGatewayStatus(ctx context.Context, projectId string, region Region, gatewayId string) ApiGetVPNGatewayStatusRequest { + return ApiGetVPNGatewayStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// Execute executes the request +// +// @return GatewayStatusResponse +func (a *DefaultAPIService) GetVPNGatewayStatusExecute(r ApiGetVPNGatewayStatusRequest) (*GatewayStatusResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayStatusResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetVPNGatewayStatus") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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) + + 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 + 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 + 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 + 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 + 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 + } + 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 ApiListGatewayConnectionsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + gatewayId string + labelSelector *map[string]string +} + +// 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) +} + +/* +ListGatewayConnections List connections for an existing VPN gateway. + +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 + @return ApiListGatewayConnectionsRequest +*/ +func (a *DefaultAPIService) ListGatewayConnections(ctx context.Context, projectId string, region Region, gatewayId string) ApiListGatewayConnectionsRequest { + return ApiListGatewayConnectionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// Execute executes the request +// +// @return ConnectionList +func (a *DefaultAPIService) ListGatewayConnectionsExecute(r ApiListGatewayConnectionsRequest) (*ConnectionList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConnectionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGatewayConnections") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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{} + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "deepObject", "") + } + // 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 + 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 + 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 + 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 + 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 + } + 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 ApiListPlansRequest struct { + ctx context.Context + ApiService DefaultAPI + region Region +} + +func (r ApiListPlansRequest) Execute() (*PlanList, error) { + return r.ApiService.ListPlansExecute(r) +} + +/* +ListPlans List available service plans for 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. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ApiListPlansRequest +*/ +func (a *DefaultAPIService) ListPlans(ctx context.Context, region Region) ApiListPlansRequest { + return ApiListPlansRequest{ + ApiService: a, + ctx: ctx, + region: region, + } +} + +// Execute executes the request +// +// @return PlanList +func (a *DefaultAPIService) ListPlansExecute(r ApiListPlansRequest) (*PlanList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PlanList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListPlans") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/regions/{region}/plans" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -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 + 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 + } + 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 ApiListQuotasRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region +} + +func (r ApiListQuotasRequest) Execute() (*QuotaListResponse, error) { + return r.ApiService.ListQuotasExecute(r) +} + +/* +ListQuotas List project quotas. + +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 ApiListQuotasRequest +*/ +func (a *DefaultAPIService) ListQuotas(ctx context.Context, projectId string, region Region) ApiListQuotasRequest { + return ApiListQuotasRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return QuotaListResponse +func (a *DefaultAPIService) ListQuotasExecute(r ApiListQuotasRequest) (*QuotaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *QuotaListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListQuotas") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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) + + 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 + 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 + } + 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 ApiListVPNGatewaysRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + labelSelector *map[string]string +} + +// Filter resources by labels. +func (r ApiListVPNGatewaysRequest) LabelSelector(labelSelector map[string]string) ApiListVPNGatewaysRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ApiListVPNGatewaysRequest) Execute() (*GatewayList, error) { + return r.ApiService.ListVPNGatewaysExecute(r) +} + +/* +ListVPNGateways List VPN gateways in a project with label filtering + +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 + @return ApiListVPNGatewaysRequest +*/ +func (a *DefaultAPIService) ListVPNGateways(ctx context.Context, projectId string, region Region) ApiListVPNGatewaysRequest { + return ApiListVPNGatewaysRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return GatewayList +func (a *DefaultAPIService) ListVPNGatewaysExecute(r ApiListVPNGatewaysRequest) (*GatewayList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListVPNGateways") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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) + + 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{} + + // 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 + 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 + 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 + 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 + } + 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 ApiUpdateGatewayConnectionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + gatewayId string + connectionId string + updateGatewayConnectionPayload *UpdateGatewayConnectionPayload +} + +func (r ApiUpdateGatewayConnectionRequest) UpdateGatewayConnectionPayload(updateGatewayConnectionPayload UpdateGatewayConnectionPayload) ApiUpdateGatewayConnectionRequest { + r.updateGatewayConnectionPayload = &updateGatewayConnectionPayload + return r +} + +func (r ApiUpdateGatewayConnectionRequest) Execute() (*ConnectionResponse, error) { + return r.ApiService.UpdateGatewayConnectionExecute(r) +} + +/* +UpdateGatewayConnection Update a connection on an existing VPN gateway. + +Updating the configuration of an existing 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 ApiUpdateGatewayConnectionRequest +*/ +func (a *DefaultAPIService) UpdateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiUpdateGatewayConnectionRequest { + return ApiUpdateGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + connectionId: connectionId, + } +} + +// Execute executes the request +// +// @return ConnectionResponse +func (a *DefaultAPIService) UpdateGatewayConnectionExecute(r ApiUpdateGatewayConnectionRequest) (*ConnectionResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConnectionResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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{"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.updateGatewayConnectionPayload + 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 + 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 + 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 + 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 + 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 + } + 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 ApiUpdateVPNGatewayRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region Region + gatewayId string + updateVPNGatewayPayload *UpdateVPNGatewayPayload +} + +func (r ApiUpdateVPNGatewayRequest) UpdateVPNGatewayPayload(updateVPNGatewayPayload UpdateVPNGatewayPayload) ApiUpdateVPNGatewayRequest { + r.updateVPNGatewayPayload = &updateVPNGatewayPayload + return r +} + +func (r ApiUpdateVPNGatewayRequest) Execute() (*GatewayResponse, error) { + return r.ApiService.UpdateVPNGatewayExecute(r) +} + +/* +UpdateVPNGateway 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. + + @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 ApiUpdateVPNGatewayRequest +*/ +func (a *DefaultAPIService) UpdateVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiUpdateVPNGatewayRequest { + return ApiUpdateVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// Execute executes the request +// +// @return GatewayResponse +func (a *DefaultAPIService) UpdateVPNGatewayExecute(r ApiUpdateVPNGatewayRequest) (*GatewayResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateVPNGateway") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/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.updateVPNGatewayPayload == nil { + return localVarReturnValue, reportError("updateVPNGatewayPayload is required and must be specified") + } + + // 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.updateVPNGatewayPayload + 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 + 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 + 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 + 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 + 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 + } + 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 +} diff --git a/services/vpn/v1beta1api/api_default_mock.go b/services/vpn/v1beta1api/api_default_mock.go new file mode 100644 index 000000000..e30d6eff8 --- /dev/null +++ b/services/vpn/v1beta1api/api_default_mock.go @@ -0,0 +1,328 @@ +/* +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 ( + "context" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateGatewayConnectionExecuteMock can be populated to implement the behavior of the CreateGatewayConnectionExecute function of this mock + CreateGatewayConnectionExecuteMock *func(r ApiCreateGatewayConnectionRequest) (*ConnectionResponse, error) + // CreateVPNGatewayExecuteMock can be populated to implement the behavior of the CreateVPNGatewayExecute function of this mock + CreateVPNGatewayExecuteMock *func(r ApiCreateVPNGatewayRequest) (*GatewayResponse, error) + // DeleteGatewayConnectionExecuteMock can be populated to implement the behavior of the DeleteGatewayConnectionExecute function of this mock + DeleteGatewayConnectionExecuteMock *func(r ApiDeleteGatewayConnectionRequest) error + // DeleteVPNGatewayExecuteMock can be populated to implement the behavior of the DeleteVPNGatewayExecute function of this mock + DeleteVPNGatewayExecuteMock *func(r ApiDeleteVPNGatewayRequest) 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) + // GetVPNGatewayExecuteMock can be populated to implement the behavior of the GetVPNGatewayExecute function of this mock + GetVPNGatewayExecuteMock *func(r ApiGetVPNGatewayRequest) (*GatewayResponse, error) + // GetVPNGatewayStatusExecuteMock can be populated to implement the behavior of the GetVPNGatewayStatusExecute function of this mock + GetVPNGatewayStatusExecuteMock *func(r ApiGetVPNGatewayStatusRequest) (*GatewayStatusResponse, error) + // ListGatewayConnectionsExecuteMock can be populated to implement the behavior of the ListGatewayConnectionsExecute function of this mock + ListGatewayConnectionsExecuteMock *func(r ApiListGatewayConnectionsRequest) (*ConnectionList, error) + // ListPlansExecuteMock can be populated to implement the behavior of the ListPlansExecute function of this mock + ListPlansExecuteMock *func(r ApiListPlansRequest) (*PlanList, error) + // ListQuotasExecuteMock can be populated to implement the behavior of the ListQuotasExecute function of this mock + ListQuotasExecuteMock *func(r ApiListQuotasRequest) (*QuotaListResponse, error) + // ListVPNGatewaysExecuteMock can be populated to implement the behavior of the ListVPNGatewaysExecute function of this mock + ListVPNGatewaysExecuteMock *func(r ApiListVPNGatewaysRequest) (*GatewayList, error) + // UpdateGatewayConnectionExecuteMock can be populated to implement the behavior of the UpdateGatewayConnectionExecute function of this mock + UpdateGatewayConnectionExecuteMock *func(r ApiUpdateGatewayConnectionRequest) (*ConnectionResponse, error) + // UpdateVPNGatewayExecuteMock can be populated to implement the behavior of the UpdateVPNGatewayExecute function of this mock + UpdateVPNGatewayExecuteMock *func(r ApiUpdateVPNGatewayRequest) (*GatewayResponse, error) +} + +func (a DefaultAPIServiceMock) CreateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string) ApiCreateGatewayConnectionRequest { + return ApiCreateGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// CreateGatewayConnectionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateGatewayConnectionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateGatewayConnectionExecute(r ApiCreateGatewayConnectionRequest) (*ConnectionResponse, error) { + if a.CreateGatewayConnectionExecuteMock == nil { + var localVarReturnValue *ConnectionResponse + return localVarReturnValue, nil + } + + return (*a.CreateGatewayConnectionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateVPNGateway(ctx context.Context, projectId string, region Region) ApiCreateVPNGatewayRequest { + return ApiCreateVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// CreateVPNGatewayExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateVPNGatewayExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateVPNGatewayExecute(r ApiCreateVPNGatewayRequest) (*GatewayResponse, error) { + if a.CreateVPNGatewayExecuteMock == nil { + var localVarReturnValue *GatewayResponse + return localVarReturnValue, nil + } + + return (*a.CreateVPNGatewayExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiDeleteGatewayConnectionRequest { + return ApiDeleteGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + connectionId: connectionId, + } +} + +// DeleteGatewayConnectionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteGatewayConnectionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteGatewayConnectionExecute(r ApiDeleteGatewayConnectionRequest) error { + if a.DeleteGatewayConnectionExecuteMock == nil { + return nil + } + + return (*a.DeleteGatewayConnectionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiDeleteVPNGatewayRequest { + return ApiDeleteVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// DeleteVPNGatewayExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteVPNGatewayExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteVPNGatewayExecute(r ApiDeleteVPNGatewayRequest) error { + if a.DeleteVPNGatewayExecuteMock == nil { + return nil + } + + return (*a.DeleteVPNGatewayExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiGetGatewayConnectionRequest { + return ApiGetGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + connectionId: connectionId, + } +} + +// GetGatewayConnectionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetGatewayConnectionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetGatewayConnectionExecute(r ApiGetGatewayConnectionRequest) (*ConnectionResponse, error) { + if a.GetGatewayConnectionExecuteMock == nil { + var localVarReturnValue *ConnectionResponse + return localVarReturnValue, nil + } + + return (*a.GetGatewayConnectionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetGatewayConnectionStatus(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiGetGatewayConnectionStatusRequest { + return ApiGetGatewayConnectionStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + connectionId: connectionId, + } +} + +// GetGatewayConnectionStatusExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetGatewayConnectionStatusExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetGatewayConnectionStatusExecute(r ApiGetGatewayConnectionStatusRequest) (*ConnectionStatusResponse, error) { + if a.GetGatewayConnectionStatusExecuteMock == nil { + var localVarReturnValue *ConnectionStatusResponse + return localVarReturnValue, nil + } + + return (*a.GetGatewayConnectionStatusExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiGetVPNGatewayRequest { + return ApiGetVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// GetVPNGatewayExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetVPNGatewayExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetVPNGatewayExecute(r ApiGetVPNGatewayRequest) (*GatewayResponse, error) { + if a.GetVPNGatewayExecuteMock == nil { + var localVarReturnValue *GatewayResponse + return localVarReturnValue, nil + } + + return (*a.GetVPNGatewayExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetVPNGatewayStatus(ctx context.Context, projectId string, region Region, gatewayId string) ApiGetVPNGatewayStatusRequest { + return ApiGetVPNGatewayStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// GetVPNGatewayStatusExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetVPNGatewayStatusExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetVPNGatewayStatusExecute(r ApiGetVPNGatewayStatusRequest) (*GatewayStatusResponse, error) { + if a.GetVPNGatewayStatusExecuteMock == nil { + var localVarReturnValue *GatewayStatusResponse + return localVarReturnValue, nil + } + + return (*a.GetVPNGatewayStatusExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListGatewayConnections(ctx context.Context, projectId string, region Region, gatewayId string) ApiListGatewayConnectionsRequest { + return ApiListGatewayConnectionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// ListGatewayConnectionsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListGatewayConnectionsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListGatewayConnectionsExecute(r ApiListGatewayConnectionsRequest) (*ConnectionList, error) { + if a.ListGatewayConnectionsExecuteMock == nil { + var localVarReturnValue *ConnectionList + return localVarReturnValue, nil + } + + return (*a.ListGatewayConnectionsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListPlans(ctx context.Context, region Region) ApiListPlansRequest { + return ApiListPlansRequest{ + ApiService: a, + ctx: ctx, + region: region, + } +} + +// ListPlansExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListPlansExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListPlansExecute(r ApiListPlansRequest) (*PlanList, error) { + if a.ListPlansExecuteMock == nil { + var localVarReturnValue *PlanList + return localVarReturnValue, nil + } + + return (*a.ListPlansExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListQuotas(ctx context.Context, projectId string, region Region) ApiListQuotasRequest { + return ApiListQuotasRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// ListQuotasExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListQuotasExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListQuotasExecute(r ApiListQuotasRequest) (*QuotaListResponse, error) { + if a.ListQuotasExecuteMock == nil { + var localVarReturnValue *QuotaListResponse + return localVarReturnValue, nil + } + + return (*a.ListQuotasExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListVPNGateways(ctx context.Context, projectId string, region Region) ApiListVPNGatewaysRequest { + return ApiListVPNGatewaysRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// ListVPNGatewaysExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListVPNGatewaysExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListVPNGatewaysExecute(r ApiListVPNGatewaysRequest) (*GatewayList, error) { + if a.ListVPNGatewaysExecuteMock == nil { + var localVarReturnValue *GatewayList + return localVarReturnValue, nil + } + + return (*a.ListVPNGatewaysExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayId string, connectionId string) ApiUpdateGatewayConnectionRequest { + return ApiUpdateGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + connectionId: connectionId, + } +} + +// UpdateGatewayConnectionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateGatewayConnectionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateGatewayConnectionExecute(r ApiUpdateGatewayConnectionRequest) (*ConnectionResponse, error) { + if a.UpdateGatewayConnectionExecuteMock == nil { + var localVarReturnValue *ConnectionResponse + return localVarReturnValue, nil + } + + return (*a.UpdateGatewayConnectionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateVPNGateway(ctx context.Context, projectId string, region Region, gatewayId string) ApiUpdateVPNGatewayRequest { + return ApiUpdateVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayId: gatewayId, + } +} + +// UpdateVPNGatewayExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateVPNGatewayExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateVPNGatewayExecute(r ApiUpdateVPNGatewayRequest) (*GatewayResponse, error) { + if a.UpdateVPNGatewayExecuteMock == nil { + var localVarReturnValue *GatewayResponse + return localVarReturnValue, nil + } + + return (*a.UpdateVPNGatewayExecuteMock)(r) +} diff --git a/services/vpn/v1beta1api/client.go b/services/vpn/v1beta1api/client.go new file mode 100644 index 000000000..67ac54b11 --- /dev/null +++ b/services/vpn/v1beta1api/client.go @@ -0,0 +1,658 @@ +/* +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 ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT VPN API API v1beta1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/vpn/v1beta1api/configuration.go b/services/vpn/v1beta1api/configuration.go new file mode 100644 index 000000000..3a207642f --- /dev/null +++ b/services/vpn/v1beta1api/configuration.go @@ -0,0 +1,40 @@ +/* +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 ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/vpn", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://vpn.api.{region}stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "eu01.", + EnumValues: []string{ + "eu01.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/vpn/v1beta1api/model_api_error.go b/services/vpn/v1beta1api/model_api_error.go new file mode 100644 index 000000000..55d6bb7dd --- /dev/null +++ b/services/vpn/v1beta1api/model_api_error.go @@ -0,0 +1,265 @@ +/* +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" + "fmt" +) + +// checks if the APIError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &APIError{} + +// APIError struct for APIError +type APIError struct { + // The HTTP status code. + Code int32 `json:"code"` + // Can contain more details on the error. + Details []APIErrorDetail `json:"details,omitempty"` + // A message describing the error. + Message string `json:"message"` + // The HTTP status code text. + Status string `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _APIError APIError + +// NewAPIError instantiates a new APIError 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 NewAPIError(code int32, message string, status string) *APIError { + this := APIError{} + this.Code = code + this.Message = message + this.Status = status + return &this +} + +// NewAPIErrorWithDefaults instantiates a new APIError 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 NewAPIErrorWithDefaults() *APIError { + this := APIError{} + return &this +} + +// GetCode returns the Code field value +func (o *APIError) GetCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *APIError) GetCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value +func (o *APIError) SetCode(v int32) { + o.Code = v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *APIError) GetDetails() []APIErrorDetail { + if o == nil || IsNil(o.Details) { + var ret []APIErrorDetail + return ret + } + return o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIError) GetDetailsOk() ([]APIErrorDetail, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *APIError) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given []APIErrorDetail and assigns it to the Details field. +func (o *APIError) SetDetails(v []APIErrorDetail) { + o.Details = v +} + +// GetMessage returns the Message field value +func (o *APIError) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *APIError) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *APIError) SetMessage(v string) { + o.Message = v +} + +// GetStatus returns the Status field value +func (o *APIError) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *APIError) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *APIError) SetStatus(v string) { + o.Status = v +} + +func (o APIError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o APIError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + toSerialize["message"] = o.Message + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *APIError) 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{ + "code", + "message", + "status", + } + + 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) + } + } + + varAPIError := _APIError{} + + err = json.Unmarshal(data, &varAPIError) + + if err != nil { + return err + } + + *o = APIError(varAPIError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "details") + delete(additionalProperties, "message") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAPIError struct { + value *APIError + isSet bool +} + +func (v NullableAPIError) Get() *APIError { + return v.value +} + +func (v *NullableAPIError) Set(val *APIError) { + v.value = val + v.isSet = true +} + +func (v NullableAPIError) IsSet() bool { + return v.isSet +} + +func (v *NullableAPIError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAPIError(val *APIError) *NullableAPIError { + return &NullableAPIError{value: val, isSet: true} +} + +func (v NullableAPIError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAPIError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_api_error_detail.go b/services/vpn/v1beta1api/model_api_error_detail.go new file mode 100644 index 000000000..ef4eed2b6 --- /dev/null +++ b/services/vpn/v1beta1api/model_api_error_detail.go @@ -0,0 +1,237 @@ +/* +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" + "fmt" +) + +// checks if the APIErrorDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &APIErrorDetail{} + +// APIErrorDetail struct for APIErrorDetail +type APIErrorDetail struct { + // The domain of the error source. + Domain string `json:"domain"` + // Metadata contains more information. For bad requests this would be field information. + Metadata map[string]interface{} `json:"metadata,omitempty"` + // The reason why the error occurs. + Reason string `json:"reason"` + AdditionalProperties map[string]interface{} +} + +type _APIErrorDetail APIErrorDetail + +// NewAPIErrorDetail instantiates a new APIErrorDetail 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 NewAPIErrorDetail(domain string, reason string) *APIErrorDetail { + this := APIErrorDetail{} + this.Domain = domain + this.Reason = reason + return &this +} + +// NewAPIErrorDetailWithDefaults instantiates a new APIErrorDetail 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 NewAPIErrorDetailWithDefaults() *APIErrorDetail { + this := APIErrorDetail{} + var domain string = "vpn.access.stackit.cloud" + this.Domain = domain + return &this +} + +// GetDomain returns the Domain field value +func (o *APIErrorDetail) GetDomain() string { + if o == nil { + var ret string + return ret + } + + return o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value +// and a boolean to check if the value has been set. +func (o *APIErrorDetail) GetDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Domain, true +} + +// SetDomain sets field value +func (o *APIErrorDetail) SetDomain(v string) { + o.Domain = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *APIErrorDetail) GetMetadata() map[string]interface{} { + if o == nil || IsNil(o.Metadata) { + var ret map[string]interface{} + return ret + } + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIErrorDetail) GetMetadataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Metadata) { + return map[string]interface{}{}, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *APIErrorDetail) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *APIErrorDetail) SetMetadata(v map[string]interface{}) { + o.Metadata = v +} + +// GetReason returns the Reason field value +func (o *APIErrorDetail) GetReason() string { + if o == nil { + var ret string + return ret + } + + return o.Reason +} + +// GetReasonOk returns a tuple with the Reason field value +// and a boolean to check if the value has been set. +func (o *APIErrorDetail) GetReasonOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Reason, true +} + +// SetReason sets field value +func (o *APIErrorDetail) SetReason(v string) { + o.Reason = v +} + +func (o APIErrorDetail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o APIErrorDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["domain"] = o.Domain + if !IsNil(o.Metadata) { + toSerialize["metadata"] = o.Metadata + } + toSerialize["reason"] = o.Reason + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *APIErrorDetail) 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{ + "domain", + "reason", + } + + 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) + } + } + + varAPIErrorDetail := _APIErrorDetail{} + + err = json.Unmarshal(data, &varAPIErrorDetail) + + if err != nil { + return err + } + + *o = APIErrorDetail(varAPIErrorDetail) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "domain") + delete(additionalProperties, "metadata") + delete(additionalProperties, "reason") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAPIErrorDetail struct { + value *APIErrorDetail + isSet bool +} + +func (v NullableAPIErrorDetail) Get() *APIErrorDetail { + return v.value +} + +func (v *NullableAPIErrorDetail) Set(val *APIErrorDetail) { + v.value = val + v.isSet = true +} + +func (v NullableAPIErrorDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableAPIErrorDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAPIErrorDetail(val *APIErrorDetail) *NullableAPIErrorDetail { + return &NullableAPIErrorDetail{value: val, isSet: true} +} + +func (v NullableAPIErrorDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAPIErrorDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_api_error_response.go b/services/vpn/v1beta1api/model_api_error_response.go new file mode 100644 index 000000000..39f66489e --- /dev/null +++ b/services/vpn/v1beta1api/model_api_error_response.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: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the APIErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &APIErrorResponse{} + +// APIErrorResponse struct for APIErrorResponse +type APIErrorResponse struct { + Error APIError `json:"error"` + AdditionalProperties map[string]interface{} +} + +type _APIErrorResponse APIErrorResponse + +// NewAPIErrorResponse instantiates a new APIErrorResponse 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 NewAPIErrorResponse(error_ APIError) *APIErrorResponse { + this := APIErrorResponse{} + this.Error = error_ + return &this +} + +// NewAPIErrorResponseWithDefaults instantiates a new APIErrorResponse 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 NewAPIErrorResponseWithDefaults() *APIErrorResponse { + this := APIErrorResponse{} + return &this +} + +// GetError returns the Error field value +func (o *APIErrorResponse) GetError() APIError { + if o == nil { + var ret APIError + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *APIErrorResponse) GetErrorOk() (*APIError, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *APIErrorResponse) SetError(v APIError) { + o.Error = v +} + +func (o APIErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o APIErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["error"] = o.Error + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *APIErrorResponse) 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{ + "error", + } + + 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) + } + } + + varAPIErrorResponse := _APIErrorResponse{} + + err = json.Unmarshal(data, &varAPIErrorResponse) + + if err != nil { + return err + } + + *o = APIErrorResponse(varAPIErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAPIErrorResponse struct { + value *APIErrorResponse + isSet bool +} + +func (v NullableAPIErrorResponse) Get() *APIErrorResponse { + return v.value +} + +func (v *NullableAPIErrorResponse) Set(val *APIErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAPIErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAPIErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAPIErrorResponse(val *APIErrorResponse) *NullableAPIErrorResponse { + return &NullableAPIErrorResponse{value: val, isSet: true} +} + +func (v NullableAPIErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAPIErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_bgp_gateway_config.go b/services/vpn/v1beta1api/model_bgp_gateway_config.go new file mode 100644 index 000000000..4d0d69cd1 --- /dev/null +++ b/services/vpn/v1beta1api/model_bgp_gateway_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 BGPGatewayConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPGatewayConfig{} + +// BGPGatewayConfig BGP configuration effects all connections. (only for routingMode=BGP_ROUTE_BASED) +type BGPGatewayConfig struct { + // ASN for private use (reserved by IANA), both 16Bit and 32Bit ranges are valid (RFC 6996). + LocalAsn *int32 `json:"localAsn,omitempty"` + // A list of IPv4 Prefixes to advertise via BGP. If omitted, the SNA network ranges will be advertised. + OverrideAdvertisedRoutes []string `json:"overrideAdvertisedRoutes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BGPGatewayConfig BGPGatewayConfig + +// NewBGPGatewayConfig instantiates a new BGPGatewayConfig 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 NewBGPGatewayConfig() *BGPGatewayConfig { + this := BGPGatewayConfig{} + return &this +} + +// NewBGPGatewayConfigWithDefaults instantiates a new BGPGatewayConfig 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 NewBGPGatewayConfigWithDefaults() *BGPGatewayConfig { + this := BGPGatewayConfig{} + return &this +} + +// GetLocalAsn returns the LocalAsn field value if set, zero value otherwise. +func (o *BGPGatewayConfig) GetLocalAsn() int32 { + if o == nil || IsNil(o.LocalAsn) { + var ret int32 + return ret + } + return *o.LocalAsn +} + +// GetLocalAsnOk returns a tuple with the LocalAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPGatewayConfig) GetLocalAsnOk() (*int32, bool) { + if o == nil || IsNil(o.LocalAsn) { + return nil, false + } + return o.LocalAsn, true +} + +// HasLocalAsn returns a boolean if a field has been set. +func (o *BGPGatewayConfig) HasLocalAsn() bool { + if o != nil && !IsNil(o.LocalAsn) { + return true + } + + return false +} + +// SetLocalAsn gets a reference to the given int32 and assigns it to the LocalAsn field. +func (o *BGPGatewayConfig) SetLocalAsn(v int32) { + o.LocalAsn = &v +} + +// GetOverrideAdvertisedRoutes returns the OverrideAdvertisedRoutes field value if set, zero value otherwise. +func (o *BGPGatewayConfig) GetOverrideAdvertisedRoutes() []string { + if o == nil || IsNil(o.OverrideAdvertisedRoutes) { + var ret []string + return ret + } + return o.OverrideAdvertisedRoutes +} + +// GetOverrideAdvertisedRoutesOk returns a tuple with the OverrideAdvertisedRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPGatewayConfig) GetOverrideAdvertisedRoutesOk() ([]string, bool) { + if o == nil || IsNil(o.OverrideAdvertisedRoutes) { + return nil, false + } + return o.OverrideAdvertisedRoutes, true +} + +// HasOverrideAdvertisedRoutes returns a boolean if a field has been set. +func (o *BGPGatewayConfig) HasOverrideAdvertisedRoutes() bool { + if o != nil && !IsNil(o.OverrideAdvertisedRoutes) { + return true + } + + return false +} + +// SetOverrideAdvertisedRoutes gets a reference to the given []string and assigns it to the OverrideAdvertisedRoutes field. +func (o *BGPGatewayConfig) SetOverrideAdvertisedRoutes(v []string) { + o.OverrideAdvertisedRoutes = v +} + +func (o BGPGatewayConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPGatewayConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LocalAsn) { + toSerialize["localAsn"] = o.LocalAsn + } + if !IsNil(o.OverrideAdvertisedRoutes) { + toSerialize["overrideAdvertisedRoutes"] = o.OverrideAdvertisedRoutes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPGatewayConfig) UnmarshalJSON(data []byte) (err error) { + varBGPGatewayConfig := _BGPGatewayConfig{} + + err = json.Unmarshal(data, &varBGPGatewayConfig) + + if err != nil { + return err + } + + *o = BGPGatewayConfig(varBGPGatewayConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "localAsn") + delete(additionalProperties, "overrideAdvertisedRoutes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPGatewayConfig struct { + value *BGPGatewayConfig + isSet bool +} + +func (v NullableBGPGatewayConfig) Get() *BGPGatewayConfig { + return v.value +} + +func (v *NullableBGPGatewayConfig) Set(val *BGPGatewayConfig) { + v.value = val + v.isSet = true +} + +func (v NullableBGPGatewayConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPGatewayConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPGatewayConfig(val *BGPGatewayConfig) *NullableBGPGatewayConfig { + return &NullableBGPGatewayConfig{value: val, isSet: true} +} + +func (v NullableBGPGatewayConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPGatewayConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_bgp_status.go b/services/vpn/v1beta1api/model_bgp_status.go new file mode 100644 index 000000000..7a9eb6f47 --- /dev/null +++ b/services/vpn/v1beta1api/model_bgp_status.go @@ -0,0 +1,190 @@ +/* +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 BGPStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPStatus{} + +// BGPStatus struct for BGPStatus +type BGPStatus struct { + Peers []BGPStatusPeers `json:"peers,omitempty"` + Routes []BGPStatusRoutes `json:"routes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BGPStatus BGPStatus + +// NewBGPStatus instantiates a new BGPStatus 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 NewBGPStatus() *BGPStatus { + this := BGPStatus{} + return &this +} + +// NewBGPStatusWithDefaults instantiates a new BGPStatus 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 NewBGPStatusWithDefaults() *BGPStatus { + this := BGPStatus{} + return &this +} + +// GetPeers returns the Peers field value if set, zero value otherwise. +func (o *BGPStatus) GetPeers() []BGPStatusPeers { + if o == nil || IsNil(o.Peers) { + var ret []BGPStatusPeers + return ret + } + return o.Peers +} + +// GetPeersOk returns a tuple with the Peers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPStatus) GetPeersOk() ([]BGPStatusPeers, bool) { + if o == nil || IsNil(o.Peers) { + return nil, false + } + return o.Peers, true +} + +// HasPeers returns a boolean if a field has been set. +func (o *BGPStatus) HasPeers() bool { + if o != nil && !IsNil(o.Peers) { + return true + } + + return false +} + +// SetPeers gets a reference to the given []BGPStatusPeers and assigns it to the Peers field. +func (o *BGPStatus) SetPeers(v []BGPStatusPeers) { + o.Peers = v +} + +// GetRoutes returns the Routes field value if set, zero value otherwise. +func (o *BGPStatus) GetRoutes() []BGPStatusRoutes { + if o == nil || IsNil(o.Routes) { + var ret []BGPStatusRoutes + return ret + } + return o.Routes +} + +// GetRoutesOk returns a tuple with the Routes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPStatus) GetRoutesOk() ([]BGPStatusRoutes, bool) { + if o == nil || IsNil(o.Routes) { + return nil, false + } + return o.Routes, true +} + +// HasRoutes returns a boolean if a field has been set. +func (o *BGPStatus) HasRoutes() bool { + if o != nil && !IsNil(o.Routes) { + return true + } + + return false +} + +// SetRoutes gets a reference to the given []BGPStatusRoutes and assigns it to the Routes field. +func (o *BGPStatus) SetRoutes(v []BGPStatusRoutes) { + o.Routes = v +} + +func (o BGPStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Peers) { + toSerialize["peers"] = o.Peers + } + if !IsNil(o.Routes) { + toSerialize["routes"] = o.Routes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPStatus) UnmarshalJSON(data []byte) (err error) { + varBGPStatus := _BGPStatus{} + + err = json.Unmarshal(data, &varBGPStatus) + + if err != nil { + return err + } + + *o = BGPStatus(varBGPStatus) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "peers") + delete(additionalProperties, "routes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPStatus struct { + value *BGPStatus + isSet bool +} + +func (v NullableBGPStatus) Get() *BGPStatus { + return v.value +} + +func (v *NullableBGPStatus) Set(val *BGPStatus) { + v.value = val + v.isSet = true +} + +func (v NullableBGPStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPStatus(val *BGPStatus) *NullableBGPStatus { + return &NullableBGPStatus{value: val, isSet: true} +} + +func (v NullableBGPStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_bgp_status_peers.go b/services/vpn/v1beta1api/model_bgp_status_peers.go new file mode 100644 index 000000000..e183c033a --- /dev/null +++ b/services/vpn/v1beta1api/model_bgp_status_peers.go @@ -0,0 +1,347 @@ +/* +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" + "fmt" +) + +// checks if the BGPStatusPeers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPStatusPeers{} + +// BGPStatusPeers struct for BGPStatusPeers +type BGPStatusPeers struct { + // The ASN of the local STACKIT gateway. + LocalAs int32 `json:"localAs"` + // Duration the session has been established + PeerUptime string `json:"peerUptime"` + // Count of prefixes received from the neighbor. + PfxRcd int32 `json:"pfxRcd"` + // Count of prefixes advertised to the neighbor. + PfxSnt int32 `json:"pfxSnt"` + // The ASN of the remote neighbor. + RemoteAs int32 `json:"remoteAs"` + // The IP address of the remote BGP neighbor. + RemoteIP string `json:"remoteIP"` + // The current BGP session state. + State string `json:"state"` + AdditionalProperties map[string]interface{} +} + +type _BGPStatusPeers BGPStatusPeers + +// NewBGPStatusPeers instantiates a new BGPStatusPeers 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 NewBGPStatusPeers(localAs int32, peerUptime string, pfxRcd int32, pfxSnt int32, remoteAs int32, remoteIP string, state string) *BGPStatusPeers { + this := BGPStatusPeers{} + this.LocalAs = localAs + this.PeerUptime = peerUptime + this.PfxRcd = pfxRcd + this.PfxSnt = pfxSnt + this.RemoteAs = remoteAs + this.RemoteIP = remoteIP + this.State = state + return &this +} + +// NewBGPStatusPeersWithDefaults instantiates a new BGPStatusPeers 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 NewBGPStatusPeersWithDefaults() *BGPStatusPeers { + this := BGPStatusPeers{} + return &this +} + +// GetLocalAs returns the LocalAs field value +func (o *BGPStatusPeers) GetLocalAs() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.LocalAs +} + +// GetLocalAsOk returns a tuple with the LocalAs field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetLocalAsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.LocalAs, true +} + +// SetLocalAs sets field value +func (o *BGPStatusPeers) SetLocalAs(v int32) { + o.LocalAs = v +} + +// GetPeerUptime returns the PeerUptime field value +func (o *BGPStatusPeers) GetPeerUptime() string { + if o == nil { + var ret string + return ret + } + + return o.PeerUptime +} + +// GetPeerUptimeOk returns a tuple with the PeerUptime field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetPeerUptimeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PeerUptime, true +} + +// SetPeerUptime sets field value +func (o *BGPStatusPeers) SetPeerUptime(v string) { + o.PeerUptime = v +} + +// GetPfxRcd returns the PfxRcd field value +func (o *BGPStatusPeers) GetPfxRcd() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PfxRcd +} + +// GetPfxRcdOk returns a tuple with the PfxRcd field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetPfxRcdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PfxRcd, true +} + +// SetPfxRcd sets field value +func (o *BGPStatusPeers) SetPfxRcd(v int32) { + o.PfxRcd = v +} + +// GetPfxSnt returns the PfxSnt field value +func (o *BGPStatusPeers) GetPfxSnt() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PfxSnt +} + +// GetPfxSntOk returns a tuple with the PfxSnt field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetPfxSntOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PfxSnt, true +} + +// SetPfxSnt sets field value +func (o *BGPStatusPeers) SetPfxSnt(v int32) { + o.PfxSnt = v +} + +// GetRemoteAs returns the RemoteAs field value +func (o *BGPStatusPeers) GetRemoteAs() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RemoteAs +} + +// GetRemoteAsOk returns a tuple with the RemoteAs field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetRemoteAsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RemoteAs, true +} + +// SetRemoteAs sets field value +func (o *BGPStatusPeers) SetRemoteAs(v int32) { + o.RemoteAs = v +} + +// GetRemoteIP returns the RemoteIP field value +func (o *BGPStatusPeers) GetRemoteIP() string { + if o == nil { + var ret string + return ret + } + + return o.RemoteIP +} + +// GetRemoteIPOk returns a tuple with the RemoteIP field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetRemoteIPOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RemoteIP, true +} + +// SetRemoteIP sets field value +func (o *BGPStatusPeers) SetRemoteIP(v string) { + o.RemoteIP = v +} + +// GetState returns the State field value +func (o *BGPStatusPeers) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *BGPStatusPeers) SetState(v string) { + o.State = v +} + +func (o BGPStatusPeers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPStatusPeers) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["localAs"] = o.LocalAs + toSerialize["peerUptime"] = o.PeerUptime + toSerialize["pfxRcd"] = o.PfxRcd + toSerialize["pfxSnt"] = o.PfxSnt + toSerialize["remoteAs"] = o.RemoteAs + toSerialize["remoteIP"] = o.RemoteIP + toSerialize["state"] = o.State + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPStatusPeers) 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{ + "localAs", + "peerUptime", + "pfxRcd", + "pfxSnt", + "remoteAs", + "remoteIP", + "state", + } + + 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) + } + } + + varBGPStatusPeers := _BGPStatusPeers{} + + err = json.Unmarshal(data, &varBGPStatusPeers) + + if err != nil { + return err + } + + *o = BGPStatusPeers(varBGPStatusPeers) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "localAs") + delete(additionalProperties, "peerUptime") + delete(additionalProperties, "pfxRcd") + delete(additionalProperties, "pfxSnt") + delete(additionalProperties, "remoteAs") + delete(additionalProperties, "remoteIP") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPStatusPeers struct { + value *BGPStatusPeers + isSet bool +} + +func (v NullableBGPStatusPeers) Get() *BGPStatusPeers { + return v.value +} + +func (v *NullableBGPStatusPeers) Set(val *BGPStatusPeers) { + v.value = val + v.isSet = true +} + +func (v NullableBGPStatusPeers) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPStatusPeers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPStatusPeers(val *BGPStatusPeers) *NullableBGPStatusPeers { + return &NullableBGPStatusPeers{value: val, isSet: true} +} + +func (v NullableBGPStatusPeers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPStatusPeers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_bgp_status_routes.go b/services/vpn/v1beta1api/model_bgp_status_routes.go new file mode 100644 index 000000000..935f03e99 --- /dev/null +++ b/services/vpn/v1beta1api/model_bgp_status_routes.go @@ -0,0 +1,285 @@ +/* +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" + "fmt" +) + +// checks if the BGPStatusRoutes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPStatusRoutes{} + +// BGPStatusRoutes struct for BGPStatusRoutes +type BGPStatusRoutes struct { + // The destination network + Network string `json:"network"` + Origin string `json:"origin"` + // The AS-PATH + Path string `json:"path"` + // BGP Router ID of the neighbor that advertised this route + PeerId string `json:"peerId"` + Weight int32 `json:"weight"` + AdditionalProperties map[string]interface{} +} + +type _BGPStatusRoutes BGPStatusRoutes + +// NewBGPStatusRoutes instantiates a new BGPStatusRoutes 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 NewBGPStatusRoutes(network string, origin string, path string, peerId string, weight int32) *BGPStatusRoutes { + this := BGPStatusRoutes{} + this.Network = network + this.Origin = origin + this.Path = path + this.PeerId = peerId + this.Weight = weight + return &this +} + +// NewBGPStatusRoutesWithDefaults instantiates a new BGPStatusRoutes 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 NewBGPStatusRoutesWithDefaults() *BGPStatusRoutes { + this := BGPStatusRoutes{} + return &this +} + +// GetNetwork returns the Network field value +func (o *BGPStatusRoutes) GetNetwork() string { + if o == nil { + var ret string + return ret + } + + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetNetworkOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Network, true +} + +// SetNetwork sets field value +func (o *BGPStatusRoutes) SetNetwork(v string) { + o.Network = v +} + +// GetOrigin returns the Origin field value +func (o *BGPStatusRoutes) GetOrigin() string { + if o == nil { + var ret string + return ret + } + + return o.Origin +} + +// GetOriginOk returns a tuple with the Origin field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetOriginOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Origin, true +} + +// SetOrigin sets field value +func (o *BGPStatusRoutes) SetOrigin(v string) { + o.Origin = v +} + +// GetPath returns the Path field value +func (o *BGPStatusRoutes) GetPath() string { + if o == nil { + var ret string + return ret + } + + return o.Path +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Path, true +} + +// SetPath sets field value +func (o *BGPStatusRoutes) SetPath(v string) { + o.Path = v +} + +// GetPeerId returns the PeerId field value +func (o *BGPStatusRoutes) GetPeerId() string { + if o == nil { + var ret string + return ret + } + + return o.PeerId +} + +// GetPeerIdOk returns a tuple with the PeerId field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetPeerIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PeerId, true +} + +// SetPeerId sets field value +func (o *BGPStatusRoutes) SetPeerId(v string) { + o.PeerId = v +} + +// GetWeight returns the Weight field value +func (o *BGPStatusRoutes) GetWeight() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Weight +} + +// GetWeightOk returns a tuple with the Weight field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetWeightOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Weight, true +} + +// SetWeight sets field value +func (o *BGPStatusRoutes) SetWeight(v int32) { + o.Weight = v +} + +func (o BGPStatusRoutes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPStatusRoutes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["network"] = o.Network + toSerialize["origin"] = o.Origin + toSerialize["path"] = o.Path + toSerialize["peerId"] = o.PeerId + toSerialize["weight"] = o.Weight + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPStatusRoutes) 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{ + "network", + "origin", + "path", + "peerId", + "weight", + } + + 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) + } + } + + varBGPStatusRoutes := _BGPStatusRoutes{} + + err = json.Unmarshal(data, &varBGPStatusRoutes) + + if err != nil { + return err + } + + *o = BGPStatusRoutes(varBGPStatusRoutes) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "network") + delete(additionalProperties, "origin") + delete(additionalProperties, "path") + delete(additionalProperties, "peerId") + delete(additionalProperties, "weight") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPStatusRoutes struct { + value *BGPStatusRoutes + isSet bool +} + +func (v NullableBGPStatusRoutes) Get() *BGPStatusRoutes { + return v.value +} + +func (v *NullableBGPStatusRoutes) Set(val *BGPStatusRoutes) { + v.value = val + v.isSet = true +} + +func (v NullableBGPStatusRoutes) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPStatusRoutes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPStatusRoutes(val *BGPStatusRoutes) *NullableBGPStatusRoutes { + return &NullableBGPStatusRoutes{value: val, isSet: true} +} + +func (v NullableBGPStatusRoutes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPStatusRoutes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_bgp_tunnel_config.go b/services/vpn/v1beta1api/model_bgp_tunnel_config.go new file mode 100644 index 000000000..4405256ff --- /dev/null +++ b/services/vpn/v1beta1api/model_bgp_tunnel_config.go @@ -0,0 +1,167 @@ +/* +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" + "fmt" +) + +// checks if the BGPTunnelConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPTunnelConfig{} + +// BGPTunnelConfig struct for BGPTunnelConfig +type BGPTunnelConfig struct { + // ASN for private use (reserved by IANA), both 16Bit and 32Bit ranges are valid (RFC 6996). + RemoteAsn int32 `json:"remoteAsn"` + AdditionalProperties map[string]interface{} +} + +type _BGPTunnelConfig BGPTunnelConfig + +// NewBGPTunnelConfig instantiates a new BGPTunnelConfig 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 NewBGPTunnelConfig(remoteAsn int32) *BGPTunnelConfig { + this := BGPTunnelConfig{} + this.RemoteAsn = remoteAsn + return &this +} + +// NewBGPTunnelConfigWithDefaults instantiates a new BGPTunnelConfig 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 NewBGPTunnelConfigWithDefaults() *BGPTunnelConfig { + this := BGPTunnelConfig{} + return &this +} + +// GetRemoteAsn returns the RemoteAsn field value +func (o *BGPTunnelConfig) GetRemoteAsn() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RemoteAsn +} + +// GetRemoteAsnOk returns a tuple with the RemoteAsn field value +// and a boolean to check if the value has been set. +func (o *BGPTunnelConfig) GetRemoteAsnOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RemoteAsn, true +} + +// SetRemoteAsn sets field value +func (o *BGPTunnelConfig) SetRemoteAsn(v int32) { + o.RemoteAsn = v +} + +func (o BGPTunnelConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BGPTunnelConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["remoteAsn"] = o.RemoteAsn + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BGPTunnelConfig) 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{ + "remoteAsn", + } + + 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) + } + } + + varBGPTunnelConfig := _BGPTunnelConfig{} + + err = json.Unmarshal(data, &varBGPTunnelConfig) + + if err != nil { + return err + } + + *o = BGPTunnelConfig(varBGPTunnelConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "remoteAsn") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBGPTunnelConfig struct { + value *BGPTunnelConfig + isSet bool +} + +func (v NullableBGPTunnelConfig) Get() *BGPTunnelConfig { + return v.value +} + +func (v *NullableBGPTunnelConfig) Set(val *BGPTunnelConfig) { + v.value = val + v.isSet = true +} + +func (v NullableBGPTunnelConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPTunnelConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPTunnelConfig(val *BGPTunnelConfig) *NullableBGPTunnelConfig { + return &NullableBGPTunnelConfig{value: val, isSet: true} +} + +func (v NullableBGPTunnelConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPTunnelConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_connection_list.go b/services/vpn/v1beta1api/model_connection_list.go new file mode 100644 index 000000000..552ac607d --- /dev/null +++ b/services/vpn/v1beta1api/model_connection_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: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ConnectionList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectionList{} + +// ConnectionList struct for ConnectionList +type ConnectionList struct { + Connections []ConnectionResponse `json:"connections"` + AdditionalProperties map[string]interface{} +} + +type _ConnectionList ConnectionList + +// NewConnectionList instantiates a new ConnectionList 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 NewConnectionList(connections []ConnectionResponse) *ConnectionList { + this := ConnectionList{} + this.Connections = connections + return &this +} + +// NewConnectionListWithDefaults instantiates a new ConnectionList 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 NewConnectionListWithDefaults() *ConnectionList { + this := ConnectionList{} + return &this +} + +// GetConnections returns the Connections field value +func (o *ConnectionList) GetConnections() []ConnectionResponse { + if o == nil { + var ret []ConnectionResponse + return ret + } + + return o.Connections +} + +// GetConnectionsOk returns a tuple with the Connections field value +// and a boolean to check if the value has been set. +func (o *ConnectionList) GetConnectionsOk() ([]ConnectionResponse, bool) { + if o == nil { + return nil, false + } + return o.Connections, true +} + +// SetConnections sets field value +func (o *ConnectionList) SetConnections(v []ConnectionResponse) { + o.Connections = v +} + +func (o ConnectionList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConnectionList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["connections"] = o.Connections + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ConnectionList) 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{ + "connections", + } + + 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) + } + } + + varConnectionList := _ConnectionList{} + + err = json.Unmarshal(data, &varConnectionList) + + if err != nil { + return err + } + + *o = ConnectionList(varConnectionList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "connections") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableConnectionList struct { + value *ConnectionList + isSet bool +} + +func (v NullableConnectionList) Get() *ConnectionList { + return v.value +} + +func (v *NullableConnectionList) Set(val *ConnectionList) { + v.value = val + v.isSet = true +} + +func (v NullableConnectionList) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectionList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectionList(val *ConnectionList) *NullableConnectionList { + return &NullableConnectionList{value: val, isSet: true} +} + +func (v NullableConnectionList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectionList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_connection_response.go b/services/vpn/v1beta1api/model_connection_response.go new file mode 100644 index 000000000..aa9888205 --- /dev/null +++ b/services/vpn/v1beta1api/model_connection_response.go @@ -0,0 +1,453 @@ +/* +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" + "fmt" +) + +// checks if the ConnectionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectionResponse{} + +// ConnectionResponse struct for ConnectionResponse +type ConnectionResponse struct { + // A user-friendly name for the connection. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` + // This flag decides whether this connection should be enabled or disabled + Enabled *bool `json:"enabled,omitempty"` + // UUID of the Gateway instance. + Id *string `json:"id,omitempty"` + // 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"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + LocalSubnets []string `json:"localSubnets,omitempty"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + RemoteSubnets []string `json:"remoteSubnets,omitempty"` + // Optional. Use this for route-based VPN. + StaticRoutes []string `json:"staticRoutes,omitempty"` + Tunnel1 TunnelConfiguration `json:"tunnel1"` + Tunnel2 TunnelConfiguration `json:"tunnel2"` + AdditionalProperties map[string]interface{} +} + +type _ConnectionResponse ConnectionResponse + +// NewConnectionResponse instantiates a new ConnectionResponse 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 NewConnectionResponse(displayName string, tunnel1 TunnelConfiguration, tunnel2 TunnelConfiguration) *ConnectionResponse { + this := ConnectionResponse{} + this.DisplayName = displayName + this.Tunnel1 = tunnel1 + this.Tunnel2 = tunnel2 + return &this +} + +// NewConnectionResponseWithDefaults instantiates a new ConnectionResponse 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 NewConnectionResponseWithDefaults() *ConnectionResponse { + this := ConnectionResponse{} + return &this +} + +// GetDisplayName returns the DisplayName field value +func (o *ConnectionResponse) 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 *ConnectionResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *ConnectionResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *ConnectionResponse) GetEnabled() bool { + if o == nil || IsNil(o.Enabled) { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionResponse) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *ConnectionResponse) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *ConnectionResponse) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ConnectionResponse) 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 *ConnectionResponse) 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 *ConnectionResponse) 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 *ConnectionResponse) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *ConnectionResponse) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionResponse) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *ConnectionResponse) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *ConnectionResponse) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetLocalSubnets returns the LocalSubnets field value if set, zero value otherwise. +func (o *ConnectionResponse) GetLocalSubnets() []string { + if o == nil || IsNil(o.LocalSubnets) { + var ret []string + return ret + } + return o.LocalSubnets +} + +// GetLocalSubnetsOk returns a tuple with the LocalSubnets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionResponse) GetLocalSubnetsOk() ([]string, bool) { + if o == nil || IsNil(o.LocalSubnets) { + return nil, false + } + return o.LocalSubnets, true +} + +// HasLocalSubnets returns a boolean if a field has been set. +func (o *ConnectionResponse) HasLocalSubnets() bool { + if o != nil && !IsNil(o.LocalSubnets) { + return true + } + + return false +} + +// SetLocalSubnets gets a reference to the given []string and assigns it to the LocalSubnets field. +func (o *ConnectionResponse) SetLocalSubnets(v []string) { + o.LocalSubnets = v +} + +// GetRemoteSubnets returns the RemoteSubnets field value if set, zero value otherwise. +func (o *ConnectionResponse) GetRemoteSubnets() []string { + if o == nil || IsNil(o.RemoteSubnets) { + var ret []string + return ret + } + return o.RemoteSubnets +} + +// GetRemoteSubnetsOk returns a tuple with the RemoteSubnets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionResponse) GetRemoteSubnetsOk() ([]string, bool) { + if o == nil || IsNil(o.RemoteSubnets) { + return nil, false + } + return o.RemoteSubnets, true +} + +// HasRemoteSubnets returns a boolean if a field has been set. +func (o *ConnectionResponse) HasRemoteSubnets() bool { + if o != nil && !IsNil(o.RemoteSubnets) { + return true + } + + return false +} + +// SetRemoteSubnets gets a reference to the given []string and assigns it to the RemoteSubnets field. +func (o *ConnectionResponse) SetRemoteSubnets(v []string) { + o.RemoteSubnets = v +} + +// GetStaticRoutes returns the StaticRoutes field value if set, zero value otherwise. +func (o *ConnectionResponse) GetStaticRoutes() []string { + if o == nil || IsNil(o.StaticRoutes) { + var ret []string + return ret + } + return o.StaticRoutes +} + +// GetStaticRoutesOk returns a tuple with the StaticRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionResponse) GetStaticRoutesOk() ([]string, bool) { + if o == nil || IsNil(o.StaticRoutes) { + return nil, false + } + return o.StaticRoutes, true +} + +// HasStaticRoutes returns a boolean if a field has been set. +func (o *ConnectionResponse) HasStaticRoutes() bool { + if o != nil && !IsNil(o.StaticRoutes) { + return true + } + + return false +} + +// SetStaticRoutes gets a reference to the given []string and assigns it to the StaticRoutes field. +func (o *ConnectionResponse) SetStaticRoutes(v []string) { + o.StaticRoutes = v +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *ConnectionResponse) GetTunnel1() TunnelConfiguration { + if o == nil { + var ret TunnelConfiguration + return ret + } + + return o.Tunnel1 +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *ConnectionResponse) GetTunnel1Ok() (*TunnelConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel1, true +} + +// SetTunnel1 sets field value +func (o *ConnectionResponse) SetTunnel1(v TunnelConfiguration) { + o.Tunnel1 = v +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *ConnectionResponse) GetTunnel2() TunnelConfiguration { + if o == nil { + var ret TunnelConfiguration + return ret + } + + return o.Tunnel2 +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *ConnectionResponse) GetTunnel2Ok() (*TunnelConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel2, true +} + +// SetTunnel2 sets field value +func (o *ConnectionResponse) SetTunnel2(v TunnelConfiguration) { + o.Tunnel2 = v +} + +func (o ConnectionResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConnectionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.LocalSubnets) { + toSerialize["localSubnets"] = o.LocalSubnets + } + if !IsNil(o.RemoteSubnets) { + toSerialize["remoteSubnets"] = o.RemoteSubnets + } + if !IsNil(o.StaticRoutes) { + toSerialize["staticRoutes"] = o.StaticRoutes + } + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ConnectionResponse) 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", + "tunnel1", + "tunnel2", + } + + 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) + } + } + + varConnectionResponse := _ConnectionResponse{} + + err = json.Unmarshal(data, &varConnectionResponse) + + if err != nil { + return err + } + + *o = ConnectionResponse(varConnectionResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "displayName") + delete(additionalProperties, "enabled") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "localSubnets") + delete(additionalProperties, "remoteSubnets") + delete(additionalProperties, "staticRoutes") + delete(additionalProperties, "tunnel1") + delete(additionalProperties, "tunnel2") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableConnectionResponse struct { + value *ConnectionResponse + isSet bool +} + +func (v NullableConnectionResponse) Get() *ConnectionResponse { + return v.value +} + +func (v *NullableConnectionResponse) Set(val *ConnectionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableConnectionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectionResponse(val *ConnectionResponse) *NullableConnectionResponse { + return &NullableConnectionResponse{value: val, isSet: true} +} + +func (v NullableConnectionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_connection_status_response.go b/services/vpn/v1beta1api/model_connection_status_response.go new file mode 100644 index 000000000..ecd8cac14 --- /dev/null +++ b/services/vpn/v1beta1api/model_connection_status_response.go @@ -0,0 +1,266 @@ +/* +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 ConnectionStatusResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectionStatusResponse{} + +// ConnectionStatusResponse struct for ConnectionStatusResponse +type ConnectionStatusResponse struct { + // The name of the connection. + DisplayName *string `json:"displayName,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + // UUID of the connection. + Id *string `json:"id,omitempty"` + Tunnels []TunnelStatus `json:"tunnels,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ConnectionStatusResponse ConnectionStatusResponse + +// NewConnectionStatusResponse instantiates a new ConnectionStatusResponse 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 NewConnectionStatusResponse() *ConnectionStatusResponse { + this := ConnectionStatusResponse{} + return &this +} + +// NewConnectionStatusResponseWithDefaults instantiates a new ConnectionStatusResponse 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 NewConnectionStatusResponseWithDefaults() *ConnectionStatusResponse { + this := ConnectionStatusResponse{} + return &this +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *ConnectionStatusResponse) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatusResponse) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *ConnectionStatusResponse) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *ConnectionStatusResponse) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *ConnectionStatusResponse) GetEnabled() bool { + if o == nil || IsNil(o.Enabled) { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatusResponse) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *ConnectionStatusResponse) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *ConnectionStatusResponse) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ConnectionStatusResponse) 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 *ConnectionStatusResponse) 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 *ConnectionStatusResponse) 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 *ConnectionStatusResponse) SetId(v string) { + o.Id = &v +} + +// GetTunnels returns the Tunnels field value if set, zero value otherwise. +func (o *ConnectionStatusResponse) GetTunnels() []TunnelStatus { + if o == nil || IsNil(o.Tunnels) { + var ret []TunnelStatus + return ret + } + return o.Tunnels +} + +// GetTunnelsOk returns a tuple with the Tunnels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatusResponse) GetTunnelsOk() ([]TunnelStatus, bool) { + if o == nil || IsNil(o.Tunnels) { + return nil, false + } + return o.Tunnels, true +} + +// HasTunnels returns a boolean if a field has been set. +func (o *ConnectionStatusResponse) HasTunnels() bool { + if o != nil && !IsNil(o.Tunnels) { + return true + } + + return false +} + +// SetTunnels gets a reference to the given []TunnelStatus and assigns it to the Tunnels field. +func (o *ConnectionStatusResponse) SetTunnels(v []TunnelStatus) { + o.Tunnels = v +} + +func (o ConnectionStatusResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConnectionStatusResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Tunnels) { + toSerialize["tunnels"] = o.Tunnels + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ConnectionStatusResponse) UnmarshalJSON(data []byte) (err error) { + varConnectionStatusResponse := _ConnectionStatusResponse{} + + err = json.Unmarshal(data, &varConnectionStatusResponse) + + if err != nil { + return err + } + + *o = ConnectionStatusResponse(varConnectionStatusResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "displayName") + delete(additionalProperties, "enabled") + delete(additionalProperties, "id") + delete(additionalProperties, "tunnels") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableConnectionStatusResponse struct { + value *ConnectionStatusResponse + isSet bool +} + +func (v NullableConnectionStatusResponse) Get() *ConnectionStatusResponse { + return v.value +} + +func (v *NullableConnectionStatusResponse) Set(val *ConnectionStatusResponse) { + v.value = val + v.isSet = true +} + +func (v NullableConnectionStatusResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectionStatusResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectionStatusResponse(val *ConnectionStatusResponse) *NullableConnectionStatusResponse { + return &NullableConnectionStatusResponse{value: val, isSet: true} +} + +func (v NullableConnectionStatusResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectionStatusResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_create_gateway_connection_payload.go b/services/vpn/v1beta1api/model_create_gateway_connection_payload.go new file mode 100644 index 000000000..24e6aeb2a --- /dev/null +++ b/services/vpn/v1beta1api/model_create_gateway_connection_payload.go @@ -0,0 +1,377 @@ +/* +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" + "fmt" +) + +// checks if the CreateGatewayConnectionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateGatewayConnectionPayload{} + +// CreateGatewayConnectionPayload struct for CreateGatewayConnectionPayload +type CreateGatewayConnectionPayload struct { + // A user-friendly name for the connection. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` + // This flag decides whether this connection should be enabled or disabled + Enabled *bool `json:"enabled,omitempty"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + LocalSubnets []string `json:"localSubnets,omitempty"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + RemoteSubnets []string `json:"remoteSubnets,omitempty"` + // Optional. Use this for route-based VPN. + StaticRoutes []string `json:"staticRoutes,omitempty"` + Tunnel1 TunnelConfiguration `json:"tunnel1"` + Tunnel2 TunnelConfiguration `json:"tunnel2"` + AdditionalProperties map[string]interface{} +} + +type _CreateGatewayConnectionPayload CreateGatewayConnectionPayload + +// NewCreateGatewayConnectionPayload instantiates a new CreateGatewayConnectionPayload 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 NewCreateGatewayConnectionPayload(displayName string, tunnel1 TunnelConfiguration, tunnel2 TunnelConfiguration) *CreateGatewayConnectionPayload { + this := CreateGatewayConnectionPayload{} + this.DisplayName = displayName + this.Tunnel1 = tunnel1 + this.Tunnel2 = tunnel2 + return &this +} + +// NewCreateGatewayConnectionPayloadWithDefaults instantiates a new CreateGatewayConnectionPayload 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 NewCreateGatewayConnectionPayloadWithDefaults() *CreateGatewayConnectionPayload { + this := CreateGatewayConnectionPayload{} + return &this +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateGatewayConnectionPayload) 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 *CreateGatewayConnectionPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateGatewayConnectionPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *CreateGatewayConnectionPayload) GetEnabled() bool { + if o == nil || IsNil(o.Enabled) { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *CreateGatewayConnectionPayload) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *CreateGatewayConnectionPayload) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetLocalSubnets returns the LocalSubnets field value if set, zero value otherwise. +func (o *CreateGatewayConnectionPayload) GetLocalSubnets() []string { + if o == nil || IsNil(o.LocalSubnets) { + var ret []string + return ret + } + return o.LocalSubnets +} + +// GetLocalSubnetsOk returns a tuple with the LocalSubnets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetLocalSubnetsOk() ([]string, bool) { + if o == nil || IsNil(o.LocalSubnets) { + return nil, false + } + return o.LocalSubnets, true +} + +// HasLocalSubnets returns a boolean if a field has been set. +func (o *CreateGatewayConnectionPayload) HasLocalSubnets() bool { + if o != nil && !IsNil(o.LocalSubnets) { + return true + } + + return false +} + +// SetLocalSubnets gets a reference to the given []string and assigns it to the LocalSubnets field. +func (o *CreateGatewayConnectionPayload) SetLocalSubnets(v []string) { + o.LocalSubnets = v +} + +// GetRemoteSubnets returns the RemoteSubnets field value if set, zero value otherwise. +func (o *CreateGatewayConnectionPayload) GetRemoteSubnets() []string { + if o == nil || IsNil(o.RemoteSubnets) { + var ret []string + return ret + } + return o.RemoteSubnets +} + +// GetRemoteSubnetsOk returns a tuple with the RemoteSubnets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetRemoteSubnetsOk() ([]string, bool) { + if o == nil || IsNil(o.RemoteSubnets) { + return nil, false + } + return o.RemoteSubnets, true +} + +// HasRemoteSubnets returns a boolean if a field has been set. +func (o *CreateGatewayConnectionPayload) HasRemoteSubnets() bool { + if o != nil && !IsNil(o.RemoteSubnets) { + return true + } + + return false +} + +// SetRemoteSubnets gets a reference to the given []string and assigns it to the RemoteSubnets field. +func (o *CreateGatewayConnectionPayload) SetRemoteSubnets(v []string) { + o.RemoteSubnets = v +} + +// GetStaticRoutes returns the StaticRoutes field value if set, zero value otherwise. +func (o *CreateGatewayConnectionPayload) GetStaticRoutes() []string { + if o == nil || IsNil(o.StaticRoutes) { + var ret []string + return ret + } + return o.StaticRoutes +} + +// GetStaticRoutesOk returns a tuple with the StaticRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetStaticRoutesOk() ([]string, bool) { + if o == nil || IsNil(o.StaticRoutes) { + return nil, false + } + return o.StaticRoutes, true +} + +// HasStaticRoutes returns a boolean if a field has been set. +func (o *CreateGatewayConnectionPayload) HasStaticRoutes() bool { + if o != nil && !IsNil(o.StaticRoutes) { + return true + } + + return false +} + +// SetStaticRoutes gets a reference to the given []string and assigns it to the StaticRoutes field. +func (o *CreateGatewayConnectionPayload) SetStaticRoutes(v []string) { + o.StaticRoutes = v +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *CreateGatewayConnectionPayload) GetTunnel1() TunnelConfiguration { + if o == nil { + var ret TunnelConfiguration + return ret + } + + return o.Tunnel1 +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetTunnel1Ok() (*TunnelConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel1, true +} + +// SetTunnel1 sets field value +func (o *CreateGatewayConnectionPayload) SetTunnel1(v TunnelConfiguration) { + o.Tunnel1 = v +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *CreateGatewayConnectionPayload) GetTunnel2() TunnelConfiguration { + if o == nil { + var ret TunnelConfiguration + return ret + } + + return o.Tunnel2 +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetTunnel2Ok() (*TunnelConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel2, true +} + +// SetTunnel2 sets field value +func (o *CreateGatewayConnectionPayload) SetTunnel2(v TunnelConfiguration) { + o.Tunnel2 = v +} + +func (o CreateGatewayConnectionPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateGatewayConnectionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.LocalSubnets) { + toSerialize["localSubnets"] = o.LocalSubnets + } + if !IsNil(o.RemoteSubnets) { + toSerialize["remoteSubnets"] = o.RemoteSubnets + } + if !IsNil(o.StaticRoutes) { + toSerialize["staticRoutes"] = o.StaticRoutes + } + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateGatewayConnectionPayload) 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", + "tunnel1", + "tunnel2", + } + + 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) + } + } + + varCreateGatewayConnectionPayload := _CreateGatewayConnectionPayload{} + + err = json.Unmarshal(data, &varCreateGatewayConnectionPayload) + + if err != nil { + return err + } + + *o = CreateGatewayConnectionPayload(varCreateGatewayConnectionPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "displayName") + delete(additionalProperties, "enabled") + delete(additionalProperties, "localSubnets") + delete(additionalProperties, "remoteSubnets") + delete(additionalProperties, "staticRoutes") + delete(additionalProperties, "tunnel1") + delete(additionalProperties, "tunnel2") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateGatewayConnectionPayload struct { + value *CreateGatewayConnectionPayload + isSet bool +} + +func (v NullableCreateGatewayConnectionPayload) Get() *CreateGatewayConnectionPayload { + return v.value +} + +func (v *NullableCreateGatewayConnectionPayload) Set(val *CreateGatewayConnectionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGatewayConnectionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGatewayConnectionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGatewayConnectionPayload(val *CreateGatewayConnectionPayload) *NullableCreateGatewayConnectionPayload { + return &NullableCreateGatewayConnectionPayload{value: val, isSet: true} +} + +func (v NullableCreateGatewayConnectionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGatewayConnectionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_create_vpn_gateway_payload.go b/services/vpn/v1beta1api/model_create_vpn_gateway_payload.go new file mode 100644 index 000000000..e0f5d64c7 --- /dev/null +++ b/services/vpn/v1beta1api/model_create_vpn_gateway_payload.go @@ -0,0 +1,330 @@ +/* +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" + "fmt" +) + +// checks if the CreateVPNGatewayPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVPNGatewayPayload{} + +// CreateVPNGatewayPayload struct for CreateVPNGatewayPayload +type CreateVPNGatewayPayload struct { + AvailabilityZones CreateVPNGatewayPayloadAvailabilityZones `json:"availabilityZones"` + Bgp *BGPGatewayConfig `json:"bgp,omitempty"` + // 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"` + // The service plan identifier. + PlanId string `json:"planId"` + RoutingType RoutingType `json:"routingType"` + AdditionalProperties map[string]interface{} +} + +type _CreateVPNGatewayPayload CreateVPNGatewayPayload + +// NewCreateVPNGatewayPayload instantiates a new CreateVPNGatewayPayload 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 NewCreateVPNGatewayPayload(availabilityZones CreateVPNGatewayPayloadAvailabilityZones, displayName string, planId string, routingType RoutingType) *CreateVPNGatewayPayload { + this := CreateVPNGatewayPayload{} + this.AvailabilityZones = availabilityZones + this.DisplayName = displayName + this.PlanId = planId + this.RoutingType = routingType + return &this +} + +// NewCreateVPNGatewayPayloadWithDefaults instantiates a new CreateVPNGatewayPayload 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 NewCreateVPNGatewayPayloadWithDefaults() *CreateVPNGatewayPayload { + this := CreateVPNGatewayPayload{} + return &this +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *CreateVPNGatewayPayload) GetAvailabilityZones() CreateVPNGatewayPayloadAvailabilityZones { + if o == nil { + var ret CreateVPNGatewayPayloadAvailabilityZones + return ret + } + + return o.AvailabilityZones +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetAvailabilityZonesOk() (*CreateVPNGatewayPayloadAvailabilityZones, bool) { + if o == nil { + return nil, false + } + return &o.AvailabilityZones, true +} + +// SetAvailabilityZones sets field value +func (o *CreateVPNGatewayPayload) SetAvailabilityZones(v CreateVPNGatewayPayloadAvailabilityZones) { + o.AvailabilityZones = v +} + +// GetBgp returns the Bgp field value if set, zero value otherwise. +func (o *CreateVPNGatewayPayload) GetBgp() BGPGatewayConfig { + if o == nil || IsNil(o.Bgp) { + var ret BGPGatewayConfig + return ret + } + return *o.Bgp +} + +// GetBgpOk returns a tuple with the Bgp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetBgpOk() (*BGPGatewayConfig, bool) { + if o == nil || IsNil(o.Bgp) { + return nil, false + } + return o.Bgp, true +} + +// HasBgp returns a boolean if a field has been set. +func (o *CreateVPNGatewayPayload) HasBgp() bool { + if o != nil && !IsNil(o.Bgp) { + return true + } + + return false +} + +// SetBgp gets a reference to the given BGPGatewayConfig and assigns it to the Bgp field. +func (o *CreateVPNGatewayPayload) SetBgp(v BGPGatewayConfig) { + o.Bgp = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateVPNGatewayPayload) 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 *CreateVPNGatewayPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateVPNGatewayPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateVPNGatewayPayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateVPNGatewayPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateVPNGatewayPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetPlanId returns the PlanId field value +func (o *CreateVPNGatewayPayload) GetPlanId() string { + if o == nil { + var ret string + return ret + } + + return o.PlanId +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetPlanIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PlanId, true +} + +// SetPlanId sets field value +func (o *CreateVPNGatewayPayload) SetPlanId(v string) { + o.PlanId = v +} + +// GetRoutingType returns the RoutingType field value +func (o *CreateVPNGatewayPayload) GetRoutingType() RoutingType { + if o == nil { + var ret RoutingType + return ret + } + + return o.RoutingType +} + +// GetRoutingTypeOk returns a tuple with the RoutingType field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetRoutingTypeOk() (*RoutingType, bool) { + if o == nil { + return nil, false + } + return &o.RoutingType, true +} + +// SetRoutingType sets field value +func (o *CreateVPNGatewayPayload) SetRoutingType(v RoutingType) { + o.RoutingType = v +} + +func (o CreateVPNGatewayPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateVPNGatewayPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["availabilityZones"] = o.AvailabilityZones + if !IsNil(o.Bgp) { + toSerialize["bgp"] = o.Bgp + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["planId"] = o.PlanId + toSerialize["routingType"] = o.RoutingType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateVPNGatewayPayload) 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{ + "availabilityZones", + "displayName", + "planId", + "routingType", + } + + 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) + } + } + + varCreateVPNGatewayPayload := _CreateVPNGatewayPayload{} + + err = json.Unmarshal(data, &varCreateVPNGatewayPayload) + + if err != nil { + return err + } + + *o = CreateVPNGatewayPayload(varCreateVPNGatewayPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "availabilityZones") + delete(additionalProperties, "bgp") + delete(additionalProperties, "displayName") + delete(additionalProperties, "labels") + delete(additionalProperties, "planId") + delete(additionalProperties, "routingType") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateVPNGatewayPayload struct { + value *CreateVPNGatewayPayload + isSet bool +} + +func (v NullableCreateVPNGatewayPayload) Get() *CreateVPNGatewayPayload { + return v.value +} + +func (v *NullableCreateVPNGatewayPayload) Set(val *CreateVPNGatewayPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVPNGatewayPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVPNGatewayPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVPNGatewayPayload(val *CreateVPNGatewayPayload) *NullableCreateVPNGatewayPayload { + return &NullableCreateVPNGatewayPayload{value: val, isSet: true} +} + +func (v NullableCreateVPNGatewayPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVPNGatewayPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_create_vpn_gateway_payload_availability_zones.go b/services/vpn/v1beta1api/model_create_vpn_gateway_payload_availability_zones.go new file mode 100644 index 000000000..622609c91 --- /dev/null +++ b/services/vpn/v1beta1api/model_create_vpn_gateway_payload_availability_zones.go @@ -0,0 +1,197 @@ +/* +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" + "fmt" +) + +// checks if the CreateVPNGatewayPayloadAvailabilityZones type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVPNGatewayPayloadAvailabilityZones{} + +// CreateVPNGatewayPayloadAvailabilityZones struct for CreateVPNGatewayPayloadAvailabilityZones +type CreateVPNGatewayPayloadAvailabilityZones struct { + // Object that represents an availability zone. + Tunnel1 string `json:"tunnel1"` + // Object that represents an availability zone. + Tunnel2 string `json:"tunnel2"` + AdditionalProperties map[string]interface{} +} + +type _CreateVPNGatewayPayloadAvailabilityZones CreateVPNGatewayPayloadAvailabilityZones + +// NewCreateVPNGatewayPayloadAvailabilityZones instantiates a new CreateVPNGatewayPayloadAvailabilityZones 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 NewCreateVPNGatewayPayloadAvailabilityZones(tunnel1 string, tunnel2 string) *CreateVPNGatewayPayloadAvailabilityZones { + this := CreateVPNGatewayPayloadAvailabilityZones{} + this.Tunnel1 = tunnel1 + this.Tunnel2 = tunnel2 + return &this +} + +// NewCreateVPNGatewayPayloadAvailabilityZonesWithDefaults instantiates a new CreateVPNGatewayPayloadAvailabilityZones 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 NewCreateVPNGatewayPayloadAvailabilityZonesWithDefaults() *CreateVPNGatewayPayloadAvailabilityZones { + this := CreateVPNGatewayPayloadAvailabilityZones{} + return &this +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *CreateVPNGatewayPayloadAvailabilityZones) GetTunnel1() string { + if o == nil { + var ret string + return ret + } + + return o.Tunnel1 +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayloadAvailabilityZones) GetTunnel1Ok() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel1, true +} + +// SetTunnel1 sets field value +func (o *CreateVPNGatewayPayloadAvailabilityZones) SetTunnel1(v string) { + o.Tunnel1 = v +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *CreateVPNGatewayPayloadAvailabilityZones) GetTunnel2() string { + if o == nil { + var ret string + return ret + } + + return o.Tunnel2 +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayloadAvailabilityZones) GetTunnel2Ok() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel2, true +} + +// SetTunnel2 sets field value +func (o *CreateVPNGatewayPayloadAvailabilityZones) SetTunnel2(v string) { + o.Tunnel2 = v +} + +func (o CreateVPNGatewayPayloadAvailabilityZones) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateVPNGatewayPayloadAvailabilityZones) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateVPNGatewayPayloadAvailabilityZones) 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{ + "tunnel1", + "tunnel2", + } + + 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) + } + } + + varCreateVPNGatewayPayloadAvailabilityZones := _CreateVPNGatewayPayloadAvailabilityZones{} + + err = json.Unmarshal(data, &varCreateVPNGatewayPayloadAvailabilityZones) + + if err != nil { + return err + } + + *o = CreateVPNGatewayPayloadAvailabilityZones(varCreateVPNGatewayPayloadAvailabilityZones) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "tunnel1") + delete(additionalProperties, "tunnel2") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateVPNGatewayPayloadAvailabilityZones struct { + value *CreateVPNGatewayPayloadAvailabilityZones + isSet bool +} + +func (v NullableCreateVPNGatewayPayloadAvailabilityZones) Get() *CreateVPNGatewayPayloadAvailabilityZones { + return v.value +} + +func (v *NullableCreateVPNGatewayPayloadAvailabilityZones) Set(val *CreateVPNGatewayPayloadAvailabilityZones) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVPNGatewayPayloadAvailabilityZones) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVPNGatewayPayloadAvailabilityZones) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVPNGatewayPayloadAvailabilityZones(val *CreateVPNGatewayPayloadAvailabilityZones) *NullableCreateVPNGatewayPayloadAvailabilityZones { + return &NullableCreateVPNGatewayPayloadAvailabilityZones{value: val, isSet: true} +} + +func (v NullableCreateVPNGatewayPayloadAvailabilityZones) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVPNGatewayPayloadAvailabilityZones) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_gateway.go b/services/vpn/v1beta1api/model_gateway.go new file mode 100644 index 000000000..d100cd417 --- /dev/null +++ b/services/vpn/v1beta1api/model_gateway.go @@ -0,0 +1,330 @@ +/* +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" + "fmt" +) + +// checks if the Gateway type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Gateway{} + +// Gateway struct for Gateway +type Gateway struct { + AvailabilityZones GatewayAvailabilityZones `json:"availabilityZones"` + Bgp *BGPGatewayConfig `json:"bgp,omitempty"` + // 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"` + // The service plan identifier. + PlanId string `json:"planId"` + RoutingType RoutingType `json:"routingType"` + AdditionalProperties map[string]interface{} +} + +type _Gateway Gateway + +// NewGateway instantiates a new Gateway 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 NewGateway(availabilityZones GatewayAvailabilityZones, displayName string, planId string, routingType RoutingType) *Gateway { + this := Gateway{} + this.AvailabilityZones = availabilityZones + this.DisplayName = displayName + this.PlanId = planId + this.RoutingType = routingType + return &this +} + +// NewGatewayWithDefaults instantiates a new Gateway 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 NewGatewayWithDefaults() *Gateway { + this := Gateway{} + return &this +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *Gateway) GetAvailabilityZones() GatewayAvailabilityZones { + if o == nil { + var ret GatewayAvailabilityZones + return ret + } + + return o.AvailabilityZones +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *Gateway) GetAvailabilityZonesOk() (*GatewayAvailabilityZones, bool) { + if o == nil { + return nil, false + } + return &o.AvailabilityZones, true +} + +// SetAvailabilityZones sets field value +func (o *Gateway) SetAvailabilityZones(v GatewayAvailabilityZones) { + o.AvailabilityZones = v +} + +// GetBgp returns the Bgp field value if set, zero value otherwise. +func (o *Gateway) GetBgp() BGPGatewayConfig { + if o == nil || IsNil(o.Bgp) { + var ret BGPGatewayConfig + return ret + } + return *o.Bgp +} + +// GetBgpOk returns a tuple with the Bgp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetBgpOk() (*BGPGatewayConfig, bool) { + if o == nil || IsNil(o.Bgp) { + return nil, false + } + return o.Bgp, true +} + +// HasBgp returns a boolean if a field has been set. +func (o *Gateway) HasBgp() bool { + if o != nil && !IsNil(o.Bgp) { + return true + } + + return false +} + +// SetBgp gets a reference to the given BGPGatewayConfig and assigns it to the Bgp field. +func (o *Gateway) SetBgp(v BGPGatewayConfig) { + o.Bgp = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *Gateway) 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 *Gateway) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *Gateway) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Gateway) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Gateway) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *Gateway) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetPlanId returns the PlanId field value +func (o *Gateway) GetPlanId() string { + if o == nil { + var ret string + return ret + } + + return o.PlanId +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *Gateway) GetPlanIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PlanId, true +} + +// SetPlanId sets field value +func (o *Gateway) SetPlanId(v string) { + o.PlanId = v +} + +// GetRoutingType returns the RoutingType field value +func (o *Gateway) GetRoutingType() RoutingType { + if o == nil { + var ret RoutingType + return ret + } + + return o.RoutingType +} + +// GetRoutingTypeOk returns a tuple with the RoutingType field value +// and a boolean to check if the value has been set. +func (o *Gateway) GetRoutingTypeOk() (*RoutingType, bool) { + if o == nil { + return nil, false + } + return &o.RoutingType, true +} + +// SetRoutingType sets field value +func (o *Gateway) SetRoutingType(v RoutingType) { + o.RoutingType = v +} + +func (o Gateway) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Gateway) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["availabilityZones"] = o.AvailabilityZones + if !IsNil(o.Bgp) { + toSerialize["bgp"] = o.Bgp + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["planId"] = o.PlanId + toSerialize["routingType"] = o.RoutingType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Gateway) 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{ + "availabilityZones", + "displayName", + "planId", + "routingType", + } + + 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) + } + } + + varGateway := _Gateway{} + + err = json.Unmarshal(data, &varGateway) + + if err != nil { + return err + } + + *o = Gateway(varGateway) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "availabilityZones") + delete(additionalProperties, "bgp") + delete(additionalProperties, "displayName") + delete(additionalProperties, "labels") + delete(additionalProperties, "planId") + delete(additionalProperties, "routingType") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGateway struct { + value *Gateway + isSet bool +} + +func (v NullableGateway) Get() *Gateway { + return v.value +} + +func (v *NullableGateway) Set(val *Gateway) { + v.value = val + v.isSet = true +} + +func (v NullableGateway) IsSet() bool { + return v.isSet +} + +func (v *NullableGateway) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGateway(val *Gateway) *NullableGateway { + return &NullableGateway{value: val, isSet: true} +} + +func (v NullableGateway) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGateway) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_gateway_availability_zones.go b/services/vpn/v1beta1api/model_gateway_availability_zones.go new file mode 100644 index 000000000..b349ac72d --- /dev/null +++ b/services/vpn/v1beta1api/model_gateway_availability_zones.go @@ -0,0 +1,197 @@ +/* +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" + "fmt" +) + +// checks if the GatewayAvailabilityZones type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayAvailabilityZones{} + +// GatewayAvailabilityZones struct for GatewayAvailabilityZones +type GatewayAvailabilityZones struct { + // Object that represents an availability zone. + Tunnel1 string `json:"tunnel1"` + // Object that represents an availability zone. + Tunnel2 string `json:"tunnel2"` + AdditionalProperties map[string]interface{} +} + +type _GatewayAvailabilityZones GatewayAvailabilityZones + +// NewGatewayAvailabilityZones instantiates a new GatewayAvailabilityZones 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 NewGatewayAvailabilityZones(tunnel1 string, tunnel2 string) *GatewayAvailabilityZones { + this := GatewayAvailabilityZones{} + this.Tunnel1 = tunnel1 + this.Tunnel2 = tunnel2 + return &this +} + +// NewGatewayAvailabilityZonesWithDefaults instantiates a new GatewayAvailabilityZones 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 NewGatewayAvailabilityZonesWithDefaults() *GatewayAvailabilityZones { + this := GatewayAvailabilityZones{} + return &this +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *GatewayAvailabilityZones) GetTunnel1() string { + if o == nil { + var ret string + return ret + } + + return o.Tunnel1 +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *GatewayAvailabilityZones) GetTunnel1Ok() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel1, true +} + +// SetTunnel1 sets field value +func (o *GatewayAvailabilityZones) SetTunnel1(v string) { + o.Tunnel1 = v +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *GatewayAvailabilityZones) GetTunnel2() string { + if o == nil { + var ret string + return ret + } + + return o.Tunnel2 +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *GatewayAvailabilityZones) GetTunnel2Ok() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel2, true +} + +// SetTunnel2 sets field value +func (o *GatewayAvailabilityZones) SetTunnel2(v string) { + o.Tunnel2 = v +} + +func (o GatewayAvailabilityZones) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GatewayAvailabilityZones) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GatewayAvailabilityZones) 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{ + "tunnel1", + "tunnel2", + } + + 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) + } + } + + varGatewayAvailabilityZones := _GatewayAvailabilityZones{} + + err = json.Unmarshal(data, &varGatewayAvailabilityZones) + + if err != nil { + return err + } + + *o = GatewayAvailabilityZones(varGatewayAvailabilityZones) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "tunnel1") + delete(additionalProperties, "tunnel2") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGatewayAvailabilityZones struct { + value *GatewayAvailabilityZones + isSet bool +} + +func (v NullableGatewayAvailabilityZones) Get() *GatewayAvailabilityZones { + return v.value +} + +func (v *NullableGatewayAvailabilityZones) Set(val *GatewayAvailabilityZones) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayAvailabilityZones) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayAvailabilityZones) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayAvailabilityZones(val *GatewayAvailabilityZones) *NullableGatewayAvailabilityZones { + return &NullableGatewayAvailabilityZones{value: val, isSet: true} +} + +func (v NullableGatewayAvailabilityZones) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayAvailabilityZones) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_gateway_list.go b/services/vpn/v1beta1api/model_gateway_list.go new file mode 100644 index 000000000..5a17a3913 --- /dev/null +++ b/services/vpn/v1beta1api/model_gateway_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: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GatewayList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayList{} + +// GatewayList struct for GatewayList +type GatewayList struct { + Gateways []GatewayResponse `json:"gateways"` + AdditionalProperties map[string]interface{} +} + +type _GatewayList GatewayList + +// NewGatewayList instantiates a new GatewayList 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 NewGatewayList(gateways []GatewayResponse) *GatewayList { + this := GatewayList{} + this.Gateways = gateways + return &this +} + +// NewGatewayListWithDefaults instantiates a new GatewayList 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 NewGatewayListWithDefaults() *GatewayList { + this := GatewayList{} + return &this +} + +// GetGateways returns the Gateways field value +func (o *GatewayList) GetGateways() []GatewayResponse { + if o == nil { + var ret []GatewayResponse + return ret + } + + return o.Gateways +} + +// GetGatewaysOk returns a tuple with the Gateways field value +// and a boolean to check if the value has been set. +func (o *GatewayList) GetGatewaysOk() ([]GatewayResponse, bool) { + if o == nil { + return nil, false + } + return o.Gateways, true +} + +// SetGateways sets field value +func (o *GatewayList) SetGateways(v []GatewayResponse) { + o.Gateways = v +} + +func (o GatewayList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GatewayList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["gateways"] = o.Gateways + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GatewayList) 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{ + "gateways", + } + + 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) + } + } + + varGatewayList := _GatewayList{} + + err = json.Unmarshal(data, &varGatewayList) + + if err != nil { + return err + } + + *o = GatewayList(varGatewayList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "gateways") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGatewayList struct { + value *GatewayList + isSet bool +} + +func (v NullableGatewayList) Get() *GatewayList { + return v.value +} + +func (v *NullableGatewayList) Set(val *GatewayList) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayList) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayList(val *GatewayList) *NullableGatewayList { + return &NullableGatewayList{value: val, isSet: true} +} + +func (v NullableGatewayList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_gateway_response.go b/services/vpn/v1beta1api/model_gateway_response.go new file mode 100644 index 000000000..549bec031 --- /dev/null +++ b/services/vpn/v1beta1api/model_gateway_response.go @@ -0,0 +1,405 @@ +/* +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" + "fmt" +) + +// checks if the GatewayResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayResponse{} + +// GatewayResponse struct for GatewayResponse +type GatewayResponse struct { + AvailabilityZones GatewayAvailabilityZones `json:"availabilityZones"` + Bgp *BGPGatewayConfig `json:"bgp,omitempty"` + // 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"` + // The service plan identifier. + PlanId string `json:"planId"` + RoutingType RoutingType `json:"routingType"` + // The server-generated UUID of the VPN gateway. + Id *string `json:"id,omitempty"` + State *GatewayStatus `json:"state,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GatewayResponse GatewayResponse + +// NewGatewayResponse instantiates a new GatewayResponse 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 NewGatewayResponse(availabilityZones GatewayAvailabilityZones, displayName string, planId string, routingType RoutingType) *GatewayResponse { + this := GatewayResponse{} + this.AvailabilityZones = availabilityZones + this.DisplayName = displayName + this.PlanId = planId + this.RoutingType = routingType + return &this +} + +// NewGatewayResponseWithDefaults instantiates a new GatewayResponse 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 NewGatewayResponseWithDefaults() *GatewayResponse { + this := GatewayResponse{} + return &this +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *GatewayResponse) GetAvailabilityZones() GatewayAvailabilityZones { + if o == nil { + var ret GatewayAvailabilityZones + return ret + } + + return o.AvailabilityZones +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetAvailabilityZonesOk() (*GatewayAvailabilityZones, bool) { + if o == nil { + return nil, false + } + return &o.AvailabilityZones, true +} + +// SetAvailabilityZones sets field value +func (o *GatewayResponse) SetAvailabilityZones(v GatewayAvailabilityZones) { + o.AvailabilityZones = v +} + +// GetBgp returns the Bgp field value if set, zero value otherwise. +func (o *GatewayResponse) GetBgp() BGPGatewayConfig { + if o == nil || IsNil(o.Bgp) { + var ret BGPGatewayConfig + return ret + } + return *o.Bgp +} + +// GetBgpOk returns a tuple with the Bgp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetBgpOk() (*BGPGatewayConfig, bool) { + if o == nil || IsNil(o.Bgp) { + return nil, false + } + return o.Bgp, true +} + +// HasBgp returns a boolean if a field has been set. +func (o *GatewayResponse) HasBgp() bool { + if o != nil && !IsNil(o.Bgp) { + return true + } + + return false +} + +// SetBgp gets a reference to the given BGPGatewayConfig and assigns it to the Bgp field. +func (o *GatewayResponse) SetBgp(v BGPGatewayConfig) { + o.Bgp = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *GatewayResponse) 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 *GatewayResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *GatewayResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *GatewayResponse) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *GatewayResponse) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *GatewayResponse) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetPlanId returns the PlanId field value +func (o *GatewayResponse) GetPlanId() string { + if o == nil { + var ret string + return ret + } + + return o.PlanId +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetPlanIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PlanId, true +} + +// SetPlanId sets field value +func (o *GatewayResponse) SetPlanId(v string) { + o.PlanId = v +} + +// GetRoutingType returns the RoutingType field value +func (o *GatewayResponse) GetRoutingType() RoutingType { + if o == nil { + var ret RoutingType + return ret + } + + return o.RoutingType +} + +// GetRoutingTypeOk returns a tuple with the RoutingType field value +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetRoutingTypeOk() (*RoutingType, bool) { + if o == nil { + return nil, false + } + return &o.RoutingType, true +} + +// SetRoutingType sets field value +func (o *GatewayResponse) SetRoutingType(v RoutingType) { + o.RoutingType = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GatewayResponse) 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 *GatewayResponse) 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 *GatewayResponse) 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 *GatewayResponse) SetId(v string) { + o.Id = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *GatewayResponse) GetState() GatewayStatus { + if o == nil || IsNil(o.State) { + var ret GatewayStatus + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetStateOk() (*GatewayStatus, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *GatewayResponse) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given GatewayStatus and assigns it to the State field. +func (o *GatewayResponse) SetState(v GatewayStatus) { + o.State = &v +} + +func (o GatewayResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GatewayResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["availabilityZones"] = o.AvailabilityZones + if !IsNil(o.Bgp) { + toSerialize["bgp"] = o.Bgp + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["planId"] = o.PlanId + toSerialize["routingType"] = o.RoutingType + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GatewayResponse) 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{ + "availabilityZones", + "displayName", + "planId", + "routingType", + } + + 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) + } + } + + varGatewayResponse := _GatewayResponse{} + + err = json.Unmarshal(data, &varGatewayResponse) + + if err != nil { + return err + } + + *o = GatewayResponse(varGatewayResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "availabilityZones") + delete(additionalProperties, "bgp") + delete(additionalProperties, "displayName") + delete(additionalProperties, "labels") + delete(additionalProperties, "planId") + delete(additionalProperties, "routingType") + delete(additionalProperties, "id") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGatewayResponse struct { + value *GatewayResponse + isSet bool +} + +func (v NullableGatewayResponse) Get() *GatewayResponse { + return v.value +} + +func (v *NullableGatewayResponse) Set(val *GatewayResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayResponse(val *GatewayResponse) *NullableGatewayResponse { + return &NullableGatewayResponse{value: val, isSet: true} +} + +func (v NullableGatewayResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_gateway_status.go b/services/vpn/v1beta1api/model_gateway_status.go new file mode 100644 index 000000000..5f8036b36 --- /dev/null +++ b/services/vpn/v1beta1api/model_gateway_status.go @@ -0,0 +1,114 @@ +/* +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" + "fmt" +) + +// GatewayStatus The current lifecycle state of the gateway infrastructure. - `PENDING`: Provisioning or update is in progress. - `READY`: The gateway is fully operational. - `ERROR`: A failure occurred. - `DELETING`: The resource is being removed. +type GatewayStatus string + +// List of GatewayStatus +const ( + GATEWAYSTATUS_PENDING GatewayStatus = "PENDING" + GATEWAYSTATUS_READY GatewayStatus = "READY" + GATEWAYSTATUS_ERROR GatewayStatus = "ERROR" + GATEWAYSTATUS_DELETING GatewayStatus = "DELETING" +) + +// All allowed values of GatewayStatus enum +var AllowedGatewayStatusEnumValues = []GatewayStatus{ + "PENDING", + "READY", + "ERROR", + "DELETING", +} + +func (v *GatewayStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := GatewayStatus(value) + for _, existing := range AllowedGatewayStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GatewayStatus", value) +} + +// NewGatewayStatusFromValue returns a pointer to a valid GatewayStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGatewayStatusFromValue(v string) (*GatewayStatus, error) { + ev := GatewayStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GatewayStatus: valid values are %v", v, AllowedGatewayStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GatewayStatus) IsValid() bool { + for _, existing := range AllowedGatewayStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GatewayStatus value +func (v GatewayStatus) Ptr() *GatewayStatus { + return &v +} + +type NullableGatewayStatus struct { + value *GatewayStatus + isSet bool +} + +func (v NullableGatewayStatus) Get() *GatewayStatus { + return v.value +} + +func (v *NullableGatewayStatus) Set(val *GatewayStatus) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayStatus(val *GatewayStatus) *NullableGatewayStatus { + return &NullableGatewayStatus{value: val, isSet: true} +} + +func (v NullableGatewayStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_gateway_status_response.go b/services/vpn/v1beta1api/model_gateway_status_response.go new file mode 100644 index 000000000..6b02298f1 --- /dev/null +++ b/services/vpn/v1beta1api/model_gateway_status_response.go @@ -0,0 +1,303 @@ +/* +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 GatewayStatusResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayStatusResponse{} + +// GatewayStatusResponse struct for GatewayStatusResponse +type GatewayStatusResponse struct { + Connections []ConnectionStatusResponse `json:"connections,omitempty"` + // Name of the Gateway instance. + DisplayName *string `json:"displayName,omitempty"` + GatewayStatus *GatewayStatus `json:"gatewayStatus,omitempty"` + // UUID of the Gateway instance. + Id *string `json:"id,omitempty"` + Tunnels []VPNTunnels `json:"tunnels,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GatewayStatusResponse GatewayStatusResponse + +// NewGatewayStatusResponse instantiates a new GatewayStatusResponse 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 NewGatewayStatusResponse() *GatewayStatusResponse { + this := GatewayStatusResponse{} + return &this +} + +// NewGatewayStatusResponseWithDefaults instantiates a new GatewayStatusResponse 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 NewGatewayStatusResponseWithDefaults() *GatewayStatusResponse { + this := GatewayStatusResponse{} + return &this +} + +// GetConnections returns the Connections field value if set, zero value otherwise. +func (o *GatewayStatusResponse) GetConnections() []ConnectionStatusResponse { + if o == nil || IsNil(o.Connections) { + var ret []ConnectionStatusResponse + return ret + } + return o.Connections +} + +// GetConnectionsOk returns a tuple with the Connections field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayStatusResponse) GetConnectionsOk() ([]ConnectionStatusResponse, bool) { + if o == nil || IsNil(o.Connections) { + return nil, false + } + return o.Connections, true +} + +// HasConnections returns a boolean if a field has been set. +func (o *GatewayStatusResponse) HasConnections() bool { + if o != nil && !IsNil(o.Connections) { + return true + } + + return false +} + +// SetConnections gets a reference to the given []ConnectionStatusResponse and assigns it to the Connections field. +func (o *GatewayStatusResponse) SetConnections(v []ConnectionStatusResponse) { + o.Connections = v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *GatewayStatusResponse) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayStatusResponse) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *GatewayStatusResponse) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *GatewayStatusResponse) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetGatewayStatus returns the GatewayStatus field value if set, zero value otherwise. +func (o *GatewayStatusResponse) GetGatewayStatus() GatewayStatus { + if o == nil || IsNil(o.GatewayStatus) { + var ret GatewayStatus + return ret + } + return *o.GatewayStatus +} + +// GetGatewayStatusOk returns a tuple with the GatewayStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayStatusResponse) GetGatewayStatusOk() (*GatewayStatus, bool) { + if o == nil || IsNil(o.GatewayStatus) { + return nil, false + } + return o.GatewayStatus, true +} + +// HasGatewayStatus returns a boolean if a field has been set. +func (o *GatewayStatusResponse) HasGatewayStatus() bool { + if o != nil && !IsNil(o.GatewayStatus) { + return true + } + + return false +} + +// SetGatewayStatus gets a reference to the given GatewayStatus and assigns it to the GatewayStatus field. +func (o *GatewayStatusResponse) SetGatewayStatus(v GatewayStatus) { + o.GatewayStatus = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GatewayStatusResponse) 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 *GatewayStatusResponse) 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 *GatewayStatusResponse) 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 *GatewayStatusResponse) SetId(v string) { + o.Id = &v +} + +// GetTunnels returns the Tunnels field value if set, zero value otherwise. +func (o *GatewayStatusResponse) GetTunnels() []VPNTunnels { + if o == nil || IsNil(o.Tunnels) { + var ret []VPNTunnels + return ret + } + return o.Tunnels +} + +// GetTunnelsOk returns a tuple with the Tunnels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayStatusResponse) GetTunnelsOk() ([]VPNTunnels, bool) { + if o == nil || IsNil(o.Tunnels) { + return nil, false + } + return o.Tunnels, true +} + +// HasTunnels returns a boolean if a field has been set. +func (o *GatewayStatusResponse) HasTunnels() bool { + if o != nil && !IsNil(o.Tunnels) { + return true + } + + return false +} + +// SetTunnels gets a reference to the given []VPNTunnels and assigns it to the Tunnels field. +func (o *GatewayStatusResponse) SetTunnels(v []VPNTunnels) { + o.Tunnels = v +} + +func (o GatewayStatusResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GatewayStatusResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Connections) { + toSerialize["connections"] = o.Connections + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.GatewayStatus) { + toSerialize["gatewayStatus"] = o.GatewayStatus + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Tunnels) { + toSerialize["tunnels"] = o.Tunnels + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GatewayStatusResponse) UnmarshalJSON(data []byte) (err error) { + varGatewayStatusResponse := _GatewayStatusResponse{} + + err = json.Unmarshal(data, &varGatewayStatusResponse) + + if err != nil { + return err + } + + *o = GatewayStatusResponse(varGatewayStatusResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "connections") + delete(additionalProperties, "displayName") + delete(additionalProperties, "gatewayStatus") + delete(additionalProperties, "id") + delete(additionalProperties, "tunnels") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGatewayStatusResponse struct { + value *GatewayStatusResponse + isSet bool +} + +func (v NullableGatewayStatusResponse) Get() *GatewayStatusResponse { + return v.value +} + +func (v *NullableGatewayStatusResponse) Set(val *GatewayStatusResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayStatusResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayStatusResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayStatusResponse(val *GatewayStatusResponse) *NullableGatewayStatusResponse { + return &NullableGatewayStatusResponse{value: val, isSet: true} +} + +func (v NullableGatewayStatusResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayStatusResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_peering_config.go b/services/vpn/v1beta1api/model_peering_config.go new file mode 100644 index 000000000..845d81eae --- /dev/null +++ b/services/vpn/v1beta1api/model_peering_config.go @@ -0,0 +1,190 @@ +/* +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 PeeringConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PeeringConfig{} + +// PeeringConfig The peering object defines the point-to-point IP configuration for the Tunnel Interface. These addresses serve as next-hop identifiers and are used for BGP peering sessions and can be used in Static Route-Based connectivity. +type PeeringConfig struct { + LocalAddress *string `json:"localAddress,omitempty" validate:"regexp=^((25[0-5]|(2[0-4]|1\\\\d|[1-9]|)\\\\d)\\\\.?\\\\b){4}$"` + RemoteAddress *string `json:"remoteAddress,omitempty" validate:"regexp=^((25[0-5]|(2[0-4]|1\\\\d|[1-9]|)\\\\d)\\\\.?\\\\b){4}$"` + AdditionalProperties map[string]interface{} +} + +type _PeeringConfig PeeringConfig + +// NewPeeringConfig instantiates a new PeeringConfig 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 NewPeeringConfig() *PeeringConfig { + this := PeeringConfig{} + return &this +} + +// NewPeeringConfigWithDefaults instantiates a new PeeringConfig 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 NewPeeringConfigWithDefaults() *PeeringConfig { + this := PeeringConfig{} + return &this +} + +// GetLocalAddress returns the LocalAddress field value if set, zero value otherwise. +func (o *PeeringConfig) GetLocalAddress() string { + if o == nil || IsNil(o.LocalAddress) { + var ret string + return ret + } + return *o.LocalAddress +} + +// GetLocalAddressOk returns a tuple with the LocalAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PeeringConfig) GetLocalAddressOk() (*string, bool) { + if o == nil || IsNil(o.LocalAddress) { + return nil, false + } + return o.LocalAddress, true +} + +// HasLocalAddress returns a boolean if a field has been set. +func (o *PeeringConfig) HasLocalAddress() bool { + if o != nil && !IsNil(o.LocalAddress) { + return true + } + + return false +} + +// SetLocalAddress gets a reference to the given string and assigns it to the LocalAddress field. +func (o *PeeringConfig) SetLocalAddress(v string) { + o.LocalAddress = &v +} + +// GetRemoteAddress returns the RemoteAddress field value if set, zero value otherwise. +func (o *PeeringConfig) GetRemoteAddress() string { + if o == nil || IsNil(o.RemoteAddress) { + var ret string + return ret + } + return *o.RemoteAddress +} + +// GetRemoteAddressOk returns a tuple with the RemoteAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PeeringConfig) GetRemoteAddressOk() (*string, bool) { + if o == nil || IsNil(o.RemoteAddress) { + return nil, false + } + return o.RemoteAddress, true +} + +// HasRemoteAddress returns a boolean if a field has been set. +func (o *PeeringConfig) HasRemoteAddress() bool { + if o != nil && !IsNil(o.RemoteAddress) { + return true + } + + return false +} + +// SetRemoteAddress gets a reference to the given string and assigns it to the RemoteAddress field. +func (o *PeeringConfig) SetRemoteAddress(v string) { + o.RemoteAddress = &v +} + +func (o PeeringConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PeeringConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LocalAddress) { + toSerialize["localAddress"] = o.LocalAddress + } + if !IsNil(o.RemoteAddress) { + toSerialize["remoteAddress"] = o.RemoteAddress + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PeeringConfig) UnmarshalJSON(data []byte) (err error) { + varPeeringConfig := _PeeringConfig{} + + err = json.Unmarshal(data, &varPeeringConfig) + + if err != nil { + return err + } + + *o = PeeringConfig(varPeeringConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "localAddress") + delete(additionalProperties, "remoteAddress") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePeeringConfig struct { + value *PeeringConfig + isSet bool +} + +func (v NullablePeeringConfig) Get() *PeeringConfig { + return v.value +} + +func (v *NullablePeeringConfig) Set(val *PeeringConfig) { + v.value = val + v.isSet = true +} + +func (v NullablePeeringConfig) IsSet() bool { + return v.isSet +} + +func (v *NullablePeeringConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePeeringConfig(val *PeeringConfig) *NullablePeeringConfig { + return &NullablePeeringConfig{value: val, isSet: true} +} + +func (v NullablePeeringConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePeeringConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_phase.go b/services/vpn/v1beta1api/model_phase.go new file mode 100644 index 000000000..53dc30870 --- /dev/null +++ b/services/vpn/v1beta1api/model_phase.go @@ -0,0 +1,233 @@ +/* +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" + "fmt" +) + +// checks if the Phase type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Phase{} + +// Phase struct for Phase +type Phase struct { + // The Diffie-Hellman Group. Required, except if AEAD algorithms are selected. + DhGroups []string `json:"dhGroups,omitempty"` + EncryptionAlgorithms []string `json:"encryptionAlgorithms"` + IntegrityAlgorithms []string `json:"integrityAlgorithms"` + AdditionalProperties map[string]interface{} +} + +type _Phase Phase + +// NewPhase instantiates a new Phase 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 NewPhase(encryptionAlgorithms []string, integrityAlgorithms []string) *Phase { + this := Phase{} + this.EncryptionAlgorithms = encryptionAlgorithms + this.IntegrityAlgorithms = integrityAlgorithms + return &this +} + +// NewPhaseWithDefaults instantiates a new Phase 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 NewPhaseWithDefaults() *Phase { + this := Phase{} + return &this +} + +// GetDhGroups returns the DhGroups field value if set, zero value otherwise. +func (o *Phase) GetDhGroups() []string { + if o == nil || IsNil(o.DhGroups) { + var ret []string + return ret + } + return o.DhGroups +} + +// GetDhGroupsOk returns a tuple with the DhGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase) GetDhGroupsOk() ([]string, bool) { + if o == nil || IsNil(o.DhGroups) { + return nil, false + } + return o.DhGroups, true +} + +// HasDhGroups returns a boolean if a field has been set. +func (o *Phase) HasDhGroups() bool { + if o != nil && !IsNil(o.DhGroups) { + return true + } + + return false +} + +// SetDhGroups gets a reference to the given []string and assigns it to the DhGroups field. +func (o *Phase) SetDhGroups(v []string) { + o.DhGroups = v +} + +// GetEncryptionAlgorithms returns the EncryptionAlgorithms field value +func (o *Phase) GetEncryptionAlgorithms() []string { + if o == nil { + var ret []string + return ret + } + + return o.EncryptionAlgorithms +} + +// GetEncryptionAlgorithmsOk returns a tuple with the EncryptionAlgorithms field value +// and a boolean to check if the value has been set. +func (o *Phase) GetEncryptionAlgorithmsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.EncryptionAlgorithms, true +} + +// SetEncryptionAlgorithms sets field value +func (o *Phase) SetEncryptionAlgorithms(v []string) { + o.EncryptionAlgorithms = v +} + +// GetIntegrityAlgorithms returns the IntegrityAlgorithms field value +func (o *Phase) GetIntegrityAlgorithms() []string { + if o == nil { + var ret []string + return ret + } + + return o.IntegrityAlgorithms +} + +// GetIntegrityAlgorithmsOk returns a tuple with the IntegrityAlgorithms field value +// and a boolean to check if the value has been set. +func (o *Phase) GetIntegrityAlgorithmsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.IntegrityAlgorithms, true +} + +// SetIntegrityAlgorithms sets field value +func (o *Phase) SetIntegrityAlgorithms(v []string) { + o.IntegrityAlgorithms = v +} + +func (o Phase) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Phase) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DhGroups) { + toSerialize["dhGroups"] = o.DhGroups + } + toSerialize["encryptionAlgorithms"] = o.EncryptionAlgorithms + toSerialize["integrityAlgorithms"] = o.IntegrityAlgorithms + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Phase) 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{ + "encryptionAlgorithms", + "integrityAlgorithms", + } + + 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) + } + } + + varPhase := _Phase{} + + err = json.Unmarshal(data, &varPhase) + + if err != nil { + return err + } + + *o = Phase(varPhase) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "dhGroups") + delete(additionalProperties, "encryptionAlgorithms") + delete(additionalProperties, "integrityAlgorithms") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePhase struct { + value *Phase + isSet bool +} + +func (v NullablePhase) Get() *Phase { + return v.value +} + +func (v *NullablePhase) Set(val *Phase) { + v.value = val + v.isSet = true +} + +func (v NullablePhase) IsSet() bool { + return v.isSet +} + +func (v *NullablePhase) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePhase(val *Phase) *NullablePhase { + return &NullablePhase{value: val, isSet: true} +} + +func (v NullablePhase) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePhase) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_phase1_status.go b/services/vpn/v1beta1api/model_phase1_status.go new file mode 100644 index 000000000..2589e5044 --- /dev/null +++ b/services/vpn/v1beta1api/model_phase1_status.go @@ -0,0 +1,267 @@ +/* +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 Phase1Status type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Phase1Status{} + +// Phase1Status struct for Phase1Status +type Phase1Status struct { + // The negotiated Diffie-Hellman Group + DhGroup *string `json:"dhGroup,omitempty"` + // The negotiated encryption algorithm. + EncryptionAlgorithm *string `json:"encryptionAlgorithm,omitempty"` + // The negotiated integrity algorithm or pseudo-random-function. + IntegrityAlgorithm *string `json:"integrityAlgorithm,omitempty"` + State *string `json:"state,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Phase1Status Phase1Status + +// NewPhase1Status instantiates a new Phase1Status 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 NewPhase1Status() *Phase1Status { + this := Phase1Status{} + return &this +} + +// NewPhase1StatusWithDefaults instantiates a new Phase1Status 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 NewPhase1StatusWithDefaults() *Phase1Status { + this := Phase1Status{} + return &this +} + +// GetDhGroup returns the DhGroup field value if set, zero value otherwise. +func (o *Phase1Status) GetDhGroup() string { + if o == nil || IsNil(o.DhGroup) { + var ret string + return ret + } + return *o.DhGroup +} + +// GetDhGroupOk returns a tuple with the DhGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase1Status) GetDhGroupOk() (*string, bool) { + if o == nil || IsNil(o.DhGroup) { + return nil, false + } + return o.DhGroup, true +} + +// HasDhGroup returns a boolean if a field has been set. +func (o *Phase1Status) HasDhGroup() bool { + if o != nil && !IsNil(o.DhGroup) { + return true + } + + return false +} + +// SetDhGroup gets a reference to the given string and assigns it to the DhGroup field. +func (o *Phase1Status) SetDhGroup(v string) { + o.DhGroup = &v +} + +// GetEncryptionAlgorithm returns the EncryptionAlgorithm field value if set, zero value otherwise. +func (o *Phase1Status) GetEncryptionAlgorithm() string { + if o == nil || IsNil(o.EncryptionAlgorithm) { + var ret string + return ret + } + return *o.EncryptionAlgorithm +} + +// GetEncryptionAlgorithmOk returns a tuple with the EncryptionAlgorithm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase1Status) GetEncryptionAlgorithmOk() (*string, bool) { + if o == nil || IsNil(o.EncryptionAlgorithm) { + return nil, false + } + return o.EncryptionAlgorithm, true +} + +// HasEncryptionAlgorithm returns a boolean if a field has been set. +func (o *Phase1Status) HasEncryptionAlgorithm() bool { + if o != nil && !IsNil(o.EncryptionAlgorithm) { + return true + } + + return false +} + +// SetEncryptionAlgorithm gets a reference to the given string and assigns it to the EncryptionAlgorithm field. +func (o *Phase1Status) SetEncryptionAlgorithm(v string) { + o.EncryptionAlgorithm = &v +} + +// GetIntegrityAlgorithm returns the IntegrityAlgorithm field value if set, zero value otherwise. +func (o *Phase1Status) GetIntegrityAlgorithm() string { + if o == nil || IsNil(o.IntegrityAlgorithm) { + var ret string + return ret + } + return *o.IntegrityAlgorithm +} + +// GetIntegrityAlgorithmOk returns a tuple with the IntegrityAlgorithm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase1Status) GetIntegrityAlgorithmOk() (*string, bool) { + if o == nil || IsNil(o.IntegrityAlgorithm) { + return nil, false + } + return o.IntegrityAlgorithm, true +} + +// HasIntegrityAlgorithm returns a boolean if a field has been set. +func (o *Phase1Status) HasIntegrityAlgorithm() bool { + if o != nil && !IsNil(o.IntegrityAlgorithm) { + return true + } + + return false +} + +// SetIntegrityAlgorithm gets a reference to the given string and assigns it to the IntegrityAlgorithm field. +func (o *Phase1Status) SetIntegrityAlgorithm(v string) { + o.IntegrityAlgorithm = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Phase1Status) GetState() string { + if o == nil || IsNil(o.State) { + var ret string + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase1Status) GetStateOk() (*string, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Phase1Status) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *Phase1Status) SetState(v string) { + o.State = &v +} + +func (o Phase1Status) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Phase1Status) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DhGroup) { + toSerialize["dhGroup"] = o.DhGroup + } + if !IsNil(o.EncryptionAlgorithm) { + toSerialize["encryptionAlgorithm"] = o.EncryptionAlgorithm + } + if !IsNil(o.IntegrityAlgorithm) { + toSerialize["integrityAlgorithm"] = o.IntegrityAlgorithm + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Phase1Status) UnmarshalJSON(data []byte) (err error) { + varPhase1Status := _Phase1Status{} + + err = json.Unmarshal(data, &varPhase1Status) + + if err != nil { + return err + } + + *o = Phase1Status(varPhase1Status) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "dhGroup") + delete(additionalProperties, "encryptionAlgorithm") + delete(additionalProperties, "integrityAlgorithm") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePhase1Status struct { + value *Phase1Status + isSet bool +} + +func (v NullablePhase1Status) Get() *Phase1Status { + return v.value +} + +func (v *NullablePhase1Status) Set(val *Phase1Status) { + v.value = val + v.isSet = true +} + +func (v NullablePhase1Status) IsSet() bool { + return v.isSet +} + +func (v *NullablePhase1Status) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePhase1Status(val *Phase1Status) *NullablePhase1Status { + return &NullablePhase1Status{value: val, isSet: true} +} + +func (v NullablePhase1Status) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePhase1Status) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_phase2_status.go b/services/vpn/v1beta1api/model_phase2_status.go new file mode 100644 index 000000000..69479d86e --- /dev/null +++ b/services/vpn/v1beta1api/model_phase2_status.go @@ -0,0 +1,495 @@ +/* +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 Phase2Status type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Phase2Status{} + +// Phase2Status struct for Phase2Status +type Phase2Status struct { + // The total data volume received through this Security Association, measured in bytes. + BytesIn *string `json:"bytesIn,omitempty"` + // The total data volume sent through this Security Association, measured in bytes. + BytesOut *string `json:"bytesOut,omitempty"` + // The negotiated Diffie-Hellman Group + DhGroup *string `json:"dhGroup,omitempty"` + // Indicates whether NAT traversal encapsulation is active for the connection. + Encap *string `json:"encap,omitempty"` + // The negotiated encryption algorithm. + EncryptionAlgorithm *string `json:"encryptionAlgorithm,omitempty"` + // The negotiated integrity algorithm or pseudo-random-function. + IntegrityAlgorithm *string `json:"integrityAlgorithm,omitempty"` + // The total number of packets received through this IPsec Security Association. + PacketsIn *string `json:"packetsIn,omitempty"` + // The total number of packets sent through this IPsec Security Association + PacketsOut *string `json:"packetsOut,omitempty"` + // The security protocol used for the tunnel, typically `ESP` (Encapsulating Security Payload). + Protocol *string `json:"protocol,omitempty"` + State *string `json:"state,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Phase2Status Phase2Status + +// NewPhase2Status instantiates a new Phase2Status 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 NewPhase2Status() *Phase2Status { + this := Phase2Status{} + return &this +} + +// NewPhase2StatusWithDefaults instantiates a new Phase2Status 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 NewPhase2StatusWithDefaults() *Phase2Status { + this := Phase2Status{} + return &this +} + +// GetBytesIn returns the BytesIn field value if set, zero value otherwise. +func (o *Phase2Status) GetBytesIn() string { + if o == nil || IsNil(o.BytesIn) { + var ret string + return ret + } + return *o.BytesIn +} + +// GetBytesInOk returns a tuple with the BytesIn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetBytesInOk() (*string, bool) { + if o == nil || IsNil(o.BytesIn) { + return nil, false + } + return o.BytesIn, true +} + +// HasBytesIn returns a boolean if a field has been set. +func (o *Phase2Status) HasBytesIn() bool { + if o != nil && !IsNil(o.BytesIn) { + return true + } + + return false +} + +// SetBytesIn gets a reference to the given string and assigns it to the BytesIn field. +func (o *Phase2Status) SetBytesIn(v string) { + o.BytesIn = &v +} + +// GetBytesOut returns the BytesOut field value if set, zero value otherwise. +func (o *Phase2Status) GetBytesOut() string { + if o == nil || IsNil(o.BytesOut) { + var ret string + return ret + } + return *o.BytesOut +} + +// GetBytesOutOk returns a tuple with the BytesOut field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetBytesOutOk() (*string, bool) { + if o == nil || IsNil(o.BytesOut) { + return nil, false + } + return o.BytesOut, true +} + +// HasBytesOut returns a boolean if a field has been set. +func (o *Phase2Status) HasBytesOut() bool { + if o != nil && !IsNil(o.BytesOut) { + return true + } + + return false +} + +// SetBytesOut gets a reference to the given string and assigns it to the BytesOut field. +func (o *Phase2Status) SetBytesOut(v string) { + o.BytesOut = &v +} + +// GetDhGroup returns the DhGroup field value if set, zero value otherwise. +func (o *Phase2Status) GetDhGroup() string { + if o == nil || IsNil(o.DhGroup) { + var ret string + return ret + } + return *o.DhGroup +} + +// GetDhGroupOk returns a tuple with the DhGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetDhGroupOk() (*string, bool) { + if o == nil || IsNil(o.DhGroup) { + return nil, false + } + return o.DhGroup, true +} + +// HasDhGroup returns a boolean if a field has been set. +func (o *Phase2Status) HasDhGroup() bool { + if o != nil && !IsNil(o.DhGroup) { + return true + } + + return false +} + +// SetDhGroup gets a reference to the given string and assigns it to the DhGroup field. +func (o *Phase2Status) SetDhGroup(v string) { + o.DhGroup = &v +} + +// GetEncap returns the Encap field value if set, zero value otherwise. +func (o *Phase2Status) GetEncap() string { + if o == nil || IsNil(o.Encap) { + var ret string + return ret + } + return *o.Encap +} + +// GetEncapOk returns a tuple with the Encap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetEncapOk() (*string, bool) { + if o == nil || IsNil(o.Encap) { + return nil, false + } + return o.Encap, true +} + +// HasEncap returns a boolean if a field has been set. +func (o *Phase2Status) HasEncap() bool { + if o != nil && !IsNil(o.Encap) { + return true + } + + return false +} + +// SetEncap gets a reference to the given string and assigns it to the Encap field. +func (o *Phase2Status) SetEncap(v string) { + o.Encap = &v +} + +// GetEncryptionAlgorithm returns the EncryptionAlgorithm field value if set, zero value otherwise. +func (o *Phase2Status) GetEncryptionAlgorithm() string { + if o == nil || IsNil(o.EncryptionAlgorithm) { + var ret string + return ret + } + return *o.EncryptionAlgorithm +} + +// GetEncryptionAlgorithmOk returns a tuple with the EncryptionAlgorithm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetEncryptionAlgorithmOk() (*string, bool) { + if o == nil || IsNil(o.EncryptionAlgorithm) { + return nil, false + } + return o.EncryptionAlgorithm, true +} + +// HasEncryptionAlgorithm returns a boolean if a field has been set. +func (o *Phase2Status) HasEncryptionAlgorithm() bool { + if o != nil && !IsNil(o.EncryptionAlgorithm) { + return true + } + + return false +} + +// SetEncryptionAlgorithm gets a reference to the given string and assigns it to the EncryptionAlgorithm field. +func (o *Phase2Status) SetEncryptionAlgorithm(v string) { + o.EncryptionAlgorithm = &v +} + +// GetIntegrityAlgorithm returns the IntegrityAlgorithm field value if set, zero value otherwise. +func (o *Phase2Status) GetIntegrityAlgorithm() string { + if o == nil || IsNil(o.IntegrityAlgorithm) { + var ret string + return ret + } + return *o.IntegrityAlgorithm +} + +// GetIntegrityAlgorithmOk returns a tuple with the IntegrityAlgorithm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetIntegrityAlgorithmOk() (*string, bool) { + if o == nil || IsNil(o.IntegrityAlgorithm) { + return nil, false + } + return o.IntegrityAlgorithm, true +} + +// HasIntegrityAlgorithm returns a boolean if a field has been set. +func (o *Phase2Status) HasIntegrityAlgorithm() bool { + if o != nil && !IsNil(o.IntegrityAlgorithm) { + return true + } + + return false +} + +// SetIntegrityAlgorithm gets a reference to the given string and assigns it to the IntegrityAlgorithm field. +func (o *Phase2Status) SetIntegrityAlgorithm(v string) { + o.IntegrityAlgorithm = &v +} + +// GetPacketsIn returns the PacketsIn field value if set, zero value otherwise. +func (o *Phase2Status) GetPacketsIn() string { + if o == nil || IsNil(o.PacketsIn) { + var ret string + return ret + } + return *o.PacketsIn +} + +// GetPacketsInOk returns a tuple with the PacketsIn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetPacketsInOk() (*string, bool) { + if o == nil || IsNil(o.PacketsIn) { + return nil, false + } + return o.PacketsIn, true +} + +// HasPacketsIn returns a boolean if a field has been set. +func (o *Phase2Status) HasPacketsIn() bool { + if o != nil && !IsNil(o.PacketsIn) { + return true + } + + return false +} + +// SetPacketsIn gets a reference to the given string and assigns it to the PacketsIn field. +func (o *Phase2Status) SetPacketsIn(v string) { + o.PacketsIn = &v +} + +// GetPacketsOut returns the PacketsOut field value if set, zero value otherwise. +func (o *Phase2Status) GetPacketsOut() string { + if o == nil || IsNil(o.PacketsOut) { + var ret string + return ret + } + return *o.PacketsOut +} + +// GetPacketsOutOk returns a tuple with the PacketsOut field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetPacketsOutOk() (*string, bool) { + if o == nil || IsNil(o.PacketsOut) { + return nil, false + } + return o.PacketsOut, true +} + +// HasPacketsOut returns a boolean if a field has been set. +func (o *Phase2Status) HasPacketsOut() bool { + if o != nil && !IsNil(o.PacketsOut) { + return true + } + + return false +} + +// SetPacketsOut gets a reference to the given string and assigns it to the PacketsOut field. +func (o *Phase2Status) SetPacketsOut(v string) { + o.PacketsOut = &v +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *Phase2Status) GetProtocol() string { + if o == nil || IsNil(o.Protocol) { + var ret string + return ret + } + return *o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetProtocolOk() (*string, bool) { + if o == nil || IsNil(o.Protocol) { + return nil, false + } + return o.Protocol, true +} + +// HasProtocol returns a boolean if a field has been set. +func (o *Phase2Status) HasProtocol() bool { + if o != nil && !IsNil(o.Protocol) { + return true + } + + return false +} + +// SetProtocol gets a reference to the given string and assigns it to the Protocol field. +func (o *Phase2Status) SetProtocol(v string) { + o.Protocol = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Phase2Status) GetState() string { + if o == nil || IsNil(o.State) { + var ret string + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetStateOk() (*string, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Phase2Status) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *Phase2Status) SetState(v string) { + o.State = &v +} + +func (o Phase2Status) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Phase2Status) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BytesIn) { + toSerialize["bytesIn"] = o.BytesIn + } + if !IsNil(o.BytesOut) { + toSerialize["bytesOut"] = o.BytesOut + } + if !IsNil(o.DhGroup) { + toSerialize["dhGroup"] = o.DhGroup + } + if !IsNil(o.Encap) { + toSerialize["encap"] = o.Encap + } + if !IsNil(o.EncryptionAlgorithm) { + toSerialize["encryptionAlgorithm"] = o.EncryptionAlgorithm + } + if !IsNil(o.IntegrityAlgorithm) { + toSerialize["integrityAlgorithm"] = o.IntegrityAlgorithm + } + if !IsNil(o.PacketsIn) { + toSerialize["packetsIn"] = o.PacketsIn + } + if !IsNil(o.PacketsOut) { + toSerialize["packetsOut"] = o.PacketsOut + } + if !IsNil(o.Protocol) { + toSerialize["protocol"] = o.Protocol + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Phase2Status) UnmarshalJSON(data []byte) (err error) { + varPhase2Status := _Phase2Status{} + + err = json.Unmarshal(data, &varPhase2Status) + + if err != nil { + return err + } + + *o = Phase2Status(varPhase2Status) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bytesIn") + delete(additionalProperties, "bytesOut") + delete(additionalProperties, "dhGroup") + delete(additionalProperties, "encap") + delete(additionalProperties, "encryptionAlgorithm") + delete(additionalProperties, "integrityAlgorithm") + delete(additionalProperties, "packetsIn") + delete(additionalProperties, "packetsOut") + delete(additionalProperties, "protocol") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePhase2Status struct { + value *Phase2Status + isSet bool +} + +func (v NullablePhase2Status) Get() *Phase2Status { + return v.value +} + +func (v *NullablePhase2Status) Set(val *Phase2Status) { + v.value = val + v.isSet = true +} + +func (v NullablePhase2Status) IsSet() bool { + return v.isSet +} + +func (v *NullablePhase2Status) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePhase2Status(val *Phase2Status) *NullablePhase2Status { + return &NullablePhase2Status{value: val, isSet: true} +} + +func (v NullablePhase2Status) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePhase2Status) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_plan.go b/services/vpn/v1beta1api/model_plan.go new file mode 100644 index 000000000..143e88212 --- /dev/null +++ b/services/vpn/v1beta1api/model_plan.go @@ -0,0 +1,306 @@ +/* +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 Plan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Plan{} + +// Plan struct for Plan +type Plan struct { + // The maximum throughput supported by the gateway in each direction, measured in MBit/s + MaxBandwidth *int32 `json:"maxBandwidth,omitempty"` + // The maximum number of connections supported by the VPN Gateway. + MaxConnections *int32 `json:"maxConnections,omitempty"` + // The name of the service plan. + Name *string `json:"name,omitempty"` + // The service plan identifier. + PlanId *string `json:"planId,omitempty"` + // The SKU identifier used for billing. + Sku *string `json:"sku,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Plan Plan + +// NewPlan instantiates a new Plan 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 NewPlan() *Plan { + this := Plan{} + return &this +} + +// NewPlanWithDefaults instantiates a new Plan 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 NewPlanWithDefaults() *Plan { + this := Plan{} + return &this +} + +// GetMaxBandwidth returns the MaxBandwidth field value if set, zero value otherwise. +func (o *Plan) GetMaxBandwidth() int32 { + if o == nil || IsNil(o.MaxBandwidth) { + var ret int32 + return ret + } + return *o.MaxBandwidth +} + +// GetMaxBandwidthOk returns a tuple with the MaxBandwidth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetMaxBandwidthOk() (*int32, bool) { + if o == nil || IsNil(o.MaxBandwidth) { + return nil, false + } + return o.MaxBandwidth, true +} + +// HasMaxBandwidth returns a boolean if a field has been set. +func (o *Plan) HasMaxBandwidth() bool { + if o != nil && !IsNil(o.MaxBandwidth) { + return true + } + + return false +} + +// SetMaxBandwidth gets a reference to the given int32 and assigns it to the MaxBandwidth field. +func (o *Plan) SetMaxBandwidth(v int32) { + o.MaxBandwidth = &v +} + +// GetMaxConnections returns the MaxConnections field value if set, zero value otherwise. +func (o *Plan) GetMaxConnections() int32 { + if o == nil || IsNil(o.MaxConnections) { + var ret int32 + return ret + } + return *o.MaxConnections +} + +// GetMaxConnectionsOk returns a tuple with the MaxConnections field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetMaxConnectionsOk() (*int32, bool) { + if o == nil || IsNil(o.MaxConnections) { + return nil, false + } + return o.MaxConnections, true +} + +// HasMaxConnections returns a boolean if a field has been set. +func (o *Plan) HasMaxConnections() bool { + if o != nil && !IsNil(o.MaxConnections) { + return true + } + + return false +} + +// SetMaxConnections gets a reference to the given int32 and assigns it to the MaxConnections field. +func (o *Plan) SetMaxConnections(v int32) { + o.MaxConnections = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Plan) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Plan) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Plan) SetName(v string) { + o.Name = &v +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *Plan) GetPlanId() string { + if o == nil || IsNil(o.PlanId) { + var ret string + return ret + } + return *o.PlanId +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetPlanIdOk() (*string, bool) { + if o == nil || IsNil(o.PlanId) { + return nil, false + } + return o.PlanId, true +} + +// HasPlanId returns a boolean if a field has been set. +func (o *Plan) HasPlanId() bool { + if o != nil && !IsNil(o.PlanId) { + return true + } + + return false +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *Plan) SetPlanId(v string) { + o.PlanId = &v +} + +// GetSku returns the Sku field value if set, zero value otherwise. +func (o *Plan) GetSku() string { + if o == nil || IsNil(o.Sku) { + var ret string + return ret + } + return *o.Sku +} + +// GetSkuOk returns a tuple with the Sku field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetSkuOk() (*string, bool) { + if o == nil || IsNil(o.Sku) { + return nil, false + } + return o.Sku, true +} + +// HasSku returns a boolean if a field has been set. +func (o *Plan) HasSku() bool { + if o != nil && !IsNil(o.Sku) { + return true + } + + return false +} + +// SetSku gets a reference to the given string and assigns it to the Sku field. +func (o *Plan) SetSku(v string) { + o.Sku = &v +} + +func (o Plan) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Plan) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MaxBandwidth) { + toSerialize["maxBandwidth"] = o.MaxBandwidth + } + if !IsNil(o.MaxConnections) { + toSerialize["maxConnections"] = o.MaxConnections + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.PlanId) { + toSerialize["planId"] = o.PlanId + } + if !IsNil(o.Sku) { + toSerialize["sku"] = o.Sku + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Plan) UnmarshalJSON(data []byte) (err error) { + varPlan := _Plan{} + + err = json.Unmarshal(data, &varPlan) + + if err != nil { + return err + } + + *o = Plan(varPlan) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "maxBandwidth") + delete(additionalProperties, "maxConnections") + delete(additionalProperties, "name") + delete(additionalProperties, "planId") + delete(additionalProperties, "sku") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlan struct { + value *Plan + isSet bool +} + +func (v NullablePlan) Get() *Plan { + return v.value +} + +func (v *NullablePlan) Set(val *Plan) { + v.value = val + v.isSet = true +} + +func (v NullablePlan) IsSet() bool { + return v.isSet +} + +func (v *NullablePlan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlan(val *Plan) *NullablePlan { + return &NullablePlan{value: val, isSet: true} +} + +func (v NullablePlan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_plan_list.go b/services/vpn/v1beta1api/model_plan_list.go new file mode 100644 index 000000000..58b96f4d1 --- /dev/null +++ b/services/vpn/v1beta1api/model_plan_list.go @@ -0,0 +1,191 @@ +/* +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 PlanList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanList{} + +// PlanList struct for PlanList +type PlanList struct { + // The service plan identifier. + DefaultPlanId *string `json:"defaultPlanId,omitempty"` + Plans []Plan `json:"plans,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PlanList PlanList + +// NewPlanList instantiates a new PlanList 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 NewPlanList() *PlanList { + this := PlanList{} + return &this +} + +// NewPlanListWithDefaults instantiates a new PlanList 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 NewPlanListWithDefaults() *PlanList { + this := PlanList{} + return &this +} + +// GetDefaultPlanId returns the DefaultPlanId field value if set, zero value otherwise. +func (o *PlanList) GetDefaultPlanId() string { + if o == nil || IsNil(o.DefaultPlanId) { + var ret string + return ret + } + return *o.DefaultPlanId +} + +// GetDefaultPlanIdOk returns a tuple with the DefaultPlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanList) GetDefaultPlanIdOk() (*string, bool) { + if o == nil || IsNil(o.DefaultPlanId) { + return nil, false + } + return o.DefaultPlanId, true +} + +// HasDefaultPlanId returns a boolean if a field has been set. +func (o *PlanList) HasDefaultPlanId() bool { + if o != nil && !IsNil(o.DefaultPlanId) { + return true + } + + return false +} + +// SetDefaultPlanId gets a reference to the given string and assigns it to the DefaultPlanId field. +func (o *PlanList) SetDefaultPlanId(v string) { + o.DefaultPlanId = &v +} + +// GetPlans returns the Plans field value if set, zero value otherwise. +func (o *PlanList) GetPlans() []Plan { + if o == nil || IsNil(o.Plans) { + var ret []Plan + return ret + } + return o.Plans +} + +// GetPlansOk returns a tuple with the Plans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanList) GetPlansOk() ([]Plan, bool) { + if o == nil || IsNil(o.Plans) { + return nil, false + } + return o.Plans, true +} + +// HasPlans returns a boolean if a field has been set. +func (o *PlanList) HasPlans() bool { + if o != nil && !IsNil(o.Plans) { + return true + } + + return false +} + +// SetPlans gets a reference to the given []Plan and assigns it to the Plans field. +func (o *PlanList) SetPlans(v []Plan) { + o.Plans = v +} + +func (o PlanList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PlanList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DefaultPlanId) { + toSerialize["defaultPlanId"] = o.DefaultPlanId + } + if !IsNil(o.Plans) { + toSerialize["plans"] = o.Plans + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PlanList) UnmarshalJSON(data []byte) (err error) { + varPlanList := _PlanList{} + + err = json.Unmarshal(data, &varPlanList) + + if err != nil { + return err + } + + *o = PlanList(varPlanList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "defaultPlanId") + delete(additionalProperties, "plans") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePlanList struct { + value *PlanList + isSet bool +} + +func (v NullablePlanList) Get() *PlanList { + return v.value +} + +func (v *NullablePlanList) Set(val *PlanList) { + v.value = val + v.isSet = true +} + +func (v NullablePlanList) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanList(val *PlanList) *NullablePlanList { + return &NullablePlanList{value: val, isSet: true} +} + +func (v NullablePlanList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_quota.go b/services/vpn/v1beta1api/model_quota.go new file mode 100644 index 000000000..5e24844fe --- /dev/null +++ b/services/vpn/v1beta1api/model_quota.go @@ -0,0 +1,195 @@ +/* +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" + "fmt" +) + +// checks if the Quota type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Quota{} + +// Quota struct for Quota +type Quota struct { + Limit int32 `json:"limit"` + Usage int32 `json:"usage"` + AdditionalProperties map[string]interface{} +} + +type _Quota Quota + +// NewQuota instantiates a new Quota 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 NewQuota(limit int32, usage int32) *Quota { + this := Quota{} + this.Limit = limit + this.Usage = usage + return &this +} + +// NewQuotaWithDefaults instantiates a new Quota 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 NewQuotaWithDefaults() *Quota { + this := Quota{} + return &this +} + +// GetLimit returns the Limit field value +func (o *Quota) GetLimit() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *Quota) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Limit, true +} + +// SetLimit sets field value +func (o *Quota) SetLimit(v int32) { + o.Limit = v +} + +// GetUsage returns the Usage field value +func (o *Quota) GetUsage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Usage +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *Quota) GetUsageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Usage, true +} + +// SetUsage sets field value +func (o *Quota) SetUsage(v int32) { + o.Usage = v +} + +func (o Quota) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Quota) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["limit"] = o.Limit + toSerialize["usage"] = o.Usage + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Quota) 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{ + "limit", + "usage", + } + + 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) + } + } + + varQuota := _Quota{} + + err = json.Unmarshal(data, &varQuota) + + if err != nil { + return err + } + + *o = Quota(varQuota) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "limit") + delete(additionalProperties, "usage") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableQuota struct { + value *Quota + isSet bool +} + +func (v NullableQuota) Get() *Quota { + return v.value +} + +func (v *NullableQuota) Set(val *Quota) { + v.value = val + v.isSet = true +} + +func (v NullableQuota) IsSet() bool { + return v.isSet +} + +func (v *NullableQuota) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuota(val *Quota) *NullableQuota { + return &NullableQuota{value: val, isSet: true} +} + +func (v NullableQuota) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuota) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_quota_list.go b/services/vpn/v1beta1api/model_quota_list.go new file mode 100644 index 000000000..43010fd8a --- /dev/null +++ b/services/vpn/v1beta1api/model_quota_list.go @@ -0,0 +1,167 @@ +/* +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" + "fmt" +) + +// checks if the QuotaList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaList{} + +// QuotaList struct for QuotaList +type QuotaList struct { + // Current limit and usage for VPN gateways. + Gateways Quota `json:"gateways"` + AdditionalProperties map[string]interface{} +} + +type _QuotaList QuotaList + +// NewQuotaList instantiates a new QuotaList 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 NewQuotaList(gateways Quota) *QuotaList { + this := QuotaList{} + this.Gateways = gateways + return &this +} + +// NewQuotaListWithDefaults instantiates a new QuotaList 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 NewQuotaListWithDefaults() *QuotaList { + this := QuotaList{} + return &this +} + +// GetGateways returns the Gateways field value +func (o *QuotaList) GetGateways() Quota { + if o == nil { + var ret Quota + return ret + } + + return o.Gateways +} + +// GetGatewaysOk returns a tuple with the Gateways field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetGatewaysOk() (*Quota, bool) { + if o == nil { + return nil, false + } + return &o.Gateways, true +} + +// SetGateways sets field value +func (o *QuotaList) SetGateways(v Quota) { + o.Gateways = v +} + +func (o QuotaList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o QuotaList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["gateways"] = o.Gateways + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *QuotaList) 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{ + "gateways", + } + + 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) + } + } + + varQuotaList := _QuotaList{} + + err = json.Unmarshal(data, &varQuotaList) + + if err != nil { + return err + } + + *o = QuotaList(varQuotaList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "gateways") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableQuotaList struct { + value *QuotaList + isSet bool +} + +func (v NullableQuotaList) Get() *QuotaList { + return v.value +} + +func (v *NullableQuotaList) Set(val *QuotaList) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaList) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaList(val *QuotaList) *NullableQuotaList { + return &NullableQuotaList{value: val, isSet: true} +} + +func (v NullableQuotaList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_quota_list_response.go b/services/vpn/v1beta1api/model_quota_list_response.go new file mode 100644 index 000000000..70586f984 --- /dev/null +++ b/services/vpn/v1beta1api/model_quota_list_response.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: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the QuotaListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListResponse{} + +// QuotaListResponse struct for QuotaListResponse +type QuotaListResponse struct { + Quotas QuotaList `json:"quotas"` + AdditionalProperties map[string]interface{} +} + +type _QuotaListResponse QuotaListResponse + +// NewQuotaListResponse instantiates a new QuotaListResponse 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 NewQuotaListResponse(quotas QuotaList) *QuotaListResponse { + this := QuotaListResponse{} + this.Quotas = quotas + return &this +} + +// NewQuotaListResponseWithDefaults instantiates a new QuotaListResponse 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 NewQuotaListResponseWithDefaults() *QuotaListResponse { + this := QuotaListResponse{} + return &this +} + +// GetQuotas returns the Quotas field value +func (o *QuotaListResponse) GetQuotas() QuotaList { + if o == nil { + var ret QuotaList + return ret + } + + return o.Quotas +} + +// GetQuotasOk returns a tuple with the Quotas field value +// and a boolean to check if the value has been set. +func (o *QuotaListResponse) GetQuotasOk() (*QuotaList, bool) { + if o == nil { + return nil, false + } + return &o.Quotas, true +} + +// SetQuotas sets field value +func (o *QuotaListResponse) SetQuotas(v QuotaList) { + o.Quotas = v +} + +func (o QuotaListResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o QuotaListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["quotas"] = o.Quotas + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *QuotaListResponse) 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{ + "quotas", + } + + 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) + } + } + + varQuotaListResponse := _QuotaListResponse{} + + err = json.Unmarshal(data, &varQuotaListResponse) + + if err != nil { + return err + } + + *o = QuotaListResponse(varQuotaListResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "quotas") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableQuotaListResponse struct { + value *QuotaListResponse + isSet bool +} + +func (v NullableQuotaListResponse) Get() *QuotaListResponse { + return v.value +} + +func (v *NullableQuotaListResponse) Set(val *QuotaListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListResponse(val *QuotaListResponse) *NullableQuotaListResponse { + return &NullableQuotaListResponse{value: val, isSet: true} +} + +func (v NullableQuotaListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_region.go b/services/vpn/v1beta1api/model_region.go new file mode 100644 index 000000000..5c9e26479 --- /dev/null +++ b/services/vpn/v1beta1api/model_region.go @@ -0,0 +1,110 @@ +/* +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" + "fmt" +) + +// Region The region in which the resource is located. +type Region string + +// List of Region +const ( + REGION_EU01 Region = "eu01" + REGION_EU02 Region = "eu02" +) + +// All allowed values of Region enum +var AllowedRegionEnumValues = []Region{ + "eu01", + "eu02", +} + +func (v *Region) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Region(value) + for _, existing := range AllowedRegionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Region", value) +} + +// NewRegionFromValue returns a pointer to a valid Region +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRegionFromValue(v string) (*Region, error) { + ev := Region(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Region: valid values are %v", v, AllowedRegionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Region) IsValid() bool { + for _, existing := range AllowedRegionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Region value +func (v Region) Ptr() *Region { + return &v +} + +type NullableRegion struct { + value *Region + isSet bool +} + +func (v NullableRegion) Get() *Region { + return v.value +} + +func (v *NullableRegion) Set(val *Region) { + v.value = val + v.isSet = true +} + +func (v NullableRegion) IsSet() bool { + return v.isSet +} + +func (v *NullableRegion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegion(val *Region) *NullableRegion { + return &NullableRegion{value: val, isSet: true} +} + +func (v NullableRegion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_routing_type.go b/services/vpn/v1beta1api/model_routing_type.go new file mode 100644 index 000000000..11f91bae3 --- /dev/null +++ b/services/vpn/v1beta1api/model_routing_type.go @@ -0,0 +1,112 @@ +/* +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" + "fmt" +) + +// RoutingType the model 'RoutingType' +type RoutingType string + +// List of RoutingType +const ( + ROUTINGTYPE_POLICY_BASED RoutingType = "POLICY_BASED" + ROUTINGTYPE_ROUTE_BASED RoutingType = "ROUTE_BASED" + ROUTINGTYPE_BGP_ROUTE_BASED RoutingType = "BGP_ROUTE_BASED" +) + +// All allowed values of RoutingType enum +var AllowedRoutingTypeEnumValues = []RoutingType{ + "POLICY_BASED", + "ROUTE_BASED", + "BGP_ROUTE_BASED", +} + +func (v *RoutingType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := RoutingType(value) + for _, existing := range AllowedRoutingTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid RoutingType", value) +} + +// NewRoutingTypeFromValue returns a pointer to a valid RoutingType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRoutingTypeFromValue(v string) (*RoutingType, error) { + ev := RoutingType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RoutingType: valid values are %v", v, AllowedRoutingTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RoutingType) IsValid() bool { + for _, existing := range AllowedRoutingTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RoutingType value +func (v RoutingType) Ptr() *RoutingType { + return &v +} + +type NullableRoutingType struct { + value *RoutingType + isSet bool +} + +func (v NullableRoutingType) Get() *RoutingType { + return v.value +} + +func (v *NullableRoutingType) Set(val *RoutingType) { + v.value = val + v.isSet = true +} + +func (v NullableRoutingType) IsSet() bool { + return v.isSet +} + +func (v *NullableRoutingType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoutingType(val *RoutingType) *NullableRoutingType { + return &NullableRoutingType{value: val, isSet: true} +} + +func (v NullableRoutingType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoutingType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_tunnel_configuration.go b/services/vpn/v1beta1api/model_tunnel_configuration.go new file mode 100644 index 000000000..6b127943a --- /dev/null +++ b/services/vpn/v1beta1api/model_tunnel_configuration.go @@ -0,0 +1,336 @@ +/* +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" + "fmt" +) + +// checks if the TunnelConfiguration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelConfiguration{} + +// TunnelConfiguration struct for TunnelConfiguration +type TunnelConfiguration struct { + Bgp *BGPTunnelConfig `json:"bgp,omitempty"` + Peering *PeeringConfig `json:"peering,omitempty"` + Phase1 TunnelConfigurationPhase1 `json:"phase1"` + Phase2 TunnelConfigurationPhase2 `json:"phase2"` + // A Pre-Shared Key for authentication. Required in create-requests, optional in update-requests and omitted in every response. + PreSharedKey *string `json:"preSharedKey,omitempty"` + RemoteAddress string `json:"remoteAddress" validate:"regexp=^((25[0-5]|(2[0-4]|1\\\\d|[1-9]|)\\\\d)\\\\.?\\\\b){4}$"` + AdditionalProperties map[string]interface{} +} + +type _TunnelConfiguration TunnelConfiguration + +// NewTunnelConfiguration instantiates a new TunnelConfiguration 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 NewTunnelConfiguration(phase1 TunnelConfigurationPhase1, phase2 TunnelConfigurationPhase2, remoteAddress string) *TunnelConfiguration { + this := TunnelConfiguration{} + this.Phase1 = phase1 + this.Phase2 = phase2 + this.RemoteAddress = remoteAddress + return &this +} + +// NewTunnelConfigurationWithDefaults instantiates a new TunnelConfiguration 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 NewTunnelConfigurationWithDefaults() *TunnelConfiguration { + this := TunnelConfiguration{} + return &this +} + +// GetBgp returns the Bgp field value if set, zero value otherwise. +func (o *TunnelConfiguration) GetBgp() BGPTunnelConfig { + if o == nil || IsNil(o.Bgp) { + var ret BGPTunnelConfig + return ret + } + return *o.Bgp +} + +// GetBgpOk returns a tuple with the Bgp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetBgpOk() (*BGPTunnelConfig, bool) { + if o == nil || IsNil(o.Bgp) { + return nil, false + } + return o.Bgp, true +} + +// HasBgp returns a boolean if a field has been set. +func (o *TunnelConfiguration) HasBgp() bool { + if o != nil && !IsNil(o.Bgp) { + return true + } + + return false +} + +// SetBgp gets a reference to the given BGPTunnelConfig and assigns it to the Bgp field. +func (o *TunnelConfiguration) SetBgp(v BGPTunnelConfig) { + o.Bgp = &v +} + +// GetPeering returns the Peering field value if set, zero value otherwise. +func (o *TunnelConfiguration) GetPeering() PeeringConfig { + if o == nil || IsNil(o.Peering) { + var ret PeeringConfig + return ret + } + return *o.Peering +} + +// GetPeeringOk returns a tuple with the Peering field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetPeeringOk() (*PeeringConfig, bool) { + if o == nil || IsNil(o.Peering) { + return nil, false + } + return o.Peering, true +} + +// HasPeering returns a boolean if a field has been set. +func (o *TunnelConfiguration) HasPeering() bool { + if o != nil && !IsNil(o.Peering) { + return true + } + + return false +} + +// SetPeering gets a reference to the given PeeringConfig and assigns it to the Peering field. +func (o *TunnelConfiguration) SetPeering(v PeeringConfig) { + o.Peering = &v +} + +// GetPhase1 returns the Phase1 field value +func (o *TunnelConfiguration) GetPhase1() TunnelConfigurationPhase1 { + if o == nil { + var ret TunnelConfigurationPhase1 + return ret + } + + return o.Phase1 +} + +// GetPhase1Ok returns a tuple with the Phase1 field value +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetPhase1Ok() (*TunnelConfigurationPhase1, bool) { + if o == nil { + return nil, false + } + return &o.Phase1, true +} + +// SetPhase1 sets field value +func (o *TunnelConfiguration) SetPhase1(v TunnelConfigurationPhase1) { + o.Phase1 = v +} + +// GetPhase2 returns the Phase2 field value +func (o *TunnelConfiguration) GetPhase2() TunnelConfigurationPhase2 { + if o == nil { + var ret TunnelConfigurationPhase2 + return ret + } + + return o.Phase2 +} + +// GetPhase2Ok returns a tuple with the Phase2 field value +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetPhase2Ok() (*TunnelConfigurationPhase2, bool) { + if o == nil { + return nil, false + } + return &o.Phase2, true +} + +// SetPhase2 sets field value +func (o *TunnelConfiguration) SetPhase2(v TunnelConfigurationPhase2) { + o.Phase2 = v +} + +// GetPreSharedKey returns the PreSharedKey field value if set, zero value otherwise. +func (o *TunnelConfiguration) GetPreSharedKey() string { + if o == nil || IsNil(o.PreSharedKey) { + var ret string + return ret + } + return *o.PreSharedKey +} + +// GetPreSharedKeyOk returns a tuple with the PreSharedKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetPreSharedKeyOk() (*string, bool) { + if o == nil || IsNil(o.PreSharedKey) { + return nil, false + } + return o.PreSharedKey, true +} + +// HasPreSharedKey returns a boolean if a field has been set. +func (o *TunnelConfiguration) HasPreSharedKey() bool { + if o != nil && !IsNil(o.PreSharedKey) { + return true + } + + return false +} + +// SetPreSharedKey gets a reference to the given string and assigns it to the PreSharedKey field. +func (o *TunnelConfiguration) SetPreSharedKey(v string) { + o.PreSharedKey = &v +} + +// GetRemoteAddress returns the RemoteAddress field value +func (o *TunnelConfiguration) GetRemoteAddress() string { + if o == nil { + var ret string + return ret + } + + return o.RemoteAddress +} + +// GetRemoteAddressOk returns a tuple with the RemoteAddress field value +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetRemoteAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RemoteAddress, true +} + +// SetRemoteAddress sets field value +func (o *TunnelConfiguration) SetRemoteAddress(v string) { + o.RemoteAddress = v +} + +func (o TunnelConfiguration) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TunnelConfiguration) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Bgp) { + toSerialize["bgp"] = o.Bgp + } + if !IsNil(o.Peering) { + toSerialize["peering"] = o.Peering + } + toSerialize["phase1"] = o.Phase1 + toSerialize["phase2"] = o.Phase2 + if !IsNil(o.PreSharedKey) { + toSerialize["preSharedKey"] = o.PreSharedKey + } + toSerialize["remoteAddress"] = o.RemoteAddress + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TunnelConfiguration) 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{ + "phase1", + "phase2", + "remoteAddress", + } + + 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) + } + } + + varTunnelConfiguration := _TunnelConfiguration{} + + err = json.Unmarshal(data, &varTunnelConfiguration) + + if err != nil { + return err + } + + *o = TunnelConfiguration(varTunnelConfiguration) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgp") + delete(additionalProperties, "peering") + delete(additionalProperties, "phase1") + delete(additionalProperties, "phase2") + delete(additionalProperties, "preSharedKey") + delete(additionalProperties, "remoteAddress") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTunnelConfiguration struct { + value *TunnelConfiguration + isSet bool +} + +func (v NullableTunnelConfiguration) Get() *TunnelConfiguration { + return v.value +} + +func (v *NullableTunnelConfiguration) Set(val *TunnelConfiguration) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfiguration) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfiguration) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfiguration(val *TunnelConfiguration) *NullableTunnelConfiguration { + return &NullableTunnelConfiguration{value: val, isSet: true} +} + +func (v NullableTunnelConfiguration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfiguration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_tunnel_configuration_phase1.go b/services/vpn/v1beta1api/model_tunnel_configuration_phase1.go new file mode 100644 index 000000000..e09b16dd0 --- /dev/null +++ b/services/vpn/v1beta1api/model_tunnel_configuration_phase1.go @@ -0,0 +1,275 @@ +/* +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" + "fmt" +) + +// checks if the TunnelConfigurationPhase1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelConfigurationPhase1{} + +// TunnelConfigurationPhase1 struct for TunnelConfigurationPhase1 +type TunnelConfigurationPhase1 struct { + // The Diffie-Hellman Group. Required, except if AEAD algorithms are selected. + DhGroups []string `json:"dhGroups,omitempty"` + EncryptionAlgorithms []string `json:"encryptionAlgorithms"` + IntegrityAlgorithms []string `json:"integrityAlgorithms"` + // Time to schedule a IKE re-keying (in seconds). + RekeyTime *int32 `json:"rekeyTime,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TunnelConfigurationPhase1 TunnelConfigurationPhase1 + +// NewTunnelConfigurationPhase1 instantiates a new TunnelConfigurationPhase1 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 NewTunnelConfigurationPhase1(encryptionAlgorithms []string, integrityAlgorithms []string) *TunnelConfigurationPhase1 { + this := TunnelConfigurationPhase1{} + this.EncryptionAlgorithms = encryptionAlgorithms + this.IntegrityAlgorithms = integrityAlgorithms + var rekeyTime int32 = 14400 + this.RekeyTime = &rekeyTime + return &this +} + +// NewTunnelConfigurationPhase1WithDefaults instantiates a new TunnelConfigurationPhase1 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 NewTunnelConfigurationPhase1WithDefaults() *TunnelConfigurationPhase1 { + this := TunnelConfigurationPhase1{} + var rekeyTime int32 = 14400 + this.RekeyTime = &rekeyTime + return &this +} + +// GetDhGroups returns the DhGroups field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase1) GetDhGroups() []string { + if o == nil || IsNil(o.DhGroups) { + var ret []string + return ret + } + return o.DhGroups +} + +// GetDhGroupsOk returns a tuple with the DhGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1) GetDhGroupsOk() ([]string, bool) { + if o == nil || IsNil(o.DhGroups) { + return nil, false + } + return o.DhGroups, true +} + +// HasDhGroups returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase1) HasDhGroups() bool { + if o != nil && !IsNil(o.DhGroups) { + return true + } + + return false +} + +// SetDhGroups gets a reference to the given []string and assigns it to the DhGroups field. +func (o *TunnelConfigurationPhase1) SetDhGroups(v []string) { + o.DhGroups = v +} + +// GetEncryptionAlgorithms returns the EncryptionAlgorithms field value +func (o *TunnelConfigurationPhase1) GetEncryptionAlgorithms() []string { + if o == nil { + var ret []string + return ret + } + + return o.EncryptionAlgorithms +} + +// GetEncryptionAlgorithmsOk returns a tuple with the EncryptionAlgorithms field value +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1) GetEncryptionAlgorithmsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.EncryptionAlgorithms, true +} + +// SetEncryptionAlgorithms sets field value +func (o *TunnelConfigurationPhase1) SetEncryptionAlgorithms(v []string) { + o.EncryptionAlgorithms = v +} + +// GetIntegrityAlgorithms returns the IntegrityAlgorithms field value +func (o *TunnelConfigurationPhase1) GetIntegrityAlgorithms() []string { + if o == nil { + var ret []string + return ret + } + + return o.IntegrityAlgorithms +} + +// GetIntegrityAlgorithmsOk returns a tuple with the IntegrityAlgorithms field value +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1) GetIntegrityAlgorithmsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.IntegrityAlgorithms, true +} + +// SetIntegrityAlgorithms sets field value +func (o *TunnelConfigurationPhase1) SetIntegrityAlgorithms(v []string) { + o.IntegrityAlgorithms = v +} + +// GetRekeyTime returns the RekeyTime field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase1) GetRekeyTime() int32 { + if o == nil || IsNil(o.RekeyTime) { + var ret int32 + return ret + } + return *o.RekeyTime +} + +// GetRekeyTimeOk returns a tuple with the RekeyTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1) GetRekeyTimeOk() (*int32, bool) { + if o == nil || IsNil(o.RekeyTime) { + return nil, false + } + return o.RekeyTime, true +} + +// HasRekeyTime returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase1) HasRekeyTime() bool { + if o != nil && !IsNil(o.RekeyTime) { + return true + } + + return false +} + +// SetRekeyTime gets a reference to the given int32 and assigns it to the RekeyTime field. +func (o *TunnelConfigurationPhase1) SetRekeyTime(v int32) { + o.RekeyTime = &v +} + +func (o TunnelConfigurationPhase1) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TunnelConfigurationPhase1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DhGroups) { + toSerialize["dhGroups"] = o.DhGroups + } + toSerialize["encryptionAlgorithms"] = o.EncryptionAlgorithms + toSerialize["integrityAlgorithms"] = o.IntegrityAlgorithms + if !IsNil(o.RekeyTime) { + toSerialize["rekeyTime"] = o.RekeyTime + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TunnelConfigurationPhase1) 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{ + "encryptionAlgorithms", + "integrityAlgorithms", + } + + 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) + } + } + + varTunnelConfigurationPhase1 := _TunnelConfigurationPhase1{} + + err = json.Unmarshal(data, &varTunnelConfigurationPhase1) + + if err != nil { + return err + } + + *o = TunnelConfigurationPhase1(varTunnelConfigurationPhase1) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "dhGroups") + delete(additionalProperties, "encryptionAlgorithms") + delete(additionalProperties, "integrityAlgorithms") + delete(additionalProperties, "rekeyTime") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTunnelConfigurationPhase1 struct { + value *TunnelConfigurationPhase1 + isSet bool +} + +func (v NullableTunnelConfigurationPhase1) Get() *TunnelConfigurationPhase1 { + return v.value +} + +func (v *NullableTunnelConfigurationPhase1) Set(val *TunnelConfigurationPhase1) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase1) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase1(val *TunnelConfigurationPhase1) *NullableTunnelConfigurationPhase1 { + return &NullableTunnelConfigurationPhase1{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_tunnel_configuration_phase2.go b/services/vpn/v1beta1api/model_tunnel_configuration_phase2.go new file mode 100644 index 000000000..6ab3a2299 --- /dev/null +++ b/services/vpn/v1beta1api/model_tunnel_configuration_phase2.go @@ -0,0 +1,359 @@ +/* +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" + "fmt" +) + +// checks if the TunnelConfigurationPhase2 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelConfigurationPhase2{} + +// TunnelConfigurationPhase2 struct for TunnelConfigurationPhase2 +type TunnelConfigurationPhase2 struct { + // The Diffie-Hellman Group. Required, except if AEAD algorithms are selected. + DhGroups []string `json:"dhGroups,omitempty"` + EncryptionAlgorithms []string `json:"encryptionAlgorithms"` + IntegrityAlgorithms []string `json:"integrityAlgorithms"` + // Action to perform for this CHILD_SA on DPD timeout. \"clear\": Closes the CHILD_SA and does not take further action. \"restart\": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA. + DpdAction *string `json:"dpdAction,omitempty"` + // Time to schedule a Child SA re-keying (in seconds). + RekeyTime *int32 `json:"rekeyTime,omitempty"` + // Action to perform after loading the connection configuration. \"none\": The connection will be loaded but needs to be manually initiated. \"start\": initiates the connection actively. + StartAction *string `json:"startAction,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TunnelConfigurationPhase2 TunnelConfigurationPhase2 + +// NewTunnelConfigurationPhase2 instantiates a new TunnelConfigurationPhase2 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 NewTunnelConfigurationPhase2(encryptionAlgorithms []string, integrityAlgorithms []string) *TunnelConfigurationPhase2 { + this := TunnelConfigurationPhase2{} + this.EncryptionAlgorithms = encryptionAlgorithms + this.IntegrityAlgorithms = integrityAlgorithms + var dpdAction string = "restart" + this.DpdAction = &dpdAction + var rekeyTime int32 = 3600 + this.RekeyTime = &rekeyTime + var startAction string = "start" + this.StartAction = &startAction + return &this +} + +// NewTunnelConfigurationPhase2WithDefaults instantiates a new TunnelConfigurationPhase2 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 NewTunnelConfigurationPhase2WithDefaults() *TunnelConfigurationPhase2 { + this := TunnelConfigurationPhase2{} + var dpdAction string = "restart" + this.DpdAction = &dpdAction + var rekeyTime int32 = 3600 + this.RekeyTime = &rekeyTime + var startAction string = "start" + this.StartAction = &startAction + return &this +} + +// GetDhGroups returns the DhGroups field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2) GetDhGroups() []string { + if o == nil || IsNil(o.DhGroups) { + var ret []string + return ret + } + return o.DhGroups +} + +// GetDhGroupsOk returns a tuple with the DhGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetDhGroupsOk() ([]string, bool) { + if o == nil || IsNil(o.DhGroups) { + return nil, false + } + return o.DhGroups, true +} + +// HasDhGroups returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2) HasDhGroups() bool { + if o != nil && !IsNil(o.DhGroups) { + return true + } + + return false +} + +// SetDhGroups gets a reference to the given []string and assigns it to the DhGroups field. +func (o *TunnelConfigurationPhase2) SetDhGroups(v []string) { + o.DhGroups = v +} + +// GetEncryptionAlgorithms returns the EncryptionAlgorithms field value +func (o *TunnelConfigurationPhase2) GetEncryptionAlgorithms() []string { + if o == nil { + var ret []string + return ret + } + + return o.EncryptionAlgorithms +} + +// GetEncryptionAlgorithmsOk returns a tuple with the EncryptionAlgorithms field value +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetEncryptionAlgorithmsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.EncryptionAlgorithms, true +} + +// SetEncryptionAlgorithms sets field value +func (o *TunnelConfigurationPhase2) SetEncryptionAlgorithms(v []string) { + o.EncryptionAlgorithms = v +} + +// GetIntegrityAlgorithms returns the IntegrityAlgorithms field value +func (o *TunnelConfigurationPhase2) GetIntegrityAlgorithms() []string { + if o == nil { + var ret []string + return ret + } + + return o.IntegrityAlgorithms +} + +// GetIntegrityAlgorithmsOk returns a tuple with the IntegrityAlgorithms field value +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetIntegrityAlgorithmsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.IntegrityAlgorithms, true +} + +// SetIntegrityAlgorithms sets field value +func (o *TunnelConfigurationPhase2) SetIntegrityAlgorithms(v []string) { + o.IntegrityAlgorithms = v +} + +// GetDpdAction returns the DpdAction field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2) GetDpdAction() string { + if o == nil || IsNil(o.DpdAction) { + var ret string + return ret + } + return *o.DpdAction +} + +// GetDpdActionOk returns a tuple with the DpdAction field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetDpdActionOk() (*string, bool) { + if o == nil || IsNil(o.DpdAction) { + return nil, false + } + return o.DpdAction, true +} + +// HasDpdAction returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2) HasDpdAction() bool { + if o != nil && !IsNil(o.DpdAction) { + return true + } + + return false +} + +// SetDpdAction gets a reference to the given string and assigns it to the DpdAction field. +func (o *TunnelConfigurationPhase2) SetDpdAction(v string) { + o.DpdAction = &v +} + +// GetRekeyTime returns the RekeyTime field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2) GetRekeyTime() int32 { + if o == nil || IsNil(o.RekeyTime) { + var ret int32 + return ret + } + return *o.RekeyTime +} + +// GetRekeyTimeOk returns a tuple with the RekeyTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetRekeyTimeOk() (*int32, bool) { + if o == nil || IsNil(o.RekeyTime) { + return nil, false + } + return o.RekeyTime, true +} + +// HasRekeyTime returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2) HasRekeyTime() bool { + if o != nil && !IsNil(o.RekeyTime) { + return true + } + + return false +} + +// SetRekeyTime gets a reference to the given int32 and assigns it to the RekeyTime field. +func (o *TunnelConfigurationPhase2) SetRekeyTime(v int32) { + o.RekeyTime = &v +} + +// GetStartAction returns the StartAction field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2) GetStartAction() string { + if o == nil || IsNil(o.StartAction) { + var ret string + return ret + } + return *o.StartAction +} + +// GetStartActionOk returns a tuple with the StartAction field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetStartActionOk() (*string, bool) { + if o == nil || IsNil(o.StartAction) { + return nil, false + } + return o.StartAction, true +} + +// HasStartAction returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2) HasStartAction() bool { + if o != nil && !IsNil(o.StartAction) { + return true + } + + return false +} + +// SetStartAction gets a reference to the given string and assigns it to the StartAction field. +func (o *TunnelConfigurationPhase2) SetStartAction(v string) { + o.StartAction = &v +} + +func (o TunnelConfigurationPhase2) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TunnelConfigurationPhase2) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DhGroups) { + toSerialize["dhGroups"] = o.DhGroups + } + toSerialize["encryptionAlgorithms"] = o.EncryptionAlgorithms + toSerialize["integrityAlgorithms"] = o.IntegrityAlgorithms + if !IsNil(o.DpdAction) { + toSerialize["dpdAction"] = o.DpdAction + } + if !IsNil(o.RekeyTime) { + toSerialize["rekeyTime"] = o.RekeyTime + } + if !IsNil(o.StartAction) { + toSerialize["startAction"] = o.StartAction + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TunnelConfigurationPhase2) 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{ + "encryptionAlgorithms", + "integrityAlgorithms", + } + + 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) + } + } + + varTunnelConfigurationPhase2 := _TunnelConfigurationPhase2{} + + err = json.Unmarshal(data, &varTunnelConfigurationPhase2) + + if err != nil { + return err + } + + *o = TunnelConfigurationPhase2(varTunnelConfigurationPhase2) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "dhGroups") + delete(additionalProperties, "encryptionAlgorithms") + delete(additionalProperties, "integrityAlgorithms") + delete(additionalProperties, "dpdAction") + delete(additionalProperties, "rekeyTime") + delete(additionalProperties, "startAction") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTunnelConfigurationPhase2 struct { + value *TunnelConfigurationPhase2 + isSet bool +} + +func (v NullableTunnelConfigurationPhase2) Get() *TunnelConfigurationPhase2 { + return v.value +} + +func (v *NullableTunnelConfigurationPhase2) Set(val *TunnelConfigurationPhase2) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase2) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase2) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase2(val *TunnelConfigurationPhase2) *NullableTunnelConfigurationPhase2 { + return &NullableTunnelConfigurationPhase2{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase2) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase2) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_tunnel_status.go b/services/vpn/v1beta1api/model_tunnel_status.go new file mode 100644 index 000000000..b28d19b42 --- /dev/null +++ b/services/vpn/v1beta1api/model_tunnel_status.go @@ -0,0 +1,264 @@ +/* +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 TunnelStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelStatus{} + +// TunnelStatus Describes the status of the VPN itself. +type TunnelStatus struct { + Established *bool `json:"established,omitempty"` + Name *string `json:"name,omitempty"` + Phase1 *Phase1Status `json:"phase1,omitempty"` + Phase2 *Phase2Status `json:"phase2,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TunnelStatus TunnelStatus + +// NewTunnelStatus instantiates a new TunnelStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTunnelStatus() *TunnelStatus { + this := TunnelStatus{} + return &this +} + +// NewTunnelStatusWithDefaults instantiates a new TunnelStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTunnelStatusWithDefaults() *TunnelStatus { + this := TunnelStatus{} + return &this +} + +// GetEstablished returns the Established field value if set, zero value otherwise. +func (o *TunnelStatus) GetEstablished() bool { + if o == nil || IsNil(o.Established) { + var ret bool + return ret + } + return *o.Established +} + +// GetEstablishedOk returns a tuple with the Established field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelStatus) GetEstablishedOk() (*bool, bool) { + if o == nil || IsNil(o.Established) { + return nil, false + } + return o.Established, true +} + +// HasEstablished returns a boolean if a field has been set. +func (o *TunnelStatus) HasEstablished() bool { + if o != nil && !IsNil(o.Established) { + return true + } + + return false +} + +// SetEstablished gets a reference to the given bool and assigns it to the Established field. +func (o *TunnelStatus) SetEstablished(v bool) { + o.Established = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TunnelStatus) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelStatus) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TunnelStatus) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TunnelStatus) SetName(v string) { + o.Name = &v +} + +// GetPhase1 returns the Phase1 field value if set, zero value otherwise. +func (o *TunnelStatus) GetPhase1() Phase1Status { + if o == nil || IsNil(o.Phase1) { + var ret Phase1Status + return ret + } + return *o.Phase1 +} + +// GetPhase1Ok returns a tuple with the Phase1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelStatus) GetPhase1Ok() (*Phase1Status, bool) { + if o == nil || IsNil(o.Phase1) { + return nil, false + } + return o.Phase1, true +} + +// HasPhase1 returns a boolean if a field has been set. +func (o *TunnelStatus) HasPhase1() bool { + if o != nil && !IsNil(o.Phase1) { + return true + } + + return false +} + +// SetPhase1 gets a reference to the given Phase1Status and assigns it to the Phase1 field. +func (o *TunnelStatus) SetPhase1(v Phase1Status) { + o.Phase1 = &v +} + +// GetPhase2 returns the Phase2 field value if set, zero value otherwise. +func (o *TunnelStatus) GetPhase2() Phase2Status { + if o == nil || IsNil(o.Phase2) { + var ret Phase2Status + return ret + } + return *o.Phase2 +} + +// GetPhase2Ok returns a tuple with the Phase2 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelStatus) GetPhase2Ok() (*Phase2Status, bool) { + if o == nil || IsNil(o.Phase2) { + return nil, false + } + return o.Phase2, true +} + +// HasPhase2 returns a boolean if a field has been set. +func (o *TunnelStatus) HasPhase2() bool { + if o != nil && !IsNil(o.Phase2) { + return true + } + + return false +} + +// SetPhase2 gets a reference to the given Phase2Status and assigns it to the Phase2 field. +func (o *TunnelStatus) SetPhase2(v Phase2Status) { + o.Phase2 = &v +} + +func (o TunnelStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TunnelStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Established) { + toSerialize["established"] = o.Established + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Phase1) { + toSerialize["phase1"] = o.Phase1 + } + if !IsNil(o.Phase2) { + toSerialize["phase2"] = o.Phase2 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TunnelStatus) UnmarshalJSON(data []byte) (err error) { + varTunnelStatus := _TunnelStatus{} + + err = json.Unmarshal(data, &varTunnelStatus) + + if err != nil { + return err + } + + *o = TunnelStatus(varTunnelStatus) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "established") + delete(additionalProperties, "name") + delete(additionalProperties, "phase1") + delete(additionalProperties, "phase2") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTunnelStatus struct { + value *TunnelStatus + isSet bool +} + +func (v NullableTunnelStatus) Get() *TunnelStatus { + return v.value +} + +func (v *NullableTunnelStatus) Set(val *TunnelStatus) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelStatus(val *TunnelStatus) *NullableTunnelStatus { + return &NullableTunnelStatus{value: val, isSet: true} +} + +func (v NullableTunnelStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_update_gateway_connection_payload.go b/services/vpn/v1beta1api/model_update_gateway_connection_payload.go new file mode 100644 index 000000000..3ff424176 --- /dev/null +++ b/services/vpn/v1beta1api/model_update_gateway_connection_payload.go @@ -0,0 +1,377 @@ +/* +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" + "fmt" +) + +// checks if the UpdateGatewayConnectionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGatewayConnectionPayload{} + +// UpdateGatewayConnectionPayload struct for UpdateGatewayConnectionPayload +type UpdateGatewayConnectionPayload struct { + // A user-friendly name for the connection. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"` + // This flag decides whether this connection should be enabled or disabled + Enabled *bool `json:"enabled,omitempty"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + LocalSubnets []string `json:"localSubnets,omitempty"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + RemoteSubnets []string `json:"remoteSubnets,omitempty"` + // Optional. Use this for route-based VPN. + StaticRoutes []string `json:"staticRoutes,omitempty"` + Tunnel1 TunnelConfiguration `json:"tunnel1"` + Tunnel2 TunnelConfiguration `json:"tunnel2"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGatewayConnectionPayload UpdateGatewayConnectionPayload + +// NewUpdateGatewayConnectionPayload instantiates a new UpdateGatewayConnectionPayload 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 NewUpdateGatewayConnectionPayload(displayName string, tunnel1 TunnelConfiguration, tunnel2 TunnelConfiguration) *UpdateGatewayConnectionPayload { + this := UpdateGatewayConnectionPayload{} + this.DisplayName = displayName + this.Tunnel1 = tunnel1 + this.Tunnel2 = tunnel2 + return &this +} + +// NewUpdateGatewayConnectionPayloadWithDefaults instantiates a new UpdateGatewayConnectionPayload 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 NewUpdateGatewayConnectionPayloadWithDefaults() *UpdateGatewayConnectionPayload { + this := UpdateGatewayConnectionPayload{} + return &this +} + +// GetDisplayName returns the DisplayName field value +func (o *UpdateGatewayConnectionPayload) 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 *UpdateGatewayConnectionPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *UpdateGatewayConnectionPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *UpdateGatewayConnectionPayload) GetEnabled() bool { + if o == nil || IsNil(o.Enabled) { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *UpdateGatewayConnectionPayload) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *UpdateGatewayConnectionPayload) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetLocalSubnets returns the LocalSubnets field value if set, zero value otherwise. +func (o *UpdateGatewayConnectionPayload) GetLocalSubnets() []string { + if o == nil || IsNil(o.LocalSubnets) { + var ret []string + return ret + } + return o.LocalSubnets +} + +// GetLocalSubnetsOk returns a tuple with the LocalSubnets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetLocalSubnetsOk() ([]string, bool) { + if o == nil || IsNil(o.LocalSubnets) { + return nil, false + } + return o.LocalSubnets, true +} + +// HasLocalSubnets returns a boolean if a field has been set. +func (o *UpdateGatewayConnectionPayload) HasLocalSubnets() bool { + if o != nil && !IsNil(o.LocalSubnets) { + return true + } + + return false +} + +// SetLocalSubnets gets a reference to the given []string and assigns it to the LocalSubnets field. +func (o *UpdateGatewayConnectionPayload) SetLocalSubnets(v []string) { + o.LocalSubnets = v +} + +// GetRemoteSubnets returns the RemoteSubnets field value if set, zero value otherwise. +func (o *UpdateGatewayConnectionPayload) GetRemoteSubnets() []string { + if o == nil || IsNil(o.RemoteSubnets) { + var ret []string + return ret + } + return o.RemoteSubnets +} + +// GetRemoteSubnetsOk returns a tuple with the RemoteSubnets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetRemoteSubnetsOk() ([]string, bool) { + if o == nil || IsNil(o.RemoteSubnets) { + return nil, false + } + return o.RemoteSubnets, true +} + +// HasRemoteSubnets returns a boolean if a field has been set. +func (o *UpdateGatewayConnectionPayload) HasRemoteSubnets() bool { + if o != nil && !IsNil(o.RemoteSubnets) { + return true + } + + return false +} + +// SetRemoteSubnets gets a reference to the given []string and assigns it to the RemoteSubnets field. +func (o *UpdateGatewayConnectionPayload) SetRemoteSubnets(v []string) { + o.RemoteSubnets = v +} + +// GetStaticRoutes returns the StaticRoutes field value if set, zero value otherwise. +func (o *UpdateGatewayConnectionPayload) GetStaticRoutes() []string { + if o == nil || IsNil(o.StaticRoutes) { + var ret []string + return ret + } + return o.StaticRoutes +} + +// GetStaticRoutesOk returns a tuple with the StaticRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetStaticRoutesOk() ([]string, bool) { + if o == nil || IsNil(o.StaticRoutes) { + return nil, false + } + return o.StaticRoutes, true +} + +// HasStaticRoutes returns a boolean if a field has been set. +func (o *UpdateGatewayConnectionPayload) HasStaticRoutes() bool { + if o != nil && !IsNil(o.StaticRoutes) { + return true + } + + return false +} + +// SetStaticRoutes gets a reference to the given []string and assigns it to the StaticRoutes field. +func (o *UpdateGatewayConnectionPayload) SetStaticRoutes(v []string) { + o.StaticRoutes = v +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *UpdateGatewayConnectionPayload) GetTunnel1() TunnelConfiguration { + if o == nil { + var ret TunnelConfiguration + return ret + } + + return o.Tunnel1 +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetTunnel1Ok() (*TunnelConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel1, true +} + +// SetTunnel1 sets field value +func (o *UpdateGatewayConnectionPayload) SetTunnel1(v TunnelConfiguration) { + o.Tunnel1 = v +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *UpdateGatewayConnectionPayload) GetTunnel2() TunnelConfiguration { + if o == nil { + var ret TunnelConfiguration + return ret + } + + return o.Tunnel2 +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetTunnel2Ok() (*TunnelConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel2, true +} + +// SetTunnel2 sets field value +func (o *UpdateGatewayConnectionPayload) SetTunnel2(v TunnelConfiguration) { + o.Tunnel2 = v +} + +func (o UpdateGatewayConnectionPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGatewayConnectionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.LocalSubnets) { + toSerialize["localSubnets"] = o.LocalSubnets + } + if !IsNil(o.RemoteSubnets) { + toSerialize["remoteSubnets"] = o.RemoteSubnets + } + if !IsNil(o.StaticRoutes) { + toSerialize["staticRoutes"] = o.StaticRoutes + } + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGatewayConnectionPayload) 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", + "tunnel1", + "tunnel2", + } + + 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) + } + } + + varUpdateGatewayConnectionPayload := _UpdateGatewayConnectionPayload{} + + err = json.Unmarshal(data, &varUpdateGatewayConnectionPayload) + + if err != nil { + return err + } + + *o = UpdateGatewayConnectionPayload(varUpdateGatewayConnectionPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "displayName") + delete(additionalProperties, "enabled") + delete(additionalProperties, "localSubnets") + delete(additionalProperties, "remoteSubnets") + delete(additionalProperties, "staticRoutes") + delete(additionalProperties, "tunnel1") + delete(additionalProperties, "tunnel2") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGatewayConnectionPayload struct { + value *UpdateGatewayConnectionPayload + isSet bool +} + +func (v NullableUpdateGatewayConnectionPayload) Get() *UpdateGatewayConnectionPayload { + return v.value +} + +func (v *NullableUpdateGatewayConnectionPayload) Set(val *UpdateGatewayConnectionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGatewayConnectionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGatewayConnectionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGatewayConnectionPayload(val *UpdateGatewayConnectionPayload) *NullableUpdateGatewayConnectionPayload { + return &NullableUpdateGatewayConnectionPayload{value: val, isSet: true} +} + +func (v NullableUpdateGatewayConnectionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGatewayConnectionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_update_vpn_gateway_payload.go b/services/vpn/v1beta1api/model_update_vpn_gateway_payload.go new file mode 100644 index 000000000..e3b3e64d5 --- /dev/null +++ b/services/vpn/v1beta1api/model_update_vpn_gateway_payload.go @@ -0,0 +1,330 @@ +/* +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" + "fmt" +) + +// checks if the UpdateVPNGatewayPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVPNGatewayPayload{} + +// UpdateVPNGatewayPayload struct for UpdateVPNGatewayPayload +type UpdateVPNGatewayPayload struct { + AvailabilityZones UpdateVPNGatewayPayloadAvailabilityZones `json:"availabilityZones"` + Bgp *BGPGatewayConfig `json:"bgp,omitempty"` + // 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"` + // The service plan identifier. + PlanId string `json:"planId"` + RoutingType RoutingType `json:"routingType"` + AdditionalProperties map[string]interface{} +} + +type _UpdateVPNGatewayPayload UpdateVPNGatewayPayload + +// NewUpdateVPNGatewayPayload instantiates a new UpdateVPNGatewayPayload 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 NewUpdateVPNGatewayPayload(availabilityZones UpdateVPNGatewayPayloadAvailabilityZones, displayName string, planId string, routingType RoutingType) *UpdateVPNGatewayPayload { + this := UpdateVPNGatewayPayload{} + this.AvailabilityZones = availabilityZones + this.DisplayName = displayName + this.PlanId = planId + this.RoutingType = routingType + return &this +} + +// NewUpdateVPNGatewayPayloadWithDefaults instantiates a new UpdateVPNGatewayPayload 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 NewUpdateVPNGatewayPayloadWithDefaults() *UpdateVPNGatewayPayload { + this := UpdateVPNGatewayPayload{} + return &this +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *UpdateVPNGatewayPayload) GetAvailabilityZones() UpdateVPNGatewayPayloadAvailabilityZones { + if o == nil { + var ret UpdateVPNGatewayPayloadAvailabilityZones + return ret + } + + return o.AvailabilityZones +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetAvailabilityZonesOk() (*UpdateVPNGatewayPayloadAvailabilityZones, bool) { + if o == nil { + return nil, false + } + return &o.AvailabilityZones, true +} + +// SetAvailabilityZones sets field value +func (o *UpdateVPNGatewayPayload) SetAvailabilityZones(v UpdateVPNGatewayPayloadAvailabilityZones) { + o.AvailabilityZones = v +} + +// GetBgp returns the Bgp field value if set, zero value otherwise. +func (o *UpdateVPNGatewayPayload) GetBgp() BGPGatewayConfig { + if o == nil || IsNil(o.Bgp) { + var ret BGPGatewayConfig + return ret + } + return *o.Bgp +} + +// GetBgpOk returns a tuple with the Bgp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetBgpOk() (*BGPGatewayConfig, bool) { + if o == nil || IsNil(o.Bgp) { + return nil, false + } + return o.Bgp, true +} + +// HasBgp returns a boolean if a field has been set. +func (o *UpdateVPNGatewayPayload) HasBgp() bool { + if o != nil && !IsNil(o.Bgp) { + return true + } + + return false +} + +// SetBgp gets a reference to the given BGPGatewayConfig and assigns it to the Bgp field. +func (o *UpdateVPNGatewayPayload) SetBgp(v BGPGatewayConfig) { + o.Bgp = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *UpdateVPNGatewayPayload) 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 *UpdateVPNGatewayPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *UpdateVPNGatewayPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateVPNGatewayPayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateVPNGatewayPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateVPNGatewayPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetPlanId returns the PlanId field value +func (o *UpdateVPNGatewayPayload) GetPlanId() string { + if o == nil { + var ret string + return ret + } + + return o.PlanId +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetPlanIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PlanId, true +} + +// SetPlanId sets field value +func (o *UpdateVPNGatewayPayload) SetPlanId(v string) { + o.PlanId = v +} + +// GetRoutingType returns the RoutingType field value +func (o *UpdateVPNGatewayPayload) GetRoutingType() RoutingType { + if o == nil { + var ret RoutingType + return ret + } + + return o.RoutingType +} + +// GetRoutingTypeOk returns a tuple with the RoutingType field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetRoutingTypeOk() (*RoutingType, bool) { + if o == nil { + return nil, false + } + return &o.RoutingType, true +} + +// SetRoutingType sets field value +func (o *UpdateVPNGatewayPayload) SetRoutingType(v RoutingType) { + o.RoutingType = v +} + +func (o UpdateVPNGatewayPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateVPNGatewayPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["availabilityZones"] = o.AvailabilityZones + if !IsNil(o.Bgp) { + toSerialize["bgp"] = o.Bgp + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["planId"] = o.PlanId + toSerialize["routingType"] = o.RoutingType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateVPNGatewayPayload) 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{ + "availabilityZones", + "displayName", + "planId", + "routingType", + } + + 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) + } + } + + varUpdateVPNGatewayPayload := _UpdateVPNGatewayPayload{} + + err = json.Unmarshal(data, &varUpdateVPNGatewayPayload) + + if err != nil { + return err + } + + *o = UpdateVPNGatewayPayload(varUpdateVPNGatewayPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "availabilityZones") + delete(additionalProperties, "bgp") + delete(additionalProperties, "displayName") + delete(additionalProperties, "labels") + delete(additionalProperties, "planId") + delete(additionalProperties, "routingType") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateVPNGatewayPayload struct { + value *UpdateVPNGatewayPayload + isSet bool +} + +func (v NullableUpdateVPNGatewayPayload) Get() *UpdateVPNGatewayPayload { + return v.value +} + +func (v *NullableUpdateVPNGatewayPayload) Set(val *UpdateVPNGatewayPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateVPNGatewayPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateVPNGatewayPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateVPNGatewayPayload(val *UpdateVPNGatewayPayload) *NullableUpdateVPNGatewayPayload { + return &NullableUpdateVPNGatewayPayload{value: val, isSet: true} +} + +func (v NullableUpdateVPNGatewayPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateVPNGatewayPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_update_vpn_gateway_payload_availability_zones.go b/services/vpn/v1beta1api/model_update_vpn_gateway_payload_availability_zones.go new file mode 100644 index 000000000..573561b86 --- /dev/null +++ b/services/vpn/v1beta1api/model_update_vpn_gateway_payload_availability_zones.go @@ -0,0 +1,197 @@ +/* +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" + "fmt" +) + +// checks if the UpdateVPNGatewayPayloadAvailabilityZones type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVPNGatewayPayloadAvailabilityZones{} + +// UpdateVPNGatewayPayloadAvailabilityZones struct for UpdateVPNGatewayPayloadAvailabilityZones +type UpdateVPNGatewayPayloadAvailabilityZones struct { + // Object that represents an availability zone. + Tunnel1 string `json:"tunnel1"` + // Object that represents an availability zone. + Tunnel2 string `json:"tunnel2"` + AdditionalProperties map[string]interface{} +} + +type _UpdateVPNGatewayPayloadAvailabilityZones UpdateVPNGatewayPayloadAvailabilityZones + +// NewUpdateVPNGatewayPayloadAvailabilityZones instantiates a new UpdateVPNGatewayPayloadAvailabilityZones 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 NewUpdateVPNGatewayPayloadAvailabilityZones(tunnel1 string, tunnel2 string) *UpdateVPNGatewayPayloadAvailabilityZones { + this := UpdateVPNGatewayPayloadAvailabilityZones{} + this.Tunnel1 = tunnel1 + this.Tunnel2 = tunnel2 + return &this +} + +// NewUpdateVPNGatewayPayloadAvailabilityZonesWithDefaults instantiates a new UpdateVPNGatewayPayloadAvailabilityZones 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 NewUpdateVPNGatewayPayloadAvailabilityZonesWithDefaults() *UpdateVPNGatewayPayloadAvailabilityZones { + this := UpdateVPNGatewayPayloadAvailabilityZones{} + return &this +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *UpdateVPNGatewayPayloadAvailabilityZones) GetTunnel1() string { + if o == nil { + var ret string + return ret + } + + return o.Tunnel1 +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayloadAvailabilityZones) GetTunnel1Ok() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel1, true +} + +// SetTunnel1 sets field value +func (o *UpdateVPNGatewayPayloadAvailabilityZones) SetTunnel1(v string) { + o.Tunnel1 = v +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *UpdateVPNGatewayPayloadAvailabilityZones) GetTunnel2() string { + if o == nil { + var ret string + return ret + } + + return o.Tunnel2 +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayloadAvailabilityZones) GetTunnel2Ok() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel2, true +} + +// SetTunnel2 sets field value +func (o *UpdateVPNGatewayPayloadAvailabilityZones) SetTunnel2(v string) { + o.Tunnel2 = v +} + +func (o UpdateVPNGatewayPayloadAvailabilityZones) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateVPNGatewayPayloadAvailabilityZones) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateVPNGatewayPayloadAvailabilityZones) 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{ + "tunnel1", + "tunnel2", + } + + 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) + } + } + + varUpdateVPNGatewayPayloadAvailabilityZones := _UpdateVPNGatewayPayloadAvailabilityZones{} + + err = json.Unmarshal(data, &varUpdateVPNGatewayPayloadAvailabilityZones) + + if err != nil { + return err + } + + *o = UpdateVPNGatewayPayloadAvailabilityZones(varUpdateVPNGatewayPayloadAvailabilityZones) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "tunnel1") + delete(additionalProperties, "tunnel2") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateVPNGatewayPayloadAvailabilityZones struct { + value *UpdateVPNGatewayPayloadAvailabilityZones + isSet bool +} + +func (v NullableUpdateVPNGatewayPayloadAvailabilityZones) Get() *UpdateVPNGatewayPayloadAvailabilityZones { + return v.value +} + +func (v *NullableUpdateVPNGatewayPayloadAvailabilityZones) Set(val *UpdateVPNGatewayPayloadAvailabilityZones) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateVPNGatewayPayloadAvailabilityZones) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateVPNGatewayPayloadAvailabilityZones) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateVPNGatewayPayloadAvailabilityZones(val *UpdateVPNGatewayPayloadAvailabilityZones) *NullableUpdateVPNGatewayPayloadAvailabilityZones { + return &NullableUpdateVPNGatewayPayloadAvailabilityZones{value: val, isSet: true} +} + +func (v NullableUpdateVPNGatewayPayloadAvailabilityZones) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateVPNGatewayPayloadAvailabilityZones) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/model_vpn_tunnels.go b/services/vpn/v1beta1api/model_vpn_tunnels.go new file mode 100644 index 000000000..53f99ea01 --- /dev/null +++ b/services/vpn/v1beta1api/model_vpn_tunnels.go @@ -0,0 +1,276 @@ +/* +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 VPNTunnels type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VPNTunnels{} + +// VPNTunnels Status of the underlying tunnel instances. +type VPNTunnels struct { + BgpStatus NullableBGPStatus `json:"bgpStatus,omitempty"` + InstanceState *GatewayStatus `json:"instanceState,omitempty"` + Name *string `json:"name,omitempty"` + // The public IPv4 address of this endpoint. + PublicIP *string `json:"publicIP,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VPNTunnels VPNTunnels + +// NewVPNTunnels instantiates a new VPNTunnels object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVPNTunnels() *VPNTunnels { + this := VPNTunnels{} + return &this +} + +// NewVPNTunnelsWithDefaults instantiates a new VPNTunnels object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVPNTunnelsWithDefaults() *VPNTunnels { + this := VPNTunnels{} + return &this +} + +// GetBgpStatus returns the BgpStatus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *VPNTunnels) GetBgpStatus() BGPStatus { + if o == nil || IsNil(o.BgpStatus.Get()) { + var ret BGPStatus + return ret + } + return *o.BgpStatus.Get() +} + +// GetBgpStatusOk returns a tuple with the BgpStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VPNTunnels) GetBgpStatusOk() (*BGPStatus, bool) { + if o == nil { + return nil, false + } + return o.BgpStatus.Get(), o.BgpStatus.IsSet() +} + +// HasBgpStatus returns a boolean if a field has been set. +func (o *VPNTunnels) HasBgpStatus() bool { + if o != nil && o.BgpStatus.IsSet() { + return true + } + + return false +} + +// SetBgpStatus gets a reference to the given NullableBGPStatus and assigns it to the BgpStatus field. +func (o *VPNTunnels) SetBgpStatus(v BGPStatus) { + o.BgpStatus.Set(&v) +} + +// SetBgpStatusNil sets the value for BgpStatus to be an explicit nil +func (o *VPNTunnels) SetBgpStatusNil() { + o.BgpStatus.Set(nil) +} + +// UnsetBgpStatus ensures that no value is present for BgpStatus, not even an explicit nil +func (o *VPNTunnels) UnsetBgpStatus() { + o.BgpStatus.Unset() +} + +// GetInstanceState returns the InstanceState field value if set, zero value otherwise. +func (o *VPNTunnels) GetInstanceState() GatewayStatus { + if o == nil || IsNil(o.InstanceState) { + var ret GatewayStatus + return ret + } + return *o.InstanceState +} + +// GetInstanceStateOk returns a tuple with the InstanceState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnels) GetInstanceStateOk() (*GatewayStatus, bool) { + if o == nil || IsNil(o.InstanceState) { + return nil, false + } + return o.InstanceState, true +} + +// HasInstanceState returns a boolean if a field has been set. +func (o *VPNTunnels) HasInstanceState() bool { + if o != nil && !IsNil(o.InstanceState) { + return true + } + + return false +} + +// SetInstanceState gets a reference to the given GatewayStatus and assigns it to the InstanceState field. +func (o *VPNTunnels) SetInstanceState(v GatewayStatus) { + o.InstanceState = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VPNTunnels) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnels) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *VPNTunnels) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VPNTunnels) SetName(v string) { + o.Name = &v +} + +// GetPublicIP returns the PublicIP field value if set, zero value otherwise. +func (o *VPNTunnels) GetPublicIP() string { + if o == nil || IsNil(o.PublicIP) { + var ret string + return ret + } + return *o.PublicIP +} + +// GetPublicIPOk returns a tuple with the PublicIP field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnels) GetPublicIPOk() (*string, bool) { + if o == nil || IsNil(o.PublicIP) { + return nil, false + } + return o.PublicIP, true +} + +// HasPublicIP returns a boolean if a field has been set. +func (o *VPNTunnels) HasPublicIP() bool { + if o != nil && !IsNil(o.PublicIP) { + return true + } + + return false +} + +// SetPublicIP gets a reference to the given string and assigns it to the PublicIP field. +func (o *VPNTunnels) SetPublicIP(v string) { + o.PublicIP = &v +} + +func (o VPNTunnels) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VPNTunnels) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.BgpStatus.IsSet() { + toSerialize["bgpStatus"] = o.BgpStatus.Get() + } + if !IsNil(o.InstanceState) { + toSerialize["instanceState"] = o.InstanceState + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.PublicIP) { + toSerialize["publicIP"] = o.PublicIP + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VPNTunnels) UnmarshalJSON(data []byte) (err error) { + varVPNTunnels := _VPNTunnels{} + + err = json.Unmarshal(data, &varVPNTunnels) + + if err != nil { + return err + } + + *o = VPNTunnels(varVPNTunnels) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bgpStatus") + delete(additionalProperties, "instanceState") + delete(additionalProperties, "name") + delete(additionalProperties, "publicIP") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVPNTunnels struct { + value *VPNTunnels + isSet bool +} + +func (v NullableVPNTunnels) Get() *VPNTunnels { + return v.value +} + +func (v *NullableVPNTunnels) Set(val *VPNTunnels) { + v.value = val + v.isSet = true +} + +func (v NullableVPNTunnels) IsSet() bool { + return v.isSet +} + +func (v *NullableVPNTunnels) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVPNTunnels(val *VPNTunnels) *NullableVPNTunnels { + return &NullableVPNTunnels{value: val, isSet: true} +} + +func (v NullableVPNTunnels) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVPNTunnels) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1beta1api/response.go b/services/vpn/v1beta1api/response.go new file mode 100644 index 000000000..698294da1 --- /dev/null +++ b/services/vpn/v1beta1api/response.go @@ -0,0 +1,47 @@ +/* +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 ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/vpn/v1beta1api/utils.go b/services/vpn/v1beta1api/utils.go new file mode 100644 index 000000000..05fc26625 --- /dev/null +++ b/services/vpn/v1beta1api/utils.go @@ -0,0 +1,361 @@ +/* +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 ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} From 58f61022e463648897b3b5f6fba12844fb6cac4d Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Thu, 19 Mar 2026 18:04:06 +0100 Subject: [PATCH 2/2] changelogs --- CHANGELOG.md | 7 +++++-- services/vpn/CHANGELOG.md | 3 +++ services/vpn/VERSION | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42b8b1f59..44d414e37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,8 +106,11 @@ - **Feature:** Add `AdditionalProperties` fields to model structs - `sqlserverflex`: [v1.6.1](services/sqlserverflex/CHANGELOG.md#v161) - **Dependencies:** Bump STACKIT SDK core module from `v0.22.0` to `v0.23.0` -- `vpn`: [v0.3.1](services/vpn/CHANGELOG.md#v031) - - **Dependencies:** Bump STACKIT SDK core module from `v0.22.0` to `v0.23.0` +- `vpn`: + - [v0.4.0](services/vpn/CHANGELOG.md#v040) + - `v1beta1api`: New package which can be used for communication with the STACKIT vpn v1 beta1 API + - [v0.3.1](services/vpn/CHANGELOG.md#v031) + - **Dependencies:** Bump STACKIT SDK core module from `v0.22.0` to `v0.23.0` ## Release (2026-03-13) - `core`: diff --git a/services/vpn/CHANGELOG.md b/services/vpn/CHANGELOG.md index e9328bf82..80d0d6d92 100644 --- a/services/vpn/CHANGELOG.md +++ b/services/vpn/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.4.0 +- `v1beta1api`: New package which can be used for communication with the STACKIT vpn v1 beta1 API + ## v0.3.1 - **Dependencies:** Bump STACKIT SDK core module from `v0.22.0` to `v0.23.0` diff --git a/services/vpn/VERSION b/services/vpn/VERSION index 1e66a6163..fb7a04cff 100644 --- a/services/vpn/VERSION +++ b/services/vpn/VERSION @@ -1 +1 @@ -v0.3.1 \ No newline at end of file +v0.4.0