diff --git a/CHANGELOG.md b/CHANGELOG.md index c396c348e..40f1779fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,9 @@ - `v3beta1api`: New package which can be used for communication with the sqlserverflex v3 beta1 API - **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead. - **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0` +- `vpn`: [v0.1.0](services/vpn/CHANGELOG.md#v010) + - **New:** SDK module for vpn service + - `v1alpha1api`: New package which can be used for communication with the vpn v1 alpha1 API ## Release (2026-02-20) - `core`: [v0.21.1](core/CHANGELOG.md#v0211) diff --git a/go.work b/go.work index edfc1f700..3e08d3690 100644 --- a/go.work +++ b/go.work @@ -72,4 +72,5 @@ use ( ./services/ske ./services/sqlserverflex ./services/stackitmarketplace + ./services/vpn ) diff --git a/services/vpn/CHANGELOG.md b/services/vpn/CHANGELOG.md new file mode 100644 index 000000000..ed30f175f --- /dev/null +++ b/services/vpn/CHANGELOG.md @@ -0,0 +1,3 @@ +## v0.1.0 +- **New:** SDK module for vpn service +- `v1alpha1api`: New package which can be used for communication with the vpn v1 alpha1 API diff --git a/services/vpn/LICENSE.md b/services/vpn/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/vpn/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/services/vpn/NOTICE.txt b/services/vpn/NOTICE.txt new file mode 100644 index 000000000..3ca03a69b --- /dev/null +++ b/services/vpn/NOTICE.txt @@ -0,0 +1,2 @@ +STACKIT vpn SDK for Go +Copyright 2026 Schwarz IT KG diff --git a/services/vpn/VERSION b/services/vpn/VERSION new file mode 100644 index 000000000..b82608c0b --- /dev/null +++ b/services/vpn/VERSION @@ -0,0 +1 @@ +v0.1.0 diff --git a/services/vpn/go.mod b/services/vpn/go.mod new file mode 100644 index 000000000..d87e836be --- /dev/null +++ b/services/vpn/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/vpn + +go 1.21 + +require github.com/stackitcloud/stackit-sdk-go/core v0.22.0 + +require ( + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/vpn/go.sum b/services/vpn/go.sum new file mode 100644 index 000000000..195011dd5 --- /dev/null +++ b/services/vpn/go.sum @@ -0,0 +1,8 @@ +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= diff --git a/services/vpn/oas_commit b/services/vpn/oas_commit new file mode 100644 index 000000000..bf3189995 --- /dev/null +++ b/services/vpn/oas_commit @@ -0,0 +1 @@ +3e9c109388be83b40c16d8cb5ab146aa314eb6e8 diff --git a/services/vpn/package.go b/services/vpn/package.go new file mode 100644 index 000000000..21364c464 --- /dev/null +++ b/services/vpn/package.go @@ -0,0 +1 @@ +package vpn diff --git a/services/vpn/v1alpha1api/api_default.go b/services/vpn/v1alpha1api/api_default.go new file mode 100644 index 000000000..3965a6651 --- /dev/null +++ b/services/vpn/v1alpha1api/api_default.go @@ -0,0 +1,2741 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alpha1api + +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 connection for an existing VPN gateway. + + Create a 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 gatewayName + @return ApiCreateGatewayConnectionRequest + */ + CreateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string) ApiCreateGatewayConnectionRequest + + // CreateGatewayConnectionExecute executes the request + // @return Connection + CreateGatewayConnectionExecute(r ApiCreateGatewayConnectionRequest) (*Connection, error) + + /* + CreateVPNGateway Create a VPN gateway in a project. + + Create 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 + @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 gatewayName + @param connectionName + @return ApiDeleteGatewayConnectionRequest + */ + DeleteGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiDeleteGatewayConnectionRequest + + // DeleteGatewayConnectionExecute executes the request + DeleteGatewayConnectionExecute(r ApiDeleteGatewayConnectionRequest) error + + /* + DeleteVPNGateway Delete a existing VPN gateway in a project. + + Delete a existing VPN gateway and all it's connections 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 gatewayName + @return ApiDeleteVPNGatewayRequest + */ + DeleteVPNGateway(ctx context.Context, projectId string, region Region, gatewayName 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 gatewayName + @param connectionName + @return ApiGetGatewayConnectionRequest + */ + GetGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiGetGatewayConnectionRequest + + // GetGatewayConnectionExecute executes the request + // @return Connection + GetGatewayConnectionExecute(r ApiGetGatewayConnectionRequest) (*Connection, error) + + /* + GetGatewayConnectionStatus Gets the status for a specific connection in an existing VPN gateway. + + Gets the status for a specific connection in 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 gatewayName + @param connectionName + @return ApiGetGatewayConnectionStatusRequest + */ + GetGatewayConnectionStatus(ctx context.Context, projectId string, region Region, gatewayName string, connectionName 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 gatewayName + @return ApiGetVPNGatewayRequest + */ + GetVPNGateway(ctx context.Context, projectId string, region Region, gatewayName 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 gatewayName + @return ApiGetVPNGatewayStatusRequest + */ + GetVPNGatewayStatus(ctx context.Context, projectId string, region Region, gatewayName 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 gatewayName + @return ApiListGatewayConnectionsRequest + */ + ListGatewayConnections(ctx context.Context, projectId string, region Region, gatewayName string) ApiListGatewayConnectionsRequest + + // ListGatewayConnectionsExecute executes the request + // @return ConnectionList + ListGatewayConnectionsExecute(r ApiListGatewayConnectionsRequest) (*ConnectionList, error) + + /* + ListPlans List available service plans for a project. + + List available service plans for a project. + + @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. + + List project quotas. + + @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 VPN gateways in a project filtered by a custom label selector format. + + @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 for an existing VPN gateway. + + Update a 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 gatewayName + @param connectionName + @return ApiUpdateGatewayConnectionRequest + */ + UpdateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiUpdateGatewayConnectionRequest + + // UpdateGatewayConnectionExecute executes the request + // @return Connection + UpdateGatewayConnectionExecute(r ApiUpdateGatewayConnectionRequest) (*Connection, error) + + /* + UpdateVPNGateway Update a VPN gateway in a project. + + Update 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 gatewayName + @return ApiUpdateVPNGatewayRequest + */ + UpdateVPNGateway(ctx context.Context, projectId string, region Region, gatewayName 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 + gatewayName string + createGatewayConnectionPayload *CreateGatewayConnectionPayload +} + +func (r ApiCreateGatewayConnectionRequest) CreateGatewayConnectionPayload(createGatewayConnectionPayload CreateGatewayConnectionPayload) ApiCreateGatewayConnectionRequest { + r.createGatewayConnectionPayload = &createGatewayConnectionPayload + return r +} + +func (r ApiCreateGatewayConnectionRequest) Execute() (*Connection, error) { + return r.ApiService.CreateGatewayConnectionExecute(r) +} + +/* +CreateGatewayConnection Create a connection for an existing VPN gateway. + +Create a 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 gatewayName + @return ApiCreateGatewayConnectionRequest +*/ +func (a *DefaultAPIService) CreateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string) ApiCreateGatewayConnectionRequest { + return ApiCreateGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// Execute executes the request +// +// @return Connection +func (a *DefaultAPIService) CreateGatewayConnectionExecute(r ApiCreateGatewayConnectionRequest) (*Connection, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Connection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -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. + +Create 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 + @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 + "/v1alpha1/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 + gatewayName string + connectionName 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 gatewayName + @param connectionName + @return ApiDeleteGatewayConnectionRequest +*/ +func (a *DefaultAPIService) DeleteGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiDeleteGatewayConnectionRequest { + return ApiDeleteGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +// 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 + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + 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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionName"+"}", url.PathEscape(parameterValueToString(r.connectionName, "connectionName")), -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 + gatewayName string +} + +func (r ApiDeleteVPNGatewayRequest) Execute() error { + return r.ApiService.DeleteVPNGatewayExecute(r) +} + +/* +DeleteVPNGateway Delete a existing VPN gateway in a project. + +Delete a existing VPN gateway and all it's connections 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 gatewayName + @return ApiDeleteVPNGatewayRequest +*/ +func (a *DefaultAPIService) DeleteVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiDeleteVPNGatewayRequest { + return ApiDeleteVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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 + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + 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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -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 + gatewayName string + connectionName string +} + +func (r ApiGetGatewayConnectionRequest) Execute() (*Connection, 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 gatewayName + @param connectionName + @return ApiGetGatewayConnectionRequest +*/ +func (a *DefaultAPIService) GetGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiGetGatewayConnectionRequest { + return ApiGetGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +// Execute executes the request +// +// @return Connection +func (a *DefaultAPIService) GetGatewayConnectionExecute(r ApiGetGatewayConnectionRequest) (*Connection, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Connection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + 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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionName"+"}", url.PathEscape(parameterValueToString(r.connectionName, "connectionName")), -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 + gatewayName string + connectionName string +} + +func (r ApiGetGatewayConnectionStatusRequest) Execute() (*ConnectionStatusResponse, error) { + return r.ApiService.GetGatewayConnectionStatusExecute(r) +} + +/* +GetGatewayConnectionStatus Gets the status for a specific connection in an existing VPN gateway. + +Gets the status for a specific connection in 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 gatewayName + @param connectionName + @return ApiGetGatewayConnectionStatusRequest +*/ +func (a *DefaultAPIService) GetGatewayConnectionStatus(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiGetGatewayConnectionStatusRequest { + return ApiGetGatewayConnectionStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +// 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 + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}/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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionName"+"}", url.PathEscape(parameterValueToString(r.connectionName, "connectionName")), -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 + gatewayName 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 gatewayName + @return ApiGetVPNGatewayRequest +*/ +func (a *DefaultAPIService) GetVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiGetVPNGatewayRequest { + return ApiGetVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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 + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + 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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -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 + gatewayName 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 gatewayName + @return ApiGetVPNGatewayStatusRequest +*/ +func (a *DefaultAPIService) GetVPNGatewayStatus(ctx context.Context, projectId string, region Region, gatewayName string) ApiGetVPNGatewayStatusRequest { + return ApiGetVPNGatewayStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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 + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -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 + gatewayName string + labelSelector *map[string]string +} + +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 gatewayName + @return ApiListGatewayConnectionsRequest +*/ +func (a *DefaultAPIService) ListGatewayConnections(ctx context.Context, projectId string, region Region, gatewayName string) ApiListGatewayConnectionsRequest { + return ApiListGatewayConnectionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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 + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -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. + +List available service plans for a project. + + @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 + "/v1alpha1/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. + +List project quotas. + + @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 + "/v1alpha1/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 +} + +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 VPN gateways in a project filtered by a custom label selector format. + + @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 + "/v1alpha1/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 + gatewayName string + connectionName string + updateGatewayConnectionPayload *UpdateGatewayConnectionPayload +} + +func (r ApiUpdateGatewayConnectionRequest) UpdateGatewayConnectionPayload(updateGatewayConnectionPayload UpdateGatewayConnectionPayload) ApiUpdateGatewayConnectionRequest { + r.updateGatewayConnectionPayload = &updateGatewayConnectionPayload + return r +} + +func (r ApiUpdateGatewayConnectionRequest) Execute() (*Connection, error) { + return r.ApiService.UpdateGatewayConnectionExecute(r) +} + +/* +UpdateGatewayConnection Update a connection for an existing VPN gateway. + +Update a 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 gatewayName + @param connectionName + @return ApiUpdateGatewayConnectionRequest +*/ +func (a *DefaultAPIService) UpdateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiUpdateGatewayConnectionRequest { + return ApiUpdateGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +// Execute executes the request +// +// @return Connection +func (a *DefaultAPIService) UpdateGatewayConnectionExecute(r ApiUpdateGatewayConnectionRequest) (*Connection, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Connection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + 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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionName"+"}", url.PathEscape(parameterValueToString(r.connectionName, "connectionName")), -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 + gatewayName 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. + +Update 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 gatewayName + @return ApiUpdateVPNGatewayRequest +*/ +func (a *DefaultAPIService) UpdateVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiUpdateVPNGatewayRequest { + return ApiUpdateVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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 + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + 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, "{"+"gatewayName"+"}", url.PathEscape(parameterValueToString(r.gatewayName, "gatewayName")), -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/v1alpha1api/api_default_mock.go b/services/vpn/v1alpha1api/api_default_mock.go new file mode 100644 index 000000000..f4d9d8a3c --- /dev/null +++ b/services/vpn/v1alpha1api/api_default_mock.go @@ -0,0 +1,328 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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) (*Connection, 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) (*Connection, 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) (*Connection, 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, gatewayName string) ApiCreateGatewayConnectionRequest { + return ApiCreateGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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) (*Connection, error) { + if a.CreateGatewayConnectionExecuteMock == nil { + var localVarReturnValue *Connection + 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, gatewayName string, connectionName string) ApiDeleteGatewayConnectionRequest { + return ApiDeleteGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +// 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, gatewayName string) ApiDeleteVPNGatewayRequest { + return ApiDeleteVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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, gatewayName string, connectionName string) ApiGetGatewayConnectionRequest { + return ApiGetGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +// 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) (*Connection, error) { + if a.GetGatewayConnectionExecuteMock == nil { + var localVarReturnValue *Connection + return localVarReturnValue, nil + } + + return (*a.GetGatewayConnectionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetGatewayConnectionStatus(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiGetGatewayConnectionStatusRequest { + return ApiGetGatewayConnectionStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +// 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, gatewayName string) ApiGetVPNGatewayRequest { + return ApiGetVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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, gatewayName string) ApiGetVPNGatewayStatusRequest { + return ApiGetVPNGatewayStatusRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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, gatewayName string) ApiListGatewayConnectionsRequest { + return ApiListGatewayConnectionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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, gatewayName string, connectionName string) ApiUpdateGatewayConnectionRequest { + return ApiUpdateGatewayConnectionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +// 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) (*Connection, error) { + if a.UpdateGatewayConnectionExecuteMock == nil { + var localVarReturnValue *Connection + return localVarReturnValue, nil + } + + return (*a.UpdateGatewayConnectionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiUpdateVPNGatewayRequest { + return ApiUpdateVPNGatewayRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +// 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/v1alpha1api/client.go b/services/vpn/v1alpha1api/client.go new file mode 100644 index 000000000..992fe708f --- /dev/null +++ b/services/vpn/v1alpha1api/client.go @@ -0,0 +1,658 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alpha1api + +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 v1alpha1 +// 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/v1alpha1api/configuration.go b/services/vpn/v1alpha1api/configuration.go new file mode 100644 index 000000000..0ab01ac82 --- /dev/null +++ b/services/vpn/v1alpha1api/configuration.go @@ -0,0 +1,40 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alpha1api + +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/v1alpha1api/model_api_error.go b/services/vpn/v1alpha1api/model_api_error.go new file mode 100644 index 000000000..2062b97f4 --- /dev/null +++ b/services/vpn/v1alpha1api/model_api_error.go @@ -0,0 +1,260 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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,omitempty"` +} + +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) *APIError { + this := APIError{} + this.Code = code + this.Message = message + 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 if set, zero value otherwise. +func (o *APIError) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIError) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *APIError) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +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 + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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", + } + + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAPIError) + + if err != nil { + return err + } + + *o = APIError(varAPIError) + + 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/v1alpha1api/model_api_error_detail.go b/services/vpn/v1alpha1api/model_api_error_detail.go new file mode 100644 index 000000000..884816ace --- /dev/null +++ b/services/vpn/v1alpha1api/model_api_error_detail.go @@ -0,0 +1,225 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAPIErrorDetail) + + if err != nil { + return err + } + + *o = APIErrorDetail(varAPIErrorDetail) + + 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/v1alpha1api/model_api_error_response.go b/services/vpn/v1alpha1api/model_api_error_response.go new file mode 100644 index 000000000..efa6b5ce4 --- /dev/null +++ b/services/vpn/v1alpha1api/model_api_error_response.go @@ -0,0 +1,156 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAPIErrorResponse) + + if err != nil { + return err + } + + *o = APIErrorResponse(varAPIErrorResponse) + + 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/v1alpha1api/model_bgp_gateway_config.go b/services/vpn/v1alpha1api/model_bgp_gateway_config.go new file mode 100644 index 000000000..3ac5bf8b1 --- /dev/null +++ b/services/vpn/v1alpha1api/model_bgp_gateway_config.go @@ -0,0 +1,162 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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). Allowed values are 64512-65534 (16-bit range) and 4200000000-4294967294 (32-bit range). + LocalAsn *int32 `json:"localAsn,omitempty"` + // List of routes (IPv4 CIDR). + OverrideAdvertisedRoutes []string `json:"overrideAdvertisedRoutes,omitempty"` +} + +// 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 + } + return toSerialize, nil +} + +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/v1alpha1api/model_bgp_status.go b/services/vpn/v1alpha1api/model_bgp_status.go new file mode 100644 index 000000000..c16407ec6 --- /dev/null +++ b/services/vpn/v1alpha1api/model_bgp_status.go @@ -0,0 +1,160 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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"` +} + +// 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 + } + return toSerialize, nil +} + +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/v1alpha1api/model_bgp_status_peers.go b/services/vpn/v1alpha1api/model_bgp_status_peers.go new file mode 100644 index 000000000..cd4909a2e --- /dev/null +++ b/services/vpn/v1alpha1api/model_bgp_status_peers.go @@ -0,0 +1,324 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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 { + LocalAs float32 `json:"localAs"` + PeerUptime string `json:"peerUptime"` + PfxRcd float32 `json:"pfxRcd"` + PfxSnt float32 `json:"pfxSnt"` + RemoteAs float32 `json:"remoteAs"` + RemoteIP string `json:"remoteIP"` + State string `json:"state"` +} + +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 float32, peerUptime string, pfxRcd float32, pfxSnt float32, remoteAs float32, 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() float32 { + if o == nil { + var ret float32 + 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() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.LocalAs, true +} + +// SetLocalAs sets field value +func (o *BGPStatusPeers) SetLocalAs(v float32) { + 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() float32 { + if o == nil { + var ret float32 + 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() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.PfxRcd, true +} + +// SetPfxRcd sets field value +func (o *BGPStatusPeers) SetPfxRcd(v float32) { + o.PfxRcd = v +} + +// GetPfxSnt returns the PfxSnt field value +func (o *BGPStatusPeers) GetPfxSnt() float32 { + if o == nil { + var ret float32 + 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() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.PfxSnt, true +} + +// SetPfxSnt sets field value +func (o *BGPStatusPeers) SetPfxSnt(v float32) { + o.PfxSnt = v +} + +// GetRemoteAs returns the RemoteAs field value +func (o *BGPStatusPeers) GetRemoteAs() float32 { + if o == nil { + var ret float32 + 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() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.RemoteAs, true +} + +// SetRemoteAs sets field value +func (o *BGPStatusPeers) SetRemoteAs(v float32) { + 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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBGPStatusPeers) + + if err != nil { + return err + } + + *o = BGPStatusPeers(varBGPStatusPeers) + + 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/v1alpha1api/model_bgp_status_routes.go b/services/vpn/v1alpha1api/model_bgp_status_routes.go new file mode 100644 index 000000000..a4a0ff8a1 --- /dev/null +++ b/services/vpn/v1alpha1api/model_bgp_status_routes.go @@ -0,0 +1,268 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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 { + Network string `json:"network"` + Origin string `json:"origin"` + Path string `json:"path"` + PeerId string `json:"peerId"` + Weight float32 `json:"weight"` +} + +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 float32) *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() float32 { + if o == nil { + var ret float32 + 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() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Weight, true +} + +// SetWeight sets field value +func (o *BGPStatusRoutes) SetWeight(v float32) { + 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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBGPStatusRoutes) + + if err != nil { + return err + } + + *o = BGPStatusRoutes(varBGPStatusRoutes) + + 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/v1alpha1api/model_bgp_tunnel_config.go b/services/vpn/v1alpha1api/model_bgp_tunnel_config.go new file mode 100644 index 000000000..40b8cda2d --- /dev/null +++ b/services/vpn/v1alpha1api/model_bgp_tunnel_config.go @@ -0,0 +1,157 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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). Allowed values are 64512-65534 (16-bit range) and 4200000000-4294967294 (32-bit range). + RemoteAsn int32 `json:"remoteAsn"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBGPTunnelConfig) + + if err != nil { + return err + } + + *o = BGPTunnelConfig(varBGPTunnelConfig) + + 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/v1alpha1api/model_connection.go b/services/vpn/v1alpha1api/model_connection.go new file mode 100644 index 000000000..83143f3b3 --- /dev/null +++ b/services/vpn/v1alpha1api/model_connection.go @@ -0,0 +1,397 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the Connection type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Connection{} + +// Connection struct for Connection +type Connection struct { + // This flag decides whether this connection should be enabled or disabled + Enabled *bool `json:"enabled,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"` + // The name of the connection. Maximum 20 characters (only alphanumeric and hyphens allowed). The name bust be unique within the parent Gateway. Currently renaming is not possible therefore deleting and re-creating the connection is necessary. + Name string `json:"name" validate:"regexp=^[a-z0-9]([a-z0-9-]{0,18}[a-z0-9])?$"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + RemoteSubnets []string `json:"remoteSubnets,omitempty"` + StaticRoutes []string `json:"staticRoutes,omitempty"` + Tunnel1 TunnelConfiguration `json:"tunnel1"` + Tunnel2 TunnelConfiguration `json:"tunnel2"` +} + +type _Connection Connection + +// NewConnection instantiates a new Connection 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 NewConnection(name string, tunnel1 TunnelConfiguration, tunnel2 TunnelConfiguration) *Connection { + this := Connection{} + this.Name = name + this.Tunnel1 = tunnel1 + this.Tunnel2 = tunnel2 + return &this +} + +// NewConnectionWithDefaults instantiates a new Connection 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 NewConnectionWithDefaults() *Connection { + this := Connection{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *Connection) 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 *Connection) 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 *Connection) 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 *Connection) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Connection) 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 *Connection) 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 *Connection) 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 *Connection) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetLocalSubnets returns the LocalSubnets field value if set, zero value otherwise. +func (o *Connection) 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 *Connection) 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 *Connection) 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 *Connection) SetLocalSubnets(v []string) { + o.LocalSubnets = v +} + +// GetName returns the Name field value +func (o *Connection) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Connection) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Connection) SetName(v string) { + o.Name = v +} + +// GetRemoteSubnets returns the RemoteSubnets field value if set, zero value otherwise. +func (o *Connection) 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 *Connection) 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 *Connection) 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 *Connection) SetRemoteSubnets(v []string) { + o.RemoteSubnets = v +} + +// GetStaticRoutes returns the StaticRoutes field value if set, zero value otherwise. +func (o *Connection) 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 *Connection) 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 *Connection) 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 *Connection) SetStaticRoutes(v []string) { + o.StaticRoutes = v +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *Connection) 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 *Connection) GetTunnel1Ok() (*TunnelConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel1, true +} + +// SetTunnel1 sets field value +func (o *Connection) SetTunnel1(v TunnelConfiguration) { + o.Tunnel1 = v +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *Connection) 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 *Connection) GetTunnel2Ok() (*TunnelConfiguration, bool) { + if o == nil { + return nil, false + } + return &o.Tunnel2, true +} + +// SetTunnel2 sets field value +func (o *Connection) SetTunnel2(v TunnelConfiguration) { + o.Tunnel2 = v +} + +func (o Connection) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Connection) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.LocalSubnets) { + toSerialize["localSubnets"] = o.LocalSubnets + } + toSerialize["name"] = o.Name + if !IsNil(o.RemoteSubnets) { + toSerialize["remoteSubnets"] = o.RemoteSubnets + } + if !IsNil(o.StaticRoutes) { + toSerialize["staticRoutes"] = o.StaticRoutes + } + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + return toSerialize, nil +} + +func (o *Connection) 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{ + "name", + "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) + } + } + + varConnection := _Connection{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varConnection) + + if err != nil { + return err + } + + *o = Connection(varConnection) + + return err +} + +type NullableConnection struct { + value *Connection + isSet bool +} + +func (v NullableConnection) Get() *Connection { + return v.value +} + +func (v *NullableConnection) Set(val *Connection) { + v.value = val + v.isSet = true +} + +func (v NullableConnection) IsSet() bool { + return v.isSet +} + +func (v *NullableConnection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnection(val *Connection) *NullableConnection { + return &NullableConnection{value: val, isSet: true} +} + +func (v NullableConnection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1alpha1api/model_connection_list.go b/services/vpn/v1alpha1api/model_connection_list.go new file mode 100644 index 000000000..4547ad37a --- /dev/null +++ b/services/vpn/v1alpha1api/model_connection_list.go @@ -0,0 +1,156 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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 []Connection `json:"connections"` +} + +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 []Connection) *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() []Connection { + if o == nil { + var ret []Connection + 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() ([]Connection, bool) { + if o == nil { + return nil, false + } + return o.Connections, true +} + +// SetConnections sets field value +func (o *ConnectionList) SetConnections(v []Connection) { + 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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varConnectionList) + + if err != nil { + return err + } + + *o = ConnectionList(varConnectionList) + + 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/v1alpha1api/model_connection_status_response.go b/services/vpn/v1alpha1api/model_connection_status_response.go new file mode 100644 index 000000000..e3df68ee9 --- /dev/null +++ b/services/vpn/v1alpha1api/model_connection_status_response.go @@ -0,0 +1,197 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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 { + Enabled *bool `json:"enabled,omitempty"` + // The name of the connection. + Name *string `json:"name,omitempty"` + Tunnels []TunnelStatus `json:"tunnels,omitempty"` +} + +// 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 +} + +// 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 +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ConnectionStatusResponse) 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 *ConnectionStatusResponse) 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 *ConnectionStatusResponse) 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 *ConnectionStatusResponse) SetName(v string) { + o.Name = &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.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Tunnels) { + toSerialize["tunnels"] = o.Tunnels + } + return toSerialize, nil +} + +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/v1alpha1api/model_create_gateway_connection_payload.go b/services/vpn/v1alpha1api/model_create_gateway_connection_payload.go new file mode 100644 index 000000000..12a9a8eae --- /dev/null +++ b/services/vpn/v1alpha1api/model_create_gateway_connection_payload.go @@ -0,0 +1,397 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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 { + // This flag decides whether this connection should be enabled or disabled + Enabled *bool `json:"enabled,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"` + // The name of the connection. Maximum 20 characters (only alphanumeric and hyphens allowed). The name bust be unique within the parent Gateway. Currently renaming is not possible therefore deleting and re-creating the connection is necessary. + Name string `json:"name" validate:"regexp=^[a-z0-9]([a-z0-9-]{0,18}[a-z0-9])?$"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + RemoteSubnets []string `json:"remoteSubnets,omitempty"` + StaticRoutes []string `json:"staticRoutes,omitempty"` + Tunnel1 TunnelConfiguration `json:"tunnel1"` + Tunnel2 TunnelConfiguration `json:"tunnel2"` +} + +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(name string, tunnel1 TunnelConfiguration, tunnel2 TunnelConfiguration) *CreateGatewayConnectionPayload { + this := CreateGatewayConnectionPayload{} + this.Name = name + 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 +} + +// 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 +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateGatewayConnectionPayload) 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 *CreateGatewayConnectionPayload) 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 *CreateGatewayConnectionPayload) 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 *CreateGatewayConnectionPayload) SetLabels(v map[string]string) { + o.Labels = &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 +} + +// GetName returns the Name field value +func (o *CreateGatewayConnectionPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateGatewayConnectionPayload) SetName(v string) { + o.Name = 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{}{} + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.LocalSubnets) { + toSerialize["localSubnets"] = o.LocalSubnets + } + toSerialize["name"] = o.Name + if !IsNil(o.RemoteSubnets) { + toSerialize["remoteSubnets"] = o.RemoteSubnets + } + if !IsNil(o.StaticRoutes) { + toSerialize["staticRoutes"] = o.StaticRoutes + } + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + 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{ + "name", + "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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateGatewayConnectionPayload) + + if err != nil { + return err + } + + *o = CreateGatewayConnectionPayload(varCreateGatewayConnectionPayload) + + 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/v1alpha1api/model_create_vpn_gateway_payload.go b/services/vpn/v1alpha1api/model_create_vpn_gateway_payload.go new file mode 100644 index 000000000..e7aa22d1e --- /dev/null +++ b/services/vpn/v1alpha1api/model_create_vpn_gateway_payload.go @@ -0,0 +1,315 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` + // 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 name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + Name string `json:"name" validate:"regexp=^[a-z0-9]([a-z0-9-]{0,18}[a-z0-9])?$"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + PlanId string `json:"planId"` + RoutingType RoutingType `json:"routingType"` +} + +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, name string, planId string, routingType RoutingType) *CreateVPNGatewayPayload { + this := CreateVPNGatewayPayload{} + this.AvailabilityZones = availabilityZones + this.Name = name + 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 +} + +// 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 +} + +// GetName returns the Name field value +func (o *CreateVPNGatewayPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateVPNGatewayPayload) SetName(v string) { + o.Name = 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 + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["planId"] = o.PlanId + toSerialize["routingType"] = o.RoutingType + 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", + "name", + "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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateVPNGatewayPayload) + + if err != nil { + return err + } + + *o = CreateVPNGatewayPayload(varCreateVPNGatewayPayload) + + 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/v1alpha1api/model_create_vpn_gateway_payload_availability_zones.go b/services/vpn/v1alpha1api/model_create_vpn_gateway_payload_availability_zones.go new file mode 100644 index 000000000..a32757662 --- /dev/null +++ b/services/vpn/v1alpha1api/model_create_vpn_gateway_payload_availability_zones.go @@ -0,0 +1,186 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateVPNGatewayPayloadAvailabilityZones) + + if err != nil { + return err + } + + *o = CreateVPNGatewayPayloadAvailabilityZones(varCreateVPNGatewayPayloadAvailabilityZones) + + 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/v1alpha1api/model_gateway.go b/services/vpn/v1alpha1api/model_gateway.go new file mode 100644 index 000000000..0dbe50c83 --- /dev/null +++ b/services/vpn/v1alpha1api/model_gateway.go @@ -0,0 +1,315 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` + // 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 name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + Name string `json:"name" validate:"regexp=^[a-z0-9]([a-z0-9-]{0,18}[a-z0-9])?$"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + PlanId string `json:"planId"` + RoutingType RoutingType `json:"routingType"` +} + +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, name string, planId string, routingType RoutingType) *Gateway { + this := Gateway{} + this.AvailabilityZones = availabilityZones + this.Name = name + 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 +} + +// 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 +} + +// GetName returns the Name field value +func (o *Gateway) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Gateway) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Gateway) SetName(v string) { + o.Name = 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 + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["planId"] = o.PlanId + toSerialize["routingType"] = o.RoutingType + 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", + "name", + "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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGateway) + + if err != nil { + return err + } + + *o = Gateway(varGateway) + + 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/v1alpha1api/model_gateway_availability_zones.go b/services/vpn/v1alpha1api/model_gateway_availability_zones.go new file mode 100644 index 000000000..b97a753d6 --- /dev/null +++ b/services/vpn/v1alpha1api/model_gateway_availability_zones.go @@ -0,0 +1,186 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGatewayAvailabilityZones) + + if err != nil { + return err + } + + *o = GatewayAvailabilityZones(varGatewayAvailabilityZones) + + 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/v1alpha1api/model_gateway_list.go b/services/vpn/v1alpha1api/model_gateway_list.go new file mode 100644 index 000000000..6eb37180a --- /dev/null +++ b/services/vpn/v1alpha1api/model_gateway_list.go @@ -0,0 +1,156 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGatewayList) + + if err != nil { + return err + } + + *o = GatewayList(varGatewayList) + + 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/v1alpha1api/model_gateway_response.go b/services/vpn/v1alpha1api/model_gateway_response.go new file mode 100644 index 000000000..d683b51b2 --- /dev/null +++ b/services/vpn/v1alpha1api/model_gateway_response.go @@ -0,0 +1,391 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` + // 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 name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + Name string `json:"name" validate:"regexp=^[a-z0-9]([a-z0-9-]{0,18}[a-z0-9])?$"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + PlanId string `json:"planId"` + RoutingType RoutingType `json:"routingType"` + Region *Region `json:"region,omitempty"` + State *GatewayStatus `json:"state,omitempty"` +} + +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, name string, planId string, routingType RoutingType) *GatewayResponse { + this := GatewayResponse{} + this.AvailabilityZones = availabilityZones + this.Name = name + this.PlanId = planId + this.RoutingType = routingType + var region Region = REGION_EU01 + this.Region = ®ion + 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{} + var region Region = REGION_EU01 + this.Region = ®ion + 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 +} + +// 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 +} + +// GetName returns the Name field value +func (o *GatewayResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GatewayResponse) SetName(v string) { + o.Name = 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 +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *GatewayResponse) GetRegion() Region { + if o == nil || IsNil(o.Region) { + var ret Region + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayResponse) GetRegionOk() (*Region, bool) { + if o == nil || IsNil(o.Region) { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *GatewayResponse) HasRegion() bool { + if o != nil && !IsNil(o.Region) { + return true + } + + return false +} + +// SetRegion gets a reference to the given Region and assigns it to the Region field. +func (o *GatewayResponse) SetRegion(v Region) { + o.Region = &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 + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["planId"] = o.PlanId + toSerialize["routingType"] = o.RoutingType + if !IsNil(o.Region) { + toSerialize["region"] = o.Region + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + 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", + "name", + "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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGatewayResponse) + + if err != nil { + return err + } + + *o = GatewayResponse(varGatewayResponse) + + 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/v1alpha1api/model_gateway_status.go b/services/vpn/v1alpha1api/model_gateway_status.go new file mode 100644 index 000000000..8362696d4 --- /dev/null +++ b/services/vpn/v1alpha1api/model_gateway_status.go @@ -0,0 +1,114 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "encoding/json" + "fmt" +) + +// GatewayStatus Describes the status of the surrounding infrastructure. +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/v1alpha1api/model_gateway_status_response.go b/services/vpn/v1alpha1api/model_gateway_status_response.go new file mode 100644 index 000000000..a0c490fc6 --- /dev/null +++ b/services/vpn/v1alpha1api/model_gateway_status_response.go @@ -0,0 +1,197 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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 { + // Name of the Gateway instance. + GatewayName *string `json:"gatewayName,omitempty"` + GatewayStatus *GatewayStatus `json:"gatewayStatus,omitempty"` + Tunnels []VPNTunnels `json:"tunnels,omitempty"` +} + +// 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 +} + +// GetGatewayName returns the GatewayName field value if set, zero value otherwise. +func (o *GatewayStatusResponse) GetGatewayName() string { + if o == nil || IsNil(o.GatewayName) { + var ret string + return ret + } + return *o.GatewayName +} + +// GetGatewayNameOk returns a tuple with the GatewayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayStatusResponse) GetGatewayNameOk() (*string, bool) { + if o == nil || IsNil(o.GatewayName) { + return nil, false + } + return o.GatewayName, true +} + +// HasGatewayName returns a boolean if a field has been set. +func (o *GatewayStatusResponse) HasGatewayName() bool { + if o != nil && !IsNil(o.GatewayName) { + return true + } + + return false +} + +// SetGatewayName gets a reference to the given string and assigns it to the GatewayName field. +func (o *GatewayStatusResponse) SetGatewayName(v string) { + o.GatewayName = &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 +} + +// 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.GatewayName) { + toSerialize["gatewayName"] = o.GatewayName + } + if !IsNil(o.GatewayStatus) { + toSerialize["gatewayStatus"] = o.GatewayStatus + } + if !IsNil(o.Tunnels) { + toSerialize["tunnels"] = o.Tunnels + } + return toSerialize, nil +} + +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/v1alpha1api/model_peering_config.go b/services/vpn/v1alpha1api/model_peering_config.go new file mode 100644 index 000000000..a6c0b11ad --- /dev/null +++ b/services/vpn/v1alpha1api/model_peering_config.go @@ -0,0 +1,160 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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}$"` +} + +// 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 + } + return toSerialize, nil +} + +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/v1alpha1api/model_phase.go b/services/vpn/v1alpha1api/model_phase.go new file mode 100644 index 000000000..a5d2a9762 --- /dev/null +++ b/services/vpn/v1alpha1api/model_phase.go @@ -0,0 +1,221 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varPhase) + + if err != nil { + return err + } + + *o = Phase(varPhase) + + 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/v1alpha1api/model_phase1_status.go b/services/vpn/v1alpha1api/model_phase1_status.go new file mode 100644 index 000000000..83a829b22 --- /dev/null +++ b/services/vpn/v1alpha1api/model_phase1_status.go @@ -0,0 +1,235 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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 { + // Negotiated Diffie-Hellman Group + DhGroup *string `json:"dhGroup,omitempty"` + // Negotiated encryption algorithm. + EncryptionAlgorithm *string `json:"encryptionAlgorithm,omitempty"` + // Negotiated integrity algorithm or pseudo-random-function. + IntegrityAlgorithm *string `json:"integrityAlgorithm,omitempty"` + State *string `json:"state,omitempty"` +} + +// 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 + } + return toSerialize, nil +} + +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/v1alpha1api/model_phase2_status.go b/services/vpn/v1alpha1api/model_phase2_status.go new file mode 100644 index 000000000..44fdfccf8 --- /dev/null +++ b/services/vpn/v1alpha1api/model_phase2_status.go @@ -0,0 +1,455 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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 { + // Bytes received. + BytesIn *string `json:"bytesIn,omitempty"` + // Bytes sent. + BytesOut *string `json:"bytesOut,omitempty"` + // Negotiated Diffie-Hellman Group + DhGroup *string `json:"dhGroup,omitempty"` + Encap *string `json:"encap,omitempty"` + // Negotiated encryption algorithm. + EncryptionAlgorithm *string `json:"encryptionAlgorithm,omitempty"` + // Negotiated integrity algorithm or pseudo-random-function. + IntegrityAlgorithm *string `json:"integrityAlgorithm,omitempty"` + // Packets received. + PacketsIn *string `json:"packetsIn,omitempty"` + // Packets sent. + PacketsOut *string `json:"packetsOut,omitempty"` + Protocol *string `json:"protocol,omitempty"` + State *string `json:"state,omitempty"` +} + +// 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 + } + return toSerialize, nil +} + +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/v1alpha1api/model_plan.go b/services/vpn/v1alpha1api/model_plan.go new file mode 100644 index 000000000..2f8e31839 --- /dev/null +++ b/services/vpn/v1alpha1api/model_plan.go @@ -0,0 +1,347 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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 { + // Maximum bandwidth of a VPN instance. + MaxBandwidth *int32 `json:"maxBandwidth,omitempty"` + // Maximum concurrent connections of a VPN Gateway. + MaxConnections *int32 `json:"maxConnections,omitempty"` + // Service plan name + Name *string `json:"name,omitempty"` + // Service plan identifier + PlanId *string `json:"planId,omitempty"` + // Region (read-only) + Region *string `json:"region,omitempty"` + // Plan SKU + Sku *string `json:"sku,omitempty"` + // Service plan type + Type *string `json:"type,omitempty"` +} + +// 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 +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *Plan) GetRegion() string { + if o == nil || IsNil(o.Region) { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetRegionOk() (*string, bool) { + if o == nil || IsNil(o.Region) { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *Plan) HasRegion() bool { + if o != nil && !IsNil(o.Region) { + return true + } + + return false +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *Plan) SetRegion(v string) { + o.Region = &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 +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Plan) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Plan) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Plan) SetType(v string) { + o.Type = &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.Region) { + toSerialize["region"] = o.Region + } + if !IsNil(o.Sku) { + toSerialize["sku"] = o.Sku + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + return toSerialize, nil +} + +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/v1alpha1api/model_plan_list.go b/services/vpn/v1alpha1api/model_plan_list.go new file mode 100644 index 000000000..1c14e721a --- /dev/null +++ b/services/vpn/v1alpha1api/model_plan_list.go @@ -0,0 +1,197 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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 { + // Default Plan ID for the current region + DefaultPlanId *string `json:"defaultPlanId,omitempty"` + Plans []Plan `json:"plans,omitempty"` + Tunnel *VPNTunnelPlan `json:"tunnel,omitempty"` +} + +// 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 +} + +// GetTunnel returns the Tunnel field value if set, zero value otherwise. +func (o *PlanList) GetTunnel() VPNTunnelPlan { + if o == nil || IsNil(o.Tunnel) { + var ret VPNTunnelPlan + return ret + } + return *o.Tunnel +} + +// GetTunnelOk returns a tuple with the Tunnel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanList) GetTunnelOk() (*VPNTunnelPlan, bool) { + if o == nil || IsNil(o.Tunnel) { + return nil, false + } + return o.Tunnel, true +} + +// HasTunnel returns a boolean if a field has been set. +func (o *PlanList) HasTunnel() bool { + if o != nil && !IsNil(o.Tunnel) { + return true + } + + return false +} + +// SetTunnel gets a reference to the given VPNTunnelPlan and assigns it to the Tunnel field. +func (o *PlanList) SetTunnel(v VPNTunnelPlan) { + o.Tunnel = &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 + } + if !IsNil(o.Tunnel) { + toSerialize["tunnel"] = o.Tunnel + } + return toSerialize, nil +} + +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/v1alpha1api/model_quota.go b/services/vpn/v1alpha1api/model_quota.go new file mode 100644 index 000000000..f41262b99 --- /dev/null +++ b/services/vpn/v1alpha1api/model_quota.go @@ -0,0 +1,184 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varQuota) + + if err != nil { + return err + } + + *o = Quota(varQuota) + + 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/v1alpha1api/model_quota_list.go b/services/vpn/v1alpha1api/model_quota_list.go new file mode 100644 index 000000000..ffbb1c75d --- /dev/null +++ b/services/vpn/v1alpha1api/model_quota_list.go @@ -0,0 +1,157 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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 { + // The number of gateways. + Gateways Quota `json:"gateways"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varQuotaList) + + if err != nil { + return err + } + + *o = QuotaList(varQuotaList) + + 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/v1alpha1api/model_quota_list_response.go b/services/vpn/v1alpha1api/model_quota_list_response.go new file mode 100644 index 000000000..3867ec307 --- /dev/null +++ b/services/vpn/v1alpha1api/model_quota_list_response.go @@ -0,0 +1,156 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varQuotaListResponse) + + if err != nil { + return err + } + + *o = QuotaListResponse(varQuotaListResponse) + + 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/v1alpha1api/model_region.go b/services/vpn/v1alpha1api/model_region.go new file mode 100644 index 000000000..ca0eaed45 --- /dev/null +++ b/services/vpn/v1alpha1api/model_region.go @@ -0,0 +1,110 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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/v1alpha1api/model_routing_type.go b/services/vpn/v1alpha1api/model_routing_type.go new file mode 100644 index 000000000..7eb5d4ff2 --- /dev/null +++ b/services/vpn/v1alpha1api/model_routing_type.go @@ -0,0 +1,112 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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/v1alpha1api/model_tunnel_configuration.go b/services/vpn/v1alpha1api/model_tunnel_configuration.go new file mode 100644 index 000000000..a0c670de8 --- /dev/null +++ b/services/vpn/v1alpha1api/model_tunnel_configuration.go @@ -0,0 +1,321 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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}$"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTunnelConfiguration) + + if err != nil { + return err + } + + *o = TunnelConfiguration(varTunnelConfiguration) + + 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/v1alpha1api/model_tunnel_configuration_phase1.go b/services/vpn/v1alpha1api/model_tunnel_configuration_phase1.go new file mode 100644 index 000000000..79bcd1df7 --- /dev/null +++ b/services/vpn/v1alpha1api/model_tunnel_configuration_phase1.go @@ -0,0 +1,262 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + } + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTunnelConfigurationPhase1) + + if err != nil { + return err + } + + *o = TunnelConfigurationPhase1(varTunnelConfigurationPhase1) + + 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/v1alpha1api/model_tunnel_configuration_phase2.go b/services/vpn/v1alpha1api/model_tunnel_configuration_phase2.go new file mode 100644 index 000000000..9a0ef940d --- /dev/null +++ b/services/vpn/v1alpha1api/model_tunnel_configuration_phase2.go @@ -0,0 +1,344 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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. \"trap\": installs a trap policy which will catch matching traffic and tries to re-negotiate the tunnel on-demand). \"restart\": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA. + DpdAction *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. \"trap\": installs a trap policy which triggers the tunnel as soon as matching traffic has been detected. \"start\": initiates the connection actively. \"start|stop\": Immediately initiate a connection for which trap policies have been installed. + StartAction *string `json:"startAction,omitempty"` +} + +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 + } + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTunnelConfigurationPhase2) + + if err != nil { + return err + } + + *o = TunnelConfigurationPhase2(varTunnelConfigurationPhase2) + + 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/v1alpha1api/model_tunnel_status.go b/services/vpn/v1alpha1api/model_tunnel_status.go new file mode 100644 index 000000000..dddd77808 --- /dev/null +++ b/services/vpn/v1alpha1api/model_tunnel_status.go @@ -0,0 +1,232 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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"` +} + +// 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 + } + return toSerialize, nil +} + +type NullableTunnelStatus struct { + value *TunnelStatus + isSet bool +} + +func (v NullableTunnelStatus) Get() *TunnelStatus { + return v.value +} + +func (v *NullableTunnelStatus) Set(val *TunnelStatus) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelStatus(val *TunnelStatus) *NullableTunnelStatus { + return &NullableTunnelStatus{value: val, isSet: true} +} + +func (v NullableTunnelStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1alpha1api/model_update_gateway_connection_payload.go b/services/vpn/v1alpha1api/model_update_gateway_connection_payload.go new file mode 100644 index 000000000..f9d3ec49b --- /dev/null +++ b/services/vpn/v1alpha1api/model_update_gateway_connection_payload.go @@ -0,0 +1,397 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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 { + // This flag decides whether this connection should be enabled or disabled + Enabled *bool `json:"enabled,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"` + // The name of the connection. Maximum 20 characters (only alphanumeric and hyphens allowed). The name bust be unique within the parent Gateway. Currently renaming is not possible therefore deleting and re-creating the connection is necessary. + Name string `json:"name" validate:"regexp=^[a-z0-9]([a-z0-9-]{0,18}[a-z0-9])?$"` + // Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based. + RemoteSubnets []string `json:"remoteSubnets,omitempty"` + StaticRoutes []string `json:"staticRoutes,omitempty"` + Tunnel1 TunnelConfiguration `json:"tunnel1"` + Tunnel2 TunnelConfiguration `json:"tunnel2"` +} + +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(name string, tunnel1 TunnelConfiguration, tunnel2 TunnelConfiguration) *UpdateGatewayConnectionPayload { + this := UpdateGatewayConnectionPayload{} + this.Name = name + 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 +} + +// 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 +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateGatewayConnectionPayload) 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 *UpdateGatewayConnectionPayload) 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 *UpdateGatewayConnectionPayload) 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 *UpdateGatewayConnectionPayload) SetLabels(v map[string]string) { + o.Labels = &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 +} + +// GetName returns the Name field value +func (o *UpdateGatewayConnectionPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *UpdateGatewayConnectionPayload) SetName(v string) { + o.Name = 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{}{} + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.LocalSubnets) { + toSerialize["localSubnets"] = o.LocalSubnets + } + toSerialize["name"] = o.Name + if !IsNil(o.RemoteSubnets) { + toSerialize["remoteSubnets"] = o.RemoteSubnets + } + if !IsNil(o.StaticRoutes) { + toSerialize["staticRoutes"] = o.StaticRoutes + } + toSerialize["tunnel1"] = o.Tunnel1 + toSerialize["tunnel2"] = o.Tunnel2 + 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{ + "name", + "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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateGatewayConnectionPayload) + + if err != nil { + return err + } + + *o = UpdateGatewayConnectionPayload(varUpdateGatewayConnectionPayload) + + 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/v1alpha1api/model_update_vpn_gateway_payload.go b/services/vpn/v1alpha1api/model_update_vpn_gateway_payload.go new file mode 100644 index 000000000..597f5d103 --- /dev/null +++ b/services/vpn/v1alpha1api/model_update_vpn_gateway_payload.go @@ -0,0 +1,315 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` + // 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 name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + Name string `json:"name" validate:"regexp=^[a-z0-9]([a-z0-9-]{0,18}[a-z0-9])?$"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + PlanId string `json:"planId"` + RoutingType RoutingType `json:"routingType"` +} + +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, name string, planId string, routingType RoutingType) *UpdateVPNGatewayPayload { + this := UpdateVPNGatewayPayload{} + this.AvailabilityZones = availabilityZones + this.Name = name + 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 +} + +// 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 +} + +// GetName returns the Name field value +func (o *UpdateVPNGatewayPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *UpdateVPNGatewayPayload) SetName(v string) { + o.Name = 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 + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["planId"] = o.PlanId + toSerialize["routingType"] = o.RoutingType + 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", + "name", + "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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateVPNGatewayPayload) + + if err != nil { + return err + } + + *o = UpdateVPNGatewayPayload(varUpdateVPNGatewayPayload) + + 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/v1alpha1api/model_update_vpn_gateway_payload_availability_zones.go b/services/vpn/v1alpha1api/model_update_vpn_gateway_payload_availability_zones.go new file mode 100644 index 000000000..cc9c713d2 --- /dev/null +++ b/services/vpn/v1alpha1api/model_update_vpn_gateway_payload_availability_zones.go @@ -0,0 +1,186 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "bytes" + "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"` +} + +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 + 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{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateVPNGatewayPayloadAvailabilityZones) + + if err != nil { + return err + } + + *o = UpdateVPNGatewayPayloadAvailabilityZones(varUpdateVPNGatewayPayloadAvailabilityZones) + + 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/v1alpha1api/model_vpn_tunnel_plan.go b/services/vpn/v1alpha1api/model_vpn_tunnel_plan.go new file mode 100644 index 000000000..bfe8a352f --- /dev/null +++ b/services/vpn/v1alpha1api/model_vpn_tunnel_plan.go @@ -0,0 +1,199 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "encoding/json" +) + +// checks if the VPNTunnelPlan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VPNTunnelPlan{} + +// VPNTunnelPlan struct for VPNTunnelPlan +type VPNTunnelPlan struct { + // Tunnel model name + Name *string `json:"name,omitempty"` + // Tunnel model region + Region *string `json:"region,omitempty"` + // Tunnel model SKU + Sku *string `json:"sku,omitempty"` +} + +// NewVPNTunnelPlan instantiates a new VPNTunnelPlan 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 NewVPNTunnelPlan() *VPNTunnelPlan { + this := VPNTunnelPlan{} + return &this +} + +// NewVPNTunnelPlanWithDefaults instantiates a new VPNTunnelPlan 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 NewVPNTunnelPlanWithDefaults() *VPNTunnelPlan { + this := VPNTunnelPlan{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VPNTunnelPlan) 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 *VPNTunnelPlan) 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 *VPNTunnelPlan) 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 *VPNTunnelPlan) SetName(v string) { + o.Name = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *VPNTunnelPlan) GetRegion() string { + if o == nil || IsNil(o.Region) { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnelPlan) GetRegionOk() (*string, bool) { + if o == nil || IsNil(o.Region) { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *VPNTunnelPlan) HasRegion() bool { + if o != nil && !IsNil(o.Region) { + return true + } + + return false +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *VPNTunnelPlan) SetRegion(v string) { + o.Region = &v +} + +// GetSku returns the Sku field value if set, zero value otherwise. +func (o *VPNTunnelPlan) 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 *VPNTunnelPlan) 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 *VPNTunnelPlan) 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 *VPNTunnelPlan) SetSku(v string) { + o.Sku = &v +} + +func (o VPNTunnelPlan) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VPNTunnelPlan) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Region) { + toSerialize["region"] = o.Region + } + if !IsNil(o.Sku) { + toSerialize["sku"] = o.Sku + } + return toSerialize, nil +} + +type NullableVPNTunnelPlan struct { + value *VPNTunnelPlan + isSet bool +} + +func (v NullableVPNTunnelPlan) Get() *VPNTunnelPlan { + return v.value +} + +func (v *NullableVPNTunnelPlan) Set(val *VPNTunnelPlan) { + v.value = val + v.isSet = true +} + +func (v NullableVPNTunnelPlan) IsSet() bool { + return v.isSet +} + +func (v *NullableVPNTunnelPlan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVPNTunnelPlan(val *VPNTunnelPlan) *NullableVPNTunnelPlan { + return &NullableVPNTunnelPlan{value: val, isSet: true} +} + +func (v NullableVPNTunnelPlan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVPNTunnelPlan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1alpha1api/model_vpn_tunnels.go b/services/vpn/v1alpha1api/model_vpn_tunnels.go new file mode 100644 index 000000000..b3af302bf --- /dev/null +++ b/services/vpn/v1alpha1api/model_vpn_tunnels.go @@ -0,0 +1,243 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +import ( + "encoding/json" +) + +// checks if the VPNTunnels type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VPNTunnels{} + +// VPNTunnels List all available tunnels with public IP and status +type VPNTunnels struct { + BgpStatus NullableBGPStatus `json:"bgpStatus,omitempty"` + InstanceState *GatewayStatus `json:"instanceState,omitempty"` + Name *string `json:"name,omitempty"` + PublicIP *string `json:"publicIP,omitempty"` +} + +// NewVPNTunnels instantiates a new VPNTunnels object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVPNTunnels() *VPNTunnels { + this := VPNTunnels{} + return &this +} + +// NewVPNTunnelsWithDefaults instantiates a new VPNTunnels object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVPNTunnelsWithDefaults() *VPNTunnels { + this := VPNTunnels{} + return &this +} + +// GetBgpStatus returns the BgpStatus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *VPNTunnels) GetBgpStatus() 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 + } + return toSerialize, nil +} + +type NullableVPNTunnels struct { + value *VPNTunnels + isSet bool +} + +func (v NullableVPNTunnels) Get() *VPNTunnels { + return v.value +} + +func (v *NullableVPNTunnels) Set(val *VPNTunnels) { + v.value = val + v.isSet = true +} + +func (v NullableVPNTunnels) IsSet() bool { + return v.isSet +} + +func (v *NullableVPNTunnels) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVPNTunnels(val *VPNTunnels) *NullableVPNTunnels { + return &NullableVPNTunnels{value: val, isSet: true} +} + +func (v NullableVPNTunnels) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVPNTunnels) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/vpn/v1alpha1api/response.go b/services/vpn/v1alpha1api/response.go new file mode 100644 index 000000000..e04a386ff --- /dev/null +++ b/services/vpn/v1alpha1api/response.go @@ -0,0 +1,47 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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/v1alpha1api/utils.go b/services/vpn/v1alpha1api/utils.go new file mode 100644 index 000000000..c715674be --- /dev/null +++ b/services/vpn/v1alpha1api/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alpha1api + +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...) +}