From 5f42f70269fff651f2757f52ec8c631119f4e4f1 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 6 Aug 2026 08:22:08 +0000 Subject: [PATCH] Generate functions --- go.work | 2 + services/functions/LICENSE.md | 201 ++ services/functions/go.mod | 10 + services/functions/go.sum | 8 + services/functions/oas_commit | 1 + services/functions/package.go | 1 + services/functions/v1alphaapi/api_default.go | 2552 +++++++++++++++++ .../functions/v1alphaapi/api_default_mock.go | 334 +++ services/functions/v1alphaapi/client.go | 658 +++++ .../functions/v1alphaapi/configuration.go | 40 + .../model_create_function_payload.go | 470 +++ .../model_create_function_payload_state.go | 115 + .../model_create_function_revision_payload.go | 689 +++++ ..._create_function_revision_payload_state.go | 117 + .../model_create_pull_secret_payload.go | 340 +++ services/functions/v1alphaapi/model_error.go | 229 ++ .../v1alphaapi/model_error_details_inner.go | 159 + .../functions/v1alphaapi/model_error_info.go | 268 ++ .../functions/v1alphaapi/model_function.go | 470 +++ .../v1alphaapi/model_function_state.go | 115 + services/functions/v1alphaapi/model_help.go | 192 ++ .../v1alphaapi/model_help_message.go | 192 ++ .../v1alphaapi/model_list_functions.go | 192 ++ .../model_list_functions_401_response.go | 153 + .../v1alphaapi/model_list_pull_secrets.go | 192 ++ .../v1alphaapi/model_list_revisions.go | 230 ++ .../functions/v1alphaapi/model_pull_secret.go | 340 +++ .../v1alphaapi/model_resource_limits.go | 195 ++ .../functions/v1alphaapi/model_revision.go | 689 +++++ .../v1alphaapi/model_revision_state.go | 117 + .../v1alphaapi/model_revision_variable.go | 265 ++ .../model_update_function_payload.go | 470 +++ .../model_update_function_payload_state.go | 115 + .../model_update_pull_secret_payload.go | 340 +++ .../model_update_revision_payload.go | 689 +++++ .../model_update_revision_payload_state.go | 117 + services/functions/v1alphaapi/response.go | 47 + services/functions/v1alphaapi/utils.go | 361 +++ 38 files changed, 11675 insertions(+) create mode 100644 services/functions/LICENSE.md create mode 100644 services/functions/go.mod create mode 100644 services/functions/go.sum create mode 100644 services/functions/oas_commit create mode 100644 services/functions/package.go create mode 100644 services/functions/v1alphaapi/api_default.go create mode 100644 services/functions/v1alphaapi/api_default_mock.go create mode 100644 services/functions/v1alphaapi/client.go create mode 100644 services/functions/v1alphaapi/configuration.go create mode 100644 services/functions/v1alphaapi/model_create_function_payload.go create mode 100644 services/functions/v1alphaapi/model_create_function_payload_state.go create mode 100644 services/functions/v1alphaapi/model_create_function_revision_payload.go create mode 100644 services/functions/v1alphaapi/model_create_function_revision_payload_state.go create mode 100644 services/functions/v1alphaapi/model_create_pull_secret_payload.go create mode 100644 services/functions/v1alphaapi/model_error.go create mode 100644 services/functions/v1alphaapi/model_error_details_inner.go create mode 100644 services/functions/v1alphaapi/model_error_info.go create mode 100644 services/functions/v1alphaapi/model_function.go create mode 100644 services/functions/v1alphaapi/model_function_state.go create mode 100644 services/functions/v1alphaapi/model_help.go create mode 100644 services/functions/v1alphaapi/model_help_message.go create mode 100644 services/functions/v1alphaapi/model_list_functions.go create mode 100644 services/functions/v1alphaapi/model_list_functions_401_response.go create mode 100644 services/functions/v1alphaapi/model_list_pull_secrets.go create mode 100644 services/functions/v1alphaapi/model_list_revisions.go create mode 100644 services/functions/v1alphaapi/model_pull_secret.go create mode 100644 services/functions/v1alphaapi/model_resource_limits.go create mode 100644 services/functions/v1alphaapi/model_revision.go create mode 100644 services/functions/v1alphaapi/model_revision_state.go create mode 100644 services/functions/v1alphaapi/model_revision_variable.go create mode 100644 services/functions/v1alphaapi/model_update_function_payload.go create mode 100644 services/functions/v1alphaapi/model_update_function_payload_state.go create mode 100644 services/functions/v1alphaapi/model_update_pull_secret_payload.go create mode 100644 services/functions/v1alphaapi/model_update_revision_payload.go create mode 100644 services/functions/v1alphaapi/model_update_revision_payload_state.go create mode 100644 services/functions/v1alphaapi/response.go create mode 100644 services/functions/v1alphaapi/utils.go diff --git a/go.work b/go.work index 6d6cb7266..6c4fc8244 100644 --- a/go.work +++ b/go.work @@ -51,6 +51,7 @@ use ( ./services/dns ./services/dremio ./services/edge + ./services/functions ./services/git ./services/iaas ./services/iaasalpha @@ -85,4 +86,5 @@ use ( ./services/telemetrylink ./services/telemetryrouter ./services/vpn + ./tools ) diff --git a/services/functions/LICENSE.md b/services/functions/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/functions/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/functions/go.mod b/services/functions/go.mod new file mode 100644 index 000000000..8f2cc8f05 --- /dev/null +++ b/services/functions/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/functions + +go 1.25 + +require github.com/stackitcloud/stackit-sdk-go/core v0.26.0 + +require ( + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/functions/go.sum b/services/functions/go.sum new file mode 100644 index 000000000..3712a0c87 --- /dev/null +++ b/services/functions/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.26.0 h1:jQEb9gkehfp6VCP6TcYk7BI10cz4l0KM2L6hqYBH2QA= +github.com/stackitcloud/stackit-sdk-go/core v0.26.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/functions/oas_commit b/services/functions/oas_commit new file mode 100644 index 000000000..da1ca1cac --- /dev/null +++ b/services/functions/oas_commit @@ -0,0 +1 @@ +602a933a8a6cc22c52171febbca7ceaf63bc7538 diff --git a/services/functions/package.go b/services/functions/package.go new file mode 100644 index 000000000..b13ee3d60 --- /dev/null +++ b/services/functions/package.go @@ -0,0 +1 @@ +package functions diff --git a/services/functions/v1alphaapi/api_default.go b/services/functions/v1alphaapi/api_default.go new file mode 100644 index 000000000..b04463065 --- /dev/null +++ b/services/functions/v1alphaapi/api_default.go @@ -0,0 +1,2552 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +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 { + + /* + CreateFunction Method for CreateFunction + + Creates a new function. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @return ApiCreateFunctionRequest + */ + CreateFunction(ctx context.Context, projectId string) ApiCreateFunctionRequest + + // CreateFunctionExecute executes the request + // @return Function + CreateFunctionExecute(r ApiCreateFunctionRequest) (*Function, error) + + /* + CreateFunctionRevision Method for CreateFunctionRevision + + Create a new function revision + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiCreateFunctionRevisionRequest + */ + CreateFunctionRevision(ctx context.Context, projectId string, functionId string) ApiCreateFunctionRevisionRequest + + // CreateFunctionRevisionExecute executes the request + // @return Revision + CreateFunctionRevisionExecute(r ApiCreateFunctionRevisionRequest) (*Revision, error) + + /* + CreatePullSecret Create OCI image registry pull secret definition + + Create a new OCI image registry pull secret configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @return ApiCreatePullSecretRequest + */ + CreatePullSecret(ctx context.Context, projectId string) ApiCreatePullSecretRequest + + // CreatePullSecretExecute executes the request + // @return PullSecret + CreatePullSecretExecute(r ApiCreatePullSecretRequest) (*PullSecret, error) + + /* + DeleteFunction Method for DeleteFunction + + Deletes a specific function. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiDeleteFunctionRequest + */ + DeleteFunction(ctx context.Context, projectId string, functionId string) ApiDeleteFunctionRequest + + // DeleteFunctionExecute executes the request + DeleteFunctionExecute(r ApiDeleteFunctionRequest) error + + /* + DeletePullSecret Remove OCI image registry pull secret definition + + Removes the OCI image pull secret registry configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param pullSecretId The identifier of the OCI registry pull secret configuration + @return ApiDeletePullSecretRequest + */ + DeletePullSecret(ctx context.Context, projectId string, pullSecretId string) ApiDeletePullSecretRequest + + // DeletePullSecretExecute executes the request + DeletePullSecretExecute(r ApiDeletePullSecretRequest) error + + /* + DeleteRevision Method for DeleteRevision + + Deletes a specific revision. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @param revisionId The identifier of the revision + @return ApiDeleteRevisionRequest + */ + DeleteRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiDeleteRevisionRequest + + // DeleteRevisionExecute executes the request + DeleteRevisionExecute(r ApiDeleteRevisionRequest) error + + /* + GetFunction Method for GetFunction + + Retrieves details of a specific function. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiGetFunctionRequest + */ + GetFunction(ctx context.Context, projectId string, functionId string) ApiGetFunctionRequest + + // GetFunctionExecute executes the request + // @return Function + GetFunctionExecute(r ApiGetFunctionRequest) (*Function, error) + + /* + GetPullSecret Get OCI image registry pull secret definition + + Returns the current OCI image registry pull secret configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param pullSecretId The identifier of the OCI registry pull secret configuration + @return ApiGetPullSecretRequest + */ + GetPullSecret(ctx context.Context, projectId string, pullSecretId string) ApiGetPullSecretRequest + + // GetPullSecretExecute executes the request + // @return PullSecret + GetPullSecretExecute(r ApiGetPullSecretRequest) (*PullSecret, error) + + /* + GetRevision Method for GetRevision + + Retrieves a specific revision. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @param revisionId The identifier of the revision + @return ApiGetRevisionRequest + */ + GetRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiGetRevisionRequest + + // GetRevisionExecute executes the request + // @return Revision + GetRevisionExecute(r ApiGetRevisionRequest) (*Revision, error) + + /* + ListFunctions Method for ListFunctions + + Lists all functions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @return ApiListFunctionsRequest + */ + ListFunctions(ctx context.Context, projectId string) ApiListFunctionsRequest + + // ListFunctionsExecute executes the request + // @return ListFunctions + ListFunctionsExecute(r ApiListFunctionsRequest) (*ListFunctions, error) + + /* + ListPullSecrets List OCI image registry pull secret definitions + + Returns all the current OCI image registry pull secret configurations for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @return ApiListPullSecretsRequest + */ + ListPullSecrets(ctx context.Context, projectId string) ApiListPullSecretsRequest + + // ListPullSecretsExecute executes the request + // @return ListPullSecrets + ListPullSecretsExecute(r ApiListPullSecretsRequest) (*ListPullSecrets, error) + + /* + ListRevisions Method for ListRevisions + + Lists all revisions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiListRevisionsRequest + */ + ListRevisions(ctx context.Context, projectId string, functionId string) ApiListRevisionsRequest + + // ListRevisionsExecute executes the request + // @return ListRevisions + ListRevisionsExecute(r ApiListRevisionsRequest) (*ListRevisions, error) + + /* + UpdateFunction Method for UpdateFunction + + Updates a specific function. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiUpdateFunctionRequest + */ + UpdateFunction(ctx context.Context, projectId string, functionId string) ApiUpdateFunctionRequest + + // UpdateFunctionExecute executes the request + // @return Function + UpdateFunctionExecute(r ApiUpdateFunctionRequest) (*Function, error) + + /* + UpdatePullSecret Update OCI image registry pull secret definition + + Updates the OCI image registry pull secret configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param pullSecretId The identifier of the OCI registry pull secret configuration + @return ApiUpdatePullSecretRequest + */ + UpdatePullSecret(ctx context.Context, projectId string, pullSecretId string) ApiUpdatePullSecretRequest + + // UpdatePullSecretExecute executes the request + // @return PullSecret + UpdatePullSecretExecute(r ApiUpdatePullSecretRequest) (*PullSecret, error) + + /* + UpdateRevision Method for UpdateRevision + + Updates a specific revision. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @param revisionId The identifier of the revision + @return ApiUpdateRevisionRequest + */ + UpdateRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiUpdateRevisionRequest + + // UpdateRevisionExecute executes the request + // @return Revision + UpdateRevisionExecute(r ApiUpdateRevisionRequest) (*Revision, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateFunctionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + createFunctionPayload *CreateFunctionPayload +} + +func (r ApiCreateFunctionRequest) CreateFunctionPayload(createFunctionPayload CreateFunctionPayload) ApiCreateFunctionRequest { + r.createFunctionPayload = &createFunctionPayload + return r +} + +func (r ApiCreateFunctionRequest) Execute() (*Function, error) { + return r.ApiService.CreateFunctionExecute(r) +} + +/* +CreateFunction Method for CreateFunction + +Creates a new function. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @return ApiCreateFunctionRequest +*/ +func (a *DefaultAPIService) CreateFunction(ctx context.Context, projectId string) ApiCreateFunctionRequest { + return ApiCreateFunctionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return Function +func (a *DefaultAPIService) CreateFunctionExecute(r ApiCreateFunctionRequest) (*Function, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Function + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateFunction") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createFunctionPayload == nil { + return localVarReturnValue, reportError("createFunctionPayload 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.createFunctionPayload + 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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiCreateFunctionRevisionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + functionId string + createFunctionRevisionPayload *CreateFunctionRevisionPayload +} + +func (r ApiCreateFunctionRevisionRequest) CreateFunctionRevisionPayload(createFunctionRevisionPayload CreateFunctionRevisionPayload) ApiCreateFunctionRevisionRequest { + r.createFunctionRevisionPayload = &createFunctionRevisionPayload + return r +} + +func (r ApiCreateFunctionRevisionRequest) Execute() (*Revision, error) { + return r.ApiService.CreateFunctionRevisionExecute(r) +} + +/* +CreateFunctionRevision Method for CreateFunctionRevision + +Create a new function revision + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiCreateFunctionRevisionRequest +*/ +func (a *DefaultAPIService) CreateFunctionRevision(ctx context.Context, projectId string, functionId string) ApiCreateFunctionRevisionRequest { + return ApiCreateFunctionRevisionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// Execute executes the request +// +// @return Revision +func (a *DefaultAPIService) CreateFunctionRevisionExecute(r ApiCreateFunctionRevisionRequest) (*Revision, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Revision + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateFunctionRevision") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions/{functionId}/revisions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"functionId"+"}", url.PathEscape(parameterValueToString(r.functionId, "functionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createFunctionRevisionPayload == nil { + return localVarReturnValue, reportError("createFunctionRevisionPayload 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.createFunctionRevisionPayload + 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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiCreatePullSecretRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + createPullSecretPayload *CreatePullSecretPayload +} + +func (r ApiCreatePullSecretRequest) CreatePullSecretPayload(createPullSecretPayload CreatePullSecretPayload) ApiCreatePullSecretRequest { + r.createPullSecretPayload = &createPullSecretPayload + return r +} + +func (r ApiCreatePullSecretRequest) Execute() (*PullSecret, error) { + return r.ApiService.CreatePullSecretExecute(r) +} + +/* +CreatePullSecret Create OCI image registry pull secret definition + +Create a new OCI image registry pull secret configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @return ApiCreatePullSecretRequest +*/ +func (a *DefaultAPIService) CreatePullSecret(ctx context.Context, projectId string) ApiCreatePullSecretRequest { + return ApiCreatePullSecretRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return PullSecret +func (a *DefaultAPIService) CreatePullSecretExecute(r ApiCreatePullSecretRequest) (*PullSecret, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PullSecret + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreatePullSecret") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/pull-secrets" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createPullSecretPayload == nil { + return localVarReturnValue, reportError("createPullSecretPayload 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.createPullSecretPayload + 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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiDeleteFunctionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + functionId string +} + +func (r ApiDeleteFunctionRequest) Execute() error { + return r.ApiService.DeleteFunctionExecute(r) +} + +/* +DeleteFunction Method for DeleteFunction + +Deletes a specific function. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiDeleteFunctionRequest +*/ +func (a *DefaultAPIService) DeleteFunction(ctx context.Context, projectId string, functionId string) ApiDeleteFunctionRequest { + return ApiDeleteFunctionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteFunctionExecute(r ApiDeleteFunctionRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteFunction") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions/{functionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"functionId"+"}", url.PathEscape(parameterValueToString(r.functionId, "functionId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiDeletePullSecretRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + pullSecretId string +} + +func (r ApiDeletePullSecretRequest) Execute() error { + return r.ApiService.DeletePullSecretExecute(r) +} + +/* +DeletePullSecret Remove OCI image registry pull secret definition + +Removes the OCI image pull secret registry configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param pullSecretId The identifier of the OCI registry pull secret configuration + @return ApiDeletePullSecretRequest +*/ +func (a *DefaultAPIService) DeletePullSecret(ctx context.Context, projectId string, pullSecretId string) ApiDeletePullSecretRequest { + return ApiDeletePullSecretRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + pullSecretId: pullSecretId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeletePullSecretExecute(r ApiDeletePullSecretRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeletePullSecret") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/pull-secrets/{pullSecretId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullSecretId"+"}", url.PathEscape(parameterValueToString(r.pullSecretId, "pullSecretId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiDeleteRevisionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + functionId string + revisionId string +} + +func (r ApiDeleteRevisionRequest) Execute() error { + return r.ApiService.DeleteRevisionExecute(r) +} + +/* +DeleteRevision Method for DeleteRevision + +Deletes a specific revision. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @param revisionId The identifier of the revision + @return ApiDeleteRevisionRequest +*/ +func (a *DefaultAPIService) DeleteRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiDeleteRevisionRequest { + return ApiDeleteRevisionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + revisionId: revisionId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteRevisionExecute(r ApiDeleteRevisionRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteRevision") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions/{functionId}/revisions/{revisionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"functionId"+"}", url.PathEscape(parameterValueToString(r.functionId, "functionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revisionId"+"}", url.PathEscape(parameterValueToString(r.revisionId, "revisionId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiGetFunctionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + functionId string +} + +func (r ApiGetFunctionRequest) Execute() (*Function, error) { + return r.ApiService.GetFunctionExecute(r) +} + +/* +GetFunction Method for GetFunction + +Retrieves details of a specific function. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiGetFunctionRequest +*/ +func (a *DefaultAPIService) GetFunction(ctx context.Context, projectId string, functionId string) ApiGetFunctionRequest { + return ApiGetFunctionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// Execute executes the request +// +// @return Function +func (a *DefaultAPIService) GetFunctionExecute(r ApiGetFunctionRequest) (*Function, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Function + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetFunction") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions/{functionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"functionId"+"}", url.PathEscape(parameterValueToString(r.functionId, "functionId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetPullSecretRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + pullSecretId string +} + +func (r ApiGetPullSecretRequest) Execute() (*PullSecret, error) { + return r.ApiService.GetPullSecretExecute(r) +} + +/* +GetPullSecret Get OCI image registry pull secret definition + +Returns the current OCI image registry pull secret configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param pullSecretId The identifier of the OCI registry pull secret configuration + @return ApiGetPullSecretRequest +*/ +func (a *DefaultAPIService) GetPullSecret(ctx context.Context, projectId string, pullSecretId string) ApiGetPullSecretRequest { + return ApiGetPullSecretRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + pullSecretId: pullSecretId, + } +} + +// Execute executes the request +// +// @return PullSecret +func (a *DefaultAPIService) GetPullSecretExecute(r ApiGetPullSecretRequest) (*PullSecret, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PullSecret + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetPullSecret") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/pull-secrets/{pullSecretId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullSecretId"+"}", url.PathEscape(parameterValueToString(r.pullSecretId, "pullSecretId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetRevisionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + functionId string + revisionId string +} + +func (r ApiGetRevisionRequest) Execute() (*Revision, error) { + return r.ApiService.GetRevisionExecute(r) +} + +/* +GetRevision Method for GetRevision + +Retrieves a specific revision. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @param revisionId The identifier of the revision + @return ApiGetRevisionRequest +*/ +func (a *DefaultAPIService) GetRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiGetRevisionRequest { + return ApiGetRevisionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + revisionId: revisionId, + } +} + +// Execute executes the request +// +// @return Revision +func (a *DefaultAPIService) GetRevisionExecute(r ApiGetRevisionRequest) (*Revision, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Revision + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetRevision") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions/{functionId}/revisions/{revisionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"functionId"+"}", url.PathEscape(parameterValueToString(r.functionId, "functionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revisionId"+"}", url.PathEscape(parameterValueToString(r.revisionId, "revisionId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListFunctionsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string +} + +func (r ApiListFunctionsRequest) Execute() (*ListFunctions, error) { + return r.ApiService.ListFunctionsExecute(r) +} + +/* +ListFunctions Method for ListFunctions + +Lists all functions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @return ApiListFunctionsRequest +*/ +func (a *DefaultAPIService) ListFunctions(ctx context.Context, projectId string) ApiListFunctionsRequest { + return ApiListFunctionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return ListFunctions +func (a *DefaultAPIService) ListFunctionsExecute(r ApiListFunctionsRequest) (*ListFunctions, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListFunctions + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListFunctions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListPullSecretsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string +} + +func (r ApiListPullSecretsRequest) Execute() (*ListPullSecrets, error) { + return r.ApiService.ListPullSecretsExecute(r) +} + +/* +ListPullSecrets List OCI image registry pull secret definitions + +Returns all the current OCI image registry pull secret configurations for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @return ApiListPullSecretsRequest +*/ +func (a *DefaultAPIService) ListPullSecrets(ctx context.Context, projectId string) ApiListPullSecretsRequest { + return ApiListPullSecretsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return ListPullSecrets +func (a *DefaultAPIService) ListPullSecretsExecute(r ApiListPullSecretsRequest) (*ListPullSecrets, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListPullSecrets + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListPullSecrets") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/pull-secrets" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListRevisionsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + functionId string +} + +func (r ApiListRevisionsRequest) Execute() (*ListRevisions, error) { + return r.ApiService.ListRevisionsExecute(r) +} + +/* +ListRevisions Method for ListRevisions + +Lists all revisions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiListRevisionsRequest +*/ +func (a *DefaultAPIService) ListRevisions(ctx context.Context, projectId string, functionId string) ApiListRevisionsRequest { + return ApiListRevisionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// Execute executes the request +// +// @return ListRevisions +func (a *DefaultAPIService) ListRevisionsExecute(r ApiListRevisionsRequest) (*ListRevisions, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListRevisions + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListRevisions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions/{functionId}/revisions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"functionId"+"}", url.PathEscape(parameterValueToString(r.functionId, "functionId")), -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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiUpdateFunctionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + functionId string + updateFunctionPayload *UpdateFunctionPayload +} + +func (r ApiUpdateFunctionRequest) UpdateFunctionPayload(updateFunctionPayload UpdateFunctionPayload) ApiUpdateFunctionRequest { + r.updateFunctionPayload = &updateFunctionPayload + return r +} + +func (r ApiUpdateFunctionRequest) Execute() (*Function, error) { + return r.ApiService.UpdateFunctionExecute(r) +} + +/* +UpdateFunction Method for UpdateFunction + +Updates a specific function. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @return ApiUpdateFunctionRequest +*/ +func (a *DefaultAPIService) UpdateFunction(ctx context.Context, projectId string, functionId string) ApiUpdateFunctionRequest { + return ApiUpdateFunctionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// Execute executes the request +// +// @return Function +func (a *DefaultAPIService) UpdateFunctionExecute(r ApiUpdateFunctionRequest) (*Function, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Function + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateFunction") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions/{functionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"functionId"+"}", url.PathEscape(parameterValueToString(r.functionId, "functionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateFunctionPayload == nil { + return localVarReturnValue, reportError("updateFunctionPayload 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.updateFunctionPayload + 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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiUpdatePullSecretRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + pullSecretId string + updatePullSecretPayload *UpdatePullSecretPayload +} + +func (r ApiUpdatePullSecretRequest) UpdatePullSecretPayload(updatePullSecretPayload UpdatePullSecretPayload) ApiUpdatePullSecretRequest { + r.updatePullSecretPayload = &updatePullSecretPayload + return r +} + +func (r ApiUpdatePullSecretRequest) Execute() (*PullSecret, error) { + return r.ApiService.UpdatePullSecretExecute(r) +} + +/* +UpdatePullSecret Update OCI image registry pull secret definition + +Updates the OCI image registry pull secret configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param pullSecretId The identifier of the OCI registry pull secret configuration + @return ApiUpdatePullSecretRequest +*/ +func (a *DefaultAPIService) UpdatePullSecret(ctx context.Context, projectId string, pullSecretId string) ApiUpdatePullSecretRequest { + return ApiUpdatePullSecretRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + pullSecretId: pullSecretId, + } +} + +// Execute executes the request +// +// @return PullSecret +func (a *DefaultAPIService) UpdatePullSecretExecute(r ApiUpdatePullSecretRequest) (*PullSecret, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PullSecret + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdatePullSecret") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/pull-secrets/{pullSecretId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullSecretId"+"}", url.PathEscape(parameterValueToString(r.pullSecretId, "pullSecretId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updatePullSecretPayload == nil { + return localVarReturnValue, reportError("updatePullSecretPayload 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.updatePullSecretPayload + 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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiUpdateRevisionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + functionId string + revisionId string + updateRevisionPayload *UpdateRevisionPayload +} + +func (r ApiUpdateRevisionRequest) UpdateRevisionPayload(updateRevisionPayload UpdateRevisionPayload) ApiUpdateRevisionRequest { + r.updateRevisionPayload = &updateRevisionPayload + return r +} + +func (r ApiUpdateRevisionRequest) Execute() (*Revision, error) { + return r.ApiService.UpdateRevisionExecute(r) +} + +/* +UpdateRevision Method for UpdateRevision + +Updates a specific revision. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param functionId The STACKIT Functions functionId + @param revisionId The identifier of the revision + @return ApiUpdateRevisionRequest +*/ +func (a *DefaultAPIService) UpdateRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiUpdateRevisionRequest { + return ApiUpdateRevisionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + revisionId: revisionId, + } +} + +// Execute executes the request +// +// @return Revision +func (a *DefaultAPIService) UpdateRevisionExecute(r ApiUpdateRevisionRequest) (*Revision, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Revision + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateRevision") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/functions/{functionId}/revisions/{revisionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"functionId"+"}", url.PathEscape(parameterValueToString(r.functionId, "functionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revisionId"+"}", url.PathEscape(parameterValueToString(r.revisionId, "revisionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateRevisionPayload == nil { + return localVarReturnValue, reportError("updateRevisionPayload 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.updateRevisionPayload + 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 == 401 { + var v ListFunctions401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} diff --git a/services/functions/v1alphaapi/api_default_mock.go b/services/functions/v1alphaapi/api_default_mock.go new file mode 100644 index 000000000..a588ff358 --- /dev/null +++ b/services/functions/v1alphaapi/api_default_mock.go @@ -0,0 +1,334 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +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 { + // CreateFunctionExecuteMock can be populated to implement the behavior of the CreateFunctionExecute function of this mock + CreateFunctionExecuteMock *func(r ApiCreateFunctionRequest) (*Function, error) + // CreateFunctionRevisionExecuteMock can be populated to implement the behavior of the CreateFunctionRevisionExecute function of this mock + CreateFunctionRevisionExecuteMock *func(r ApiCreateFunctionRevisionRequest) (*Revision, error) + // CreatePullSecretExecuteMock can be populated to implement the behavior of the CreatePullSecretExecute function of this mock + CreatePullSecretExecuteMock *func(r ApiCreatePullSecretRequest) (*PullSecret, error) + // DeleteFunctionExecuteMock can be populated to implement the behavior of the DeleteFunctionExecute function of this mock + DeleteFunctionExecuteMock *func(r ApiDeleteFunctionRequest) error + // DeletePullSecretExecuteMock can be populated to implement the behavior of the DeletePullSecretExecute function of this mock + DeletePullSecretExecuteMock *func(r ApiDeletePullSecretRequest) error + // DeleteRevisionExecuteMock can be populated to implement the behavior of the DeleteRevisionExecute function of this mock + DeleteRevisionExecuteMock *func(r ApiDeleteRevisionRequest) error + // GetFunctionExecuteMock can be populated to implement the behavior of the GetFunctionExecute function of this mock + GetFunctionExecuteMock *func(r ApiGetFunctionRequest) (*Function, error) + // GetPullSecretExecuteMock can be populated to implement the behavior of the GetPullSecretExecute function of this mock + GetPullSecretExecuteMock *func(r ApiGetPullSecretRequest) (*PullSecret, error) + // GetRevisionExecuteMock can be populated to implement the behavior of the GetRevisionExecute function of this mock + GetRevisionExecuteMock *func(r ApiGetRevisionRequest) (*Revision, error) + // ListFunctionsExecuteMock can be populated to implement the behavior of the ListFunctionsExecute function of this mock + ListFunctionsExecuteMock *func(r ApiListFunctionsRequest) (*ListFunctions, error) + // ListPullSecretsExecuteMock can be populated to implement the behavior of the ListPullSecretsExecute function of this mock + ListPullSecretsExecuteMock *func(r ApiListPullSecretsRequest) (*ListPullSecrets, error) + // ListRevisionsExecuteMock can be populated to implement the behavior of the ListRevisionsExecute function of this mock + ListRevisionsExecuteMock *func(r ApiListRevisionsRequest) (*ListRevisions, error) + // UpdateFunctionExecuteMock can be populated to implement the behavior of the UpdateFunctionExecute function of this mock + UpdateFunctionExecuteMock *func(r ApiUpdateFunctionRequest) (*Function, error) + // UpdatePullSecretExecuteMock can be populated to implement the behavior of the UpdatePullSecretExecute function of this mock + UpdatePullSecretExecuteMock *func(r ApiUpdatePullSecretRequest) (*PullSecret, error) + // UpdateRevisionExecuteMock can be populated to implement the behavior of the UpdateRevisionExecute function of this mock + UpdateRevisionExecuteMock *func(r ApiUpdateRevisionRequest) (*Revision, error) +} + +func (a DefaultAPIServiceMock) CreateFunction(ctx context.Context, projectId string) ApiCreateFunctionRequest { + return ApiCreateFunctionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// CreateFunctionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateFunctionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateFunctionExecute(r ApiCreateFunctionRequest) (*Function, error) { + if a.CreateFunctionExecuteMock == nil { + var localVarReturnValue *Function + return localVarReturnValue, nil + } + + return (*a.CreateFunctionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateFunctionRevision(ctx context.Context, projectId string, functionId string) ApiCreateFunctionRevisionRequest { + return ApiCreateFunctionRevisionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// CreateFunctionRevisionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateFunctionRevisionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateFunctionRevisionExecute(r ApiCreateFunctionRevisionRequest) (*Revision, error) { + if a.CreateFunctionRevisionExecuteMock == nil { + var localVarReturnValue *Revision + return localVarReturnValue, nil + } + + return (*a.CreateFunctionRevisionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreatePullSecret(ctx context.Context, projectId string) ApiCreatePullSecretRequest { + return ApiCreatePullSecretRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// CreatePullSecretExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreatePullSecretExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreatePullSecretExecute(r ApiCreatePullSecretRequest) (*PullSecret, error) { + if a.CreatePullSecretExecuteMock == nil { + var localVarReturnValue *PullSecret + return localVarReturnValue, nil + } + + return (*a.CreatePullSecretExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteFunction(ctx context.Context, projectId string, functionId string) ApiDeleteFunctionRequest { + return ApiDeleteFunctionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// DeleteFunctionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteFunctionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteFunctionExecute(r ApiDeleteFunctionRequest) error { + if a.DeleteFunctionExecuteMock == nil { + return nil + } + + return (*a.DeleteFunctionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeletePullSecret(ctx context.Context, projectId string, pullSecretId string) ApiDeletePullSecretRequest { + return ApiDeletePullSecretRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + pullSecretId: pullSecretId, + } +} + +// DeletePullSecretExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeletePullSecretExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeletePullSecretExecute(r ApiDeletePullSecretRequest) error { + if a.DeletePullSecretExecuteMock == nil { + return nil + } + + return (*a.DeletePullSecretExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiDeleteRevisionRequest { + return ApiDeleteRevisionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + revisionId: revisionId, + } +} + +// DeleteRevisionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteRevisionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteRevisionExecute(r ApiDeleteRevisionRequest) error { + if a.DeleteRevisionExecuteMock == nil { + return nil + } + + return (*a.DeleteRevisionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetFunction(ctx context.Context, projectId string, functionId string) ApiGetFunctionRequest { + return ApiGetFunctionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// GetFunctionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetFunctionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetFunctionExecute(r ApiGetFunctionRequest) (*Function, error) { + if a.GetFunctionExecuteMock == nil { + var localVarReturnValue *Function + return localVarReturnValue, nil + } + + return (*a.GetFunctionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetPullSecret(ctx context.Context, projectId string, pullSecretId string) ApiGetPullSecretRequest { + return ApiGetPullSecretRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + pullSecretId: pullSecretId, + } +} + +// GetPullSecretExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetPullSecretExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetPullSecretExecute(r ApiGetPullSecretRequest) (*PullSecret, error) { + if a.GetPullSecretExecuteMock == nil { + var localVarReturnValue *PullSecret + return localVarReturnValue, nil + } + + return (*a.GetPullSecretExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiGetRevisionRequest { + return ApiGetRevisionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + revisionId: revisionId, + } +} + +// GetRevisionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetRevisionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetRevisionExecute(r ApiGetRevisionRequest) (*Revision, error) { + if a.GetRevisionExecuteMock == nil { + var localVarReturnValue *Revision + return localVarReturnValue, nil + } + + return (*a.GetRevisionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListFunctions(ctx context.Context, projectId string) ApiListFunctionsRequest { + return ApiListFunctionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// ListFunctionsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListFunctionsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListFunctionsExecute(r ApiListFunctionsRequest) (*ListFunctions, error) { + if a.ListFunctionsExecuteMock == nil { + var localVarReturnValue *ListFunctions + return localVarReturnValue, nil + } + + return (*a.ListFunctionsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListPullSecrets(ctx context.Context, projectId string) ApiListPullSecretsRequest { + return ApiListPullSecretsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// ListPullSecretsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListPullSecretsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListPullSecretsExecute(r ApiListPullSecretsRequest) (*ListPullSecrets, error) { + if a.ListPullSecretsExecuteMock == nil { + var localVarReturnValue *ListPullSecrets + return localVarReturnValue, nil + } + + return (*a.ListPullSecretsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListRevisions(ctx context.Context, projectId string, functionId string) ApiListRevisionsRequest { + return ApiListRevisionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// ListRevisionsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListRevisionsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListRevisionsExecute(r ApiListRevisionsRequest) (*ListRevisions, error) { + if a.ListRevisionsExecuteMock == nil { + var localVarReturnValue *ListRevisions + return localVarReturnValue, nil + } + + return (*a.ListRevisionsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateFunction(ctx context.Context, projectId string, functionId string) ApiUpdateFunctionRequest { + return ApiUpdateFunctionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + } +} + +// UpdateFunctionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateFunctionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateFunctionExecute(r ApiUpdateFunctionRequest) (*Function, error) { + if a.UpdateFunctionExecuteMock == nil { + var localVarReturnValue *Function + return localVarReturnValue, nil + } + + return (*a.UpdateFunctionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdatePullSecret(ctx context.Context, projectId string, pullSecretId string) ApiUpdatePullSecretRequest { + return ApiUpdatePullSecretRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + pullSecretId: pullSecretId, + } +} + +// UpdatePullSecretExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdatePullSecretExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdatePullSecretExecute(r ApiUpdatePullSecretRequest) (*PullSecret, error) { + if a.UpdatePullSecretExecuteMock == nil { + var localVarReturnValue *PullSecret + return localVarReturnValue, nil + } + + return (*a.UpdatePullSecretExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateRevision(ctx context.Context, projectId string, functionId string, revisionId string) ApiUpdateRevisionRequest { + return ApiUpdateRevisionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + functionId: functionId, + revisionId: revisionId, + } +} + +// UpdateRevisionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateRevisionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateRevisionExecute(r ApiUpdateRevisionRequest) (*Revision, error) { + if a.UpdateRevisionExecuteMock == nil { + var localVarReturnValue *Revision + return localVarReturnValue, nil + } + + return (*a.UpdateRevisionExecuteMock)(r) +} diff --git a/services/functions/v1alphaapi/client.go b/services/functions/v1alphaapi/client.go new file mode 100644 index 000000000..44441e452 --- /dev/null +++ b/services/functions/v1alphaapi/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +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 Functions Core API API v1alpha +// 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/functions/v1alphaapi/configuration.go b/services/functions/v1alphaapi/configuration.go new file mode 100644 index 000000000..6b372bd3a --- /dev/null +++ b/services/functions/v1alphaapi/configuration.go @@ -0,0 +1,40 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +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/functions", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://functions.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/functions/v1alphaapi/model_create_function_payload.go b/services/functions/v1alphaapi/model_create_function_payload.go new file mode 100644 index 000000000..0edab5c37 --- /dev/null +++ b/services/functions/v1alphaapi/model_create_function_payload.go @@ -0,0 +1,470 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the CreateFunctionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateFunctionPayload{} + +// CreateFunctionPayload Represents a STACKIT Functions function. +type CreateFunctionPayload struct { + // Time the function was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // The ID of the currently-deployed revision associated with this function. + CurrentRevision *string `json:"current_revision,omitempty"` + // Unique identifier for the function. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + // User-defined name of the function. + Name string `json:"name"` + State *CreateFunctionPayloadState `json:"state,omitempty"` + // Error message related to this function's status. + StateError *string `json:"state_error,omitempty"` + // Time the function was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // URLs that resolve to the function. + Url []string `json:"url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateFunctionPayload CreateFunctionPayload + +// NewCreateFunctionPayload instantiates a new CreateFunctionPayload 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 NewCreateFunctionPayload(name string) *CreateFunctionPayload { + this := CreateFunctionPayload{} + this.Name = name + return &this +} + +// NewCreateFunctionPayloadWithDefaults instantiates a new CreateFunctionPayload 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 NewCreateFunctionPayloadWithDefaults() *CreateFunctionPayload { + this := CreateFunctionPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateFunctionPayload) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionPayload) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateFunctionPayload) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateFunctionPayload) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCurrentRevision returns the CurrentRevision field value if set, zero value otherwise. +func (o *CreateFunctionPayload) GetCurrentRevision() string { + if o == nil || IsNil(o.CurrentRevision) { + var ret string + return ret + } + return *o.CurrentRevision +} + +// GetCurrentRevisionOk returns a tuple with the CurrentRevision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionPayload) GetCurrentRevisionOk() (*string, bool) { + if o == nil || IsNil(o.CurrentRevision) { + return nil, false + } + return o.CurrentRevision, true +} + +// HasCurrentRevision returns a boolean if a field has been set. +func (o *CreateFunctionPayload) HasCurrentRevision() bool { + if o != nil && !IsNil(o.CurrentRevision) { + return true + } + + return false +} + +// SetCurrentRevision gets a reference to the given string and assigns it to the CurrentRevision field. +func (o *CreateFunctionPayload) SetCurrentRevision(v string) { + o.CurrentRevision = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateFunctionPayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateFunctionPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateFunctionPayload) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateFunctionPayload) 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 *CreateFunctionPayload) 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 *CreateFunctionPayload) 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 *CreateFunctionPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *CreateFunctionPayload) 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 *CreateFunctionPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateFunctionPayload) SetName(v string) { + o.Name = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *CreateFunctionPayload) GetState() CreateFunctionPayloadState { + if o == nil || IsNil(o.State) { + var ret CreateFunctionPayloadState + 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 *CreateFunctionPayload) GetStateOk() (*CreateFunctionPayloadState, 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 *CreateFunctionPayload) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given CreateFunctionPayloadState and assigns it to the State field. +func (o *CreateFunctionPayload) SetState(v CreateFunctionPayloadState) { + o.State = &v +} + +// GetStateError returns the StateError field value if set, zero value otherwise. +func (o *CreateFunctionPayload) GetStateError() string { + if o == nil || IsNil(o.StateError) { + var ret string + return ret + } + return *o.StateError +} + +// GetStateErrorOk returns a tuple with the StateError field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionPayload) GetStateErrorOk() (*string, bool) { + if o == nil || IsNil(o.StateError) { + return nil, false + } + return o.StateError, true +} + +// HasStateError returns a boolean if a field has been set. +func (o *CreateFunctionPayload) HasStateError() bool { + if o != nil && !IsNil(o.StateError) { + return true + } + + return false +} + +// SetStateError gets a reference to the given string and assigns it to the StateError field. +func (o *CreateFunctionPayload) SetStateError(v string) { + o.StateError = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateFunctionPayload) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionPayload) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateFunctionPayload) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateFunctionPayload) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *CreateFunctionPayload) GetUrl() []string { + if o == nil || IsNil(o.Url) { + var ret []string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionPayload) GetUrlOk() ([]string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *CreateFunctionPayload) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given []string and assigns it to the Url field. +func (o *CreateFunctionPayload) SetUrl(v []string) { + o.Url = v +} + +func (o CreateFunctionPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateFunctionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CurrentRevision) { + toSerialize["current_revision"] = o.CurrentRevision + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.StateError) { + toSerialize["state_error"] = o.StateError + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateFunctionPayload) 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", + } + + 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) + } + } + + varCreateFunctionPayload := _CreateFunctionPayload{} + + err = json.Unmarshal(data, &varCreateFunctionPayload) + + if err != nil { + return err + } + + *o = CreateFunctionPayload(varCreateFunctionPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "current_revision") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "state") + delete(additionalProperties, "state_error") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateFunctionPayload struct { + value *CreateFunctionPayload + isSet bool +} + +func (v NullableCreateFunctionPayload) Get() *CreateFunctionPayload { + return v.value +} + +func (v *NullableCreateFunctionPayload) Set(val *CreateFunctionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateFunctionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateFunctionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateFunctionPayload(val *CreateFunctionPayload) *NullableCreateFunctionPayload { + return &NullableCreateFunctionPayload{value: val, isSet: true} +} + +func (v NullableCreateFunctionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateFunctionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_create_function_payload_state.go b/services/functions/v1alphaapi/model_create_function_payload_state.go new file mode 100644 index 000000000..af9e8a90e --- /dev/null +++ b/services/functions/v1alphaapi/model_create_function_payload_state.go @@ -0,0 +1,115 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// CreateFunctionPayloadState Status of this function's latest revision. +type CreateFunctionPayloadState string + +// List of CreateFunctionPayload_state +const ( + CREATEFUNCTIONPAYLOADSTATE_CREATING CreateFunctionPayloadState = "CREATING" + CREATEFUNCTIONPAYLOADSTATE_ACTIVE CreateFunctionPayloadState = "ACTIVE" + CREATEFUNCTIONPAYLOADSTATE_FAILED CreateFunctionPayloadState = "FAILED" + CREATEFUNCTIONPAYLOADSTATE_UNKNOWN_DEFAULT_OPEN_API CreateFunctionPayloadState = "unknown_default_open_api" +) + +// All allowed values of CreateFunctionPayloadState enum +var AllowedCreateFunctionPayloadStateEnumValues = []CreateFunctionPayloadState{ + "CREATING", + "ACTIVE", + "FAILED", + "unknown_default_open_api", +} + +func (v *CreateFunctionPayloadState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := CreateFunctionPayloadState(value) + for _, existing := range AllowedCreateFunctionPayloadStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = CREATEFUNCTIONPAYLOADSTATE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewCreateFunctionPayloadStateFromValue returns a pointer to a valid CreateFunctionPayloadState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateFunctionPayloadStateFromValue(v string) (*CreateFunctionPayloadState, error) { + ev := CreateFunctionPayloadState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateFunctionPayloadState: valid values are %v", v, AllowedCreateFunctionPayloadStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateFunctionPayloadState) IsValid() bool { + for _, existing := range AllowedCreateFunctionPayloadStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CreateFunctionPayload_state value +func (v CreateFunctionPayloadState) Ptr() *CreateFunctionPayloadState { + return &v +} + +type NullableCreateFunctionPayloadState struct { + value *CreateFunctionPayloadState + isSet bool +} + +func (v NullableCreateFunctionPayloadState) Get() *CreateFunctionPayloadState { + return v.value +} + +func (v *NullableCreateFunctionPayloadState) Set(val *CreateFunctionPayloadState) { + v.value = val + v.isSet = true +} + +func (v NullableCreateFunctionPayloadState) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateFunctionPayloadState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateFunctionPayloadState(val *CreateFunctionPayloadState) *NullableCreateFunctionPayloadState { + return &NullableCreateFunctionPayloadState{value: val, isSet: true} +} + +func (v NullableCreateFunctionPayloadState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateFunctionPayloadState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_create_function_revision_payload.go b/services/functions/v1alphaapi/model_create_function_revision_payload.go new file mode 100644 index 000000000..95752a30f --- /dev/null +++ b/services/functions/v1alphaapi/model_create_function_revision_payload.go @@ -0,0 +1,689 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the CreateFunctionRevisionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateFunctionRevisionPayload{} + +// CreateFunctionRevisionPayload The function revision +type CreateFunctionRevisionPayload struct { + // Time the function was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // A hashed fingerprint of the revision artifact. + Digest *string `json:"digest,omitempty"` + // The ID of the function associated with this revision. + FunctionId *string `json:"function_id,omitempty"` + // The revision identifier. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + Limits ResourceLimits `json:"limits"` + // Revision message + Message *string `json:"message,omitempty"` + // The name of the the revision. Must be unique within the function. + Name *string `json:"name,omitempty"` + // OCI Registry pull secret to use for pulling the revision's image. + OciPullSecretId *string `json:"oci_pull_secret_id,omitempty"` + // OCI reference for the revision. + OciReference string `json:"oci_reference" validate:"regexp=(:[vV]?\\\\d+\\\\.\\\\d+\\\\.\\\\d+(@sha256:[a-fA-F0-9]{64})?)$|((:latest)?@sha256:[a-fA-F0-9]{64})$"` + State *CreateFunctionRevisionPayloadState `json:"state,omitempty"` + // Error message related to this revision. + StateError *string `json:"state_error,omitempty"` + // Time the function was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Variable values for this revision. Each variable must reference a variable definition on the function. + Variables []RevisionVariable `json:"variables,omitempty"` + // The version number of the revision. + Version *int64 `json:"version,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateFunctionRevisionPayload CreateFunctionRevisionPayload + +// NewCreateFunctionRevisionPayload instantiates a new CreateFunctionRevisionPayload 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 NewCreateFunctionRevisionPayload(limits ResourceLimits, ociReference string) *CreateFunctionRevisionPayload { + this := CreateFunctionRevisionPayload{} + this.Limits = limits + this.OciReference = ociReference + return &this +} + +// NewCreateFunctionRevisionPayloadWithDefaults instantiates a new CreateFunctionRevisionPayload 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 NewCreateFunctionRevisionPayloadWithDefaults() *CreateFunctionRevisionPayload { + this := CreateFunctionRevisionPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateFunctionRevisionPayload) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDigest returns the Digest field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetDigest() string { + if o == nil || IsNil(o.Digest) { + var ret string + return ret + } + return *o.Digest +} + +// GetDigestOk returns a tuple with the Digest field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetDigestOk() (*string, bool) { + if o == nil || IsNil(o.Digest) { + return nil, false + } + return o.Digest, true +} + +// HasDigest returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasDigest() bool { + if o != nil && !IsNil(o.Digest) { + return true + } + + return false +} + +// SetDigest gets a reference to the given string and assigns it to the Digest field. +func (o *CreateFunctionRevisionPayload) SetDigest(v string) { + o.Digest = &v +} + +// GetFunctionId returns the FunctionId field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetFunctionId() string { + if o == nil || IsNil(o.FunctionId) { + var ret string + return ret + } + return *o.FunctionId +} + +// GetFunctionIdOk returns a tuple with the FunctionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetFunctionIdOk() (*string, bool) { + if o == nil || IsNil(o.FunctionId) { + return nil, false + } + return o.FunctionId, true +} + +// HasFunctionId returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasFunctionId() bool { + if o != nil && !IsNil(o.FunctionId) { + return true + } + + return false +} + +// SetFunctionId gets a reference to the given string and assigns it to the FunctionId field. +func (o *CreateFunctionRevisionPayload) SetFunctionId(v string) { + o.FunctionId = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateFunctionRevisionPayload) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) 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 *CreateFunctionRevisionPayload) 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 *CreateFunctionRevisionPayload) 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 *CreateFunctionRevisionPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetLimits returns the Limits field value +func (o *CreateFunctionRevisionPayload) GetLimits() ResourceLimits { + if o == nil { + var ret ResourceLimits + return ret + } + + return o.Limits +} + +// GetLimitsOk returns a tuple with the Limits field value +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetLimitsOk() (*ResourceLimits, bool) { + if o == nil { + return nil, false + } + return &o.Limits, true +} + +// SetLimits sets field value +func (o *CreateFunctionRevisionPayload) SetLimits(v ResourceLimits) { + o.Limits = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *CreateFunctionRevisionPayload) SetMessage(v string) { + o.Message = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) 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 *CreateFunctionRevisionPayload) 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 *CreateFunctionRevisionPayload) 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 *CreateFunctionRevisionPayload) SetName(v string) { + o.Name = &v +} + +// GetOciPullSecretId returns the OciPullSecretId field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetOciPullSecretId() string { + if o == nil || IsNil(o.OciPullSecretId) { + var ret string + return ret + } + return *o.OciPullSecretId +} + +// GetOciPullSecretIdOk returns a tuple with the OciPullSecretId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetOciPullSecretIdOk() (*string, bool) { + if o == nil || IsNil(o.OciPullSecretId) { + return nil, false + } + return o.OciPullSecretId, true +} + +// HasOciPullSecretId returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasOciPullSecretId() bool { + if o != nil && !IsNil(o.OciPullSecretId) { + return true + } + + return false +} + +// SetOciPullSecretId gets a reference to the given string and assigns it to the OciPullSecretId field. +func (o *CreateFunctionRevisionPayload) SetOciPullSecretId(v string) { + o.OciPullSecretId = &v +} + +// GetOciReference returns the OciReference field value +func (o *CreateFunctionRevisionPayload) GetOciReference() string { + if o == nil { + var ret string + return ret + } + + return o.OciReference +} + +// GetOciReferenceOk returns a tuple with the OciReference field value +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetOciReferenceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OciReference, true +} + +// SetOciReference sets field value +func (o *CreateFunctionRevisionPayload) SetOciReference(v string) { + o.OciReference = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetState() CreateFunctionRevisionPayloadState { + if o == nil || IsNil(o.State) { + var ret CreateFunctionRevisionPayloadState + 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 *CreateFunctionRevisionPayload) GetStateOk() (*CreateFunctionRevisionPayloadState, 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 *CreateFunctionRevisionPayload) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given CreateFunctionRevisionPayloadState and assigns it to the State field. +func (o *CreateFunctionRevisionPayload) SetState(v CreateFunctionRevisionPayloadState) { + o.State = &v +} + +// GetStateError returns the StateError field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetStateError() string { + if o == nil || IsNil(o.StateError) { + var ret string + return ret + } + return *o.StateError +} + +// GetStateErrorOk returns a tuple with the StateError field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetStateErrorOk() (*string, bool) { + if o == nil || IsNil(o.StateError) { + return nil, false + } + return o.StateError, true +} + +// HasStateError returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasStateError() bool { + if o != nil && !IsNil(o.StateError) { + return true + } + + return false +} + +// SetStateError gets a reference to the given string and assigns it to the StateError field. +func (o *CreateFunctionRevisionPayload) SetStateError(v string) { + o.StateError = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateFunctionRevisionPayload) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetVariables() []RevisionVariable { + if o == nil || IsNil(o.Variables) { + var ret []RevisionVariable + return ret + } + return o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetVariablesOk() ([]RevisionVariable, bool) { + if o == nil || IsNil(o.Variables) { + return nil, false + } + return o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasVariables() bool { + if o != nil && !IsNil(o.Variables) { + return true + } + + return false +} + +// SetVariables gets a reference to the given []RevisionVariable and assigns it to the Variables field. +func (o *CreateFunctionRevisionPayload) SetVariables(v []RevisionVariable) { + o.Variables = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *CreateFunctionRevisionPayload) GetVersion() int64 { + if o == nil || IsNil(o.Version) { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFunctionRevisionPayload) GetVersionOk() (*int64, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *CreateFunctionRevisionPayload) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *CreateFunctionRevisionPayload) SetVersion(v int64) { + o.Version = &v +} + +func (o CreateFunctionRevisionPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateFunctionRevisionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Digest) { + toSerialize["digest"] = o.Digest + } + if !IsNil(o.FunctionId) { + toSerialize["function_id"] = o.FunctionId + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["limits"] = o.Limits + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OciPullSecretId) { + toSerialize["oci_pull_secret_id"] = o.OciPullSecretId + } + toSerialize["oci_reference"] = o.OciReference + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.StateError) { + toSerialize["state_error"] = o.StateError + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Variables) { + toSerialize["variables"] = o.Variables + } + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateFunctionRevisionPayload) 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{ + "limits", + "oci_reference", + } + + 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) + } + } + + varCreateFunctionRevisionPayload := _CreateFunctionRevisionPayload{} + + err = json.Unmarshal(data, &varCreateFunctionRevisionPayload) + + if err != nil { + return err + } + + *o = CreateFunctionRevisionPayload(varCreateFunctionRevisionPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "digest") + delete(additionalProperties, "function_id") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "limits") + delete(additionalProperties, "message") + delete(additionalProperties, "name") + delete(additionalProperties, "oci_pull_secret_id") + delete(additionalProperties, "oci_reference") + delete(additionalProperties, "state") + delete(additionalProperties, "state_error") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "variables") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateFunctionRevisionPayload struct { + value *CreateFunctionRevisionPayload + isSet bool +} + +func (v NullableCreateFunctionRevisionPayload) Get() *CreateFunctionRevisionPayload { + return v.value +} + +func (v *NullableCreateFunctionRevisionPayload) Set(val *CreateFunctionRevisionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateFunctionRevisionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateFunctionRevisionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateFunctionRevisionPayload(val *CreateFunctionRevisionPayload) *NullableCreateFunctionRevisionPayload { + return &NullableCreateFunctionRevisionPayload{value: val, isSet: true} +} + +func (v NullableCreateFunctionRevisionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateFunctionRevisionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_create_function_revision_payload_state.go b/services/functions/v1alphaapi/model_create_function_revision_payload_state.go new file mode 100644 index 000000000..17a0fc6b5 --- /dev/null +++ b/services/functions/v1alphaapi/model_create_function_revision_payload_state.go @@ -0,0 +1,117 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// CreateFunctionRevisionPayloadState Status of this revision. +type CreateFunctionRevisionPayloadState string + +// List of createFunctionRevisionPayload_state +const ( + CREATEFUNCTIONREVISIONPAYLOADSTATE_CANCELLED CreateFunctionRevisionPayloadState = "CANCELLED" + CREATEFUNCTIONREVISIONPAYLOADSTATE_CREATING CreateFunctionRevisionPayloadState = "CREATING" + CREATEFUNCTIONREVISIONPAYLOADSTATE_ACTIVE CreateFunctionRevisionPayloadState = "ACTIVE" + CREATEFUNCTIONREVISIONPAYLOADSTATE_FAILED CreateFunctionRevisionPayloadState = "FAILED" + CREATEFUNCTIONREVISIONPAYLOADSTATE_UNKNOWN_DEFAULT_OPEN_API CreateFunctionRevisionPayloadState = "unknown_default_open_api" +) + +// All allowed values of CreateFunctionRevisionPayloadState enum +var AllowedCreateFunctionRevisionPayloadStateEnumValues = []CreateFunctionRevisionPayloadState{ + "CANCELLED", + "CREATING", + "ACTIVE", + "FAILED", + "unknown_default_open_api", +} + +func (v *CreateFunctionRevisionPayloadState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := CreateFunctionRevisionPayloadState(value) + for _, existing := range AllowedCreateFunctionRevisionPayloadStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = CREATEFUNCTIONREVISIONPAYLOADSTATE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewCreateFunctionRevisionPayloadStateFromValue returns a pointer to a valid CreateFunctionRevisionPayloadState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateFunctionRevisionPayloadStateFromValue(v string) (*CreateFunctionRevisionPayloadState, error) { + ev := CreateFunctionRevisionPayloadState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateFunctionRevisionPayloadState: valid values are %v", v, AllowedCreateFunctionRevisionPayloadStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateFunctionRevisionPayloadState) IsValid() bool { + for _, existing := range AllowedCreateFunctionRevisionPayloadStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to createFunctionRevisionPayload_state value +func (v CreateFunctionRevisionPayloadState) Ptr() *CreateFunctionRevisionPayloadState { + return &v +} + +type NullableCreateFunctionRevisionPayloadState struct { + value *CreateFunctionRevisionPayloadState + isSet bool +} + +func (v NullableCreateFunctionRevisionPayloadState) Get() *CreateFunctionRevisionPayloadState { + return v.value +} + +func (v *NullableCreateFunctionRevisionPayloadState) Set(val *CreateFunctionRevisionPayloadState) { + v.value = val + v.isSet = true +} + +func (v NullableCreateFunctionRevisionPayloadState) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateFunctionRevisionPayloadState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateFunctionRevisionPayloadState(val *CreateFunctionRevisionPayloadState) *NullableCreateFunctionRevisionPayloadState { + return &NullableCreateFunctionRevisionPayloadState{value: val, isSet: true} +} + +func (v NullableCreateFunctionRevisionPayloadState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateFunctionRevisionPayloadState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_create_pull_secret_payload.go b/services/functions/v1alphaapi/model_create_pull_secret_payload.go new file mode 100644 index 000000000..8441e8f42 --- /dev/null +++ b/services/functions/v1alphaapi/model_create_pull_secret_payload.go @@ -0,0 +1,340 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreatePullSecretPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreatePullSecretPayload{} + +// CreatePullSecretPayload struct for CreatePullSecretPayload +type CreatePullSecretPayload struct { + // The OCI registry address. + Address string `json:"address"` + // Unique identifier for the OCI registry pull secret. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + // Unique name for the OCI registry pull secret. + Name *string `json:"name,omitempty"` + // The password for the OCI registry pull-secret. + Password string `json:"password"` + // The username for the OCI registry pull-secret. + Username string `json:"username"` + AdditionalProperties map[string]interface{} +} + +type _CreatePullSecretPayload CreatePullSecretPayload + +// NewCreatePullSecretPayload instantiates a new CreatePullSecretPayload 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 NewCreatePullSecretPayload(address string, password string, username string) *CreatePullSecretPayload { + this := CreatePullSecretPayload{} + this.Address = address + this.Password = password + this.Username = username + return &this +} + +// NewCreatePullSecretPayloadWithDefaults instantiates a new CreatePullSecretPayload 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 NewCreatePullSecretPayloadWithDefaults() *CreatePullSecretPayload { + this := CreatePullSecretPayload{} + return &this +} + +// GetAddress returns the Address field value +func (o *CreatePullSecretPayload) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *CreatePullSecretPayload) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *CreatePullSecretPayload) SetAddress(v string) { + o.Address = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreatePullSecretPayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreatePullSecretPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreatePullSecretPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreatePullSecretPayload) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreatePullSecretPayload) 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 *CreatePullSecretPayload) 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 *CreatePullSecretPayload) 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 *CreatePullSecretPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreatePullSecretPayload) 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 *CreatePullSecretPayload) 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 *CreatePullSecretPayload) 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 *CreatePullSecretPayload) SetName(v string) { + o.Name = &v +} + +// GetPassword returns the Password field value +func (o *CreatePullSecretPayload) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *CreatePullSecretPayload) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *CreatePullSecretPayload) SetPassword(v string) { + o.Password = v +} + +// GetUsername returns the Username field value +func (o *CreatePullSecretPayload) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *CreatePullSecretPayload) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *CreatePullSecretPayload) SetUsername(v string) { + o.Username = v +} + +func (o CreatePullSecretPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreatePullSecretPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["password"] = o.Password + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreatePullSecretPayload) 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{ + "address", + "password", + "username", + } + + 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) + } + } + + varCreatePullSecretPayload := _CreatePullSecretPayload{} + + err = json.Unmarshal(data, &varCreatePullSecretPayload) + + if err != nil { + return err + } + + *o = CreatePullSecretPayload(varCreatePullSecretPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "password") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreatePullSecretPayload struct { + value *CreatePullSecretPayload + isSet bool +} + +func (v NullableCreatePullSecretPayload) Get() *CreatePullSecretPayload { + return v.value +} + +func (v *NullableCreatePullSecretPayload) Set(val *CreatePullSecretPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreatePullSecretPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreatePullSecretPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreatePullSecretPayload(val *CreatePullSecretPayload) *NullableCreatePullSecretPayload { + return &NullableCreatePullSecretPayload{value: val, isSet: true} +} + +func (v NullableCreatePullSecretPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreatePullSecretPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_error.go b/services/functions/v1alphaapi/model_error.go new file mode 100644 index 000000000..846f31e8b --- /dev/null +++ b/services/functions/v1alphaapi/model_error.go @@ -0,0 +1,229 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +// Error struct for Error +type Error struct { + // The status code of the response + Code *int32 `json:"code,omitempty"` + Details []ErrorDetailsInner `json:"details,omitempty"` + // The error message of the response + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Error Error + +// NewError instantiates a new Error 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 NewError() *Error { + this := Error{} + return &this +} + +// NewErrorWithDefaults instantiates a new Error 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 NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *Error) GetCode() int32 { + if o == nil || IsNil(o.Code) { + var ret int32 + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetCodeOk() (*int32, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *Error) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given int32 and assigns it to the Code field. +func (o *Error) SetCode(v int32) { + o.Code = &v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *Error) GetDetails() []ErrorDetailsInner { + if o == nil || IsNil(o.Details) { + var ret []ErrorDetailsInner + 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 *Error) GetDetailsOk() ([]ErrorDetailsInner, 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 *Error) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given []ErrorDetailsInner and assigns it to the Details field. +func (o *Error) SetDetails(v []ErrorDetailsInner) { + o.Details = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Error) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *Error) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *Error) SetMessage(v string) { + o.Message = &v +} + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Error) UnmarshalJSON(data []byte) (err error) { + varError := _Error{} + + err = json.Unmarshal(data, &varError) + + if err != nil { + return err + } + + *o = Error(varError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "details") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_error_details_inner.go b/services/functions/v1alphaapi/model_error_details_inner.go new file mode 100644 index 000000000..904eafa2e --- /dev/null +++ b/services/functions/v1alphaapi/model_error_details_inner.go @@ -0,0 +1,159 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// ErrorDetailsInner - struct for ErrorDetailsInner +type ErrorDetailsInner struct { + ErrorInfo *ErrorInfo + Help *Help +} + +// ErrorInfoAsErrorDetailsInner is a convenience function that returns ErrorInfo wrapped in ErrorDetailsInner +func ErrorInfoAsErrorDetailsInner(v *ErrorInfo) ErrorDetailsInner { + return ErrorDetailsInner{ + ErrorInfo: v, + } +} + +// HelpAsErrorDetailsInner is a convenience function that returns Help wrapped in ErrorDetailsInner +func HelpAsErrorDetailsInner(v *Help) ErrorDetailsInner { + return ErrorDetailsInner{ + Help: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ErrorDetailsInner) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into ErrorInfo + err = json.Unmarshal(data, &dst.ErrorInfo) + if err == nil { + jsonErrorInfo, _ := json.Marshal(dst.ErrorInfo) + if string(jsonErrorInfo) == "{}" { // empty struct + dst.ErrorInfo = nil + } else { + match++ + } + } else { + dst.ErrorInfo = nil + } + + // try to unmarshal data into Help + err = json.Unmarshal(data, &dst.Help) + if err == nil { + jsonHelp, _ := json.Marshal(dst.Help) + if string(jsonHelp) == "{}" { // empty struct + dst.Help = nil + } else { + match++ + } + } else { + dst.Help = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.ErrorInfo = nil + dst.Help = nil + + return fmt.Errorf("data matches more than one schema in oneOf(ErrorDetailsInner)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(ErrorDetailsInner)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ErrorDetailsInner) MarshalJSON() ([]byte, error) { + if src.ErrorInfo != nil { + return json.Marshal(&src.ErrorInfo) + } + + if src.Help != nil { + return json.Marshal(&src.Help) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *ErrorDetailsInner) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.ErrorInfo != nil { + return obj.ErrorInfo + } + + if obj.Help != nil { + return obj.Help + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj ErrorDetailsInner) GetActualInstanceValue() interface{} { + if obj.ErrorInfo != nil { + return *obj.ErrorInfo + } + + if obj.Help != nil { + return *obj.Help + } + + // all schemas are nil + return nil +} + +type NullableErrorDetailsInner struct { + value *ErrorDetailsInner + isSet bool +} + +func (v NullableErrorDetailsInner) Get() *ErrorDetailsInner { + return v.value +} + +func (v *NullableErrorDetailsInner) Set(val *ErrorDetailsInner) { + v.value = val + v.isSet = true +} + +func (v NullableErrorDetailsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorDetailsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorDetailsInner(val *ErrorDetailsInner) *NullableErrorDetailsInner { + return &NullableErrorDetailsInner{value: val, isSet: true} +} + +func (v NullableErrorDetailsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorDetailsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_error_info.go b/services/functions/v1alphaapi/model_error_info.go new file mode 100644 index 000000000..5888281eb --- /dev/null +++ b/services/functions/v1alphaapi/model_error_info.go @@ -0,0 +1,268 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ErrorInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorInfo{} + +// ErrorInfo struct for ErrorInfo +type ErrorInfo struct { + // The error type category + Type *string `json:"@type,omitempty"` + // The logic grouping to which reason belongs + Domain *string `json:"domain,omitempty"` + // Error metadata returned to the client + Metadata *map[string]string `json:"metadata,omitempty"` + // A short description of why the error occurred + Reason *string `json:"reason,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ErrorInfo ErrorInfo + +// NewErrorInfo instantiates a new ErrorInfo 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 NewErrorInfo() *ErrorInfo { + this := ErrorInfo{} + return &this +} + +// NewErrorInfoWithDefaults instantiates a new ErrorInfo 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 NewErrorInfoWithDefaults() *ErrorInfo { + this := ErrorInfo{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ErrorInfo) 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 *ErrorInfo) 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 *ErrorInfo) 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 *ErrorInfo) SetType(v string) { + o.Type = &v +} + +// GetDomain returns the Domain field value if set, zero value otherwise. +func (o *ErrorInfo) GetDomain() string { + if o == nil || IsNil(o.Domain) { + var ret string + return ret + } + return *o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorInfo) GetDomainOk() (*string, bool) { + if o == nil || IsNil(o.Domain) { + return nil, false + } + return o.Domain, true +} + +// HasDomain returns a boolean if a field has been set. +func (o *ErrorInfo) HasDomain() bool { + if o != nil && !IsNil(o.Domain) { + return true + } + + return false +} + +// SetDomain gets a reference to the given string and assigns it to the Domain field. +func (o *ErrorInfo) SetDomain(v string) { + o.Domain = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *ErrorInfo) GetMetadata() map[string]string { + if o == nil || IsNil(o.Metadata) { + var ret map[string]string + 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 *ErrorInfo) GetMetadataOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Metadata) { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *ErrorInfo) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. +func (o *ErrorInfo) SetMetadata(v map[string]string) { + o.Metadata = &v +} + +// GetReason returns the Reason field value if set, zero value otherwise. +func (o *ErrorInfo) GetReason() string { + if o == nil || IsNil(o.Reason) { + var ret string + return ret + } + return *o.Reason +} + +// GetReasonOk returns a tuple with the Reason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorInfo) GetReasonOk() (*string, bool) { + if o == nil || IsNil(o.Reason) { + return nil, false + } + return o.Reason, true +} + +// HasReason returns a boolean if a field has been set. +func (o *ErrorInfo) HasReason() bool { + if o != nil && !IsNil(o.Reason) { + return true + } + + return false +} + +// SetReason gets a reference to the given string and assigns it to the Reason field. +func (o *ErrorInfo) SetReason(v string) { + o.Reason = &v +} + +func (o ErrorInfo) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Type) { + toSerialize["@type"] = o.Type + } + if !IsNil(o.Domain) { + toSerialize["domain"] = o.Domain + } + if !IsNil(o.Metadata) { + toSerialize["metadata"] = o.Metadata + } + if !IsNil(o.Reason) { + toSerialize["reason"] = o.Reason + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ErrorInfo) UnmarshalJSON(data []byte) (err error) { + varErrorInfo := _ErrorInfo{} + + err = json.Unmarshal(data, &varErrorInfo) + + if err != nil { + return err + } + + *o = ErrorInfo(varErrorInfo) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "@type") + delete(additionalProperties, "domain") + delete(additionalProperties, "metadata") + delete(additionalProperties, "reason") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableErrorInfo struct { + value *ErrorInfo + isSet bool +} + +func (v NullableErrorInfo) Get() *ErrorInfo { + return v.value +} + +func (v *NullableErrorInfo) Set(val *ErrorInfo) { + v.value = val + v.isSet = true +} + +func (v NullableErrorInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorInfo(val *ErrorInfo) *NullableErrorInfo { + return &NullableErrorInfo{value: val, isSet: true} +} + +func (v NullableErrorInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_function.go b/services/functions/v1alphaapi/model_function.go new file mode 100644 index 000000000..fdbbb7142 --- /dev/null +++ b/services/functions/v1alphaapi/model_function.go @@ -0,0 +1,470 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Function type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Function{} + +// Function Represents a STACKIT Functions function. +type Function struct { + // Time the function was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // The ID of the currently-deployed revision associated with this function. + CurrentRevision *string `json:"current_revision,omitempty"` + // Unique identifier for the function. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + // User-defined name of the function. + Name string `json:"name"` + State *FunctionState `json:"state,omitempty"` + // Error message related to this function's status. + StateError *string `json:"state_error,omitempty"` + // Time the function was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // URLs that resolve to the function. + Url []string `json:"url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Function Function + +// NewFunction instantiates a new Function 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 NewFunction(name string) *Function { + this := Function{} + this.Name = name + return &this +} + +// NewFunctionWithDefaults instantiates a new Function 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 NewFunctionWithDefaults() *Function { + this := Function{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Function) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Function) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Function) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Function) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCurrentRevision returns the CurrentRevision field value if set, zero value otherwise. +func (o *Function) GetCurrentRevision() string { + if o == nil || IsNil(o.CurrentRevision) { + var ret string + return ret + } + return *o.CurrentRevision +} + +// GetCurrentRevisionOk returns a tuple with the CurrentRevision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Function) GetCurrentRevisionOk() (*string, bool) { + if o == nil || IsNil(o.CurrentRevision) { + return nil, false + } + return o.CurrentRevision, true +} + +// HasCurrentRevision returns a boolean if a field has been set. +func (o *Function) HasCurrentRevision() bool { + if o != nil && !IsNil(o.CurrentRevision) { + return true + } + + return false +} + +// SetCurrentRevision gets a reference to the given string and assigns it to the CurrentRevision field. +func (o *Function) SetCurrentRevision(v string) { + o.CurrentRevision = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Function) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Function) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Function) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Function) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Function) 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 *Function) 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 *Function) 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 *Function) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *Function) 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 *Function) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Function) SetName(v string) { + o.Name = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Function) GetState() FunctionState { + if o == nil || IsNil(o.State) { + var ret FunctionState + 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 *Function) GetStateOk() (*FunctionState, 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 *Function) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given FunctionState and assigns it to the State field. +func (o *Function) SetState(v FunctionState) { + o.State = &v +} + +// GetStateError returns the StateError field value if set, zero value otherwise. +func (o *Function) GetStateError() string { + if o == nil || IsNil(o.StateError) { + var ret string + return ret + } + return *o.StateError +} + +// GetStateErrorOk returns a tuple with the StateError field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Function) GetStateErrorOk() (*string, bool) { + if o == nil || IsNil(o.StateError) { + return nil, false + } + return o.StateError, true +} + +// HasStateError returns a boolean if a field has been set. +func (o *Function) HasStateError() bool { + if o != nil && !IsNil(o.StateError) { + return true + } + + return false +} + +// SetStateError gets a reference to the given string and assigns it to the StateError field. +func (o *Function) SetStateError(v string) { + o.StateError = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Function) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Function) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Function) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Function) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *Function) GetUrl() []string { + if o == nil || IsNil(o.Url) { + var ret []string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Function) GetUrlOk() ([]string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *Function) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given []string and assigns it to the Url field. +func (o *Function) SetUrl(v []string) { + o.Url = v +} + +func (o Function) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Function) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CurrentRevision) { + toSerialize["current_revision"] = o.CurrentRevision + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.StateError) { + toSerialize["state_error"] = o.StateError + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Function) 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", + } + + 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) + } + } + + varFunction := _Function{} + + err = json.Unmarshal(data, &varFunction) + + if err != nil { + return err + } + + *o = Function(varFunction) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "current_revision") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "state") + delete(additionalProperties, "state_error") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFunction struct { + value *Function + isSet bool +} + +func (v NullableFunction) Get() *Function { + return v.value +} + +func (v *NullableFunction) Set(val *Function) { + v.value = val + v.isSet = true +} + +func (v NullableFunction) IsSet() bool { + return v.isSet +} + +func (v *NullableFunction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFunction(val *Function) *NullableFunction { + return &NullableFunction{value: val, isSet: true} +} + +func (v NullableFunction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFunction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_function_state.go b/services/functions/v1alphaapi/model_function_state.go new file mode 100644 index 000000000..2ff360291 --- /dev/null +++ b/services/functions/v1alphaapi/model_function_state.go @@ -0,0 +1,115 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// FunctionState Status of this function's latest revision. +type FunctionState string + +// List of Function_state +const ( + FUNCTIONSTATE_CREATING FunctionState = "CREATING" + FUNCTIONSTATE_ACTIVE FunctionState = "ACTIVE" + FUNCTIONSTATE_FAILED FunctionState = "FAILED" + FUNCTIONSTATE_UNKNOWN_DEFAULT_OPEN_API FunctionState = "unknown_default_open_api" +) + +// All allowed values of FunctionState enum +var AllowedFunctionStateEnumValues = []FunctionState{ + "CREATING", + "ACTIVE", + "FAILED", + "unknown_default_open_api", +} + +func (v *FunctionState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FunctionState(value) + for _, existing := range AllowedFunctionStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = FUNCTIONSTATE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewFunctionStateFromValue returns a pointer to a valid FunctionState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFunctionStateFromValue(v string) (*FunctionState, error) { + ev := FunctionState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FunctionState: valid values are %v", v, AllowedFunctionStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FunctionState) IsValid() bool { + for _, existing := range AllowedFunctionStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Function_state value +func (v FunctionState) Ptr() *FunctionState { + return &v +} + +type NullableFunctionState struct { + value *FunctionState + isSet bool +} + +func (v NullableFunctionState) Get() *FunctionState { + return v.value +} + +func (v *NullableFunctionState) Set(val *FunctionState) { + v.value = val + v.isSet = true +} + +func (v NullableFunctionState) IsSet() bool { + return v.isSet +} + +func (v *NullableFunctionState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFunctionState(val *FunctionState) *NullableFunctionState { + return &NullableFunctionState{value: val, isSet: true} +} + +func (v NullableFunctionState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFunctionState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_help.go b/services/functions/v1alphaapi/model_help.go new file mode 100644 index 000000000..9e40f072c --- /dev/null +++ b/services/functions/v1alphaapi/model_help.go @@ -0,0 +1,192 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the Help type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Help{} + +// Help struct for Help +type Help struct { + // The rpc type of Help object + Type *string `json:"@type,omitempty"` + // A reference to further information related to the same topic + Links []HelpMessage `json:"links,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Help Help + +// NewHelp instantiates a new Help 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 NewHelp() *Help { + this := Help{} + return &this +} + +// NewHelpWithDefaults instantiates a new Help 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 NewHelpWithDefaults() *Help { + this := Help{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Help) 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 *Help) 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 *Help) 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 *Help) SetType(v string) { + o.Type = &v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Help) GetLinks() []HelpMessage { + if o == nil || IsNil(o.Links) { + var ret []HelpMessage + return ret + } + return o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Help) GetLinksOk() ([]HelpMessage, bool) { + if o == nil || IsNil(o.Links) { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *Help) HasLinks() bool { + if o != nil && !IsNil(o.Links) { + return true + } + + return false +} + +// SetLinks gets a reference to the given []HelpMessage and assigns it to the Links field. +func (o *Help) SetLinks(v []HelpMessage) { + o.Links = v +} + +func (o Help) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Help) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Type) { + toSerialize["@type"] = o.Type + } + if !IsNil(o.Links) { + toSerialize["links"] = o.Links + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Help) UnmarshalJSON(data []byte) (err error) { + varHelp := _Help{} + + err = json.Unmarshal(data, &varHelp) + + if err != nil { + return err + } + + *o = Help(varHelp) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "@type") + delete(additionalProperties, "links") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHelp struct { + value *Help + isSet bool +} + +func (v NullableHelp) Get() *Help { + return v.value +} + +func (v *NullableHelp) Set(val *Help) { + v.value = val + v.isSet = true +} + +func (v NullableHelp) IsSet() bool { + return v.isSet +} + +func (v *NullableHelp) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHelp(val *Help) *NullableHelp { + return &NullableHelp{value: val, isSet: true} +} + +func (v NullableHelp) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHelp) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_help_message.go b/services/functions/v1alphaapi/model_help_message.go new file mode 100644 index 000000000..a64ac58e7 --- /dev/null +++ b/services/functions/v1alphaapi/model_help_message.go @@ -0,0 +1,192 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the HelpMessage type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HelpMessage{} + +// HelpMessage struct for HelpMessage +type HelpMessage struct { + // Describes what the link offers + Description *string `json:"description,omitempty"` + // The URL of the link + Url *string `json:"url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _HelpMessage HelpMessage + +// NewHelpMessage instantiates a new HelpMessage 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 NewHelpMessage() *HelpMessage { + this := HelpMessage{} + return &this +} + +// NewHelpMessageWithDefaults instantiates a new HelpMessage 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 NewHelpMessageWithDefaults() *HelpMessage { + this := HelpMessage{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *HelpMessage) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HelpMessage) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *HelpMessage) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *HelpMessage) SetDescription(v string) { + o.Description = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *HelpMessage) GetUrl() string { + if o == nil || IsNil(o.Url) { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HelpMessage) GetUrlOk() (*string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *HelpMessage) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *HelpMessage) SetUrl(v string) { + o.Url = &v +} + +func (o HelpMessage) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HelpMessage) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *HelpMessage) UnmarshalJSON(data []byte) (err error) { + varHelpMessage := _HelpMessage{} + + err = json.Unmarshal(data, &varHelpMessage) + + if err != nil { + return err + } + + *o = HelpMessage(varHelpMessage) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHelpMessage struct { + value *HelpMessage + isSet bool +} + +func (v NullableHelpMessage) Get() *HelpMessage { + return v.value +} + +func (v *NullableHelpMessage) Set(val *HelpMessage) { + v.value = val + v.isSet = true +} + +func (v NullableHelpMessage) IsSet() bool { + return v.isSet +} + +func (v *NullableHelpMessage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHelpMessage(val *HelpMessage) *NullableHelpMessage { + return &NullableHelpMessage{value: val, isSet: true} +} + +func (v NullableHelpMessage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHelpMessage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_list_functions.go b/services/functions/v1alphaapi/model_list_functions.go new file mode 100644 index 000000000..d28cb7b34 --- /dev/null +++ b/services/functions/v1alphaapi/model_list_functions.go @@ -0,0 +1,192 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ListFunctions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListFunctions{} + +// ListFunctions struct for ListFunctions +type ListFunctions struct { + // List of functions. + Functions []Function `json:"functions,omitempty"` + // Token for the next page of results. + NextPageToken *string `json:"next_page_token,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListFunctions ListFunctions + +// NewListFunctions instantiates a new ListFunctions 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 NewListFunctions() *ListFunctions { + this := ListFunctions{} + return &this +} + +// NewListFunctionsWithDefaults instantiates a new ListFunctions 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 NewListFunctionsWithDefaults() *ListFunctions { + this := ListFunctions{} + return &this +} + +// GetFunctions returns the Functions field value if set, zero value otherwise. +func (o *ListFunctions) GetFunctions() []Function { + if o == nil || IsNil(o.Functions) { + var ret []Function + return ret + } + return o.Functions +} + +// GetFunctionsOk returns a tuple with the Functions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListFunctions) GetFunctionsOk() ([]Function, bool) { + if o == nil || IsNil(o.Functions) { + return nil, false + } + return o.Functions, true +} + +// HasFunctions returns a boolean if a field has been set. +func (o *ListFunctions) HasFunctions() bool { + if o != nil && !IsNil(o.Functions) { + return true + } + + return false +} + +// SetFunctions gets a reference to the given []Function and assigns it to the Functions field. +func (o *ListFunctions) SetFunctions(v []Function) { + o.Functions = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListFunctions) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListFunctions) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListFunctions) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListFunctions) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ListFunctions) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListFunctions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Functions) { + toSerialize["functions"] = o.Functions + } + if !IsNil(o.NextPageToken) { + toSerialize["next_page_token"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListFunctions) UnmarshalJSON(data []byte) (err error) { + varListFunctions := _ListFunctions{} + + err = json.Unmarshal(data, &varListFunctions) + + if err != nil { + return err + } + + *o = ListFunctions(varListFunctions) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "functions") + delete(additionalProperties, "next_page_token") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListFunctions struct { + value *ListFunctions + isSet bool +} + +func (v NullableListFunctions) Get() *ListFunctions { + return v.value +} + +func (v *NullableListFunctions) Set(val *ListFunctions) { + v.value = val + v.isSet = true +} + +func (v NullableListFunctions) IsSet() bool { + return v.isSet +} + +func (v *NullableListFunctions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListFunctions(val *ListFunctions) *NullableListFunctions { + return &NullableListFunctions{value: val, isSet: true} +} + +func (v NullableListFunctions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListFunctions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_list_functions_401_response.go b/services/functions/v1alphaapi/model_list_functions_401_response.go new file mode 100644 index 000000000..31fa8e084 --- /dev/null +++ b/services/functions/v1alphaapi/model_list_functions_401_response.go @@ -0,0 +1,153 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ListFunctions401Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListFunctions401Response{} + +// ListFunctions401Response struct for ListFunctions401Response +type ListFunctions401Response struct { + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListFunctions401Response ListFunctions401Response + +// NewListFunctions401Response instantiates a new ListFunctions401Response 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 NewListFunctions401Response() *ListFunctions401Response { + this := ListFunctions401Response{} + return &this +} + +// NewListFunctions401ResponseWithDefaults instantiates a new ListFunctions401Response 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 NewListFunctions401ResponseWithDefaults() *ListFunctions401Response { + this := ListFunctions401Response{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ListFunctions401Response) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListFunctions401Response) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *ListFunctions401Response) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ListFunctions401Response) SetMessage(v string) { + o.Message = &v +} + +func (o ListFunctions401Response) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListFunctions401Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListFunctions401Response) UnmarshalJSON(data []byte) (err error) { + varListFunctions401Response := _ListFunctions401Response{} + + err = json.Unmarshal(data, &varListFunctions401Response) + + if err != nil { + return err + } + + *o = ListFunctions401Response(varListFunctions401Response) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListFunctions401Response struct { + value *ListFunctions401Response + isSet bool +} + +func (v NullableListFunctions401Response) Get() *ListFunctions401Response { + return v.value +} + +func (v *NullableListFunctions401Response) Set(val *ListFunctions401Response) { + v.value = val + v.isSet = true +} + +func (v NullableListFunctions401Response) IsSet() bool { + return v.isSet +} + +func (v *NullableListFunctions401Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListFunctions401Response(val *ListFunctions401Response) *NullableListFunctions401Response { + return &NullableListFunctions401Response{value: val, isSet: true} +} + +func (v NullableListFunctions401Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListFunctions401Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_list_pull_secrets.go b/services/functions/v1alphaapi/model_list_pull_secrets.go new file mode 100644 index 000000000..dcc3c6067 --- /dev/null +++ b/services/functions/v1alphaapi/model_list_pull_secrets.go @@ -0,0 +1,192 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ListPullSecrets type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListPullSecrets{} + +// ListPullSecrets struct for ListPullSecrets +type ListPullSecrets struct { + // Token for the next page of results. + NextPageToken *string `json:"next_page_token,omitempty"` + // List of oci registries pull secrets associated with the project. + PullSecrets []PullSecret `json:"pull_secrets,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListPullSecrets ListPullSecrets + +// NewListPullSecrets instantiates a new ListPullSecrets 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 NewListPullSecrets() *ListPullSecrets { + this := ListPullSecrets{} + return &this +} + +// NewListPullSecretsWithDefaults instantiates a new ListPullSecrets 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 NewListPullSecretsWithDefaults() *ListPullSecrets { + this := ListPullSecrets{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListPullSecrets) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListPullSecrets) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListPullSecrets) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListPullSecrets) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +// GetPullSecrets returns the PullSecrets field value if set, zero value otherwise. +func (o *ListPullSecrets) GetPullSecrets() []PullSecret { + if o == nil || IsNil(o.PullSecrets) { + var ret []PullSecret + return ret + } + return o.PullSecrets +} + +// GetPullSecretsOk returns a tuple with the PullSecrets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListPullSecrets) GetPullSecretsOk() ([]PullSecret, bool) { + if o == nil || IsNil(o.PullSecrets) { + return nil, false + } + return o.PullSecrets, true +} + +// HasPullSecrets returns a boolean if a field has been set. +func (o *ListPullSecrets) HasPullSecrets() bool { + if o != nil && !IsNil(o.PullSecrets) { + return true + } + + return false +} + +// SetPullSecrets gets a reference to the given []PullSecret and assigns it to the PullSecrets field. +func (o *ListPullSecrets) SetPullSecrets(v []PullSecret) { + o.PullSecrets = v +} + +func (o ListPullSecrets) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListPullSecrets) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NextPageToken) { + toSerialize["next_page_token"] = o.NextPageToken + } + if !IsNil(o.PullSecrets) { + toSerialize["pull_secrets"] = o.PullSecrets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListPullSecrets) UnmarshalJSON(data []byte) (err error) { + varListPullSecrets := _ListPullSecrets{} + + err = json.Unmarshal(data, &varListPullSecrets) + + if err != nil { + return err + } + + *o = ListPullSecrets(varListPullSecrets) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "next_page_token") + delete(additionalProperties, "pull_secrets") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListPullSecrets struct { + value *ListPullSecrets + isSet bool +} + +func (v NullableListPullSecrets) Get() *ListPullSecrets { + return v.value +} + +func (v *NullableListPullSecrets) Set(val *ListPullSecrets) { + v.value = val + v.isSet = true +} + +func (v NullableListPullSecrets) IsSet() bool { + return v.isSet +} + +func (v *NullableListPullSecrets) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListPullSecrets(val *ListPullSecrets) *NullableListPullSecrets { + return &NullableListPullSecrets{value: val, isSet: true} +} + +func (v NullableListPullSecrets) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListPullSecrets) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_list_revisions.go b/services/functions/v1alphaapi/model_list_revisions.go new file mode 100644 index 000000000..86c21bef9 --- /dev/null +++ b/services/functions/v1alphaapi/model_list_revisions.go @@ -0,0 +1,230 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ListRevisions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListRevisions{} + +// ListRevisions struct for ListRevisions +type ListRevisions struct { + // Maximum number of items + MaxItems *int64 `json:"maxItems,omitempty"` + // Token for the next page of results. + NextPageToken *string `json:"next_page_token,omitempty"` + // List of revisions. + RevisionList []Revision `json:"revisionList,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListRevisions ListRevisions + +// NewListRevisions instantiates a new ListRevisions 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 NewListRevisions() *ListRevisions { + this := ListRevisions{} + return &this +} + +// NewListRevisionsWithDefaults instantiates a new ListRevisions 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 NewListRevisionsWithDefaults() *ListRevisions { + this := ListRevisions{} + return &this +} + +// GetMaxItems returns the MaxItems field value if set, zero value otherwise. +func (o *ListRevisions) GetMaxItems() int64 { + if o == nil || IsNil(o.MaxItems) { + var ret int64 + return ret + } + return *o.MaxItems +} + +// GetMaxItemsOk returns a tuple with the MaxItems field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListRevisions) GetMaxItemsOk() (*int64, bool) { + if o == nil || IsNil(o.MaxItems) { + return nil, false + } + return o.MaxItems, true +} + +// HasMaxItems returns a boolean if a field has been set. +func (o *ListRevisions) HasMaxItems() bool { + if o != nil && !IsNil(o.MaxItems) { + return true + } + + return false +} + +// SetMaxItems gets a reference to the given int64 and assigns it to the MaxItems field. +func (o *ListRevisions) SetMaxItems(v int64) { + o.MaxItems = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListRevisions) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListRevisions) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListRevisions) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListRevisions) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +// GetRevisionList returns the RevisionList field value if set, zero value otherwise. +func (o *ListRevisions) GetRevisionList() []Revision { + if o == nil || IsNil(o.RevisionList) { + var ret []Revision + return ret + } + return o.RevisionList +} + +// GetRevisionListOk returns a tuple with the RevisionList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListRevisions) GetRevisionListOk() ([]Revision, bool) { + if o == nil || IsNil(o.RevisionList) { + return nil, false + } + return o.RevisionList, true +} + +// HasRevisionList returns a boolean if a field has been set. +func (o *ListRevisions) HasRevisionList() bool { + if o != nil && !IsNil(o.RevisionList) { + return true + } + + return false +} + +// SetRevisionList gets a reference to the given []Revision and assigns it to the RevisionList field. +func (o *ListRevisions) SetRevisionList(v []Revision) { + o.RevisionList = v +} + +func (o ListRevisions) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListRevisions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MaxItems) { + toSerialize["maxItems"] = o.MaxItems + } + if !IsNil(o.NextPageToken) { + toSerialize["next_page_token"] = o.NextPageToken + } + if !IsNil(o.RevisionList) { + toSerialize["revisionList"] = o.RevisionList + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListRevisions) UnmarshalJSON(data []byte) (err error) { + varListRevisions := _ListRevisions{} + + err = json.Unmarshal(data, &varListRevisions) + + if err != nil { + return err + } + + *o = ListRevisions(varListRevisions) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "maxItems") + delete(additionalProperties, "next_page_token") + delete(additionalProperties, "revisionList") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListRevisions struct { + value *ListRevisions + isSet bool +} + +func (v NullableListRevisions) Get() *ListRevisions { + return v.value +} + +func (v *NullableListRevisions) Set(val *ListRevisions) { + v.value = val + v.isSet = true +} + +func (v NullableListRevisions) IsSet() bool { + return v.isSet +} + +func (v *NullableListRevisions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListRevisions(val *ListRevisions) *NullableListRevisions { + return &NullableListRevisions{value: val, isSet: true} +} + +func (v NullableListRevisions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListRevisions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_pull_secret.go b/services/functions/v1alphaapi/model_pull_secret.go new file mode 100644 index 000000000..51f46ad2f --- /dev/null +++ b/services/functions/v1alphaapi/model_pull_secret.go @@ -0,0 +1,340 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the PullSecret type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PullSecret{} + +// PullSecret struct for PullSecret +type PullSecret struct { + // The OCI registry address. + Address string `json:"address"` + // Unique identifier for the OCI registry pull secret. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + // Unique name for the OCI registry pull secret. + Name *string `json:"name,omitempty"` + // The password for the OCI registry pull-secret. + Password string `json:"password"` + // The username for the OCI registry pull-secret. + Username string `json:"username"` + AdditionalProperties map[string]interface{} +} + +type _PullSecret PullSecret + +// NewPullSecret instantiates a new PullSecret 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 NewPullSecret(address string, password string, username string) *PullSecret { + this := PullSecret{} + this.Address = address + this.Password = password + this.Username = username + return &this +} + +// NewPullSecretWithDefaults instantiates a new PullSecret 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 NewPullSecretWithDefaults() *PullSecret { + this := PullSecret{} + return &this +} + +// GetAddress returns the Address field value +func (o *PullSecret) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *PullSecret) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *PullSecret) SetAddress(v string) { + o.Address = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PullSecret) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PullSecret) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *PullSecret) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PullSecret) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PullSecret) 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 *PullSecret) 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 *PullSecret) 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 *PullSecret) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PullSecret) 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 *PullSecret) 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 *PullSecret) 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 *PullSecret) SetName(v string) { + o.Name = &v +} + +// GetPassword returns the Password field value +func (o *PullSecret) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *PullSecret) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *PullSecret) SetPassword(v string) { + o.Password = v +} + +// GetUsername returns the Username field value +func (o *PullSecret) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *PullSecret) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *PullSecret) SetUsername(v string) { + o.Username = v +} + +func (o PullSecret) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PullSecret) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["password"] = o.Password + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PullSecret) 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{ + "address", + "password", + "username", + } + + 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) + } + } + + varPullSecret := _PullSecret{} + + err = json.Unmarshal(data, &varPullSecret) + + if err != nil { + return err + } + + *o = PullSecret(varPullSecret) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "password") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePullSecret struct { + value *PullSecret + isSet bool +} + +func (v NullablePullSecret) Get() *PullSecret { + return v.value +} + +func (v *NullablePullSecret) Set(val *PullSecret) { + v.value = val + v.isSet = true +} + +func (v NullablePullSecret) IsSet() bool { + return v.isSet +} + +func (v *NullablePullSecret) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePullSecret(val *PullSecret) *NullablePullSecret { + return &NullablePullSecret{value: val, isSet: true} +} + +func (v NullablePullSecret) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePullSecret) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_resource_limits.go b/services/functions/v1alphaapi/model_resource_limits.go new file mode 100644 index 000000000..daa323ad0 --- /dev/null +++ b/services/functions/v1alphaapi/model_resource_limits.go @@ -0,0 +1,195 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ResourceLimits type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourceLimits{} + +// ResourceLimits Resource utilization limitations +type ResourceLimits struct { + Concurrency int32 `json:"concurrency"` + Plan string `json:"plan"` + AdditionalProperties map[string]interface{} +} + +type _ResourceLimits ResourceLimits + +// NewResourceLimits instantiates a new ResourceLimits 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 NewResourceLimits(concurrency int32, plan string) *ResourceLimits { + this := ResourceLimits{} + this.Concurrency = concurrency + this.Plan = plan + return &this +} + +// NewResourceLimitsWithDefaults instantiates a new ResourceLimits 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 NewResourceLimitsWithDefaults() *ResourceLimits { + this := ResourceLimits{} + return &this +} + +// GetConcurrency returns the Concurrency field value +func (o *ResourceLimits) GetConcurrency() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Concurrency +} + +// GetConcurrencyOk returns a tuple with the Concurrency field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetConcurrencyOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Concurrency, true +} + +// SetConcurrency sets field value +func (o *ResourceLimits) SetConcurrency(v int32) { + o.Concurrency = v +} + +// GetPlan returns the Plan field value +func (o *ResourceLimits) GetPlan() string { + if o == nil { + var ret string + return ret + } + + return o.Plan +} + +// GetPlanOk returns a tuple with the Plan field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetPlanOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Plan, true +} + +// SetPlan sets field value +func (o *ResourceLimits) SetPlan(v string) { + o.Plan = v +} + +func (o ResourceLimits) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ResourceLimits) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["concurrency"] = o.Concurrency + toSerialize["plan"] = o.Plan + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ResourceLimits) 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{ + "concurrency", + "plan", + } + + 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) + } + } + + varResourceLimits := _ResourceLimits{} + + err = json.Unmarshal(data, &varResourceLimits) + + if err != nil { + return err + } + + *o = ResourceLimits(varResourceLimits) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "concurrency") + delete(additionalProperties, "plan") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableResourceLimits struct { + value *ResourceLimits + isSet bool +} + +func (v NullableResourceLimits) Get() *ResourceLimits { + return v.value +} + +func (v *NullableResourceLimits) Set(val *ResourceLimits) { + v.value = val + v.isSet = true +} + +func (v NullableResourceLimits) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceLimits) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceLimits(val *ResourceLimits) *NullableResourceLimits { + return &NullableResourceLimits{value: val, isSet: true} +} + +func (v NullableResourceLimits) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceLimits) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_revision.go b/services/functions/v1alphaapi/model_revision.go new file mode 100644 index 000000000..ae218b3c1 --- /dev/null +++ b/services/functions/v1alphaapi/model_revision.go @@ -0,0 +1,689 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Revision type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Revision{} + +// Revision The function revision +type Revision struct { + // Time the function was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // A hashed fingerprint of the revision artifact. + Digest *string `json:"digest,omitempty"` + // The ID of the function associated with this revision. + FunctionId *string `json:"function_id,omitempty"` + // The revision identifier. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + Limits ResourceLimits `json:"limits"` + // Revision message + Message *string `json:"message,omitempty"` + // The name of the the revision. Must be unique within the function. + Name *string `json:"name,omitempty"` + // OCI Registry pull secret to use for pulling the revision's image. + OciPullSecretId *string `json:"oci_pull_secret_id,omitempty"` + // OCI reference for the revision. + OciReference string `json:"oci_reference" validate:"regexp=(:[vV]?\\\\d+\\\\.\\\\d+\\\\.\\\\d+(@sha256:[a-fA-F0-9]{64})?)$|((:latest)?@sha256:[a-fA-F0-9]{64})$"` + State *RevisionState `json:"state,omitempty"` + // Error message related to this revision. + StateError *string `json:"state_error,omitempty"` + // Time the function was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Variable values for this revision. Each variable must reference a variable definition on the function. + Variables []RevisionVariable `json:"variables,omitempty"` + // The version number of the revision. + Version *int64 `json:"version,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Revision Revision + +// NewRevision instantiates a new Revision 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 NewRevision(limits ResourceLimits, ociReference string) *Revision { + this := Revision{} + this.Limits = limits + this.OciReference = ociReference + return &this +} + +// NewRevisionWithDefaults instantiates a new Revision 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 NewRevisionWithDefaults() *Revision { + this := Revision{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Revision) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Revision) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Revision) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDigest returns the Digest field value if set, zero value otherwise. +func (o *Revision) GetDigest() string { + if o == nil || IsNil(o.Digest) { + var ret string + return ret + } + return *o.Digest +} + +// GetDigestOk returns a tuple with the Digest field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetDigestOk() (*string, bool) { + if o == nil || IsNil(o.Digest) { + return nil, false + } + return o.Digest, true +} + +// HasDigest returns a boolean if a field has been set. +func (o *Revision) HasDigest() bool { + if o != nil && !IsNil(o.Digest) { + return true + } + + return false +} + +// SetDigest gets a reference to the given string and assigns it to the Digest field. +func (o *Revision) SetDigest(v string) { + o.Digest = &v +} + +// GetFunctionId returns the FunctionId field value if set, zero value otherwise. +func (o *Revision) GetFunctionId() string { + if o == nil || IsNil(o.FunctionId) { + var ret string + return ret + } + return *o.FunctionId +} + +// GetFunctionIdOk returns a tuple with the FunctionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetFunctionIdOk() (*string, bool) { + if o == nil || IsNil(o.FunctionId) { + return nil, false + } + return o.FunctionId, true +} + +// HasFunctionId returns a boolean if a field has been set. +func (o *Revision) HasFunctionId() bool { + if o != nil && !IsNil(o.FunctionId) { + return true + } + + return false +} + +// SetFunctionId gets a reference to the given string and assigns it to the FunctionId field. +func (o *Revision) SetFunctionId(v string) { + o.FunctionId = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Revision) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Revision) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Revision) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Revision) 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 *Revision) 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 *Revision) 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 *Revision) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetLimits returns the Limits field value +func (o *Revision) GetLimits() ResourceLimits { + if o == nil { + var ret ResourceLimits + return ret + } + + return o.Limits +} + +// GetLimitsOk returns a tuple with the Limits field value +// and a boolean to check if the value has been set. +func (o *Revision) GetLimitsOk() (*ResourceLimits, bool) { + if o == nil { + return nil, false + } + return &o.Limits, true +} + +// SetLimits sets field value +func (o *Revision) SetLimits(v ResourceLimits) { + o.Limits = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Revision) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *Revision) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *Revision) SetMessage(v string) { + o.Message = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Revision) 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 *Revision) 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 *Revision) 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 *Revision) SetName(v string) { + o.Name = &v +} + +// GetOciPullSecretId returns the OciPullSecretId field value if set, zero value otherwise. +func (o *Revision) GetOciPullSecretId() string { + if o == nil || IsNil(o.OciPullSecretId) { + var ret string + return ret + } + return *o.OciPullSecretId +} + +// GetOciPullSecretIdOk returns a tuple with the OciPullSecretId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetOciPullSecretIdOk() (*string, bool) { + if o == nil || IsNil(o.OciPullSecretId) { + return nil, false + } + return o.OciPullSecretId, true +} + +// HasOciPullSecretId returns a boolean if a field has been set. +func (o *Revision) HasOciPullSecretId() bool { + if o != nil && !IsNil(o.OciPullSecretId) { + return true + } + + return false +} + +// SetOciPullSecretId gets a reference to the given string and assigns it to the OciPullSecretId field. +func (o *Revision) SetOciPullSecretId(v string) { + o.OciPullSecretId = &v +} + +// GetOciReference returns the OciReference field value +func (o *Revision) GetOciReference() string { + if o == nil { + var ret string + return ret + } + + return o.OciReference +} + +// GetOciReferenceOk returns a tuple with the OciReference field value +// and a boolean to check if the value has been set. +func (o *Revision) GetOciReferenceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OciReference, true +} + +// SetOciReference sets field value +func (o *Revision) SetOciReference(v string) { + o.OciReference = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Revision) GetState() RevisionState { + if o == nil || IsNil(o.State) { + var ret RevisionState + 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 *Revision) GetStateOk() (*RevisionState, 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 *Revision) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given RevisionState and assigns it to the State field. +func (o *Revision) SetState(v RevisionState) { + o.State = &v +} + +// GetStateError returns the StateError field value if set, zero value otherwise. +func (o *Revision) GetStateError() string { + if o == nil || IsNil(o.StateError) { + var ret string + return ret + } + return *o.StateError +} + +// GetStateErrorOk returns a tuple with the StateError field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetStateErrorOk() (*string, bool) { + if o == nil || IsNil(o.StateError) { + return nil, false + } + return o.StateError, true +} + +// HasStateError returns a boolean if a field has been set. +func (o *Revision) HasStateError() bool { + if o != nil && !IsNil(o.StateError) { + return true + } + + return false +} + +// SetStateError gets a reference to the given string and assigns it to the StateError field. +func (o *Revision) SetStateError(v string) { + o.StateError = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Revision) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Revision) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Revision) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *Revision) GetVariables() []RevisionVariable { + if o == nil || IsNil(o.Variables) { + var ret []RevisionVariable + return ret + } + return o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetVariablesOk() ([]RevisionVariable, bool) { + if o == nil || IsNil(o.Variables) { + return nil, false + } + return o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *Revision) HasVariables() bool { + if o != nil && !IsNil(o.Variables) { + return true + } + + return false +} + +// SetVariables gets a reference to the given []RevisionVariable and assigns it to the Variables field. +func (o *Revision) SetVariables(v []RevisionVariable) { + o.Variables = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *Revision) GetVersion() int64 { + if o == nil || IsNil(o.Version) { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Revision) GetVersionOk() (*int64, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *Revision) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *Revision) SetVersion(v int64) { + o.Version = &v +} + +func (o Revision) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Revision) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Digest) { + toSerialize["digest"] = o.Digest + } + if !IsNil(o.FunctionId) { + toSerialize["function_id"] = o.FunctionId + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["limits"] = o.Limits + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OciPullSecretId) { + toSerialize["oci_pull_secret_id"] = o.OciPullSecretId + } + toSerialize["oci_reference"] = o.OciReference + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.StateError) { + toSerialize["state_error"] = o.StateError + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Variables) { + toSerialize["variables"] = o.Variables + } + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Revision) 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{ + "limits", + "oci_reference", + } + + 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) + } + } + + varRevision := _Revision{} + + err = json.Unmarshal(data, &varRevision) + + if err != nil { + return err + } + + *o = Revision(varRevision) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "digest") + delete(additionalProperties, "function_id") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "limits") + delete(additionalProperties, "message") + delete(additionalProperties, "name") + delete(additionalProperties, "oci_pull_secret_id") + delete(additionalProperties, "oci_reference") + delete(additionalProperties, "state") + delete(additionalProperties, "state_error") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "variables") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRevision struct { + value *Revision + isSet bool +} + +func (v NullableRevision) Get() *Revision { + return v.value +} + +func (v *NullableRevision) Set(val *Revision) { + v.value = val + v.isSet = true +} + +func (v NullableRevision) IsSet() bool { + return v.isSet +} + +func (v *NullableRevision) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRevision(val *Revision) *NullableRevision { + return &NullableRevision{value: val, isSet: true} +} + +func (v NullableRevision) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRevision) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_revision_state.go b/services/functions/v1alphaapi/model_revision_state.go new file mode 100644 index 000000000..5d9af4b90 --- /dev/null +++ b/services/functions/v1alphaapi/model_revision_state.go @@ -0,0 +1,117 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// RevisionState Status of this revision. +type RevisionState string + +// List of Revision_state +const ( + REVISIONSTATE_CANCELLED RevisionState = "CANCELLED" + REVISIONSTATE_CREATING RevisionState = "CREATING" + REVISIONSTATE_ACTIVE RevisionState = "ACTIVE" + REVISIONSTATE_FAILED RevisionState = "FAILED" + REVISIONSTATE_UNKNOWN_DEFAULT_OPEN_API RevisionState = "unknown_default_open_api" +) + +// All allowed values of RevisionState enum +var AllowedRevisionStateEnumValues = []RevisionState{ + "CANCELLED", + "CREATING", + "ACTIVE", + "FAILED", + "unknown_default_open_api", +} + +func (v *RevisionState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := RevisionState(value) + for _, existing := range AllowedRevisionStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = REVISIONSTATE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewRevisionStateFromValue returns a pointer to a valid RevisionState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRevisionStateFromValue(v string) (*RevisionState, error) { + ev := RevisionState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RevisionState: valid values are %v", v, AllowedRevisionStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RevisionState) IsValid() bool { + for _, existing := range AllowedRevisionStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Revision_state value +func (v RevisionState) Ptr() *RevisionState { + return &v +} + +type NullableRevisionState struct { + value *RevisionState + isSet bool +} + +func (v NullableRevisionState) Get() *RevisionState { + return v.value +} + +func (v *NullableRevisionState) Set(val *RevisionState) { + v.value = val + v.isSet = true +} + +func (v NullableRevisionState) IsSet() bool { + return v.isSet +} + +func (v *NullableRevisionState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRevisionState(val *RevisionState) *NullableRevisionState { + return &NullableRevisionState{value: val, isSet: true} +} + +func (v NullableRevisionState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRevisionState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_revision_variable.go b/services/functions/v1alphaapi/model_revision_variable.go new file mode 100644 index 000000000..15343185b --- /dev/null +++ b/services/functions/v1alphaapi/model_revision_variable.go @@ -0,0 +1,265 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the RevisionVariable type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RevisionVariable{} + +// RevisionVariable Represents a variable value for a specific revision. +type RevisionVariable struct { + // Name of the variable (must match a variable definition on the function). + Name string `json:"name" validate:"regexp=^[a-zA-Z_][a-zA-Z0-9_]*$"` + // The value of the variable. Only present for normal variables. Secrets will have a vault reference instead. + Value NullableString `json:"value,omitempty"` + // Reference to the vault secret. Only present for secret variables. + VaultReference NullableString `json:"vault_reference,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RevisionVariable RevisionVariable + +// NewRevisionVariable instantiates a new RevisionVariable 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 NewRevisionVariable(name string) *RevisionVariable { + this := RevisionVariable{} + this.Name = name + return &this +} + +// NewRevisionVariableWithDefaults instantiates a new RevisionVariable 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 NewRevisionVariableWithDefaults() *RevisionVariable { + this := RevisionVariable{} + return &this +} + +// GetName returns the Name field value +func (o *RevisionVariable) 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 *RevisionVariable) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *RevisionVariable) SetName(v string) { + o.Name = v +} + +// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RevisionVariable) GetValue() string { + if o == nil || IsNil(o.Value.Get()) { + var ret string + return ret + } + return *o.Value.Get() +} + +// GetValueOk returns a tuple with the Value 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 *RevisionVariable) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Value.Get(), o.Value.IsSet() +} + +// HasValue returns a boolean if a field has been set. +func (o *RevisionVariable) HasValue() bool { + if o != nil && o.Value.IsSet() { + return true + } + + return false +} + +// SetValue gets a reference to the given NullableString and assigns it to the Value field. +func (o *RevisionVariable) SetValue(v string) { + o.Value.Set(&v) +} + +// SetValueNil sets the value for Value to be an explicit nil +func (o *RevisionVariable) SetValueNil() { + o.Value.Set(nil) +} + +// UnsetValue ensures that no value is present for Value, not even an explicit nil +func (o *RevisionVariable) UnsetValue() { + o.Value.Unset() +} + +// GetVaultReference returns the VaultReference field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RevisionVariable) GetVaultReference() string { + if o == nil || IsNil(o.VaultReference.Get()) { + var ret string + return ret + } + return *o.VaultReference.Get() +} + +// GetVaultReferenceOk returns a tuple with the VaultReference 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 *RevisionVariable) GetVaultReferenceOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.VaultReference.Get(), o.VaultReference.IsSet() +} + +// HasVaultReference returns a boolean if a field has been set. +func (o *RevisionVariable) HasVaultReference() bool { + if o != nil && o.VaultReference.IsSet() { + return true + } + + return false +} + +// SetVaultReference gets a reference to the given NullableString and assigns it to the VaultReference field. +func (o *RevisionVariable) SetVaultReference(v string) { + o.VaultReference.Set(&v) +} + +// SetVaultReferenceNil sets the value for VaultReference to be an explicit nil +func (o *RevisionVariable) SetVaultReferenceNil() { + o.VaultReference.Set(nil) +} + +// UnsetVaultReference ensures that no value is present for VaultReference, not even an explicit nil +func (o *RevisionVariable) UnsetVaultReference() { + o.VaultReference.Unset() +} + +func (o RevisionVariable) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RevisionVariable) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if o.Value.IsSet() { + toSerialize["value"] = o.Value.Get() + } + if o.VaultReference.IsSet() { + toSerialize["vault_reference"] = o.VaultReference.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RevisionVariable) 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", + } + + 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) + } + } + + varRevisionVariable := _RevisionVariable{} + + err = json.Unmarshal(data, &varRevisionVariable) + + if err != nil { + return err + } + + *o = RevisionVariable(varRevisionVariable) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "value") + delete(additionalProperties, "vault_reference") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRevisionVariable struct { + value *RevisionVariable + isSet bool +} + +func (v NullableRevisionVariable) Get() *RevisionVariable { + return v.value +} + +func (v *NullableRevisionVariable) Set(val *RevisionVariable) { + v.value = val + v.isSet = true +} + +func (v NullableRevisionVariable) IsSet() bool { + return v.isSet +} + +func (v *NullableRevisionVariable) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRevisionVariable(val *RevisionVariable) *NullableRevisionVariable { + return &NullableRevisionVariable{value: val, isSet: true} +} + +func (v NullableRevisionVariable) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRevisionVariable) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_update_function_payload.go b/services/functions/v1alphaapi/model_update_function_payload.go new file mode 100644 index 000000000..9674d2118 --- /dev/null +++ b/services/functions/v1alphaapi/model_update_function_payload.go @@ -0,0 +1,470 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the UpdateFunctionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateFunctionPayload{} + +// UpdateFunctionPayload Represents a STACKIT Functions function. +type UpdateFunctionPayload struct { + // Time the function was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // The ID of the currently-deployed revision associated with this function. + CurrentRevision *string `json:"current_revision,omitempty"` + // Unique identifier for the function. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + // User-defined name of the function. + Name string `json:"name"` + State *UpdateFunctionPayloadState `json:"state,omitempty"` + // Error message related to this function's status. + StateError *string `json:"state_error,omitempty"` + // Time the function was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // URLs that resolve to the function. + Url []string `json:"url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateFunctionPayload UpdateFunctionPayload + +// NewUpdateFunctionPayload instantiates a new UpdateFunctionPayload 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 NewUpdateFunctionPayload(name string) *UpdateFunctionPayload { + this := UpdateFunctionPayload{} + this.Name = name + return &this +} + +// NewUpdateFunctionPayloadWithDefaults instantiates a new UpdateFunctionPayload 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 NewUpdateFunctionPayloadWithDefaults() *UpdateFunctionPayload { + this := UpdateFunctionPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UpdateFunctionPayload) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateFunctionPayload) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UpdateFunctionPayload) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UpdateFunctionPayload) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCurrentRevision returns the CurrentRevision field value if set, zero value otherwise. +func (o *UpdateFunctionPayload) GetCurrentRevision() string { + if o == nil || IsNil(o.CurrentRevision) { + var ret string + return ret + } + return *o.CurrentRevision +} + +// GetCurrentRevisionOk returns a tuple with the CurrentRevision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateFunctionPayload) GetCurrentRevisionOk() (*string, bool) { + if o == nil || IsNil(o.CurrentRevision) { + return nil, false + } + return o.CurrentRevision, true +} + +// HasCurrentRevision returns a boolean if a field has been set. +func (o *UpdateFunctionPayload) HasCurrentRevision() bool { + if o != nil && !IsNil(o.CurrentRevision) { + return true + } + + return false +} + +// SetCurrentRevision gets a reference to the given string and assigns it to the CurrentRevision field. +func (o *UpdateFunctionPayload) SetCurrentRevision(v string) { + o.CurrentRevision = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateFunctionPayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateFunctionPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateFunctionPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateFunctionPayload) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateFunctionPayload) 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 *UpdateFunctionPayload) 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 *UpdateFunctionPayload) 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 *UpdateFunctionPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *UpdateFunctionPayload) 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 *UpdateFunctionPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *UpdateFunctionPayload) SetName(v string) { + o.Name = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *UpdateFunctionPayload) GetState() UpdateFunctionPayloadState { + if o == nil || IsNil(o.State) { + var ret UpdateFunctionPayloadState + 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 *UpdateFunctionPayload) GetStateOk() (*UpdateFunctionPayloadState, 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 *UpdateFunctionPayload) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given UpdateFunctionPayloadState and assigns it to the State field. +func (o *UpdateFunctionPayload) SetState(v UpdateFunctionPayloadState) { + o.State = &v +} + +// GetStateError returns the StateError field value if set, zero value otherwise. +func (o *UpdateFunctionPayload) GetStateError() string { + if o == nil || IsNil(o.StateError) { + var ret string + return ret + } + return *o.StateError +} + +// GetStateErrorOk returns a tuple with the StateError field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateFunctionPayload) GetStateErrorOk() (*string, bool) { + if o == nil || IsNil(o.StateError) { + return nil, false + } + return o.StateError, true +} + +// HasStateError returns a boolean if a field has been set. +func (o *UpdateFunctionPayload) HasStateError() bool { + if o != nil && !IsNil(o.StateError) { + return true + } + + return false +} + +// SetStateError gets a reference to the given string and assigns it to the StateError field. +func (o *UpdateFunctionPayload) SetStateError(v string) { + o.StateError = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *UpdateFunctionPayload) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateFunctionPayload) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *UpdateFunctionPayload) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *UpdateFunctionPayload) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *UpdateFunctionPayload) GetUrl() []string { + if o == nil || IsNil(o.Url) { + var ret []string + return ret + } + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateFunctionPayload) GetUrlOk() ([]string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *UpdateFunctionPayload) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given []string and assigns it to the Url field. +func (o *UpdateFunctionPayload) SetUrl(v []string) { + o.Url = v +} + +func (o UpdateFunctionPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateFunctionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.CurrentRevision) { + toSerialize["current_revision"] = o.CurrentRevision + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.StateError) { + toSerialize["state_error"] = o.StateError + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateFunctionPayload) 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", + } + + 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) + } + } + + varUpdateFunctionPayload := _UpdateFunctionPayload{} + + err = json.Unmarshal(data, &varUpdateFunctionPayload) + + if err != nil { + return err + } + + *o = UpdateFunctionPayload(varUpdateFunctionPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "current_revision") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "state") + delete(additionalProperties, "state_error") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateFunctionPayload struct { + value *UpdateFunctionPayload + isSet bool +} + +func (v NullableUpdateFunctionPayload) Get() *UpdateFunctionPayload { + return v.value +} + +func (v *NullableUpdateFunctionPayload) Set(val *UpdateFunctionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateFunctionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateFunctionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateFunctionPayload(val *UpdateFunctionPayload) *NullableUpdateFunctionPayload { + return &NullableUpdateFunctionPayload{value: val, isSet: true} +} + +func (v NullableUpdateFunctionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateFunctionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_update_function_payload_state.go b/services/functions/v1alphaapi/model_update_function_payload_state.go new file mode 100644 index 000000000..b0450ad7d --- /dev/null +++ b/services/functions/v1alphaapi/model_update_function_payload_state.go @@ -0,0 +1,115 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// UpdateFunctionPayloadState Status of this function's latest revision. +type UpdateFunctionPayloadState string + +// List of UpdateFunctionPayload_state +const ( + UPDATEFUNCTIONPAYLOADSTATE_CREATING UpdateFunctionPayloadState = "CREATING" + UPDATEFUNCTIONPAYLOADSTATE_ACTIVE UpdateFunctionPayloadState = "ACTIVE" + UPDATEFUNCTIONPAYLOADSTATE_FAILED UpdateFunctionPayloadState = "FAILED" + UPDATEFUNCTIONPAYLOADSTATE_UNKNOWN_DEFAULT_OPEN_API UpdateFunctionPayloadState = "unknown_default_open_api" +) + +// All allowed values of UpdateFunctionPayloadState enum +var AllowedUpdateFunctionPayloadStateEnumValues = []UpdateFunctionPayloadState{ + "CREATING", + "ACTIVE", + "FAILED", + "unknown_default_open_api", +} + +func (v *UpdateFunctionPayloadState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := UpdateFunctionPayloadState(value) + for _, existing := range AllowedUpdateFunctionPayloadStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = UPDATEFUNCTIONPAYLOADSTATE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewUpdateFunctionPayloadStateFromValue returns a pointer to a valid UpdateFunctionPayloadState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateFunctionPayloadStateFromValue(v string) (*UpdateFunctionPayloadState, error) { + ev := UpdateFunctionPayloadState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateFunctionPayloadState: valid values are %v", v, AllowedUpdateFunctionPayloadStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateFunctionPayloadState) IsValid() bool { + for _, existing := range AllowedUpdateFunctionPayloadStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UpdateFunctionPayload_state value +func (v UpdateFunctionPayloadState) Ptr() *UpdateFunctionPayloadState { + return &v +} + +type NullableUpdateFunctionPayloadState struct { + value *UpdateFunctionPayloadState + isSet bool +} + +func (v NullableUpdateFunctionPayloadState) Get() *UpdateFunctionPayloadState { + return v.value +} + +func (v *NullableUpdateFunctionPayloadState) Set(val *UpdateFunctionPayloadState) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateFunctionPayloadState) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateFunctionPayloadState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateFunctionPayloadState(val *UpdateFunctionPayloadState) *NullableUpdateFunctionPayloadState { + return &NullableUpdateFunctionPayloadState{value: val, isSet: true} +} + +func (v NullableUpdateFunctionPayloadState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateFunctionPayloadState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_update_pull_secret_payload.go b/services/functions/v1alphaapi/model_update_pull_secret_payload.go new file mode 100644 index 000000000..3a8f56514 --- /dev/null +++ b/services/functions/v1alphaapi/model_update_pull_secret_payload.go @@ -0,0 +1,340 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdatePullSecretPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdatePullSecretPayload{} + +// UpdatePullSecretPayload struct for UpdatePullSecretPayload +type UpdatePullSecretPayload struct { + // The OCI registry address. + Address string `json:"address"` + // Unique identifier for the OCI registry pull secret. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + // Unique name for the OCI registry pull secret. + Name *string `json:"name,omitempty"` + // The password for the OCI registry pull-secret. + Password string `json:"password"` + // The username for the OCI registry pull-secret. + Username string `json:"username"` + AdditionalProperties map[string]interface{} +} + +type _UpdatePullSecretPayload UpdatePullSecretPayload + +// NewUpdatePullSecretPayload instantiates a new UpdatePullSecretPayload 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 NewUpdatePullSecretPayload(address string, password string, username string) *UpdatePullSecretPayload { + this := UpdatePullSecretPayload{} + this.Address = address + this.Password = password + this.Username = username + return &this +} + +// NewUpdatePullSecretPayloadWithDefaults instantiates a new UpdatePullSecretPayload 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 NewUpdatePullSecretPayloadWithDefaults() *UpdatePullSecretPayload { + this := UpdatePullSecretPayload{} + return &this +} + +// GetAddress returns the Address field value +func (o *UpdatePullSecretPayload) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *UpdatePullSecretPayload) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *UpdatePullSecretPayload) SetAddress(v string) { + o.Address = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdatePullSecretPayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdatePullSecretPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UpdatePullSecretPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdatePullSecretPayload) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdatePullSecretPayload) 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 *UpdatePullSecretPayload) 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 *UpdatePullSecretPayload) 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 *UpdatePullSecretPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdatePullSecretPayload) 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 *UpdatePullSecretPayload) 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 *UpdatePullSecretPayload) 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 *UpdatePullSecretPayload) SetName(v string) { + o.Name = &v +} + +// GetPassword returns the Password field value +func (o *UpdatePullSecretPayload) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *UpdatePullSecretPayload) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *UpdatePullSecretPayload) SetPassword(v string) { + o.Password = v +} + +// GetUsername returns the Username field value +func (o *UpdatePullSecretPayload) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *UpdatePullSecretPayload) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *UpdatePullSecretPayload) SetUsername(v string) { + o.Username = v +} + +func (o UpdatePullSecretPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdatePullSecretPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["password"] = o.Password + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdatePullSecretPayload) 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{ + "address", + "password", + "username", + } + + 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) + } + } + + varUpdatePullSecretPayload := _UpdatePullSecretPayload{} + + err = json.Unmarshal(data, &varUpdatePullSecretPayload) + + if err != nil { + return err + } + + *o = UpdatePullSecretPayload(varUpdatePullSecretPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "password") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdatePullSecretPayload struct { + value *UpdatePullSecretPayload + isSet bool +} + +func (v NullableUpdatePullSecretPayload) Get() *UpdatePullSecretPayload { + return v.value +} + +func (v *NullableUpdatePullSecretPayload) Set(val *UpdatePullSecretPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdatePullSecretPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdatePullSecretPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdatePullSecretPayload(val *UpdatePullSecretPayload) *NullableUpdatePullSecretPayload { + return &NullableUpdatePullSecretPayload{value: val, isSet: true} +} + +func (v NullableUpdatePullSecretPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdatePullSecretPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_update_revision_payload.go b/services/functions/v1alphaapi/model_update_revision_payload.go new file mode 100644 index 000000000..89fd089aa --- /dev/null +++ b/services/functions/v1alphaapi/model_update_revision_payload.go @@ -0,0 +1,689 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the UpdateRevisionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRevisionPayload{} + +// UpdateRevisionPayload The function revision +type UpdateRevisionPayload struct { + // Time the function was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // A hashed fingerprint of the revision artifact. + Digest *string `json:"digest,omitempty"` + // The ID of the function associated with this revision. + FunctionId *string `json:"function_id,omitempty"` + // The revision identifier. + Id *string `json:"id,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + Limits ResourceLimits `json:"limits"` + // Revision message + Message *string `json:"message,omitempty"` + // The name of the the revision. Must be unique within the function. + Name *string `json:"name,omitempty"` + // OCI Registry pull secret to use for pulling the revision's image. + OciPullSecretId *string `json:"oci_pull_secret_id,omitempty"` + // OCI reference for the revision. + OciReference string `json:"oci_reference" validate:"regexp=(:[vV]?\\\\d+\\\\.\\\\d+\\\\.\\\\d+(@sha256:[a-fA-F0-9]{64})?)$|((:latest)?@sha256:[a-fA-F0-9]{64})$"` + State *UpdateRevisionPayloadState `json:"state,omitempty"` + // Error message related to this revision. + StateError *string `json:"state_error,omitempty"` + // Time the function was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Variable values for this revision. Each variable must reference a variable definition on the function. + Variables []RevisionVariable `json:"variables,omitempty"` + // The version number of the revision. + Version *int64 `json:"version,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateRevisionPayload UpdateRevisionPayload + +// NewUpdateRevisionPayload instantiates a new UpdateRevisionPayload 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 NewUpdateRevisionPayload(limits ResourceLimits, ociReference string) *UpdateRevisionPayload { + this := UpdateRevisionPayload{} + this.Limits = limits + this.OciReference = ociReference + return &this +} + +// NewUpdateRevisionPayloadWithDefaults instantiates a new UpdateRevisionPayload 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 NewUpdateRevisionPayloadWithDefaults() *UpdateRevisionPayload { + this := UpdateRevisionPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetCreatedAt() time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UpdateRevisionPayload) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDigest returns the Digest field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetDigest() string { + if o == nil || IsNil(o.Digest) { + var ret string + return ret + } + return *o.Digest +} + +// GetDigestOk returns a tuple with the Digest field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetDigestOk() (*string, bool) { + if o == nil || IsNil(o.Digest) { + return nil, false + } + return o.Digest, true +} + +// HasDigest returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasDigest() bool { + if o != nil && !IsNil(o.Digest) { + return true + } + + return false +} + +// SetDigest gets a reference to the given string and assigns it to the Digest field. +func (o *UpdateRevisionPayload) SetDigest(v string) { + o.Digest = &v +} + +// GetFunctionId returns the FunctionId field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetFunctionId() string { + if o == nil || IsNil(o.FunctionId) { + var ret string + return ret + } + return *o.FunctionId +} + +// GetFunctionIdOk returns a tuple with the FunctionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetFunctionIdOk() (*string, bool) { + if o == nil || IsNil(o.FunctionId) { + return nil, false + } + return o.FunctionId, true +} + +// HasFunctionId returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasFunctionId() bool { + if o != nil && !IsNil(o.FunctionId) { + return true + } + + return false +} + +// SetFunctionId gets a reference to the given string and assigns it to the FunctionId field. +func (o *UpdateRevisionPayload) SetFunctionId(v string) { + o.FunctionId = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateRevisionPayload) SetId(v string) { + o.Id = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) 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 *UpdateRevisionPayload) 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 *UpdateRevisionPayload) 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 *UpdateRevisionPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetLimits returns the Limits field value +func (o *UpdateRevisionPayload) GetLimits() ResourceLimits { + if o == nil { + var ret ResourceLimits + return ret + } + + return o.Limits +} + +// GetLimitsOk returns a tuple with the Limits field value +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetLimitsOk() (*ResourceLimits, bool) { + if o == nil { + return nil, false + } + return &o.Limits, true +} + +// SetLimits sets field value +func (o *UpdateRevisionPayload) SetLimits(v ResourceLimits) { + o.Limits = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *UpdateRevisionPayload) SetMessage(v string) { + o.Message = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) 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 *UpdateRevisionPayload) 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 *UpdateRevisionPayload) 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 *UpdateRevisionPayload) SetName(v string) { + o.Name = &v +} + +// GetOciPullSecretId returns the OciPullSecretId field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetOciPullSecretId() string { + if o == nil || IsNil(o.OciPullSecretId) { + var ret string + return ret + } + return *o.OciPullSecretId +} + +// GetOciPullSecretIdOk returns a tuple with the OciPullSecretId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetOciPullSecretIdOk() (*string, bool) { + if o == nil || IsNil(o.OciPullSecretId) { + return nil, false + } + return o.OciPullSecretId, true +} + +// HasOciPullSecretId returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasOciPullSecretId() bool { + if o != nil && !IsNil(o.OciPullSecretId) { + return true + } + + return false +} + +// SetOciPullSecretId gets a reference to the given string and assigns it to the OciPullSecretId field. +func (o *UpdateRevisionPayload) SetOciPullSecretId(v string) { + o.OciPullSecretId = &v +} + +// GetOciReference returns the OciReference field value +func (o *UpdateRevisionPayload) GetOciReference() string { + if o == nil { + var ret string + return ret + } + + return o.OciReference +} + +// GetOciReferenceOk returns a tuple with the OciReference field value +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetOciReferenceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OciReference, true +} + +// SetOciReference sets field value +func (o *UpdateRevisionPayload) SetOciReference(v string) { + o.OciReference = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetState() UpdateRevisionPayloadState { + if o == nil || IsNil(o.State) { + var ret UpdateRevisionPayloadState + 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 *UpdateRevisionPayload) GetStateOk() (*UpdateRevisionPayloadState, 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 *UpdateRevisionPayload) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given UpdateRevisionPayloadState and assigns it to the State field. +func (o *UpdateRevisionPayload) SetState(v UpdateRevisionPayloadState) { + o.State = &v +} + +// GetStateError returns the StateError field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetStateError() string { + if o == nil || IsNil(o.StateError) { + var ret string + return ret + } + return *o.StateError +} + +// GetStateErrorOk returns a tuple with the StateError field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetStateErrorOk() (*string, bool) { + if o == nil || IsNil(o.StateError) { + return nil, false + } + return o.StateError, true +} + +// HasStateError returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasStateError() bool { + if o != nil && !IsNil(o.StateError) { + return true + } + + return false +} + +// SetStateError gets a reference to the given string and assigns it to the StateError field. +func (o *UpdateRevisionPayload) SetStateError(v string) { + o.StateError = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetUpdatedAt() time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *UpdateRevisionPayload) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetVariables() []RevisionVariable { + if o == nil || IsNil(o.Variables) { + var ret []RevisionVariable + return ret + } + return o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetVariablesOk() ([]RevisionVariable, bool) { + if o == nil || IsNil(o.Variables) { + return nil, false + } + return o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasVariables() bool { + if o != nil && !IsNil(o.Variables) { + return true + } + + return false +} + +// SetVariables gets a reference to the given []RevisionVariable and assigns it to the Variables field. +func (o *UpdateRevisionPayload) SetVariables(v []RevisionVariable) { + o.Variables = v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *UpdateRevisionPayload) GetVersion() int64 { + if o == nil || IsNil(o.Version) { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRevisionPayload) GetVersionOk() (*int64, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *UpdateRevisionPayload) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *UpdateRevisionPayload) SetVersion(v int64) { + o.Version = &v +} + +func (o UpdateRevisionPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateRevisionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["created_at"] = o.CreatedAt + } + if !IsNil(o.Digest) { + toSerialize["digest"] = o.Digest + } + if !IsNil(o.FunctionId) { + toSerialize["function_id"] = o.FunctionId + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["limits"] = o.Limits + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OciPullSecretId) { + toSerialize["oci_pull_secret_id"] = o.OciPullSecretId + } + toSerialize["oci_reference"] = o.OciReference + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.StateError) { + toSerialize["state_error"] = o.StateError + } + if !IsNil(o.UpdatedAt) { + toSerialize["updated_at"] = o.UpdatedAt + } + if !IsNil(o.Variables) { + toSerialize["variables"] = o.Variables + } + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateRevisionPayload) 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{ + "limits", + "oci_reference", + } + + 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) + } + } + + varUpdateRevisionPayload := _UpdateRevisionPayload{} + + err = json.Unmarshal(data, &varUpdateRevisionPayload) + + if err != nil { + return err + } + + *o = UpdateRevisionPayload(varUpdateRevisionPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "created_at") + delete(additionalProperties, "digest") + delete(additionalProperties, "function_id") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "limits") + delete(additionalProperties, "message") + delete(additionalProperties, "name") + delete(additionalProperties, "oci_pull_secret_id") + delete(additionalProperties, "oci_reference") + delete(additionalProperties, "state") + delete(additionalProperties, "state_error") + delete(additionalProperties, "updated_at") + delete(additionalProperties, "variables") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateRevisionPayload struct { + value *UpdateRevisionPayload + isSet bool +} + +func (v NullableUpdateRevisionPayload) Get() *UpdateRevisionPayload { + return v.value +} + +func (v *NullableUpdateRevisionPayload) Set(val *UpdateRevisionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRevisionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRevisionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRevisionPayload(val *UpdateRevisionPayload) *NullableUpdateRevisionPayload { + return &NullableUpdateRevisionPayload{value: val, isSet: true} +} + +func (v NullableUpdateRevisionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRevisionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/model_update_revision_payload_state.go b/services/functions/v1alphaapi/model_update_revision_payload_state.go new file mode 100644 index 000000000..d3ebea7a8 --- /dev/null +++ b/services/functions/v1alphaapi/model_update_revision_payload_state.go @@ -0,0 +1,117 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// UpdateRevisionPayloadState Status of this revision. +type UpdateRevisionPayloadState string + +// List of UpdateRevisionPayload_state +const ( + UPDATEREVISIONPAYLOADSTATE_CANCELLED UpdateRevisionPayloadState = "CANCELLED" + UPDATEREVISIONPAYLOADSTATE_CREATING UpdateRevisionPayloadState = "CREATING" + UPDATEREVISIONPAYLOADSTATE_ACTIVE UpdateRevisionPayloadState = "ACTIVE" + UPDATEREVISIONPAYLOADSTATE_FAILED UpdateRevisionPayloadState = "FAILED" + UPDATEREVISIONPAYLOADSTATE_UNKNOWN_DEFAULT_OPEN_API UpdateRevisionPayloadState = "unknown_default_open_api" +) + +// All allowed values of UpdateRevisionPayloadState enum +var AllowedUpdateRevisionPayloadStateEnumValues = []UpdateRevisionPayloadState{ + "CANCELLED", + "CREATING", + "ACTIVE", + "FAILED", + "unknown_default_open_api", +} + +func (v *UpdateRevisionPayloadState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := UpdateRevisionPayloadState(value) + for _, existing := range AllowedUpdateRevisionPayloadStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = UPDATEREVISIONPAYLOADSTATE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewUpdateRevisionPayloadStateFromValue returns a pointer to a valid UpdateRevisionPayloadState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateRevisionPayloadStateFromValue(v string) (*UpdateRevisionPayloadState, error) { + ev := UpdateRevisionPayloadState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateRevisionPayloadState: valid values are %v", v, AllowedUpdateRevisionPayloadStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateRevisionPayloadState) IsValid() bool { + for _, existing := range AllowedUpdateRevisionPayloadStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UpdateRevisionPayload_state value +func (v UpdateRevisionPayloadState) Ptr() *UpdateRevisionPayloadState { + return &v +} + +type NullableUpdateRevisionPayloadState struct { + value *UpdateRevisionPayloadState + isSet bool +} + +func (v NullableUpdateRevisionPayloadState) Get() *UpdateRevisionPayloadState { + return v.value +} + +func (v *NullableUpdateRevisionPayloadState) Set(val *UpdateRevisionPayloadState) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRevisionPayloadState) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRevisionPayloadState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRevisionPayloadState(val *UpdateRevisionPayloadState) *NullableUpdateRevisionPayloadState { + return &NullableUpdateRevisionPayloadState{value: val, isSet: true} +} + +func (v NullableUpdateRevisionPayloadState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRevisionPayloadState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/functions/v1alphaapi/response.go b/services/functions/v1alphaapi/response.go new file mode 100644 index 000000000..ffa5c727e --- /dev/null +++ b/services/functions/v1alphaapi/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +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/functions/v1alphaapi/utils.go b/services/functions/v1alphaapi/utils.go new file mode 100644 index 000000000..364bea7f0 --- /dev/null +++ b/services/functions/v1alphaapi/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Functions Core API + +This API provides endpoints for managing STACKIT Functions. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +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...) +}