diff --git a/go.work b/go.work index 7c0013e6d..ce3ce9b56 100644 --- a/go.work +++ b/go.work @@ -72,6 +72,7 @@ use ( ./services/redis ./services/resourcemanager ./services/runcommand + ./services/sca ./services/scf ./services/secretsmanager ./services/serverbackup diff --git a/services/sca/LICENSE.md b/services/sca/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/sca/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/sca/go.mod b/services/sca/go.mod new file mode 100644 index 000000000..4208eebb7 --- /dev/null +++ b/services/sca/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/sca + +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/sca/go.sum b/services/sca/go.sum new file mode 100644 index 000000000..3712a0c87 --- /dev/null +++ b/services/sca/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/sca/oas_commit b/services/sca/oas_commit new file mode 100644 index 000000000..7432e1eed --- /dev/null +++ b/services/sca/oas_commit @@ -0,0 +1 @@ +d7306ee5d2400a8571c390a29df8ffd02428182f diff --git a/services/sca/package.go b/services/sca/package.go new file mode 100644 index 000000000..3c1e87a25 --- /dev/null +++ b/services/sca/package.go @@ -0,0 +1 @@ +package sca diff --git a/services/sca/v1alphaapi/api_default.go b/services/sca/v1alphaapi/api_default.go new file mode 100644 index 000000000..842baf2cb --- /dev/null +++ b/services/sca/v1alphaapi/api_default.go @@ -0,0 +1,1441 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// 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 { + + /* + CreateApplication Creates a new application within a environment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to create the application in. + @param environmentId environment to create the application in. + @return ApiCreateApplicationRequest + */ + CreateApplication(ctx context.Context, projectId string, environmentId string) ApiCreateApplicationRequest + + // CreateApplicationExecute executes the request + // @return Application + CreateApplicationExecute(r ApiCreateApplicationRequest) (*Application, error) + + /* + DeleteApplication Deletes an application by resource name. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to delete the application in. + @param environmentId environment to delete the application in. + @param applicationId Application id to delete. + @return ApiDeleteApplicationRequest + */ + DeleteApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiDeleteApplicationRequest + + // DeleteApplicationExecute executes the request + // @return Application + DeleteApplicationExecute(r ApiDeleteApplicationRequest) (*Application, error) + + /* + GetApplication Retrieves a application by resource name. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to fetch the application from. + @param environmentId environment to fetch the application from. + @param applicationId Application id to fetch. + @return ApiGetApplicationRequest + */ + GetApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationRequest + + // GetApplicationExecute executes the request + // @return Application + GetApplicationExecute(r ApiGetApplicationRequest) (*Application, error) + + /* + GetApplicationEvents GetApplicationEvents retrieves events of an application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to fetch the application from. + @param environmentId Environment to fetch the application from. + @param applicationId Application id to fetch. + @return ApiGetApplicationEventsRequest + */ + GetApplicationEvents(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationEventsRequest + + // GetApplicationEventsExecute executes the request + // @return GetApplicationEventsResponse + GetApplicationEventsExecute(r ApiGetApplicationEventsRequest) (*GetApplicationEventsResponse, error) + + /* + GetApplicationLogs GetApplicationLogs retrieves logs of an application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to fetch the application from. + @param environmentId Environment to fetch the application from. + @param applicationId Application id to fetch. + @return ApiGetApplicationLogsRequest + */ + GetApplicationLogs(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationLogsRequest + + // GetApplicationLogsExecute executes the request + // @return GetApplicationLogsResponse + GetApplicationLogsExecute(r ApiGetApplicationLogsRequest) (*GetApplicationLogsResponse, error) + + /* + GetOverview Get overview of the environment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Parent project resource name to list under. + @return ApiGetOverviewRequest + */ + GetOverview(ctx context.Context, projectId string) ApiGetOverviewRequest + + // GetOverviewExecute executes the request + // @return GetOverviewResponse + GetOverviewExecute(r ApiGetOverviewRequest) (*GetOverviewResponse, error) + + /* + ListApplications Lists applications within a environment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to list the applications in. + @param environmentId environment to list the applications in. + @return ApiListApplicationsRequest + */ + ListApplications(ctx context.Context, projectId string, environmentId string) ApiListApplicationsRequest + + // ListApplicationsExecute executes the request + // @return ListApplicationsResponse + ListApplicationsExecute(r ApiListApplicationsRequest) (*ListApplicationsResponse, error) + + /* + UpdateApplication Updates an existing application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to update the application in. + @param environmentId environment to update the application in. + @param applicationId Application id to update. + @return ApiUpdateApplicationRequest + */ + UpdateApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiUpdateApplicationRequest + + // UpdateApplicationExecute executes the request + // @return Application + UpdateApplicationExecute(r ApiUpdateApplicationRequest) (*Application, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateApplicationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + environmentId string + createApplicationPayload *CreateApplicationPayload +} + +// Application to create. +func (r ApiCreateApplicationRequest) CreateApplicationPayload(createApplicationPayload CreateApplicationPayload) ApiCreateApplicationRequest { + r.createApplicationPayload = &createApplicationPayload + return r +} + +func (r ApiCreateApplicationRequest) Execute() (*Application, error) { + return r.ApiService.CreateApplicationExecute(r) +} + +/* +CreateApplication Creates a new application within a environment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to create the application in. + @param environmentId environment to create the application in. + @return ApiCreateApplicationRequest +*/ +func (a *DefaultAPIService) CreateApplication(ctx context.Context, projectId string, environmentId string) ApiCreateApplicationRequest { + return ApiCreateApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + } +} + +// Execute executes the request +// +// @return Application +func (a *DefaultAPIService) CreateApplicationExecute(r ApiCreateApplicationRequest) (*Application, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Application + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateApplication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/environments/{environmentId}/applications" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createApplicationPayload == nil { + return localVarReturnValue, reportError("createApplicationPayload 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.createApplicationPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiDeleteApplicationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + environmentId string + applicationId string +} + +func (r ApiDeleteApplicationRequest) Execute() (*Application, error) { + return r.ApiService.DeleteApplicationExecute(r) +} + +/* +DeleteApplication Deletes an application by resource name. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to delete the application in. + @param environmentId environment to delete the application in. + @param applicationId Application id to delete. + @return ApiDeleteApplicationRequest +*/ +func (a *DefaultAPIService) DeleteApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiDeleteApplicationRequest { + return ApiDeleteApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// Execute executes the request +// +// @return Application +func (a *DefaultAPIService) DeleteApplicationExecute(r ApiDeleteApplicationRequest) (*Application, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Application + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteApplication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/environments/{environmentId}/applications/{applicationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationId"+"}", url.PathEscape(parameterValueToString(r.applicationId, "applicationId")), -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 ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetApplicationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + environmentId string + applicationId string +} + +func (r ApiGetApplicationRequest) Execute() (*Application, error) { + return r.ApiService.GetApplicationExecute(r) +} + +/* +GetApplication Retrieves a application by resource name. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to fetch the application from. + @param environmentId environment to fetch the application from. + @param applicationId Application id to fetch. + @return ApiGetApplicationRequest +*/ +func (a *DefaultAPIService) GetApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationRequest { + return ApiGetApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// Execute executes the request +// +// @return Application +func (a *DefaultAPIService) GetApplicationExecute(r ApiGetApplicationRequest) (*Application, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Application + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetApplication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/environments/{environmentId}/applications/{applicationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationId"+"}", url.PathEscape(parameterValueToString(r.applicationId, "applicationId")), -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 ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetApplicationEventsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + environmentId string + applicationId string +} + +func (r ApiGetApplicationEventsRequest) Execute() (*GetApplicationEventsResponse, error) { + return r.ApiService.GetApplicationEventsExecute(r) +} + +/* +GetApplicationEvents GetApplicationEvents retrieves events of an application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to fetch the application from. + @param environmentId Environment to fetch the application from. + @param applicationId Application id to fetch. + @return ApiGetApplicationEventsRequest +*/ +func (a *DefaultAPIService) GetApplicationEvents(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationEventsRequest { + return ApiGetApplicationEventsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// Execute executes the request +// +// @return GetApplicationEventsResponse +func (a *DefaultAPIService) GetApplicationEventsExecute(r ApiGetApplicationEventsRequest) (*GetApplicationEventsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetApplicationEventsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetApplicationEvents") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/environments/{environmentId}/applications/{applicationId}/events" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationId"+"}", url.PathEscape(parameterValueToString(r.applicationId, "applicationId")), -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 ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetApplicationLogsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + environmentId string + applicationId string + instance *string + container *string + previous *bool +} + +// Instance name of the application. +func (r ApiGetApplicationLogsRequest) Instance(instance string) ApiGetApplicationLogsRequest { + r.instance = &instance + return r +} + +// Container name to collect logs. +func (r ApiGetApplicationLogsRequest) Container(container string) ApiGetApplicationLogsRequest { + r.container = &container + return r +} + +// Get previous failed execution of the container. +func (r ApiGetApplicationLogsRequest) Previous(previous bool) ApiGetApplicationLogsRequest { + r.previous = &previous + return r +} + +func (r ApiGetApplicationLogsRequest) Execute() (*GetApplicationLogsResponse, error) { + return r.ApiService.GetApplicationLogsExecute(r) +} + +/* +GetApplicationLogs GetApplicationLogs retrieves logs of an application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to fetch the application from. + @param environmentId Environment to fetch the application from. + @param applicationId Application id to fetch. + @return ApiGetApplicationLogsRequest +*/ +func (a *DefaultAPIService) GetApplicationLogs(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationLogsRequest { + return ApiGetApplicationLogsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// Execute executes the request +// +// @return GetApplicationLogsResponse +func (a *DefaultAPIService) GetApplicationLogsExecute(r ApiGetApplicationLogsRequest) (*GetApplicationLogsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetApplicationLogsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetApplicationLogs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/environments/{environmentId}/applications/{applicationId}/logs" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationId"+"}", url.PathEscape(parameterValueToString(r.applicationId, "applicationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.instance == nil { + return localVarReturnValue, reportError("instance is required and must be specified") + } + if r.container == nil { + return localVarReturnValue, reportError("container is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "instance", r.instance, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "container", r.container, "form", "") + if r.previous != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "previous", r.previous, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetOverviewRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string +} + +func (r ApiGetOverviewRequest) Execute() (*GetOverviewResponse, error) { + return r.ApiService.GetOverviewExecute(r) +} + +/* +GetOverview Get overview of the environment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Parent project resource name to list under. + @return ApiGetOverviewRequest +*/ +func (a *DefaultAPIService) GetOverview(ctx context.Context, projectId string) ApiGetOverviewRequest { + return ApiGetOverviewRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// Execute executes the request +// +// @return GetOverviewResponse +func (a *DefaultAPIService) GetOverviewExecute(r ApiGetOverviewRequest) (*GetOverviewResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetOverviewResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetOverview") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/overview" + 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 ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListApplicationsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + environmentId string +} + +func (r ApiListApplicationsRequest) Execute() (*ListApplicationsResponse, error) { + return r.ApiService.ListApplicationsExecute(r) +} + +/* +ListApplications Lists applications within a environment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to list the applications in. + @param environmentId environment to list the applications in. + @return ApiListApplicationsRequest +*/ +func (a *DefaultAPIService) ListApplications(ctx context.Context, projectId string, environmentId string) ApiListApplicationsRequest { + return ApiListApplicationsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + } +} + +// Execute executes the request +// +// @return ListApplicationsResponse +func (a *DefaultAPIService) ListApplicationsExecute(r ApiListApplicationsRequest) (*ListApplicationsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListApplicationsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListApplications") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/environments/{environmentId}/applications" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiUpdateApplicationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + environmentId string + applicationId string + updateApplicationPayload *UpdateApplicationPayload +} + +// Application to update. +func (r ApiUpdateApplicationRequest) UpdateApplicationPayload(updateApplicationPayload UpdateApplicationPayload) ApiUpdateApplicationRequest { + r.updateApplicationPayload = &updateApplicationPayload + return r +} + +func (r ApiUpdateApplicationRequest) Execute() (*Application, error) { + return r.ApiService.UpdateApplicationExecute(r) +} + +/* +UpdateApplication Updates an existing application. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project to update the application in. + @param environmentId environment to update the application in. + @param applicationId Application id to update. + @return ApiUpdateApplicationRequest +*/ +func (a *DefaultAPIService) UpdateApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiUpdateApplicationRequest { + return ApiUpdateApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// Execute executes the request +// +// @return Application +func (a *DefaultAPIService) UpdateApplicationExecute(r ApiUpdateApplicationRequest) (*Application, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Application + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateApplication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/environments/{environmentId}/applications/{applicationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"environmentId"+"}", url.PathEscape(parameterValueToString(r.environmentId, "environmentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationId"+"}", url.PathEscape(parameterValueToString(r.applicationId, "applicationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateApplicationPayload == nil { + return localVarReturnValue, reportError("updateApplicationPayload 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.updateApplicationPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ApiErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} diff --git a/services/sca/v1alphaapi/api_default_mock.go b/services/sca/v1alphaapi/api_default_mock.go new file mode 100644 index 000000000..6a7451104 --- /dev/null +++ b/services/sca/v1alphaapi/api_default_mock.go @@ -0,0 +1,195 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// 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 { + // CreateApplicationExecuteMock can be populated to implement the behavior of the CreateApplicationExecute function of this mock + CreateApplicationExecuteMock *func(r ApiCreateApplicationRequest) (*Application, error) + // DeleteApplicationExecuteMock can be populated to implement the behavior of the DeleteApplicationExecute function of this mock + DeleteApplicationExecuteMock *func(r ApiDeleteApplicationRequest) (*Application, error) + // GetApplicationExecuteMock can be populated to implement the behavior of the GetApplicationExecute function of this mock + GetApplicationExecuteMock *func(r ApiGetApplicationRequest) (*Application, error) + // GetApplicationEventsExecuteMock can be populated to implement the behavior of the GetApplicationEventsExecute function of this mock + GetApplicationEventsExecuteMock *func(r ApiGetApplicationEventsRequest) (*GetApplicationEventsResponse, error) + // GetApplicationLogsExecuteMock can be populated to implement the behavior of the GetApplicationLogsExecute function of this mock + GetApplicationLogsExecuteMock *func(r ApiGetApplicationLogsRequest) (*GetApplicationLogsResponse, error) + // GetOverviewExecuteMock can be populated to implement the behavior of the GetOverviewExecute function of this mock + GetOverviewExecuteMock *func(r ApiGetOverviewRequest) (*GetOverviewResponse, error) + // ListApplicationsExecuteMock can be populated to implement the behavior of the ListApplicationsExecute function of this mock + ListApplicationsExecuteMock *func(r ApiListApplicationsRequest) (*ListApplicationsResponse, error) + // UpdateApplicationExecuteMock can be populated to implement the behavior of the UpdateApplicationExecute function of this mock + UpdateApplicationExecuteMock *func(r ApiUpdateApplicationRequest) (*Application, error) +} + +func (a DefaultAPIServiceMock) CreateApplication(ctx context.Context, projectId string, environmentId string) ApiCreateApplicationRequest { + return ApiCreateApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + } +} + +// CreateApplicationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateApplicationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateApplicationExecute(r ApiCreateApplicationRequest) (*Application, error) { + if a.CreateApplicationExecuteMock == nil { + var localVarReturnValue *Application + return localVarReturnValue, nil + } + + return (*a.CreateApplicationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiDeleteApplicationRequest { + return ApiDeleteApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// DeleteApplicationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteApplicationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteApplicationExecute(r ApiDeleteApplicationRequest) (*Application, error) { + if a.DeleteApplicationExecuteMock == nil { + var localVarReturnValue *Application + return localVarReturnValue, nil + } + + return (*a.DeleteApplicationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationRequest { + return ApiGetApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// GetApplicationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetApplicationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetApplicationExecute(r ApiGetApplicationRequest) (*Application, error) { + if a.GetApplicationExecuteMock == nil { + var localVarReturnValue *Application + return localVarReturnValue, nil + } + + return (*a.GetApplicationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetApplicationEvents(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationEventsRequest { + return ApiGetApplicationEventsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// GetApplicationEventsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetApplicationEventsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetApplicationEventsExecute(r ApiGetApplicationEventsRequest) (*GetApplicationEventsResponse, error) { + if a.GetApplicationEventsExecuteMock == nil { + var localVarReturnValue *GetApplicationEventsResponse + return localVarReturnValue, nil + } + + return (*a.GetApplicationEventsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetApplicationLogs(ctx context.Context, projectId string, environmentId string, applicationId string) ApiGetApplicationLogsRequest { + return ApiGetApplicationLogsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// GetApplicationLogsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetApplicationLogsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetApplicationLogsExecute(r ApiGetApplicationLogsRequest) (*GetApplicationLogsResponse, error) { + if a.GetApplicationLogsExecuteMock == nil { + var localVarReturnValue *GetApplicationLogsResponse + return localVarReturnValue, nil + } + + return (*a.GetApplicationLogsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetOverview(ctx context.Context, projectId string) ApiGetOverviewRequest { + return ApiGetOverviewRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + } +} + +// GetOverviewExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetOverviewExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetOverviewExecute(r ApiGetOverviewRequest) (*GetOverviewResponse, error) { + if a.GetOverviewExecuteMock == nil { + var localVarReturnValue *GetOverviewResponse + return localVarReturnValue, nil + } + + return (*a.GetOverviewExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListApplications(ctx context.Context, projectId string, environmentId string) ApiListApplicationsRequest { + return ApiListApplicationsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + } +} + +// ListApplicationsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListApplicationsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListApplicationsExecute(r ApiListApplicationsRequest) (*ListApplicationsResponse, error) { + if a.ListApplicationsExecuteMock == nil { + var localVarReturnValue *ListApplicationsResponse + return localVarReturnValue, nil + } + + return (*a.ListApplicationsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateApplication(ctx context.Context, projectId string, environmentId string, applicationId string) ApiUpdateApplicationRequest { + return ApiUpdateApplicationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + environmentId: environmentId, + applicationId: applicationId, + } +} + +// UpdateApplicationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateApplicationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateApplicationExecute(r ApiUpdateApplicationRequest) (*Application, error) { + if a.UpdateApplicationExecuteMock == nil { + var localVarReturnValue *Application + return localVarReturnValue, nil + } + + return (*a.UpdateApplicationExecuteMock)(r) +} diff --git a/services/sca/v1alphaapi/client.go b/services/sca/v1alphaapi/client.go new file mode 100644 index 000000000..8e71d426a --- /dev/null +++ b/services/sca/v1alphaapi/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// 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 Container Applications (SCA) API v1alpha.0.0 +// 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/sca/v1alphaapi/configuration.go b/services/sca/v1alphaapi/configuration.go new file mode 100644 index 000000000..0bf550ecf --- /dev/null +++ b/services/sca/v1alphaapi/configuration.go @@ -0,0 +1,40 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// 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/sca", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://sca.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/sca/v1alphaapi/model_api_error_response.go b/services/sca/v1alphaapi/model_api_error_response.go new file mode 100644 index 000000000..5c774429f --- /dev/null +++ b/services/sca/v1alphaapi/model_api_error_response.go @@ -0,0 +1,192 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ApiErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApiErrorResponse{} + +// ApiErrorResponse ApiErrorResponse represents a standard error response from the API. +type ApiErrorResponse struct { + // The HTTP status code or internal error code. + Code *int32 `json:"code,omitempty"` + // A human-readable error message. + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ApiErrorResponse ApiErrorResponse + +// NewApiErrorResponse instantiates a new ApiErrorResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiErrorResponse() *ApiErrorResponse { + this := ApiErrorResponse{} + return &this +} + +// NewApiErrorResponseWithDefaults instantiates a new ApiErrorResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiErrorResponseWithDefaults() *ApiErrorResponse { + this := ApiErrorResponse{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *ApiErrorResponse) 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 *ApiErrorResponse) 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 *ApiErrorResponse) 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 *ApiErrorResponse) SetCode(v int32) { + o.Code = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ApiErrorResponse) 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 *ApiErrorResponse) 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 *ApiErrorResponse) 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 *ApiErrorResponse) SetMessage(v string) { + o.Message = &v +} + +func (o ApiErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApiErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ApiErrorResponse) UnmarshalJSON(data []byte) (err error) { + varApiErrorResponse := _ApiErrorResponse{} + + err = json.Unmarshal(data, &varApiErrorResponse) + + if err != nil { + return err + } + + *o = ApiErrorResponse(varApiErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableApiErrorResponse struct { + value *ApiErrorResponse + isSet bool +} + +func (v NullableApiErrorResponse) Get() *ApiErrorResponse { + return v.value +} + +func (v *NullableApiErrorResponse) Set(val *ApiErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableApiErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableApiErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiErrorResponse(val *ApiErrorResponse) *NullableApiErrorResponse { + return &NullableApiErrorResponse{value: val, isSet: true} +} + +func (v NullableApiErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_application.go b/services/sca/v1alphaapi/model_application.go new file mode 100644 index 000000000..70f862e5f --- /dev/null +++ b/services/sca/v1alphaapi/model_application.go @@ -0,0 +1,405 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Application type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Application{} + +// Application Application describes a deployable multi-container workload instance. +type Application struct { + // Containers to deploy for the application. + Containers []Container `json:"containers"` + // Human-readable display name. + DisplayName string `json:"displayName"` + // Application identifier, for example: 00000000-0000-0000-0000-000000000000. + Id *string `json:"id,omitempty"` + Network Network `json:"network"` + Registry *ApplicationRegistry `json:"registry,omitempty"` + RuntimeStatus *RuntimeStatus `json:"runtimeStatus,omitempty"` + Scaling Scaling `json:"scaling"` + // Secrets associated with the application. + Secrets []ApplicationSecret `json:"secrets,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Application Application + +// NewApplication instantiates a new Application 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 NewApplication(containers []Container, displayName string, network Network, scaling Scaling) *Application { + this := Application{} + this.Containers = containers + this.DisplayName = displayName + this.Network = network + this.Scaling = scaling + return &this +} + +// NewApplicationWithDefaults instantiates a new Application 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 NewApplicationWithDefaults() *Application { + this := Application{} + return &this +} + +// GetContainers returns the Containers field value +func (o *Application) GetContainers() []Container { + if o == nil { + var ret []Container + return ret + } + + return o.Containers +} + +// GetContainersOk returns a tuple with the Containers field value +// and a boolean to check if the value has been set. +func (o *Application) GetContainersOk() ([]Container, bool) { + if o == nil { + return nil, false + } + return o.Containers, true +} + +// SetContainers sets field value +func (o *Application) SetContainers(v []Container) { + o.Containers = v +} + +// GetDisplayName returns the DisplayName field value +func (o *Application) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *Application) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *Application) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Application) 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 *Application) 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 *Application) 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 *Application) SetId(v string) { + o.Id = &v +} + +// GetNetwork returns the Network field value +func (o *Application) GetNetwork() Network { + if o == nil { + var ret Network + return ret + } + + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *Application) GetNetworkOk() (*Network, bool) { + if o == nil { + return nil, false + } + return &o.Network, true +} + +// SetNetwork sets field value +func (o *Application) SetNetwork(v Network) { + o.Network = v +} + +// GetRegistry returns the Registry field value if set, zero value otherwise. +func (o *Application) GetRegistry() ApplicationRegistry { + if o == nil || IsNil(o.Registry) { + var ret ApplicationRegistry + return ret + } + return *o.Registry +} + +// GetRegistryOk returns a tuple with the Registry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Application) GetRegistryOk() (*ApplicationRegistry, bool) { + if o == nil || IsNil(o.Registry) { + return nil, false + } + return o.Registry, true +} + +// HasRegistry returns a boolean if a field has been set. +func (o *Application) HasRegistry() bool { + if o != nil && !IsNil(o.Registry) { + return true + } + + return false +} + +// SetRegistry gets a reference to the given ApplicationRegistry and assigns it to the Registry field. +func (o *Application) SetRegistry(v ApplicationRegistry) { + o.Registry = &v +} + +// GetRuntimeStatus returns the RuntimeStatus field value if set, zero value otherwise. +func (o *Application) GetRuntimeStatus() RuntimeStatus { + if o == nil || IsNil(o.RuntimeStatus) { + var ret RuntimeStatus + return ret + } + return *o.RuntimeStatus +} + +// GetRuntimeStatusOk returns a tuple with the RuntimeStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Application) GetRuntimeStatusOk() (*RuntimeStatus, bool) { + if o == nil || IsNil(o.RuntimeStatus) { + return nil, false + } + return o.RuntimeStatus, true +} + +// HasRuntimeStatus returns a boolean if a field has been set. +func (o *Application) HasRuntimeStatus() bool { + if o != nil && !IsNil(o.RuntimeStatus) { + return true + } + + return false +} + +// SetRuntimeStatus gets a reference to the given RuntimeStatus and assigns it to the RuntimeStatus field. +func (o *Application) SetRuntimeStatus(v RuntimeStatus) { + o.RuntimeStatus = &v +} + +// GetScaling returns the Scaling field value +func (o *Application) GetScaling() Scaling { + if o == nil { + var ret Scaling + return ret + } + + return o.Scaling +} + +// GetScalingOk returns a tuple with the Scaling field value +// and a boolean to check if the value has been set. +func (o *Application) GetScalingOk() (*Scaling, bool) { + if o == nil { + return nil, false + } + return &o.Scaling, true +} + +// SetScaling sets field value +func (o *Application) SetScaling(v Scaling) { + o.Scaling = v +} + +// GetSecrets returns the Secrets field value if set, zero value otherwise. +func (o *Application) GetSecrets() []ApplicationSecret { + if o == nil || IsNil(o.Secrets) { + var ret []ApplicationSecret + return ret + } + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Application) GetSecretsOk() ([]ApplicationSecret, bool) { + if o == nil || IsNil(o.Secrets) { + return nil, false + } + return o.Secrets, true +} + +// HasSecrets returns a boolean if a field has been set. +func (o *Application) HasSecrets() bool { + if o != nil && !IsNil(o.Secrets) { + return true + } + + return false +} + +// SetSecrets gets a reference to the given []ApplicationSecret and assigns it to the Secrets field. +func (o *Application) SetSecrets(v []ApplicationSecret) { + o.Secrets = v +} + +func (o Application) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Application) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["containers"] = o.Containers + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + toSerialize["network"] = o.Network + if !IsNil(o.Registry) { + toSerialize["registry"] = o.Registry + } + if !IsNil(o.RuntimeStatus) { + toSerialize["runtimeStatus"] = o.RuntimeStatus + } + toSerialize["scaling"] = o.Scaling + if !IsNil(o.Secrets) { + toSerialize["secrets"] = o.Secrets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Application) 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{ + "containers", + "displayName", + "network", + "scaling", + } + + 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) + } + } + + varApplication := _Application{} + + err = json.Unmarshal(data, &varApplication) + + if err != nil { + return err + } + + *o = Application(varApplication) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "containers") + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + delete(additionalProperties, "network") + delete(additionalProperties, "registry") + delete(additionalProperties, "runtimeStatus") + delete(additionalProperties, "scaling") + delete(additionalProperties, "secrets") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableApplication struct { + value *Application + isSet bool +} + +func (v NullableApplication) Get() *Application { + return v.value +} + +func (v *NullableApplication) Set(val *Application) { + v.value = val + v.isSet = true +} + +func (v NullableApplication) IsSet() bool { + return v.isSet +} + +func (v *NullableApplication) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApplication(val *Application) *NullableApplication { + return &NullableApplication{value: val, isSet: true} +} + +func (v NullableApplication) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApplication) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_application_registry.go b/services/sca/v1alphaapi/model_application_registry.go new file mode 100644 index 000000000..8880ab0fe --- /dev/null +++ b/services/sca/v1alphaapi/model_application_registry.go @@ -0,0 +1,233 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ApplicationRegistry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationRegistry{} + +// ApplicationRegistry struct for ApplicationRegistry +type ApplicationRegistry struct { + // Password to authenticate to the registry. Omit or set to null to indicate deletion in updates. + Password *string `json:"password,omitempty"` + Url string `json:"url"` + User string `json:"user"` + AdditionalProperties map[string]interface{} +} + +type _ApplicationRegistry ApplicationRegistry + +// NewApplicationRegistry instantiates a new ApplicationRegistry 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 NewApplicationRegistry(url string, user string) *ApplicationRegistry { + this := ApplicationRegistry{} + this.Url = url + this.User = user + return &this +} + +// NewApplicationRegistryWithDefaults instantiates a new ApplicationRegistry 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 NewApplicationRegistryWithDefaults() *ApplicationRegistry { + this := ApplicationRegistry{} + return &this +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *ApplicationRegistry) GetPassword() string { + if o == nil || IsNil(o.Password) { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationRegistry) GetPasswordOk() (*string, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *ApplicationRegistry) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *ApplicationRegistry) SetPassword(v string) { + o.Password = &v +} + +// GetUrl returns the Url field value +func (o *ApplicationRegistry) GetUrl() string { + if o == nil { + var ret string + return ret + } + + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ApplicationRegistry) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *ApplicationRegistry) SetUrl(v string) { + o.Url = v +} + +// GetUser returns the User field value +func (o *ApplicationRegistry) GetUser() string { + if o == nil { + var ret string + return ret + } + + return o.User +} + +// GetUserOk returns a tuple with the User field value +// and a boolean to check if the value has been set. +func (o *ApplicationRegistry) GetUserOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.User, true +} + +// SetUser sets field value +func (o *ApplicationRegistry) SetUser(v string) { + o.User = v +} + +func (o ApplicationRegistry) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApplicationRegistry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Password) { + toSerialize["password"] = o.Password + } + toSerialize["url"] = o.Url + toSerialize["user"] = o.User + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ApplicationRegistry) 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{ + "url", + "user", + } + + 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) + } + } + + varApplicationRegistry := _ApplicationRegistry{} + + err = json.Unmarshal(data, &varApplicationRegistry) + + if err != nil { + return err + } + + *o = ApplicationRegistry(varApplicationRegistry) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "password") + delete(additionalProperties, "url") + delete(additionalProperties, "user") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableApplicationRegistry struct { + value *ApplicationRegistry + isSet bool +} + +func (v NullableApplicationRegistry) Get() *ApplicationRegistry { + return v.value +} + +func (v *NullableApplicationRegistry) Set(val *ApplicationRegistry) { + v.value = val + v.isSet = true +} + +func (v NullableApplicationRegistry) IsSet() bool { + return v.isSet +} + +func (v *NullableApplicationRegistry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApplicationRegistry(val *ApplicationRegistry) *NullableApplicationRegistry { + return &NullableApplicationRegistry{value: val, isSet: true} +} + +func (v NullableApplicationRegistry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApplicationRegistry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_application_secret.go b/services/sca/v1alphaapi/model_application_secret.go new file mode 100644 index 000000000..316267e3b --- /dev/null +++ b/services/sca/v1alphaapi/model_application_secret.go @@ -0,0 +1,205 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ApplicationSecret type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationSecret{} + +// ApplicationSecret ApplicationSecret defines a single secret key-value pair. +type ApplicationSecret struct { + // Secret key. + Key string `json:"key"` + // Secret value. Omit or set to null to keep the existing value unchanged. + Value *string `json:"value,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ApplicationSecret ApplicationSecret + +// NewApplicationSecret instantiates a new ApplicationSecret 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 NewApplicationSecret(key string) *ApplicationSecret { + this := ApplicationSecret{} + this.Key = key + return &this +} + +// NewApplicationSecretWithDefaults instantiates a new ApplicationSecret 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 NewApplicationSecretWithDefaults() *ApplicationSecret { + this := ApplicationSecret{} + return &this +} + +// GetKey returns the Key field value +func (o *ApplicationSecret) GetKey() string { + if o == nil { + var ret string + return ret + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *ApplicationSecret) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Key, true +} + +// SetKey sets field value +func (o *ApplicationSecret) SetKey(v string) { + o.Key = v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *ApplicationSecret) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationSecret) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *ApplicationSecret) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *ApplicationSecret) SetValue(v string) { + o.Value = &v +} + +func (o ApplicationSecret) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApplicationSecret) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["key"] = o.Key + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ApplicationSecret) 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{ + "key", + } + + 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) + } + } + + varApplicationSecret := _ApplicationSecret{} + + err = json.Unmarshal(data, &varApplicationSecret) + + if err != nil { + return err + } + + *o = ApplicationSecret(varApplicationSecret) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "key") + delete(additionalProperties, "value") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableApplicationSecret struct { + value *ApplicationSecret + isSet bool +} + +func (v NullableApplicationSecret) Get() *ApplicationSecret { + return v.value +} + +func (v *NullableApplicationSecret) Set(val *ApplicationSecret) { + v.value = val + v.isSet = true +} + +func (v NullableApplicationSecret) IsSet() bool { + return v.isSet +} + +func (v *NullableApplicationSecret) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApplicationSecret(val *ApplicationSecret) *NullableApplicationSecret { + return &NullableApplicationSecret{value: val, isSet: true} +} + +func (v NullableApplicationSecret) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApplicationSecret) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_application_summary.go b/services/sca/v1alphaapi/model_application_summary.go new file mode 100644 index 000000000..29d0f807e --- /dev/null +++ b/services/sca/v1alphaapi/model_application_summary.go @@ -0,0 +1,462 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "time" +) + +// checks if the ApplicationSummary type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationSummary{} + +// ApplicationSummary ApplicationSummary describes a summary of an application. +type ApplicationSummary struct { + // Number of containers. + Containers *int32 `json:"containers,omitempty"` + // Creation date in RFC3339 format. + CreatedAt *time.Time `json:"createdAt,omitempty"` + // Application's human-readable name. + DisplayName *string `json:"displayName,omitempty"` + // Environment's human-readable name. + EnvironmentName *string `json:"environmentName,omitempty"` + // Application identifier, for example: 00000000-0000-0000-0000-000000000000. + Id *string `json:"id,omitempty"` + // Application's running instances. + Instances *int32 `json:"instances,omitempty"` + // Date of the last moment the application got the running status in RFC3339 format. + LastDeployment *time.Time `json:"lastDeployment,omitempty"` + Status *CurrentStatus `json:"status,omitempty"` + // Application's published URL. + Url *string `json:"url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ApplicationSummary ApplicationSummary + +// NewApplicationSummary instantiates a new ApplicationSummary 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 NewApplicationSummary() *ApplicationSummary { + this := ApplicationSummary{} + var status CurrentStatus = CURRENTSTATUS_CURRENT_STATUS_UNSPECIFIED + this.Status = &status + return &this +} + +// NewApplicationSummaryWithDefaults instantiates a new ApplicationSummary 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 NewApplicationSummaryWithDefaults() *ApplicationSummary { + this := ApplicationSummary{} + var status CurrentStatus = CURRENTSTATUS_CURRENT_STATUS_UNSPECIFIED + this.Status = &status + return &this +} + +// GetContainers returns the Containers field value if set, zero value otherwise. +func (o *ApplicationSummary) GetContainers() int32 { + if o == nil || IsNil(o.Containers) { + var ret int32 + return ret + } + return *o.Containers +} + +// GetContainersOk returns a tuple with the Containers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationSummary) GetContainersOk() (*int32, bool) { + if o == nil || IsNil(o.Containers) { + return nil, false + } + return o.Containers, true +} + +// HasContainers returns a boolean if a field has been set. +func (o *ApplicationSummary) HasContainers() bool { + if o != nil && !IsNil(o.Containers) { + return true + } + + return false +} + +// SetContainers gets a reference to the given int32 and assigns it to the Containers field. +func (o *ApplicationSummary) SetContainers(v int32) { + o.Containers = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ApplicationSummary) 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 *ApplicationSummary) 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 *ApplicationSummary) 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 *ApplicationSummary) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *ApplicationSummary) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationSummary) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *ApplicationSummary) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *ApplicationSummary) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetEnvironmentName returns the EnvironmentName field value if set, zero value otherwise. +func (o *ApplicationSummary) GetEnvironmentName() string { + if o == nil || IsNil(o.EnvironmentName) { + var ret string + return ret + } + return *o.EnvironmentName +} + +// GetEnvironmentNameOk returns a tuple with the EnvironmentName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationSummary) GetEnvironmentNameOk() (*string, bool) { + if o == nil || IsNil(o.EnvironmentName) { + return nil, false + } + return o.EnvironmentName, true +} + +// HasEnvironmentName returns a boolean if a field has been set. +func (o *ApplicationSummary) HasEnvironmentName() bool { + if o != nil && !IsNil(o.EnvironmentName) { + return true + } + + return false +} + +// SetEnvironmentName gets a reference to the given string and assigns it to the EnvironmentName field. +func (o *ApplicationSummary) SetEnvironmentName(v string) { + o.EnvironmentName = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ApplicationSummary) 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 *ApplicationSummary) 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 *ApplicationSummary) 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 *ApplicationSummary) SetId(v string) { + o.Id = &v +} + +// GetInstances returns the Instances field value if set, zero value otherwise. +func (o *ApplicationSummary) GetInstances() int32 { + if o == nil || IsNil(o.Instances) { + var ret int32 + return ret + } + return *o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationSummary) GetInstancesOk() (*int32, bool) { + if o == nil || IsNil(o.Instances) { + return nil, false + } + return o.Instances, true +} + +// HasInstances returns a boolean if a field has been set. +func (o *ApplicationSummary) HasInstances() bool { + if o != nil && !IsNil(o.Instances) { + return true + } + + return false +} + +// SetInstances gets a reference to the given int32 and assigns it to the Instances field. +func (o *ApplicationSummary) SetInstances(v int32) { + o.Instances = &v +} + +// GetLastDeployment returns the LastDeployment field value if set, zero value otherwise. +func (o *ApplicationSummary) GetLastDeployment() time.Time { + if o == nil || IsNil(o.LastDeployment) { + var ret time.Time + return ret + } + return *o.LastDeployment +} + +// GetLastDeploymentOk returns a tuple with the LastDeployment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationSummary) GetLastDeploymentOk() (*time.Time, bool) { + if o == nil || IsNil(o.LastDeployment) { + return nil, false + } + return o.LastDeployment, true +} + +// HasLastDeployment returns a boolean if a field has been set. +func (o *ApplicationSummary) HasLastDeployment() bool { + if o != nil && !IsNil(o.LastDeployment) { + return true + } + + return false +} + +// SetLastDeployment gets a reference to the given time.Time and assigns it to the LastDeployment field. +func (o *ApplicationSummary) SetLastDeployment(v time.Time) { + o.LastDeployment = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *ApplicationSummary) GetStatus() CurrentStatus { + if o == nil || IsNil(o.Status) { + var ret CurrentStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApplicationSummary) GetStatusOk() (*CurrentStatus, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *ApplicationSummary) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given CurrentStatus and assigns it to the Status field. +func (o *ApplicationSummary) SetStatus(v CurrentStatus) { + o.Status = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *ApplicationSummary) 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 *ApplicationSummary) 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 *ApplicationSummary) 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 *ApplicationSummary) SetUrl(v string) { + o.Url = &v +} + +func (o ApplicationSummary) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApplicationSummary) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Containers) { + toSerialize["containers"] = o.Containers + } + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.EnvironmentName) { + toSerialize["environmentName"] = o.EnvironmentName + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Instances) { + toSerialize["instances"] = o.Instances + } + if !IsNil(o.LastDeployment) { + toSerialize["lastDeployment"] = o.LastDeployment + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ApplicationSummary) UnmarshalJSON(data []byte) (err error) { + varApplicationSummary := _ApplicationSummary{} + + err = json.Unmarshal(data, &varApplicationSummary) + + if err != nil { + return err + } + + *o = ApplicationSummary(varApplicationSummary) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "containers") + delete(additionalProperties, "createdAt") + delete(additionalProperties, "displayName") + delete(additionalProperties, "environmentName") + delete(additionalProperties, "id") + delete(additionalProperties, "instances") + delete(additionalProperties, "lastDeployment") + delete(additionalProperties, "status") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableApplicationSummary struct { + value *ApplicationSummary + isSet bool +} + +func (v NullableApplicationSummary) Get() *ApplicationSummary { + return v.value +} + +func (v *NullableApplicationSummary) Set(val *ApplicationSummary) { + v.value = val + v.isSet = true +} + +func (v NullableApplicationSummary) IsSet() bool { + return v.isSet +} + +func (v *NullableApplicationSummary) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApplicationSummary(val *ApplicationSummary) *NullableApplicationSummary { + return &NullableApplicationSummary{value: val, isSet: true} +} + +func (v NullableApplicationSummary) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApplicationSummary) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_auto_scaling.go b/services/sca/v1alphaapi/model_auto_scaling.go new file mode 100644 index 000000000..8e9c56fa5 --- /dev/null +++ b/services/sca/v1alphaapi/model_auto_scaling.go @@ -0,0 +1,265 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the AutoScaling type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AutoScaling{} + +// AutoScaling AutoScaling configuration. +type AutoScaling struct { + // Allow automatically scale to zero. + AllowScaleToZero *bool `json:"allowScaleToZero,omitempty"` + // Maximum number of instances. + MaxInstances int32 `json:"maxInstances"` + // Minimum number of instances. + MinInstances int32 `json:"minInstances"` + // Scaling rules. + Rules []ScaleRule `json:"rules"` + AdditionalProperties map[string]interface{} +} + +type _AutoScaling AutoScaling + +// NewAutoScaling instantiates a new AutoScaling 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 NewAutoScaling(maxInstances int32, minInstances int32, rules []ScaleRule) *AutoScaling { + this := AutoScaling{} + this.MaxInstances = maxInstances + this.MinInstances = minInstances + this.Rules = rules + return &this +} + +// NewAutoScalingWithDefaults instantiates a new AutoScaling 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 NewAutoScalingWithDefaults() *AutoScaling { + this := AutoScaling{} + return &this +} + +// GetAllowScaleToZero returns the AllowScaleToZero field value if set, zero value otherwise. +func (o *AutoScaling) GetAllowScaleToZero() bool { + if o == nil || IsNil(o.AllowScaleToZero) { + var ret bool + return ret + } + return *o.AllowScaleToZero +} + +// GetAllowScaleToZeroOk returns a tuple with the AllowScaleToZero field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AutoScaling) GetAllowScaleToZeroOk() (*bool, bool) { + if o == nil || IsNil(o.AllowScaleToZero) { + return nil, false + } + return o.AllowScaleToZero, true +} + +// HasAllowScaleToZero returns a boolean if a field has been set. +func (o *AutoScaling) HasAllowScaleToZero() bool { + if o != nil && !IsNil(o.AllowScaleToZero) { + return true + } + + return false +} + +// SetAllowScaleToZero gets a reference to the given bool and assigns it to the AllowScaleToZero field. +func (o *AutoScaling) SetAllowScaleToZero(v bool) { + o.AllowScaleToZero = &v +} + +// GetMaxInstances returns the MaxInstances field value +func (o *AutoScaling) GetMaxInstances() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MaxInstances +} + +// GetMaxInstancesOk returns a tuple with the MaxInstances field value +// and a boolean to check if the value has been set. +func (o *AutoScaling) GetMaxInstancesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MaxInstances, true +} + +// SetMaxInstances sets field value +func (o *AutoScaling) SetMaxInstances(v int32) { + o.MaxInstances = v +} + +// GetMinInstances returns the MinInstances field value +func (o *AutoScaling) GetMinInstances() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MinInstances +} + +// GetMinInstancesOk returns a tuple with the MinInstances field value +// and a boolean to check if the value has been set. +func (o *AutoScaling) GetMinInstancesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MinInstances, true +} + +// SetMinInstances sets field value +func (o *AutoScaling) SetMinInstances(v int32) { + o.MinInstances = v +} + +// GetRules returns the Rules field value +func (o *AutoScaling) GetRules() []ScaleRule { + if o == nil { + var ret []ScaleRule + return ret + } + + return o.Rules +} + +// GetRulesOk returns a tuple with the Rules field value +// and a boolean to check if the value has been set. +func (o *AutoScaling) GetRulesOk() ([]ScaleRule, bool) { + if o == nil { + return nil, false + } + return o.Rules, true +} + +// SetRules sets field value +func (o *AutoScaling) SetRules(v []ScaleRule) { + o.Rules = v +} + +func (o AutoScaling) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AutoScaling) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AllowScaleToZero) { + toSerialize["allowScaleToZero"] = o.AllowScaleToZero + } + toSerialize["maxInstances"] = o.MaxInstances + toSerialize["minInstances"] = o.MinInstances + toSerialize["rules"] = o.Rules + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AutoScaling) 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{ + "maxInstances", + "minInstances", + "rules", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAutoScaling := _AutoScaling{} + + err = json.Unmarshal(data, &varAutoScaling) + + if err != nil { + return err + } + + *o = AutoScaling(varAutoScaling) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "allowScaleToZero") + delete(additionalProperties, "maxInstances") + delete(additionalProperties, "minInstances") + delete(additionalProperties, "rules") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAutoScaling struct { + value *AutoScaling + isSet bool +} + +func (v NullableAutoScaling) Get() *AutoScaling { + return v.value +} + +func (v *NullableAutoScaling) Set(val *AutoScaling) { + v.value = val + v.isSet = true +} + +func (v NullableAutoScaling) IsSet() bool { + return v.isSet +} + +func (v *NullableAutoScaling) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAutoScaling(val *AutoScaling) *NullableAutoScaling { + return &NullableAutoScaling{value: val, isSet: true} +} + +func (v NullableAutoScaling) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAutoScaling) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_container.go b/services/sca/v1alphaapi/model_container.go new file mode 100644 index 000000000..9c39f70ce --- /dev/null +++ b/services/sca/v1alphaapi/model_container.go @@ -0,0 +1,387 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Container type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Container{} + +// Container Container describes a simplified container configuration for the application. +type Container struct { + // Container argument override. + Args []string `json:"args,omitempty"` + // Container command override. + Command []string `json:"command,omitempty"` + // CPU limit for the container. + Cpu *int32 `json:"cpu,omitempty"` + // Environment variables exposed to the container. + EnvironmentVariables []EnvVar `json:"environmentVariables,omitempty"` + // Container image configuration. + Image string `json:"image"` + // Memory limit for the container. + Memory *int32 `json:"memory,omitempty"` + // Container name. + Name string `json:"name"` + AdditionalProperties map[string]interface{} +} + +type _Container Container + +// NewContainer instantiates a new Container 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 NewContainer(image string, name string) *Container { + this := Container{} + this.Image = image + this.Name = name + return &this +} + +// NewContainerWithDefaults instantiates a new Container 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 NewContainerWithDefaults() *Container { + this := Container{} + return &this +} + +// GetArgs returns the Args field value if set, zero value otherwise. +func (o *Container) GetArgs() []string { + if o == nil || IsNil(o.Args) { + var ret []string + return ret + } + return o.Args +} + +// GetArgsOk returns a tuple with the Args field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Container) GetArgsOk() ([]string, bool) { + if o == nil || IsNil(o.Args) { + return nil, false + } + return o.Args, true +} + +// HasArgs returns a boolean if a field has been set. +func (o *Container) HasArgs() bool { + if o != nil && !IsNil(o.Args) { + return true + } + + return false +} + +// SetArgs gets a reference to the given []string and assigns it to the Args field. +func (o *Container) SetArgs(v []string) { + o.Args = v +} + +// GetCommand returns the Command field value if set, zero value otherwise. +func (o *Container) GetCommand() []string { + if o == nil || IsNil(o.Command) { + var ret []string + return ret + } + return o.Command +} + +// GetCommandOk returns a tuple with the Command field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Container) GetCommandOk() ([]string, bool) { + if o == nil || IsNil(o.Command) { + return nil, false + } + return o.Command, true +} + +// HasCommand returns a boolean if a field has been set. +func (o *Container) HasCommand() bool { + if o != nil && !IsNil(o.Command) { + return true + } + + return false +} + +// SetCommand gets a reference to the given []string and assigns it to the Command field. +func (o *Container) SetCommand(v []string) { + o.Command = v +} + +// GetCpu returns the Cpu field value if set, zero value otherwise. +func (o *Container) GetCpu() int32 { + if o == nil || IsNil(o.Cpu) { + var ret int32 + return ret + } + return *o.Cpu +} + +// GetCpuOk returns a tuple with the Cpu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Container) GetCpuOk() (*int32, bool) { + if o == nil || IsNil(o.Cpu) { + return nil, false + } + return o.Cpu, true +} + +// HasCpu returns a boolean if a field has been set. +func (o *Container) HasCpu() bool { + if o != nil && !IsNil(o.Cpu) { + return true + } + + return false +} + +// SetCpu gets a reference to the given int32 and assigns it to the Cpu field. +func (o *Container) SetCpu(v int32) { + o.Cpu = &v +} + +// GetEnvironmentVariables returns the EnvironmentVariables field value if set, zero value otherwise. +func (o *Container) GetEnvironmentVariables() []EnvVar { + if o == nil || IsNil(o.EnvironmentVariables) { + var ret []EnvVar + return ret + } + return o.EnvironmentVariables +} + +// GetEnvironmentVariablesOk returns a tuple with the EnvironmentVariables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Container) GetEnvironmentVariablesOk() ([]EnvVar, bool) { + if o == nil || IsNil(o.EnvironmentVariables) { + return nil, false + } + return o.EnvironmentVariables, true +} + +// HasEnvironmentVariables returns a boolean if a field has been set. +func (o *Container) HasEnvironmentVariables() bool { + if o != nil && !IsNil(o.EnvironmentVariables) { + return true + } + + return false +} + +// SetEnvironmentVariables gets a reference to the given []EnvVar and assigns it to the EnvironmentVariables field. +func (o *Container) SetEnvironmentVariables(v []EnvVar) { + o.EnvironmentVariables = v +} + +// GetImage returns the Image field value +func (o *Container) GetImage() string { + if o == nil { + var ret string + return ret + } + + return o.Image +} + +// GetImageOk returns a tuple with the Image field value +// and a boolean to check if the value has been set. +func (o *Container) GetImageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Image, true +} + +// SetImage sets field value +func (o *Container) SetImage(v string) { + o.Image = v +} + +// GetMemory returns the Memory field value if set, zero value otherwise. +func (o *Container) GetMemory() int32 { + if o == nil || IsNil(o.Memory) { + var ret int32 + return ret + } + return *o.Memory +} + +// GetMemoryOk returns a tuple with the Memory field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Container) GetMemoryOk() (*int32, bool) { + if o == nil || IsNil(o.Memory) { + return nil, false + } + return o.Memory, true +} + +// HasMemory returns a boolean if a field has been set. +func (o *Container) HasMemory() bool { + if o != nil && !IsNil(o.Memory) { + return true + } + + return false +} + +// SetMemory gets a reference to the given int32 and assigns it to the Memory field. +func (o *Container) SetMemory(v int32) { + o.Memory = &v +} + +// GetName returns the Name field value +func (o *Container) 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 *Container) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Container) SetName(v string) { + o.Name = v +} + +func (o Container) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Container) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Args) { + toSerialize["args"] = o.Args + } + if !IsNil(o.Command) { + toSerialize["command"] = o.Command + } + if !IsNil(o.Cpu) { + toSerialize["cpu"] = o.Cpu + } + if !IsNil(o.EnvironmentVariables) { + toSerialize["environmentVariables"] = o.EnvironmentVariables + } + toSerialize["image"] = o.Image + if !IsNil(o.Memory) { + toSerialize["memory"] = o.Memory + } + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Container) 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{ + "image", + "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) + } + } + + varContainer := _Container{} + + err = json.Unmarshal(data, &varContainer) + + if err != nil { + return err + } + + *o = Container(varContainer) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "args") + delete(additionalProperties, "command") + delete(additionalProperties, "cpu") + delete(additionalProperties, "environmentVariables") + delete(additionalProperties, "image") + delete(additionalProperties, "memory") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableContainer struct { + value *Container + isSet bool +} + +func (v NullableContainer) Get() *Container { + return v.value +} + +func (v *NullableContainer) Set(val *Container) { + v.value = val + v.isSet = true +} + +func (v NullableContainer) IsSet() bool { + return v.isSet +} + +func (v *NullableContainer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableContainer(val *Container) *NullableContainer { + return &NullableContainer{value: val, isSet: true} +} + +func (v NullableContainer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableContainer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_create_application_payload.go b/services/sca/v1alphaapi/model_create_application_payload.go new file mode 100644 index 000000000..01462dced --- /dev/null +++ b/services/sca/v1alphaapi/model_create_application_payload.go @@ -0,0 +1,405 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateApplicationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateApplicationPayload{} + +// CreateApplicationPayload Application describes a deployable multi-container workload instance. +type CreateApplicationPayload struct { + // Containers to deploy for the application. + Containers []Container `json:"containers"` + // Human-readable display name. + DisplayName string `json:"displayName"` + // Application identifier, for example: 00000000-0000-0000-0000-000000000000. + Id *string `json:"id,omitempty"` + Network Network `json:"network"` + Registry *ApplicationRegistry `json:"registry,omitempty"` + RuntimeStatus *RuntimeStatus `json:"runtimeStatus,omitempty"` + Scaling Scaling `json:"scaling"` + // Secrets associated with the application. + Secrets []ApplicationSecret `json:"secrets,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateApplicationPayload CreateApplicationPayload + +// NewCreateApplicationPayload instantiates a new CreateApplicationPayload 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 NewCreateApplicationPayload(containers []Container, displayName string, network Network, scaling Scaling) *CreateApplicationPayload { + this := CreateApplicationPayload{} + this.Containers = containers + this.DisplayName = displayName + this.Network = network + this.Scaling = scaling + return &this +} + +// NewCreateApplicationPayloadWithDefaults instantiates a new CreateApplicationPayload 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 NewCreateApplicationPayloadWithDefaults() *CreateApplicationPayload { + this := CreateApplicationPayload{} + return &this +} + +// GetContainers returns the Containers field value +func (o *CreateApplicationPayload) GetContainers() []Container { + if o == nil { + var ret []Container + return ret + } + + return o.Containers +} + +// GetContainersOk returns a tuple with the Containers field value +// and a boolean to check if the value has been set. +func (o *CreateApplicationPayload) GetContainersOk() ([]Container, bool) { + if o == nil { + return nil, false + } + return o.Containers, true +} + +// SetContainers sets field value +func (o *CreateApplicationPayload) SetContainers(v []Container) { + o.Containers = v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateApplicationPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateApplicationPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateApplicationPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateApplicationPayload) 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 *CreateApplicationPayload) 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 *CreateApplicationPayload) 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 *CreateApplicationPayload) SetId(v string) { + o.Id = &v +} + +// GetNetwork returns the Network field value +func (o *CreateApplicationPayload) GetNetwork() Network { + if o == nil { + var ret Network + return ret + } + + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *CreateApplicationPayload) GetNetworkOk() (*Network, bool) { + if o == nil { + return nil, false + } + return &o.Network, true +} + +// SetNetwork sets field value +func (o *CreateApplicationPayload) SetNetwork(v Network) { + o.Network = v +} + +// GetRegistry returns the Registry field value if set, zero value otherwise. +func (o *CreateApplicationPayload) GetRegistry() ApplicationRegistry { + if o == nil || IsNil(o.Registry) { + var ret ApplicationRegistry + return ret + } + return *o.Registry +} + +// GetRegistryOk returns a tuple with the Registry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateApplicationPayload) GetRegistryOk() (*ApplicationRegistry, bool) { + if o == nil || IsNil(o.Registry) { + return nil, false + } + return o.Registry, true +} + +// HasRegistry returns a boolean if a field has been set. +func (o *CreateApplicationPayload) HasRegistry() bool { + if o != nil && !IsNil(o.Registry) { + return true + } + + return false +} + +// SetRegistry gets a reference to the given ApplicationRegistry and assigns it to the Registry field. +func (o *CreateApplicationPayload) SetRegistry(v ApplicationRegistry) { + o.Registry = &v +} + +// GetRuntimeStatus returns the RuntimeStatus field value if set, zero value otherwise. +func (o *CreateApplicationPayload) GetRuntimeStatus() RuntimeStatus { + if o == nil || IsNil(o.RuntimeStatus) { + var ret RuntimeStatus + return ret + } + return *o.RuntimeStatus +} + +// GetRuntimeStatusOk returns a tuple with the RuntimeStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateApplicationPayload) GetRuntimeStatusOk() (*RuntimeStatus, bool) { + if o == nil || IsNil(o.RuntimeStatus) { + return nil, false + } + return o.RuntimeStatus, true +} + +// HasRuntimeStatus returns a boolean if a field has been set. +func (o *CreateApplicationPayload) HasRuntimeStatus() bool { + if o != nil && !IsNil(o.RuntimeStatus) { + return true + } + + return false +} + +// SetRuntimeStatus gets a reference to the given RuntimeStatus and assigns it to the RuntimeStatus field. +func (o *CreateApplicationPayload) SetRuntimeStatus(v RuntimeStatus) { + o.RuntimeStatus = &v +} + +// GetScaling returns the Scaling field value +func (o *CreateApplicationPayload) GetScaling() Scaling { + if o == nil { + var ret Scaling + return ret + } + + return o.Scaling +} + +// GetScalingOk returns a tuple with the Scaling field value +// and a boolean to check if the value has been set. +func (o *CreateApplicationPayload) GetScalingOk() (*Scaling, bool) { + if o == nil { + return nil, false + } + return &o.Scaling, true +} + +// SetScaling sets field value +func (o *CreateApplicationPayload) SetScaling(v Scaling) { + o.Scaling = v +} + +// GetSecrets returns the Secrets field value if set, zero value otherwise. +func (o *CreateApplicationPayload) GetSecrets() []ApplicationSecret { + if o == nil || IsNil(o.Secrets) { + var ret []ApplicationSecret + return ret + } + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateApplicationPayload) GetSecretsOk() ([]ApplicationSecret, bool) { + if o == nil || IsNil(o.Secrets) { + return nil, false + } + return o.Secrets, true +} + +// HasSecrets returns a boolean if a field has been set. +func (o *CreateApplicationPayload) HasSecrets() bool { + if o != nil && !IsNil(o.Secrets) { + return true + } + + return false +} + +// SetSecrets gets a reference to the given []ApplicationSecret and assigns it to the Secrets field. +func (o *CreateApplicationPayload) SetSecrets(v []ApplicationSecret) { + o.Secrets = v +} + +func (o CreateApplicationPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateApplicationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["containers"] = o.Containers + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + toSerialize["network"] = o.Network + if !IsNil(o.Registry) { + toSerialize["registry"] = o.Registry + } + if !IsNil(o.RuntimeStatus) { + toSerialize["runtimeStatus"] = o.RuntimeStatus + } + toSerialize["scaling"] = o.Scaling + if !IsNil(o.Secrets) { + toSerialize["secrets"] = o.Secrets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateApplicationPayload) 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{ + "containers", + "displayName", + "network", + "scaling", + } + + 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) + } + } + + varCreateApplicationPayload := _CreateApplicationPayload{} + + err = json.Unmarshal(data, &varCreateApplicationPayload) + + if err != nil { + return err + } + + *o = CreateApplicationPayload(varCreateApplicationPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "containers") + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + delete(additionalProperties, "network") + delete(additionalProperties, "registry") + delete(additionalProperties, "runtimeStatus") + delete(additionalProperties, "scaling") + delete(additionalProperties, "secrets") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateApplicationPayload struct { + value *CreateApplicationPayload + isSet bool +} + +func (v NullableCreateApplicationPayload) Get() *CreateApplicationPayload { + return v.value +} + +func (v *NullableCreateApplicationPayload) Set(val *CreateApplicationPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateApplicationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateApplicationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateApplicationPayload(val *CreateApplicationPayload) *NullableCreateApplicationPayload { + return &NullableCreateApplicationPayload{value: val, isSet: true} +} + +func (v NullableCreateApplicationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateApplicationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_current_status.go b/services/sca/v1alphaapi/model_current_status.go new file mode 100644 index 000000000..88923e581 --- /dev/null +++ b/services/sca/v1alphaapi/model_current_status.go @@ -0,0 +1,119 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// CurrentStatus - CURRENT_STATUS_UNSPECIFIED: Used as zero value. - CURRENT_STATUS_PROGRESSING: Applications replicas are being created. - CURRENT_STATUS_RUNNING: Application is ready and has the desired replicas running. - CURRENT_STATUS_FAILED: Application is not available and has some error. - CURRENT_STATUS_IDLE: Application is ready but is scaled to 0 replicas. +type CurrentStatus string + +// List of CurrentStatus +const ( + CURRENTSTATUS_CURRENT_STATUS_UNSPECIFIED CurrentStatus = "CURRENT_STATUS_UNSPECIFIED" + CURRENTSTATUS_CURRENT_STATUS_PROGRESSING CurrentStatus = "CURRENT_STATUS_PROGRESSING" + CURRENTSTATUS_CURRENT_STATUS_RUNNING CurrentStatus = "CURRENT_STATUS_RUNNING" + CURRENTSTATUS_CURRENT_STATUS_FAILED CurrentStatus = "CURRENT_STATUS_FAILED" + CURRENTSTATUS_CURRENT_STATUS_IDLE CurrentStatus = "CURRENT_STATUS_IDLE" + CURRENTSTATUS_UNKNOWN_DEFAULT_OPEN_API CurrentStatus = "unknown_default_open_api" +) + +// All allowed values of CurrentStatus enum +var AllowedCurrentStatusEnumValues = []CurrentStatus{ + "CURRENT_STATUS_UNSPECIFIED", + "CURRENT_STATUS_PROGRESSING", + "CURRENT_STATUS_RUNNING", + "CURRENT_STATUS_FAILED", + "CURRENT_STATUS_IDLE", + "unknown_default_open_api", +} + +func (v *CurrentStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := CurrentStatus(value) + for _, existing := range AllowedCurrentStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = CURRENTSTATUS_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewCurrentStatusFromValue returns a pointer to a valid CurrentStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCurrentStatusFromValue(v string) (*CurrentStatus, error) { + ev := CurrentStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CurrentStatus: valid values are %v", v, AllowedCurrentStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CurrentStatus) IsValid() bool { + for _, existing := range AllowedCurrentStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CurrentStatus value +func (v CurrentStatus) Ptr() *CurrentStatus { + return &v +} + +type NullableCurrentStatus struct { + value *CurrentStatus + isSet bool +} + +func (v NullableCurrentStatus) Get() *CurrentStatus { + return v.value +} + +func (v *NullableCurrentStatus) Set(val *CurrentStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCurrentStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCurrentStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCurrentStatus(val *CurrentStatus) *NullableCurrentStatus { + return &NullableCurrentStatus{value: val, isSet: true} +} + +func (v NullableCurrentStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCurrentStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_custom_rule_parameter.go b/services/sca/v1alphaapi/model_custom_rule_parameter.go new file mode 100644 index 000000000..a2c8b7a0f --- /dev/null +++ b/services/sca/v1alphaapi/model_custom_rule_parameter.go @@ -0,0 +1,195 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CustomRuleParameter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CustomRuleParameter{} + +// CustomRuleParameter CustomRuleParameter defines a single scaler parameter. +type CustomRuleParameter struct { + Name string `json:"name"` + Value string `json:"value"` + AdditionalProperties map[string]interface{} +} + +type _CustomRuleParameter CustomRuleParameter + +// NewCustomRuleParameter instantiates a new CustomRuleParameter 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 NewCustomRuleParameter(name string, value string) *CustomRuleParameter { + this := CustomRuleParameter{} + this.Name = name + this.Value = value + return &this +} + +// NewCustomRuleParameterWithDefaults instantiates a new CustomRuleParameter 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 NewCustomRuleParameterWithDefaults() *CustomRuleParameter { + this := CustomRuleParameter{} + return &this +} + +// GetName returns the Name field value +func (o *CustomRuleParameter) 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 *CustomRuleParameter) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CustomRuleParameter) SetName(v string) { + o.Name = v +} + +// GetValue returns the Value field value +func (o *CustomRuleParameter) GetValue() string { + if o == nil { + var ret string + return ret + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *CustomRuleParameter) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value +func (o *CustomRuleParameter) SetValue(v string) { + o.Value = v +} + +func (o CustomRuleParameter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CustomRuleParameter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CustomRuleParameter) 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", + "value", + } + + 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) + } + } + + varCustomRuleParameter := _CustomRuleParameter{} + + err = json.Unmarshal(data, &varCustomRuleParameter) + + if err != nil { + return err + } + + *o = CustomRuleParameter(varCustomRuleParameter) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "value") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCustomRuleParameter struct { + value *CustomRuleParameter + isSet bool +} + +func (v NullableCustomRuleParameter) Get() *CustomRuleParameter { + return v.value +} + +func (v *NullableCustomRuleParameter) Set(val *CustomRuleParameter) { + v.value = val + v.isSet = true +} + +func (v NullableCustomRuleParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableCustomRuleParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCustomRuleParameter(val *CustomRuleParameter) *NullableCustomRuleParameter { + return &NullableCustomRuleParameter{value: val, isSet: true} +} + +func (v NullableCustomRuleParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCustomRuleParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_custom_rule_secret_mapping.go b/services/sca/v1alphaapi/model_custom_rule_secret_mapping.go new file mode 100644 index 000000000..28f772ccf --- /dev/null +++ b/services/sca/v1alphaapi/model_custom_rule_secret_mapping.go @@ -0,0 +1,197 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CustomRuleSecretMapping type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CustomRuleSecretMapping{} + +// CustomRuleSecretMapping CustomRuleSecretMapping maps a scaler parameter to an environment secret. +type CustomRuleSecretMapping struct { + // Secret parameter name. + Parameter string `json:"parameter"` + // Environment secret name. + Secret string `json:"secret"` + AdditionalProperties map[string]interface{} +} + +type _CustomRuleSecretMapping CustomRuleSecretMapping + +// NewCustomRuleSecretMapping instantiates a new CustomRuleSecretMapping 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 NewCustomRuleSecretMapping(parameter string, secret string) *CustomRuleSecretMapping { + this := CustomRuleSecretMapping{} + this.Parameter = parameter + this.Secret = secret + return &this +} + +// NewCustomRuleSecretMappingWithDefaults instantiates a new CustomRuleSecretMapping 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 NewCustomRuleSecretMappingWithDefaults() *CustomRuleSecretMapping { + this := CustomRuleSecretMapping{} + return &this +} + +// GetParameter returns the Parameter field value +func (o *CustomRuleSecretMapping) GetParameter() string { + if o == nil { + var ret string + return ret + } + + return o.Parameter +} + +// GetParameterOk returns a tuple with the Parameter field value +// and a boolean to check if the value has been set. +func (o *CustomRuleSecretMapping) GetParameterOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Parameter, true +} + +// SetParameter sets field value +func (o *CustomRuleSecretMapping) SetParameter(v string) { + o.Parameter = v +} + +// GetSecret returns the Secret field value +func (o *CustomRuleSecretMapping) GetSecret() string { + if o == nil { + var ret string + return ret + } + + return o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value +// and a boolean to check if the value has been set. +func (o *CustomRuleSecretMapping) GetSecretOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Secret, true +} + +// SetSecret sets field value +func (o *CustomRuleSecretMapping) SetSecret(v string) { + o.Secret = v +} + +func (o CustomRuleSecretMapping) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CustomRuleSecretMapping) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["parameter"] = o.Parameter + toSerialize["secret"] = o.Secret + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CustomRuleSecretMapping) 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{ + "parameter", + "secret", + } + + 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) + } + } + + varCustomRuleSecretMapping := _CustomRuleSecretMapping{} + + err = json.Unmarshal(data, &varCustomRuleSecretMapping) + + if err != nil { + return err + } + + *o = CustomRuleSecretMapping(varCustomRuleSecretMapping) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "parameter") + delete(additionalProperties, "secret") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCustomRuleSecretMapping struct { + value *CustomRuleSecretMapping + isSet bool +} + +func (v NullableCustomRuleSecretMapping) Get() *CustomRuleSecretMapping { + return v.value +} + +func (v *NullableCustomRuleSecretMapping) Set(val *CustomRuleSecretMapping) { + v.value = val + v.isSet = true +} + +func (v NullableCustomRuleSecretMapping) IsSet() bool { + return v.isSet +} + +func (v *NullableCustomRuleSecretMapping) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCustomRuleSecretMapping(val *CustomRuleSecretMapping) *NullableCustomRuleSecretMapping { + return &NullableCustomRuleSecretMapping{value: val, isSet: true} +} + +func (v NullableCustomRuleSecretMapping) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCustomRuleSecretMapping) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_custom_scale_rule.go b/services/sca/v1alphaapi/model_custom_scale_rule.go new file mode 100644 index 000000000..e8769ec56 --- /dev/null +++ b/services/sca/v1alphaapi/model_custom_scale_rule.go @@ -0,0 +1,243 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CustomScaleRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CustomScaleRule{} + +// CustomScaleRule CustomScaleRule defines parameters for custom scalers (e.g., KEDA). +type CustomScaleRule struct { + // Scaler parameters. + Parameters []CustomRuleParameter `json:"parameters,omitempty"` + // Secret mappings for the scaler. + SecretsMapping []CustomRuleSecretMapping `json:"secretsMapping,omitempty"` + // Scaler type. + Type string `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _CustomScaleRule CustomScaleRule + +// NewCustomScaleRule instantiates a new CustomScaleRule 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 NewCustomScaleRule(types string) *CustomScaleRule { + this := CustomScaleRule{} + this.Type = types + return &this +} + +// NewCustomScaleRuleWithDefaults instantiates a new CustomScaleRule 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 NewCustomScaleRuleWithDefaults() *CustomScaleRule { + this := CustomScaleRule{} + return &this +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *CustomScaleRule) GetParameters() []CustomRuleParameter { + if o == nil || IsNil(o.Parameters) { + var ret []CustomRuleParameter + return ret + } + return o.Parameters +} + +// GetParametersOk returns a tuple with the Parameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomScaleRule) GetParametersOk() ([]CustomRuleParameter, bool) { + if o == nil || IsNil(o.Parameters) { + return nil, false + } + return o.Parameters, true +} + +// HasParameters returns a boolean if a field has been set. +func (o *CustomScaleRule) HasParameters() bool { + if o != nil && !IsNil(o.Parameters) { + return true + } + + return false +} + +// SetParameters gets a reference to the given []CustomRuleParameter and assigns it to the Parameters field. +func (o *CustomScaleRule) SetParameters(v []CustomRuleParameter) { + o.Parameters = v +} + +// GetSecretsMapping returns the SecretsMapping field value if set, zero value otherwise. +func (o *CustomScaleRule) GetSecretsMapping() []CustomRuleSecretMapping { + if o == nil || IsNil(o.SecretsMapping) { + var ret []CustomRuleSecretMapping + return ret + } + return o.SecretsMapping +} + +// GetSecretsMappingOk returns a tuple with the SecretsMapping field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomScaleRule) GetSecretsMappingOk() ([]CustomRuleSecretMapping, bool) { + if o == nil || IsNil(o.SecretsMapping) { + return nil, false + } + return o.SecretsMapping, true +} + +// HasSecretsMapping returns a boolean if a field has been set. +func (o *CustomScaleRule) HasSecretsMapping() bool { + if o != nil && !IsNil(o.SecretsMapping) { + return true + } + + return false +} + +// SetSecretsMapping gets a reference to the given []CustomRuleSecretMapping and assigns it to the SecretsMapping field. +func (o *CustomScaleRule) SetSecretsMapping(v []CustomRuleSecretMapping) { + o.SecretsMapping = v +} + +// GetType returns the Type field value +func (o *CustomScaleRule) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CustomScaleRule) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *CustomScaleRule) SetType(v string) { + o.Type = v +} + +func (o CustomScaleRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CustomScaleRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Parameters) { + toSerialize["parameters"] = o.Parameters + } + if !IsNil(o.SecretsMapping) { + toSerialize["secretsMapping"] = o.SecretsMapping + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CustomScaleRule) 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{ + "type", + } + + 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) + } + } + + varCustomScaleRule := _CustomScaleRule{} + + err = json.Unmarshal(data, &varCustomScaleRule) + + if err != nil { + return err + } + + *o = CustomScaleRule(varCustomScaleRule) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "parameters") + delete(additionalProperties, "secretsMapping") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCustomScaleRule struct { + value *CustomScaleRule + isSet bool +} + +func (v NullableCustomScaleRule) Get() *CustomScaleRule { + return v.value +} + +func (v *NullableCustomScaleRule) Set(val *CustomScaleRule) { + v.value = val + v.isSet = true +} + +func (v NullableCustomScaleRule) IsSet() bool { + return v.isSet +} + +func (v *NullableCustomScaleRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCustomScaleRule(val *CustomScaleRule) *NullableCustomScaleRule { + return &NullableCustomScaleRule{value: val, isSet: true} +} + +func (v NullableCustomScaleRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCustomScaleRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_env_var.go b/services/sca/v1alphaapi/model_env_var.go new file mode 100644 index 000000000..b3a75a3de --- /dev/null +++ b/services/sca/v1alphaapi/model_env_var.go @@ -0,0 +1,238 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the EnvVar type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EnvVar{} + +// EnvVar EnvVar defines a single environment variable. +type EnvVar struct { + // Environment variable key. + Key string `json:"key"` + Origin *EnvVarType `json:"origin,omitempty"` + // Environment variable value. + Value string `json:"value"` + AdditionalProperties map[string]interface{} +} + +type _EnvVar EnvVar + +// NewEnvVar instantiates a new EnvVar 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 NewEnvVar(key string, value string) *EnvVar { + this := EnvVar{} + this.Key = key + var origin EnvVarType = ENVVARTYPE_ENV_FROM_SOURCE_TYPE_UNSPECIFIED + this.Origin = &origin + this.Value = value + return &this +} + +// NewEnvVarWithDefaults instantiates a new EnvVar 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 NewEnvVarWithDefaults() *EnvVar { + this := EnvVar{} + var origin EnvVarType = ENVVARTYPE_ENV_FROM_SOURCE_TYPE_UNSPECIFIED + this.Origin = &origin + return &this +} + +// GetKey returns the Key field value +func (o *EnvVar) GetKey() string { + if o == nil { + var ret string + return ret + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *EnvVar) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Key, true +} + +// SetKey sets field value +func (o *EnvVar) SetKey(v string) { + o.Key = v +} + +// GetOrigin returns the Origin field value if set, zero value otherwise. +func (o *EnvVar) GetOrigin() EnvVarType { + if o == nil || IsNil(o.Origin) { + var ret EnvVarType + return ret + } + return *o.Origin +} + +// GetOriginOk returns a tuple with the Origin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnvVar) GetOriginOk() (*EnvVarType, bool) { + if o == nil || IsNil(o.Origin) { + return nil, false + } + return o.Origin, true +} + +// HasOrigin returns a boolean if a field has been set. +func (o *EnvVar) HasOrigin() bool { + if o != nil && !IsNil(o.Origin) { + return true + } + + return false +} + +// SetOrigin gets a reference to the given EnvVarType and assigns it to the Origin field. +func (o *EnvVar) SetOrigin(v EnvVarType) { + o.Origin = &v +} + +// GetValue returns the Value field value +func (o *EnvVar) GetValue() string { + if o == nil { + var ret string + return ret + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *EnvVar) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value +func (o *EnvVar) SetValue(v string) { + o.Value = v +} + +func (o EnvVar) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EnvVar) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["key"] = o.Key + if !IsNil(o.Origin) { + toSerialize["origin"] = o.Origin + } + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *EnvVar) 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{ + "key", + "value", + } + + 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) + } + } + + varEnvVar := _EnvVar{} + + err = json.Unmarshal(data, &varEnvVar) + + if err != nil { + return err + } + + *o = EnvVar(varEnvVar) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "key") + delete(additionalProperties, "origin") + delete(additionalProperties, "value") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEnvVar struct { + value *EnvVar + isSet bool +} + +func (v NullableEnvVar) Get() *EnvVar { + return v.value +} + +func (v *NullableEnvVar) Set(val *EnvVar) { + v.value = val + v.isSet = true +} + +func (v NullableEnvVar) IsSet() bool { + return v.isSet +} + +func (v *NullableEnvVar) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnvVar(val *EnvVar) *NullableEnvVar { + return &NullableEnvVar{value: val, isSet: true} +} + +func (v NullableEnvVar) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnvVar) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_env_var_type.go b/services/sca/v1alphaapi/model_env_var_type.go new file mode 100644 index 000000000..c19c91a99 --- /dev/null +++ b/services/sca/v1alphaapi/model_env_var_type.go @@ -0,0 +1,115 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// EnvVarType EnvVarType identifies the origin of an environment variable. - ENV_FROM_SOURCE_TYPE_UNSPECIFIED: Used as zero value. - ENV_FROM_SOURCE_TYPE_MANUAL: Environment source from a literal value. - ENV_FROM_SOURCE_TYPE_SECRET: Environment source from a secret. +type EnvVarType string + +// List of EnvVarType +const ( + ENVVARTYPE_ENV_FROM_SOURCE_TYPE_UNSPECIFIED EnvVarType = "ENV_FROM_SOURCE_TYPE_UNSPECIFIED" + ENVVARTYPE_ENV_FROM_SOURCE_TYPE_MANUAL EnvVarType = "ENV_FROM_SOURCE_TYPE_MANUAL" + ENVVARTYPE_ENV_FROM_SOURCE_TYPE_SECRET EnvVarType = "ENV_FROM_SOURCE_TYPE_SECRET" + ENVVARTYPE_UNKNOWN_DEFAULT_OPEN_API EnvVarType = "unknown_default_open_api" +) + +// All allowed values of EnvVarType enum +var AllowedEnvVarTypeEnumValues = []EnvVarType{ + "ENV_FROM_SOURCE_TYPE_UNSPECIFIED", + "ENV_FROM_SOURCE_TYPE_MANUAL", + "ENV_FROM_SOURCE_TYPE_SECRET", + "unknown_default_open_api", +} + +func (v *EnvVarType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := EnvVarType(value) + for _, existing := range AllowedEnvVarTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = ENVVARTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewEnvVarTypeFromValue returns a pointer to a valid EnvVarType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewEnvVarTypeFromValue(v string) (*EnvVarType, error) { + ev := EnvVarType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for EnvVarType: valid values are %v", v, AllowedEnvVarTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v EnvVarType) IsValid() bool { + for _, existing := range AllowedEnvVarTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EnvVarType value +func (v EnvVarType) Ptr() *EnvVarType { + return &v +} + +type NullableEnvVarType struct { + value *EnvVarType + isSet bool +} + +func (v NullableEnvVarType) Get() *EnvVarType { + return v.value +} + +func (v *NullableEnvVarType) Set(val *EnvVarType) { + v.value = val + v.isSet = true +} + +func (v NullableEnvVarType) IsSet() bool { + return v.isSet +} + +func (v *NullableEnvVarType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnvVarType(val *EnvVarType) *NullableEnvVarType { + return &NullableEnvVarType{value: val, isSet: true} +} + +func (v NullableEnvVarType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnvVarType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_event.go b/services/sca/v1alphaapi/model_event.go new file mode 100644 index 000000000..32d519867 --- /dev/null +++ b/services/sca/v1alphaapi/model_event.go @@ -0,0 +1,154 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the Event type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Event{} + +// Event Event defines an event line. +type Event struct { + // Event message. + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Event Event + +// NewEvent instantiates a new Event 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 NewEvent() *Event { + this := Event{} + return &this +} + +// NewEventWithDefaults instantiates a new Event 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 NewEventWithDefaults() *Event { + this := Event{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Event) 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 *Event) 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 *Event) 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 *Event) SetMessage(v string) { + o.Message = &v +} + +func (o Event) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Event) 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 *Event) UnmarshalJSON(data []byte) (err error) { + varEvent := _Event{} + + err = json.Unmarshal(data, &varEvent) + + if err != nil { + return err + } + + *o = Event(varEvent) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEvent struct { + value *Event + isSet bool +} + +func (v NullableEvent) Get() *Event { + return v.value +} + +func (v *NullableEvent) Set(val *Event) { + v.value = val + v.isSet = true +} + +func (v NullableEvent) IsSet() bool { + return v.isSet +} + +func (v *NullableEvent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEvent(val *Event) *NullableEvent { + return &NullableEvent{value: val, isSet: true} +} + +func (v NullableEvent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEvent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_get_application_events_response.go b/services/sca/v1alphaapi/model_get_application_events_response.go new file mode 100644 index 000000000..0b6f4d7fa --- /dev/null +++ b/services/sca/v1alphaapi/model_get_application_events_response.go @@ -0,0 +1,154 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the GetApplicationEventsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetApplicationEventsResponse{} + +// GetApplicationEventsResponse GetApplicationEventsResponse contains an application's events list. +type GetApplicationEventsResponse struct { + // Events list. + Events []Event `json:"events,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GetApplicationEventsResponse GetApplicationEventsResponse + +// NewGetApplicationEventsResponse instantiates a new GetApplicationEventsResponse 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 NewGetApplicationEventsResponse() *GetApplicationEventsResponse { + this := GetApplicationEventsResponse{} + return &this +} + +// NewGetApplicationEventsResponseWithDefaults instantiates a new GetApplicationEventsResponse 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 NewGetApplicationEventsResponseWithDefaults() *GetApplicationEventsResponse { + this := GetApplicationEventsResponse{} + return &this +} + +// GetEvents returns the Events field value if set, zero value otherwise. +func (o *GetApplicationEventsResponse) GetEvents() []Event { + if o == nil || IsNil(o.Events) { + var ret []Event + return ret + } + return o.Events +} + +// GetEventsOk returns a tuple with the Events field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetApplicationEventsResponse) GetEventsOk() ([]Event, bool) { + if o == nil || IsNil(o.Events) { + return nil, false + } + return o.Events, true +} + +// HasEvents returns a boolean if a field has been set. +func (o *GetApplicationEventsResponse) HasEvents() bool { + if o != nil && !IsNil(o.Events) { + return true + } + + return false +} + +// SetEvents gets a reference to the given []Event and assigns it to the Events field. +func (o *GetApplicationEventsResponse) SetEvents(v []Event) { + o.Events = v +} + +func (o GetApplicationEventsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetApplicationEventsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Events) { + toSerialize["events"] = o.Events + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetApplicationEventsResponse) UnmarshalJSON(data []byte) (err error) { + varGetApplicationEventsResponse := _GetApplicationEventsResponse{} + + err = json.Unmarshal(data, &varGetApplicationEventsResponse) + + if err != nil { + return err + } + + *o = GetApplicationEventsResponse(varGetApplicationEventsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "events") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetApplicationEventsResponse struct { + value *GetApplicationEventsResponse + isSet bool +} + +func (v NullableGetApplicationEventsResponse) Get() *GetApplicationEventsResponse { + return v.value +} + +func (v *NullableGetApplicationEventsResponse) Set(val *GetApplicationEventsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetApplicationEventsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetApplicationEventsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetApplicationEventsResponse(val *GetApplicationEventsResponse) *NullableGetApplicationEventsResponse { + return &NullableGetApplicationEventsResponse{value: val, isSet: true} +} + +func (v NullableGetApplicationEventsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetApplicationEventsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_get_application_logs_response.go b/services/sca/v1alphaapi/model_get_application_logs_response.go new file mode 100644 index 000000000..15d666824 --- /dev/null +++ b/services/sca/v1alphaapi/model_get_application_logs_response.go @@ -0,0 +1,154 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the GetApplicationLogsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetApplicationLogsResponse{} + +// GetApplicationLogsResponse GetApplicationLogsResponse contains an application's logs list. +type GetApplicationLogsResponse struct { + // Logs list. + Logs []Log `json:"logs,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GetApplicationLogsResponse GetApplicationLogsResponse + +// NewGetApplicationLogsResponse instantiates a new GetApplicationLogsResponse 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 NewGetApplicationLogsResponse() *GetApplicationLogsResponse { + this := GetApplicationLogsResponse{} + return &this +} + +// NewGetApplicationLogsResponseWithDefaults instantiates a new GetApplicationLogsResponse 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 NewGetApplicationLogsResponseWithDefaults() *GetApplicationLogsResponse { + this := GetApplicationLogsResponse{} + return &this +} + +// GetLogs returns the Logs field value if set, zero value otherwise. +func (o *GetApplicationLogsResponse) GetLogs() []Log { + if o == nil || IsNil(o.Logs) { + var ret []Log + return ret + } + return o.Logs +} + +// GetLogsOk returns a tuple with the Logs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetApplicationLogsResponse) GetLogsOk() ([]Log, bool) { + if o == nil || IsNil(o.Logs) { + return nil, false + } + return o.Logs, true +} + +// HasLogs returns a boolean if a field has been set. +func (o *GetApplicationLogsResponse) HasLogs() bool { + if o != nil && !IsNil(o.Logs) { + return true + } + + return false +} + +// SetLogs gets a reference to the given []Log and assigns it to the Logs field. +func (o *GetApplicationLogsResponse) SetLogs(v []Log) { + o.Logs = v +} + +func (o GetApplicationLogsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetApplicationLogsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Logs) { + toSerialize["logs"] = o.Logs + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetApplicationLogsResponse) UnmarshalJSON(data []byte) (err error) { + varGetApplicationLogsResponse := _GetApplicationLogsResponse{} + + err = json.Unmarshal(data, &varGetApplicationLogsResponse) + + if err != nil { + return err + } + + *o = GetApplicationLogsResponse(varGetApplicationLogsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "logs") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetApplicationLogsResponse struct { + value *GetApplicationLogsResponse + isSet bool +} + +func (v NullableGetApplicationLogsResponse) Get() *GetApplicationLogsResponse { + return v.value +} + +func (v *NullableGetApplicationLogsResponse) Set(val *GetApplicationLogsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetApplicationLogsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetApplicationLogsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetApplicationLogsResponse(val *GetApplicationLogsResponse) *NullableGetApplicationLogsResponse { + return &NullableGetApplicationLogsResponse{value: val, isSet: true} +} + +func (v NullableGetApplicationLogsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetApplicationLogsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_get_overview_response.go b/services/sca/v1alphaapi/model_get_overview_response.go new file mode 100644 index 000000000..acf04c731 --- /dev/null +++ b/services/sca/v1alphaapi/model_get_overview_response.go @@ -0,0 +1,166 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetOverviewResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetOverviewResponse{} + +// GetOverviewResponse GetOverviewResponse contains a summary of the current state of the project's application. +type GetOverviewResponse struct { + Summary Summary `json:"summary"` + AdditionalProperties map[string]interface{} +} + +type _GetOverviewResponse GetOverviewResponse + +// NewGetOverviewResponse instantiates a new GetOverviewResponse 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 NewGetOverviewResponse(summary Summary) *GetOverviewResponse { + this := GetOverviewResponse{} + this.Summary = summary + return &this +} + +// NewGetOverviewResponseWithDefaults instantiates a new GetOverviewResponse 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 NewGetOverviewResponseWithDefaults() *GetOverviewResponse { + this := GetOverviewResponse{} + return &this +} + +// GetSummary returns the Summary field value +func (o *GetOverviewResponse) GetSummary() Summary { + if o == nil { + var ret Summary + return ret + } + + return o.Summary +} + +// GetSummaryOk returns a tuple with the Summary field value +// and a boolean to check if the value has been set. +func (o *GetOverviewResponse) GetSummaryOk() (*Summary, bool) { + if o == nil { + return nil, false + } + return &o.Summary, true +} + +// SetSummary sets field value +func (o *GetOverviewResponse) SetSummary(v Summary) { + o.Summary = v +} + +func (o GetOverviewResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetOverviewResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["summary"] = o.Summary + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetOverviewResponse) 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{ + "summary", + } + + 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) + } + } + + varGetOverviewResponse := _GetOverviewResponse{} + + err = json.Unmarshal(data, &varGetOverviewResponse) + + if err != nil { + return err + } + + *o = GetOverviewResponse(varGetOverviewResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "summary") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetOverviewResponse struct { + value *GetOverviewResponse + isSet bool +} + +func (v NullableGetOverviewResponse) Get() *GetOverviewResponse { + return v.value +} + +func (v *NullableGetOverviewResponse) Set(val *GetOverviewResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetOverviewResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetOverviewResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetOverviewResponse(val *GetOverviewResponse) *NullableGetOverviewResponse { + return &NullableGetOverviewResponse{value: val, isSet: true} +} + +func (v NullableGetOverviewResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetOverviewResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_http_scale_rule.go b/services/sca/v1alphaapi/model_http_scale_rule.go new file mode 100644 index 000000000..9c7c5201f --- /dev/null +++ b/services/sca/v1alphaapi/model_http_scale_rule.go @@ -0,0 +1,192 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the HttpScaleRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpScaleRule{} + +// HttpScaleRule HttpScaleRule defines parameters for HTTP-based scaling. +type HttpScaleRule struct { + // Target concurrency per instance. + Concurrency *int32 `json:"concurrency,omitempty"` + // Target requests per second per instance. + Rps *int32 `json:"rps,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _HttpScaleRule HttpScaleRule + +// NewHttpScaleRule instantiates a new HttpScaleRule 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 NewHttpScaleRule() *HttpScaleRule { + this := HttpScaleRule{} + return &this +} + +// NewHttpScaleRuleWithDefaults instantiates a new HttpScaleRule 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 NewHttpScaleRuleWithDefaults() *HttpScaleRule { + this := HttpScaleRule{} + return &this +} + +// GetConcurrency returns the Concurrency field value if set, zero value otherwise. +func (o *HttpScaleRule) GetConcurrency() int32 { + if o == nil || IsNil(o.Concurrency) { + var ret int32 + return ret + } + return *o.Concurrency +} + +// GetConcurrencyOk returns a tuple with the Concurrency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpScaleRule) GetConcurrencyOk() (*int32, bool) { + if o == nil || IsNil(o.Concurrency) { + return nil, false + } + return o.Concurrency, true +} + +// HasConcurrency returns a boolean if a field has been set. +func (o *HttpScaleRule) HasConcurrency() bool { + if o != nil && !IsNil(o.Concurrency) { + return true + } + + return false +} + +// SetConcurrency gets a reference to the given int32 and assigns it to the Concurrency field. +func (o *HttpScaleRule) SetConcurrency(v int32) { + o.Concurrency = &v +} + +// GetRps returns the Rps field value if set, zero value otherwise. +func (o *HttpScaleRule) GetRps() int32 { + if o == nil || IsNil(o.Rps) { + var ret int32 + return ret + } + return *o.Rps +} + +// GetRpsOk returns a tuple with the Rps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpScaleRule) GetRpsOk() (*int32, bool) { + if o == nil || IsNil(o.Rps) { + return nil, false + } + return o.Rps, true +} + +// HasRps returns a boolean if a field has been set. +func (o *HttpScaleRule) HasRps() bool { + if o != nil && !IsNil(o.Rps) { + return true + } + + return false +} + +// SetRps gets a reference to the given int32 and assigns it to the Rps field. +func (o *HttpScaleRule) SetRps(v int32) { + o.Rps = &v +} + +func (o HttpScaleRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HttpScaleRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Concurrency) { + toSerialize["concurrency"] = o.Concurrency + } + if !IsNil(o.Rps) { + toSerialize["rps"] = o.Rps + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *HttpScaleRule) UnmarshalJSON(data []byte) (err error) { + varHttpScaleRule := _HttpScaleRule{} + + err = json.Unmarshal(data, &varHttpScaleRule) + + if err != nil { + return err + } + + *o = HttpScaleRule(varHttpScaleRule) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "concurrency") + delete(additionalProperties, "rps") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHttpScaleRule struct { + value *HttpScaleRule + isSet bool +} + +func (v NullableHttpScaleRule) Get() *HttpScaleRule { + return v.value +} + +func (v *NullableHttpScaleRule) Set(val *HttpScaleRule) { + v.value = val + v.isSet = true +} + +func (v NullableHttpScaleRule) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpScaleRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpScaleRule(val *HttpScaleRule) *NullableHttpScaleRule { + return &NullableHttpScaleRule{value: val, isSet: true} +} + +func (v NullableHttpScaleRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpScaleRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_instance.go b/services/sca/v1alphaapi/model_instance.go new file mode 100644 index 000000000..5bb4600ea --- /dev/null +++ b/services/sca/v1alphaapi/model_instance.go @@ -0,0 +1,195 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the Instance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Instance{} + +// Instance Application instance summary. +type Instance struct { + // Instance's name. + Name *string `json:"name,omitempty"` + Status *InstanceStatus `json:"status,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Instance Instance + +// NewInstance instantiates a new Instance 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 NewInstance() *Instance { + this := Instance{} + var status InstanceStatus = INSTANCESTATUS_INSTANCE_STATUS_PROGRESSING + this.Status = &status + return &this +} + +// NewInstanceWithDefaults instantiates a new Instance 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 NewInstanceWithDefaults() *Instance { + this := Instance{} + var status InstanceStatus = INSTANCESTATUS_INSTANCE_STATUS_PROGRESSING + this.Status = &status + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Instance) 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 *Instance) 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 *Instance) 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 *Instance) SetName(v string) { + o.Name = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Instance) GetStatus() InstanceStatus { + if o == nil || IsNil(o.Status) { + var ret InstanceStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetStatusOk() (*InstanceStatus, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Instance) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given InstanceStatus and assigns it to the Status field. +func (o *Instance) SetStatus(v InstanceStatus) { + o.Status = &v +} + +func (o Instance) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Instance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Instance) UnmarshalJSON(data []byte) (err error) { + varInstance := _Instance{} + + err = json.Unmarshal(data, &varInstance) + + if err != nil { + return err + } + + *o = Instance(varInstance) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstance struct { + value *Instance + isSet bool +} + +func (v NullableInstance) Get() *Instance { + return v.value +} + +func (v *NullableInstance) Set(val *Instance) { + v.value = val + v.isSet = true +} + +func (v NullableInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstance(val *Instance) *NullableInstance { + return &NullableInstance{value: val, isSet: true} +} + +func (v NullableInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_instance_status.go b/services/sca/v1alphaapi/model_instance_status.go new file mode 100644 index 000000000..d6d3ef7d4 --- /dev/null +++ b/services/sca/v1alphaapi/model_instance_status.go @@ -0,0 +1,115 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// InstanceStatus - INSTANCE_STATUS_PROGRESSING: Instance is being created. - INSTANCE_STATUS_RUNNING: Instance is available and running. - INSTANCE_STATUS_FAILED: Instance is not available and has some error. +type InstanceStatus string + +// List of InstanceStatus +const ( + INSTANCESTATUS_INSTANCE_STATUS_PROGRESSING InstanceStatus = "INSTANCE_STATUS_PROGRESSING" + INSTANCESTATUS_INSTANCE_STATUS_RUNNING InstanceStatus = "INSTANCE_STATUS_RUNNING" + INSTANCESTATUS_INSTANCE_STATUS_FAILED InstanceStatus = "INSTANCE_STATUS_FAILED" + INSTANCESTATUS_UNKNOWN_DEFAULT_OPEN_API InstanceStatus = "unknown_default_open_api" +) + +// All allowed values of InstanceStatus enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "INSTANCE_STATUS_PROGRESSING", + "INSTANCE_STATUS_RUNNING", + "INSTANCE_STATUS_FAILED", + "unknown_default_open_api", +} + +func (v *InstanceStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InstanceStatus(value) + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = INSTANCESTATUS_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStatusFromValue(v string) (*InstanceStatus, error) { + ev := InstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to InstanceStatus value +func (v InstanceStatus) Ptr() *InstanceStatus { + return &v +} + +type NullableInstanceStatus struct { + value *InstanceStatus + isSet bool +} + +func (v NullableInstanceStatus) Get() *InstanceStatus { + return v.value +} + +func (v *NullableInstanceStatus) Set(val *InstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus { + return &NullableInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_list_applications_response.go b/services/sca/v1alphaapi/model_list_applications_response.go new file mode 100644 index 000000000..8dec28e66 --- /dev/null +++ b/services/sca/v1alphaapi/model_list_applications_response.go @@ -0,0 +1,154 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ListApplicationsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListApplicationsResponse{} + +// ListApplicationsResponse ListApplicationsResponse contains applications and pagination metadata. +type ListApplicationsResponse struct { + // Applications under the requested parent. + Items []ApplicationSummary `json:"items,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListApplicationsResponse ListApplicationsResponse + +// NewListApplicationsResponse instantiates a new ListApplicationsResponse 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 NewListApplicationsResponse() *ListApplicationsResponse { + this := ListApplicationsResponse{} + return &this +} + +// NewListApplicationsResponseWithDefaults instantiates a new ListApplicationsResponse 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 NewListApplicationsResponseWithDefaults() *ListApplicationsResponse { + this := ListApplicationsResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ListApplicationsResponse) GetItems() []ApplicationSummary { + if o == nil || IsNil(o.Items) { + var ret []ApplicationSummary + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListApplicationsResponse) GetItemsOk() ([]ApplicationSummary, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *ListApplicationsResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []ApplicationSummary and assigns it to the Items field. +func (o *ListApplicationsResponse) SetItems(v []ApplicationSummary) { + o.Items = v +} + +func (o ListApplicationsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListApplicationsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListApplicationsResponse) UnmarshalJSON(data []byte) (err error) { + varListApplicationsResponse := _ListApplicationsResponse{} + + err = json.Unmarshal(data, &varListApplicationsResponse) + + if err != nil { + return err + } + + *o = ListApplicationsResponse(varListApplicationsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListApplicationsResponse struct { + value *ListApplicationsResponse + isSet bool +} + +func (v NullableListApplicationsResponse) Get() *ListApplicationsResponse { + return v.value +} + +func (v *NullableListApplicationsResponse) Set(val *ListApplicationsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListApplicationsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListApplicationsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListApplicationsResponse(val *ListApplicationsResponse) *NullableListApplicationsResponse { + return &NullableListApplicationsResponse{value: val, isSet: true} +} + +func (v NullableListApplicationsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListApplicationsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_log.go b/services/sca/v1alphaapi/model_log.go new file mode 100644 index 000000000..53b9692a9 --- /dev/null +++ b/services/sca/v1alphaapi/model_log.go @@ -0,0 +1,154 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the Log type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Log{} + +// Log Log defines a log line. +type Log struct { + // Log message. + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Log Log + +// NewLog instantiates a new Log 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 NewLog() *Log { + this := Log{} + return &this +} + +// NewLogWithDefaults instantiates a new Log 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 NewLogWithDefaults() *Log { + this := Log{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Log) 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 *Log) 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 *Log) 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 *Log) SetMessage(v string) { + o.Message = &v +} + +func (o Log) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Log) 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 *Log) UnmarshalJSON(data []byte) (err error) { + varLog := _Log{} + + err = json.Unmarshal(data, &varLog) + + if err != nil { + return err + } + + *o = Log(varLog) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableLog struct { + value *Log + isSet bool +} + +func (v NullableLog) Get() *Log { + return v.value +} + +func (v *NullableLog) Set(val *Log) { + v.value = val + v.isSet = true +} + +func (v NullableLog) IsSet() bool { + return v.isSet +} + +func (v *NullableLog) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLog(val *Log) *NullableLog { + return &NullableLog{value: val, isSet: true} +} + +func (v NullableLog) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLog) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_manual_scaling.go b/services/sca/v1alphaapi/model_manual_scaling.go new file mode 100644 index 000000000..e27075921 --- /dev/null +++ b/services/sca/v1alphaapi/model_manual_scaling.go @@ -0,0 +1,167 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ManualScaling type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ManualScaling{} + +// ManualScaling ManualScaling configuration. +type ManualScaling struct { + // Number of instances to run. + Instances int32 `json:"instances"` + AdditionalProperties map[string]interface{} +} + +type _ManualScaling ManualScaling + +// NewManualScaling instantiates a new ManualScaling 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 NewManualScaling(instances int32) *ManualScaling { + this := ManualScaling{} + this.Instances = instances + return &this +} + +// NewManualScalingWithDefaults instantiates a new ManualScaling 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 NewManualScalingWithDefaults() *ManualScaling { + this := ManualScaling{} + return &this +} + +// GetInstances returns the Instances field value +func (o *ManualScaling) GetInstances() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *ManualScaling) GetInstancesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Instances, true +} + +// SetInstances sets field value +func (o *ManualScaling) SetInstances(v int32) { + o.Instances = v +} + +func (o ManualScaling) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ManualScaling) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instances"] = o.Instances + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ManualScaling) 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{ + "instances", + } + + 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) + } + } + + varManualScaling := _ManualScaling{} + + err = json.Unmarshal(data, &varManualScaling) + + if err != nil { + return err + } + + *o = ManualScaling(varManualScaling) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instances") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableManualScaling struct { + value *ManualScaling + isSet bool +} + +func (v NullableManualScaling) Get() *ManualScaling { + return v.value +} + +func (v *NullableManualScaling) Set(val *ManualScaling) { + v.value = val + v.isSet = true +} + +func (v NullableManualScaling) IsSet() bool { + return v.isSet +} + +func (v *NullableManualScaling) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableManualScaling(val *ManualScaling) *NullableManualScaling { + return &NullableManualScaling{value: val, isSet: true} +} + +func (v NullableManualScaling) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableManualScaling) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_network.go b/services/sca/v1alphaapi/model_network.go new file mode 100644 index 000000000..cd7d8ad25 --- /dev/null +++ b/services/sca/v1alphaapi/model_network.go @@ -0,0 +1,243 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Network type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Network{} + +// Network Network configuration for an application. +type Network struct { + // Allowed destination CIDRs for Ingress traffic. + IngressAcl []string `json:"ingressAcl,omitempty"` + // Port number. + Port *int32 `json:"port,omitempty"` + // Whether the application should be accessible from the internet. + PublicIngress bool `json:"publicIngress"` + AdditionalProperties map[string]interface{} +} + +type _Network Network + +// NewNetwork instantiates a new Network 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 NewNetwork(publicIngress bool) *Network { + this := Network{} + this.PublicIngress = publicIngress + return &this +} + +// NewNetworkWithDefaults instantiates a new Network 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 NewNetworkWithDefaults() *Network { + this := Network{} + return &this +} + +// GetIngressAcl returns the IngressAcl field value if set, zero value otherwise. +func (o *Network) GetIngressAcl() []string { + if o == nil || IsNil(o.IngressAcl) { + var ret []string + return ret + } + return o.IngressAcl +} + +// GetIngressAclOk returns a tuple with the IngressAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetIngressAclOk() ([]string, bool) { + if o == nil || IsNil(o.IngressAcl) { + return nil, false + } + return o.IngressAcl, true +} + +// HasIngressAcl returns a boolean if a field has been set. +func (o *Network) HasIngressAcl() bool { + if o != nil && !IsNil(o.IngressAcl) { + return true + } + + return false +} + +// SetIngressAcl gets a reference to the given []string and assigns it to the IngressAcl field. +func (o *Network) SetIngressAcl(v []string) { + o.IngressAcl = v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *Network) GetPort() int32 { + if o == nil || IsNil(o.Port) { + var ret int32 + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetPortOk() (*int32, bool) { + if o == nil || IsNil(o.Port) { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *Network) HasPort() bool { + if o != nil && !IsNil(o.Port) { + return true + } + + return false +} + +// SetPort gets a reference to the given int32 and assigns it to the Port field. +func (o *Network) SetPort(v int32) { + o.Port = &v +} + +// GetPublicIngress returns the PublicIngress field value +func (o *Network) GetPublicIngress() bool { + if o == nil { + var ret bool + return ret + } + + return o.PublicIngress +} + +// GetPublicIngressOk returns a tuple with the PublicIngress field value +// and a boolean to check if the value has been set. +func (o *Network) GetPublicIngressOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.PublicIngress, true +} + +// SetPublicIngress sets field value +func (o *Network) SetPublicIngress(v bool) { + o.PublicIngress = v +} + +func (o Network) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Network) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IngressAcl) { + toSerialize["ingressAcl"] = o.IngressAcl + } + if !IsNil(o.Port) { + toSerialize["port"] = o.Port + } + toSerialize["publicIngress"] = o.PublicIngress + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Network) 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{ + "publicIngress", + } + + 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) + } + } + + varNetwork := _Network{} + + err = json.Unmarshal(data, &varNetwork) + + if err != nil { + return err + } + + *o = Network(varNetwork) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ingressAcl") + delete(additionalProperties, "port") + delete(additionalProperties, "publicIngress") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNetwork struct { + value *Network + isSet bool +} + +func (v NullableNetwork) Get() *Network { + return v.value +} + +func (v *NullableNetwork) Set(val *Network) { + v.value = val + v.isSet = true +} + +func (v NullableNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetwork(val *Network) *NullableNetwork { + return &NullableNetwork{value: val, isSet: true} +} + +func (v NullableNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_rule_type.go b/services/sca/v1alphaapi/model_rule_type.go new file mode 100644 index 000000000..e361f6e1b --- /dev/null +++ b/services/sca/v1alphaapi/model_rule_type.go @@ -0,0 +1,115 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// RuleType - RULE_TYPE_UNSPECIFIED: Used as zero value. - RULE_TYPE_HTTP: HTTP scaling rule. - RULE_TYPE_CUSTOM: Custom scaling rule (e.g. KEDA). +type RuleType string + +// List of RuleType +const ( + RULETYPE_RULE_TYPE_UNSPECIFIED RuleType = "RULE_TYPE_UNSPECIFIED" + RULETYPE_RULE_TYPE_HTTP RuleType = "RULE_TYPE_HTTP" + RULETYPE_RULE_TYPE_CUSTOM RuleType = "RULE_TYPE_CUSTOM" + RULETYPE_UNKNOWN_DEFAULT_OPEN_API RuleType = "unknown_default_open_api" +) + +// All allowed values of RuleType enum +var AllowedRuleTypeEnumValues = []RuleType{ + "RULE_TYPE_UNSPECIFIED", + "RULE_TYPE_HTTP", + "RULE_TYPE_CUSTOM", + "unknown_default_open_api", +} + +func (v *RuleType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := RuleType(value) + for _, existing := range AllowedRuleTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = RULETYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewRuleTypeFromValue returns a pointer to a valid RuleType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRuleTypeFromValue(v string) (*RuleType, error) { + ev := RuleType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RuleType: valid values are %v", v, AllowedRuleTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RuleType) IsValid() bool { + for _, existing := range AllowedRuleTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RuleType value +func (v RuleType) Ptr() *RuleType { + return &v +} + +type NullableRuleType struct { + value *RuleType + isSet bool +} + +func (v NullableRuleType) Get() *RuleType { + return v.value +} + +func (v *NullableRuleType) Set(val *RuleType) { + v.value = val + v.isSet = true +} + +func (v NullableRuleType) IsSet() bool { + return v.isSet +} + +func (v *NullableRuleType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRuleType(val *RuleType) *NullableRuleType { + return &NullableRuleType{value: val, isSet: true} +} + +func (v NullableRuleType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRuleType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_runtime_status.go b/services/sca/v1alphaapi/model_runtime_status.go new file mode 100644 index 000000000..94be423d9 --- /dev/null +++ b/services/sca/v1alphaapi/model_runtime_status.go @@ -0,0 +1,309 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "time" +) + +// checks if the RuntimeStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RuntimeStatus{} + +// RuntimeStatus struct for RuntimeStatus +type RuntimeStatus struct { + CurrentStatus *CurrentStatus `json:"currentStatus,omitempty"` + // Failure reasons collected from workload conditions. + FailureReasons []string `json:"failureReasons,omitempty"` + Instances []Instance `json:"instances,omitempty"` + // Last time the application was deployed. + LastDeployment *time.Time `json:"lastDeployment,omitempty"` + // Known URLs for the running application. + Urls []string `json:"urls,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RuntimeStatus RuntimeStatus + +// NewRuntimeStatus instantiates a new RuntimeStatus 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 NewRuntimeStatus() *RuntimeStatus { + this := RuntimeStatus{} + var currentStatus CurrentStatus = CURRENTSTATUS_CURRENT_STATUS_UNSPECIFIED + this.CurrentStatus = ¤tStatus + return &this +} + +// NewRuntimeStatusWithDefaults instantiates a new RuntimeStatus 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 NewRuntimeStatusWithDefaults() *RuntimeStatus { + this := RuntimeStatus{} + var currentStatus CurrentStatus = CURRENTSTATUS_CURRENT_STATUS_UNSPECIFIED + this.CurrentStatus = ¤tStatus + return &this +} + +// GetCurrentStatus returns the CurrentStatus field value if set, zero value otherwise. +func (o *RuntimeStatus) GetCurrentStatus() CurrentStatus { + if o == nil || IsNil(o.CurrentStatus) { + var ret CurrentStatus + return ret + } + return *o.CurrentStatus +} + +// GetCurrentStatusOk returns a tuple with the CurrentStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuntimeStatus) GetCurrentStatusOk() (*CurrentStatus, bool) { + if o == nil || IsNil(o.CurrentStatus) { + return nil, false + } + return o.CurrentStatus, true +} + +// HasCurrentStatus returns a boolean if a field has been set. +func (o *RuntimeStatus) HasCurrentStatus() bool { + if o != nil && !IsNil(o.CurrentStatus) { + return true + } + + return false +} + +// SetCurrentStatus gets a reference to the given CurrentStatus and assigns it to the CurrentStatus field. +func (o *RuntimeStatus) SetCurrentStatus(v CurrentStatus) { + o.CurrentStatus = &v +} + +// GetFailureReasons returns the FailureReasons field value if set, zero value otherwise. +func (o *RuntimeStatus) GetFailureReasons() []string { + if o == nil || IsNil(o.FailureReasons) { + var ret []string + return ret + } + return o.FailureReasons +} + +// GetFailureReasonsOk returns a tuple with the FailureReasons field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuntimeStatus) GetFailureReasonsOk() ([]string, bool) { + if o == nil || IsNil(o.FailureReasons) { + return nil, false + } + return o.FailureReasons, true +} + +// HasFailureReasons returns a boolean if a field has been set. +func (o *RuntimeStatus) HasFailureReasons() bool { + if o != nil && !IsNil(o.FailureReasons) { + return true + } + + return false +} + +// SetFailureReasons gets a reference to the given []string and assigns it to the FailureReasons field. +func (o *RuntimeStatus) SetFailureReasons(v []string) { + o.FailureReasons = v +} + +// GetInstances returns the Instances field value if set, zero value otherwise. +func (o *RuntimeStatus) GetInstances() []Instance { + if o == nil || IsNil(o.Instances) { + var ret []Instance + return ret + } + return o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuntimeStatus) GetInstancesOk() ([]Instance, bool) { + if o == nil || IsNil(o.Instances) { + return nil, false + } + return o.Instances, true +} + +// HasInstances returns a boolean if a field has been set. +func (o *RuntimeStatus) HasInstances() bool { + if o != nil && !IsNil(o.Instances) { + return true + } + + return false +} + +// SetInstances gets a reference to the given []Instance and assigns it to the Instances field. +func (o *RuntimeStatus) SetInstances(v []Instance) { + o.Instances = v +} + +// GetLastDeployment returns the LastDeployment field value if set, zero value otherwise. +func (o *RuntimeStatus) GetLastDeployment() time.Time { + if o == nil || IsNil(o.LastDeployment) { + var ret time.Time + return ret + } + return *o.LastDeployment +} + +// GetLastDeploymentOk returns a tuple with the LastDeployment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuntimeStatus) GetLastDeploymentOk() (*time.Time, bool) { + if o == nil || IsNil(o.LastDeployment) { + return nil, false + } + return o.LastDeployment, true +} + +// HasLastDeployment returns a boolean if a field has been set. +func (o *RuntimeStatus) HasLastDeployment() bool { + if o != nil && !IsNil(o.LastDeployment) { + return true + } + + return false +} + +// SetLastDeployment gets a reference to the given time.Time and assigns it to the LastDeployment field. +func (o *RuntimeStatus) SetLastDeployment(v time.Time) { + o.LastDeployment = &v +} + +// GetUrls returns the Urls field value if set, zero value otherwise. +func (o *RuntimeStatus) GetUrls() []string { + if o == nil || IsNil(o.Urls) { + var ret []string + return ret + } + return o.Urls +} + +// GetUrlsOk returns a tuple with the Urls field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuntimeStatus) GetUrlsOk() ([]string, bool) { + if o == nil || IsNil(o.Urls) { + return nil, false + } + return o.Urls, true +} + +// HasUrls returns a boolean if a field has been set. +func (o *RuntimeStatus) HasUrls() bool { + if o != nil && !IsNil(o.Urls) { + return true + } + + return false +} + +// SetUrls gets a reference to the given []string and assigns it to the Urls field. +func (o *RuntimeStatus) SetUrls(v []string) { + o.Urls = v +} + +func (o RuntimeStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RuntimeStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CurrentStatus) { + toSerialize["currentStatus"] = o.CurrentStatus + } + if !IsNil(o.FailureReasons) { + toSerialize["failureReasons"] = o.FailureReasons + } + if !IsNil(o.Instances) { + toSerialize["instances"] = o.Instances + } + if !IsNil(o.LastDeployment) { + toSerialize["lastDeployment"] = o.LastDeployment + } + if !IsNil(o.Urls) { + toSerialize["urls"] = o.Urls + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RuntimeStatus) UnmarshalJSON(data []byte) (err error) { + varRuntimeStatus := _RuntimeStatus{} + + err = json.Unmarshal(data, &varRuntimeStatus) + + if err != nil { + return err + } + + *o = RuntimeStatus(varRuntimeStatus) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "currentStatus") + delete(additionalProperties, "failureReasons") + delete(additionalProperties, "instances") + delete(additionalProperties, "lastDeployment") + delete(additionalProperties, "urls") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRuntimeStatus struct { + value *RuntimeStatus + isSet bool +} + +func (v NullableRuntimeStatus) Get() *RuntimeStatus { + return v.value +} + +func (v *NullableRuntimeStatus) Set(val *RuntimeStatus) { + v.value = val + v.isSet = true +} + +func (v NullableRuntimeStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableRuntimeStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRuntimeStatus(val *RuntimeStatus) *NullableRuntimeStatus { + return &NullableRuntimeStatus{value: val, isSet: true} +} + +func (v NullableRuntimeStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRuntimeStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_scale_rule.go b/services/sca/v1alphaapi/model_scale_rule.go new file mode 100644 index 000000000..b41a03183 --- /dev/null +++ b/services/sca/v1alphaapi/model_scale_rule.go @@ -0,0 +1,272 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ScaleRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ScaleRule{} + +// ScaleRule ScaleRule defines one autoscaling trigger. +type ScaleRule struct { + CustomRule *CustomScaleRule `json:"customRule,omitempty"` + HttpRule *HttpScaleRule `json:"httpRule,omitempty"` + // Rule name. + Name string `json:"name"` + Type RuleType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _ScaleRule ScaleRule + +// NewScaleRule instantiates a new ScaleRule 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 NewScaleRule(name string, types RuleType) *ScaleRule { + this := ScaleRule{} + this.Name = name + this.Type = types + return &this +} + +// NewScaleRuleWithDefaults instantiates a new ScaleRule 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 NewScaleRuleWithDefaults() *ScaleRule { + this := ScaleRule{} + var types RuleType = RULETYPE_RULE_TYPE_UNSPECIFIED + this.Type = types + return &this +} + +// GetCustomRule returns the CustomRule field value if set, zero value otherwise. +func (o *ScaleRule) GetCustomRule() CustomScaleRule { + if o == nil || IsNil(o.CustomRule) { + var ret CustomScaleRule + return ret + } + return *o.CustomRule +} + +// GetCustomRuleOk returns a tuple with the CustomRule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScaleRule) GetCustomRuleOk() (*CustomScaleRule, bool) { + if o == nil || IsNil(o.CustomRule) { + return nil, false + } + return o.CustomRule, true +} + +// HasCustomRule returns a boolean if a field has been set. +func (o *ScaleRule) HasCustomRule() bool { + if o != nil && !IsNil(o.CustomRule) { + return true + } + + return false +} + +// SetCustomRule gets a reference to the given CustomScaleRule and assigns it to the CustomRule field. +func (o *ScaleRule) SetCustomRule(v CustomScaleRule) { + o.CustomRule = &v +} + +// GetHttpRule returns the HttpRule field value if set, zero value otherwise. +func (o *ScaleRule) GetHttpRule() HttpScaleRule { + if o == nil || IsNil(o.HttpRule) { + var ret HttpScaleRule + return ret + } + return *o.HttpRule +} + +// GetHttpRuleOk returns a tuple with the HttpRule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScaleRule) GetHttpRuleOk() (*HttpScaleRule, bool) { + if o == nil || IsNil(o.HttpRule) { + return nil, false + } + return o.HttpRule, true +} + +// HasHttpRule returns a boolean if a field has been set. +func (o *ScaleRule) HasHttpRule() bool { + if o != nil && !IsNil(o.HttpRule) { + return true + } + + return false +} + +// SetHttpRule gets a reference to the given HttpScaleRule and assigns it to the HttpRule field. +func (o *ScaleRule) SetHttpRule(v HttpScaleRule) { + o.HttpRule = &v +} + +// GetName returns the Name field value +func (o *ScaleRule) 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 *ScaleRule) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ScaleRule) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value +func (o *ScaleRule) GetType() RuleType { + if o == nil { + var ret RuleType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ScaleRule) GetTypeOk() (*RuleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *ScaleRule) SetType(v RuleType) { + o.Type = v +} + +func (o ScaleRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ScaleRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomRule) { + toSerialize["customRule"] = o.CustomRule + } + if !IsNil(o.HttpRule) { + toSerialize["httpRule"] = o.HttpRule + } + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ScaleRule) 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", + "type", + } + + 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) + } + } + + varScaleRule := _ScaleRule{} + + err = json.Unmarshal(data, &varScaleRule) + + if err != nil { + return err + } + + *o = ScaleRule(varScaleRule) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "customRule") + delete(additionalProperties, "httpRule") + delete(additionalProperties, "name") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableScaleRule struct { + value *ScaleRule + isSet bool +} + +func (v NullableScaleRule) Get() *ScaleRule { + return v.value +} + +func (v *NullableScaleRule) Set(val *ScaleRule) { + v.value = val + v.isSet = true +} + +func (v NullableScaleRule) IsSet() bool { + return v.isSet +} + +func (v *NullableScaleRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScaleRule(val *ScaleRule) *NullableScaleRule { + return &NullableScaleRule{value: val, isSet: true} +} + +func (v NullableScaleRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScaleRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_scaling.go b/services/sca/v1alphaapi/model_scaling.go new file mode 100644 index 000000000..de7879cef --- /dev/null +++ b/services/sca/v1alphaapi/model_scaling.go @@ -0,0 +1,242 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Scaling type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Scaling{} + +// Scaling Scaling configuration for the application. +type Scaling struct { + AutoScaling *AutoScaling `json:"autoScaling,omitempty"` + ManualScaling *ManualScaling `json:"manualScaling,omitempty"` + Type ScalingType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _Scaling Scaling + +// NewScaling instantiates a new Scaling 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 NewScaling(types ScalingType) *Scaling { + this := Scaling{} + this.Type = types + return &this +} + +// NewScalingWithDefaults instantiates a new Scaling 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 NewScalingWithDefaults() *Scaling { + this := Scaling{} + var types ScalingType = SCALINGTYPE_SCALING_TYPE_UNSPECIFIED + this.Type = types + return &this +} + +// GetAutoScaling returns the AutoScaling field value if set, zero value otherwise. +func (o *Scaling) GetAutoScaling() AutoScaling { + if o == nil || IsNil(o.AutoScaling) { + var ret AutoScaling + return ret + } + return *o.AutoScaling +} + +// GetAutoScalingOk returns a tuple with the AutoScaling field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Scaling) GetAutoScalingOk() (*AutoScaling, bool) { + if o == nil || IsNil(o.AutoScaling) { + return nil, false + } + return o.AutoScaling, true +} + +// HasAutoScaling returns a boolean if a field has been set. +func (o *Scaling) HasAutoScaling() bool { + if o != nil && !IsNil(o.AutoScaling) { + return true + } + + return false +} + +// SetAutoScaling gets a reference to the given AutoScaling and assigns it to the AutoScaling field. +func (o *Scaling) SetAutoScaling(v AutoScaling) { + o.AutoScaling = &v +} + +// GetManualScaling returns the ManualScaling field value if set, zero value otherwise. +func (o *Scaling) GetManualScaling() ManualScaling { + if o == nil || IsNil(o.ManualScaling) { + var ret ManualScaling + return ret + } + return *o.ManualScaling +} + +// GetManualScalingOk returns a tuple with the ManualScaling field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Scaling) GetManualScalingOk() (*ManualScaling, bool) { + if o == nil || IsNil(o.ManualScaling) { + return nil, false + } + return o.ManualScaling, true +} + +// HasManualScaling returns a boolean if a field has been set. +func (o *Scaling) HasManualScaling() bool { + if o != nil && !IsNil(o.ManualScaling) { + return true + } + + return false +} + +// SetManualScaling gets a reference to the given ManualScaling and assigns it to the ManualScaling field. +func (o *Scaling) SetManualScaling(v ManualScaling) { + o.ManualScaling = &v +} + +// GetType returns the Type field value +func (o *Scaling) GetType() ScalingType { + if o == nil { + var ret ScalingType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Scaling) GetTypeOk() (*ScalingType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *Scaling) SetType(v ScalingType) { + o.Type = v +} + +func (o Scaling) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Scaling) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AutoScaling) { + toSerialize["autoScaling"] = o.AutoScaling + } + if !IsNil(o.ManualScaling) { + toSerialize["manualScaling"] = o.ManualScaling + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Scaling) 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{ + "type", + } + + 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) + } + } + + varScaling := _Scaling{} + + err = json.Unmarshal(data, &varScaling) + + if err != nil { + return err + } + + *o = Scaling(varScaling) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "autoScaling") + delete(additionalProperties, "manualScaling") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableScaling struct { + value *Scaling + isSet bool +} + +func (v NullableScaling) Get() *Scaling { + return v.value +} + +func (v *NullableScaling) Set(val *Scaling) { + v.value = val + v.isSet = true +} + +func (v NullableScaling) IsSet() bool { + return v.isSet +} + +func (v *NullableScaling) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScaling(val *Scaling) *NullableScaling { + return &NullableScaling{value: val, isSet: true} +} + +func (v NullableScaling) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScaling) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_scaling_type.go b/services/sca/v1alphaapi/model_scaling_type.go new file mode 100644 index 000000000..fd35798fb --- /dev/null +++ b/services/sca/v1alphaapi/model_scaling_type.go @@ -0,0 +1,115 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// ScalingType - SCALING_TYPE_UNSPECIFIED: Used as zero value. - SCALING_TYPE_AUTO: Auto scaling based on rules. - SCALING_TYPE_MANUAL: Manual scaling with fixed number of instances. +type ScalingType string + +// List of ScalingType +const ( + SCALINGTYPE_SCALING_TYPE_UNSPECIFIED ScalingType = "SCALING_TYPE_UNSPECIFIED" + SCALINGTYPE_SCALING_TYPE_AUTO ScalingType = "SCALING_TYPE_AUTO" + SCALINGTYPE_SCALING_TYPE_MANUAL ScalingType = "SCALING_TYPE_MANUAL" + SCALINGTYPE_UNKNOWN_DEFAULT_OPEN_API ScalingType = "unknown_default_open_api" +) + +// All allowed values of ScalingType enum +var AllowedScalingTypeEnumValues = []ScalingType{ + "SCALING_TYPE_UNSPECIFIED", + "SCALING_TYPE_AUTO", + "SCALING_TYPE_MANUAL", + "unknown_default_open_api", +} + +func (v *ScalingType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ScalingType(value) + for _, existing := range AllowedScalingTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = SCALINGTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewScalingTypeFromValue returns a pointer to a valid ScalingType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewScalingTypeFromValue(v string) (*ScalingType, error) { + ev := ScalingType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ScalingType: valid values are %v", v, AllowedScalingTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ScalingType) IsValid() bool { + for _, existing := range AllowedScalingTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ScalingType value +func (v ScalingType) Ptr() *ScalingType { + return &v +} + +type NullableScalingType struct { + value *ScalingType + isSet bool +} + +func (v NullableScalingType) Get() *ScalingType { + return v.value +} + +func (v *NullableScalingType) Set(val *ScalingType) { + v.value = val + v.isSet = true +} + +func (v NullableScalingType) IsSet() bool { + return v.isSet +} + +func (v *NullableScalingType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScalingType(val *ScalingType) *NullableScalingType { + return &NullableScalingType{value: val, isSet: true} +} + +func (v NullableScalingType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScalingType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_summary.go b/services/sca/v1alphaapi/model_summary.go new file mode 100644 index 000000000..b904ed6b8 --- /dev/null +++ b/services/sca/v1alphaapi/model_summary.go @@ -0,0 +1,192 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the Summary type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Summary{} + +// Summary Summary describes the current status of a project. +type Summary struct { + // Number of applications running in a project. + ApplicationsRunning *int32 `json:"applicationsRunning,omitempty"` + // Number of applications created in a project. + ApplicationsTotal *int32 `json:"applicationsTotal,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Summary Summary + +// NewSummary instantiates a new Summary 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 NewSummary() *Summary { + this := Summary{} + return &this +} + +// NewSummaryWithDefaults instantiates a new Summary 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 NewSummaryWithDefaults() *Summary { + this := Summary{} + return &this +} + +// GetApplicationsRunning returns the ApplicationsRunning field value if set, zero value otherwise. +func (o *Summary) GetApplicationsRunning() int32 { + if o == nil || IsNil(o.ApplicationsRunning) { + var ret int32 + return ret + } + return *o.ApplicationsRunning +} + +// GetApplicationsRunningOk returns a tuple with the ApplicationsRunning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Summary) GetApplicationsRunningOk() (*int32, bool) { + if o == nil || IsNil(o.ApplicationsRunning) { + return nil, false + } + return o.ApplicationsRunning, true +} + +// HasApplicationsRunning returns a boolean if a field has been set. +func (o *Summary) HasApplicationsRunning() bool { + if o != nil && !IsNil(o.ApplicationsRunning) { + return true + } + + return false +} + +// SetApplicationsRunning gets a reference to the given int32 and assigns it to the ApplicationsRunning field. +func (o *Summary) SetApplicationsRunning(v int32) { + o.ApplicationsRunning = &v +} + +// GetApplicationsTotal returns the ApplicationsTotal field value if set, zero value otherwise. +func (o *Summary) GetApplicationsTotal() int32 { + if o == nil || IsNil(o.ApplicationsTotal) { + var ret int32 + return ret + } + return *o.ApplicationsTotal +} + +// GetApplicationsTotalOk returns a tuple with the ApplicationsTotal field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Summary) GetApplicationsTotalOk() (*int32, bool) { + if o == nil || IsNil(o.ApplicationsTotal) { + return nil, false + } + return o.ApplicationsTotal, true +} + +// HasApplicationsTotal returns a boolean if a field has been set. +func (o *Summary) HasApplicationsTotal() bool { + if o != nil && !IsNil(o.ApplicationsTotal) { + return true + } + + return false +} + +// SetApplicationsTotal gets a reference to the given int32 and assigns it to the ApplicationsTotal field. +func (o *Summary) SetApplicationsTotal(v int32) { + o.ApplicationsTotal = &v +} + +func (o Summary) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Summary) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ApplicationsRunning) { + toSerialize["applicationsRunning"] = o.ApplicationsRunning + } + if !IsNil(o.ApplicationsTotal) { + toSerialize["applicationsTotal"] = o.ApplicationsTotal + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Summary) UnmarshalJSON(data []byte) (err error) { + varSummary := _Summary{} + + err = json.Unmarshal(data, &varSummary) + + if err != nil { + return err + } + + *o = Summary(varSummary) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "applicationsRunning") + delete(additionalProperties, "applicationsTotal") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSummary struct { + value *Summary + isSet bool +} + +func (v NullableSummary) Get() *Summary { + return v.value +} + +func (v *NullableSummary) Set(val *Summary) { + v.value = val + v.isSet = true +} + +func (v NullableSummary) IsSet() bool { + return v.isSet +} + +func (v *NullableSummary) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSummary(val *Summary) *NullableSummary { + return &NullableSummary{value: val, isSet: true} +} + +func (v NullableSummary) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSummary) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/model_update_application_payload.go b/services/sca/v1alphaapi/model_update_application_payload.go new file mode 100644 index 000000000..e2ecc88d9 --- /dev/null +++ b/services/sca/v1alphaapi/model_update_application_payload.go @@ -0,0 +1,405 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateApplicationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateApplicationPayload{} + +// UpdateApplicationPayload Application describes a deployable multi-container workload instance. +type UpdateApplicationPayload struct { + // Containers to deploy for the application. + Containers []Container `json:"containers"` + // Human-readable display name. + DisplayName string `json:"displayName"` + // Application identifier, for example: 00000000-0000-0000-0000-000000000000. + Id *string `json:"id,omitempty"` + Network Network `json:"network"` + Registry *ApplicationRegistry `json:"registry,omitempty"` + RuntimeStatus *RuntimeStatus `json:"runtimeStatus,omitempty"` + Scaling Scaling `json:"scaling"` + // Secrets associated with the application. + Secrets []ApplicationSecret `json:"secrets,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateApplicationPayload UpdateApplicationPayload + +// NewUpdateApplicationPayload instantiates a new UpdateApplicationPayload 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 NewUpdateApplicationPayload(containers []Container, displayName string, network Network, scaling Scaling) *UpdateApplicationPayload { + this := UpdateApplicationPayload{} + this.Containers = containers + this.DisplayName = displayName + this.Network = network + this.Scaling = scaling + return &this +} + +// NewUpdateApplicationPayloadWithDefaults instantiates a new UpdateApplicationPayload 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 NewUpdateApplicationPayloadWithDefaults() *UpdateApplicationPayload { + this := UpdateApplicationPayload{} + return &this +} + +// GetContainers returns the Containers field value +func (o *UpdateApplicationPayload) GetContainers() []Container { + if o == nil { + var ret []Container + return ret + } + + return o.Containers +} + +// GetContainersOk returns a tuple with the Containers field value +// and a boolean to check if the value has been set. +func (o *UpdateApplicationPayload) GetContainersOk() ([]Container, bool) { + if o == nil { + return nil, false + } + return o.Containers, true +} + +// SetContainers sets field value +func (o *UpdateApplicationPayload) SetContainers(v []Container) { + o.Containers = v +} + +// GetDisplayName returns the DisplayName field value +func (o *UpdateApplicationPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *UpdateApplicationPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *UpdateApplicationPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateApplicationPayload) 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 *UpdateApplicationPayload) 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 *UpdateApplicationPayload) 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 *UpdateApplicationPayload) SetId(v string) { + o.Id = &v +} + +// GetNetwork returns the Network field value +func (o *UpdateApplicationPayload) GetNetwork() Network { + if o == nil { + var ret Network + return ret + } + + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *UpdateApplicationPayload) GetNetworkOk() (*Network, bool) { + if o == nil { + return nil, false + } + return &o.Network, true +} + +// SetNetwork sets field value +func (o *UpdateApplicationPayload) SetNetwork(v Network) { + o.Network = v +} + +// GetRegistry returns the Registry field value if set, zero value otherwise. +func (o *UpdateApplicationPayload) GetRegistry() ApplicationRegistry { + if o == nil || IsNil(o.Registry) { + var ret ApplicationRegistry + return ret + } + return *o.Registry +} + +// GetRegistryOk returns a tuple with the Registry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateApplicationPayload) GetRegistryOk() (*ApplicationRegistry, bool) { + if o == nil || IsNil(o.Registry) { + return nil, false + } + return o.Registry, true +} + +// HasRegistry returns a boolean if a field has been set. +func (o *UpdateApplicationPayload) HasRegistry() bool { + if o != nil && !IsNil(o.Registry) { + return true + } + + return false +} + +// SetRegistry gets a reference to the given ApplicationRegistry and assigns it to the Registry field. +func (o *UpdateApplicationPayload) SetRegistry(v ApplicationRegistry) { + o.Registry = &v +} + +// GetRuntimeStatus returns the RuntimeStatus field value if set, zero value otherwise. +func (o *UpdateApplicationPayload) GetRuntimeStatus() RuntimeStatus { + if o == nil || IsNil(o.RuntimeStatus) { + var ret RuntimeStatus + return ret + } + return *o.RuntimeStatus +} + +// GetRuntimeStatusOk returns a tuple with the RuntimeStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateApplicationPayload) GetRuntimeStatusOk() (*RuntimeStatus, bool) { + if o == nil || IsNil(o.RuntimeStatus) { + return nil, false + } + return o.RuntimeStatus, true +} + +// HasRuntimeStatus returns a boolean if a field has been set. +func (o *UpdateApplicationPayload) HasRuntimeStatus() bool { + if o != nil && !IsNil(o.RuntimeStatus) { + return true + } + + return false +} + +// SetRuntimeStatus gets a reference to the given RuntimeStatus and assigns it to the RuntimeStatus field. +func (o *UpdateApplicationPayload) SetRuntimeStatus(v RuntimeStatus) { + o.RuntimeStatus = &v +} + +// GetScaling returns the Scaling field value +func (o *UpdateApplicationPayload) GetScaling() Scaling { + if o == nil { + var ret Scaling + return ret + } + + return o.Scaling +} + +// GetScalingOk returns a tuple with the Scaling field value +// and a boolean to check if the value has been set. +func (o *UpdateApplicationPayload) GetScalingOk() (*Scaling, bool) { + if o == nil { + return nil, false + } + return &o.Scaling, true +} + +// SetScaling sets field value +func (o *UpdateApplicationPayload) SetScaling(v Scaling) { + o.Scaling = v +} + +// GetSecrets returns the Secrets field value if set, zero value otherwise. +func (o *UpdateApplicationPayload) GetSecrets() []ApplicationSecret { + if o == nil || IsNil(o.Secrets) { + var ret []ApplicationSecret + return ret + } + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateApplicationPayload) GetSecretsOk() ([]ApplicationSecret, bool) { + if o == nil || IsNil(o.Secrets) { + return nil, false + } + return o.Secrets, true +} + +// HasSecrets returns a boolean if a field has been set. +func (o *UpdateApplicationPayload) HasSecrets() bool { + if o != nil && !IsNil(o.Secrets) { + return true + } + + return false +} + +// SetSecrets gets a reference to the given []ApplicationSecret and assigns it to the Secrets field. +func (o *UpdateApplicationPayload) SetSecrets(v []ApplicationSecret) { + o.Secrets = v +} + +func (o UpdateApplicationPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateApplicationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["containers"] = o.Containers + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + toSerialize["network"] = o.Network + if !IsNil(o.Registry) { + toSerialize["registry"] = o.Registry + } + if !IsNil(o.RuntimeStatus) { + toSerialize["runtimeStatus"] = o.RuntimeStatus + } + toSerialize["scaling"] = o.Scaling + if !IsNil(o.Secrets) { + toSerialize["secrets"] = o.Secrets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateApplicationPayload) 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{ + "containers", + "displayName", + "network", + "scaling", + } + + 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) + } + } + + varUpdateApplicationPayload := _UpdateApplicationPayload{} + + err = json.Unmarshal(data, &varUpdateApplicationPayload) + + if err != nil { + return err + } + + *o = UpdateApplicationPayload(varUpdateApplicationPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "containers") + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + delete(additionalProperties, "network") + delete(additionalProperties, "registry") + delete(additionalProperties, "runtimeStatus") + delete(additionalProperties, "scaling") + delete(additionalProperties, "secrets") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateApplicationPayload struct { + value *UpdateApplicationPayload + isSet bool +} + +func (v NullableUpdateApplicationPayload) Get() *UpdateApplicationPayload { + return v.value +} + +func (v *NullableUpdateApplicationPayload) Set(val *UpdateApplicationPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateApplicationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateApplicationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateApplicationPayload(val *UpdateApplicationPayload) *NullableUpdateApplicationPayload { + return &NullableUpdateApplicationPayload{value: val, isSet: true} +} + +func (v NullableUpdateApplicationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateApplicationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sca/v1alphaapi/response.go b/services/sca/v1alphaapi/response.go new file mode 100644 index 000000000..326e64cc2 --- /dev/null +++ b/services/sca/v1alphaapi/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// 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/sca/v1alphaapi/utils.go b/services/sca/v1alphaapi/utils.go new file mode 100644 index 000000000..932cb2c49 --- /dev/null +++ b/services/sca/v1alphaapi/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Container Applications (SCA) + +STACKIT Container Applications (SCA) is a Platform as a Service (PaaS) that provides developers with a complete, managed platform to deploy and operate applications without managing the underlying infrastructure. + +API version: 1alpha.0.0 +*/ + +// 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...) +}