diff --git a/go.work b/go.work index 976faa29d..40c54fe12 100644 --- a/go.work +++ b/go.work @@ -83,4 +83,5 @@ use ( ./services/telemetrylink ./services/telemetryrouter ./services/vpn + ./services/workflows ) diff --git a/services/workflows/LICENSE.md b/services/workflows/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/workflows/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/workflows/go.mod b/services/workflows/go.mod new file mode 100644 index 000000000..df3ad3342 --- /dev/null +++ b/services/workflows/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/workflows + +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/workflows/go.sum b/services/workflows/go.sum new file mode 100644 index 000000000..3712a0c87 --- /dev/null +++ b/services/workflows/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/workflows/oas_commit b/services/workflows/oas_commit new file mode 100644 index 000000000..308f94ffe --- /dev/null +++ b/services/workflows/oas_commit @@ -0,0 +1 @@ +00b020b2998425397c9a0e51364fe8846fa66880 diff --git a/services/workflows/package.go b/services/workflows/package.go new file mode 100644 index 000000000..8f3b66c70 --- /dev/null +++ b/services/workflows/package.go @@ -0,0 +1 @@ +package workflows diff --git a/services/workflows/v1alphaapi/api_default.go b/services/workflows/v1alphaapi/api_default.go new file mode 100644 index 000000000..153e5317c --- /dev/null +++ b/services/workflows/v1alphaapi/api_default.go @@ -0,0 +1,2789 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// 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 { + + /* + CreateDagBundle Method for CreateDagBundle + + Adds a new DAG bundle to this STACKIT Workflows instance. Only supported for Airflow 3 instances. Maximum 10 bundles per instance. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiCreateDagBundleRequest + */ + CreateDagBundle(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateDagBundleRequest + + // CreateDagBundleExecute executes the request + // @return DagBundleResponse + CreateDagBundleExecute(r ApiCreateDagBundleRequest) (*DagBundleResponse, error) + + /* + CreateInstance Method for CreateInstance + + Creates a new STACKIT Workflows instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @return ApiCreateInstanceRequest + */ + CreateInstance(ctx context.Context, projectId string, regionId string) ApiCreateInstanceRequest + + // CreateInstanceExecute executes the request + // @return Instance + CreateInstanceExecute(r ApiCreateInstanceRequest) (*Instance, error) + + /* + DeleteDagBundle Method for DeleteDagBundle + + Removes a DAG bundle from this STACKIT Workflows instance. At least one bundle must remain configured. Only supported for Airflow 3 instances. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @param bundleName The unique name of the DAG bundle. Must be a valid DNS label (lowercase alphanumeric and hyphens, max 63 characters). + @return ApiDeleteDagBundleRequest + */ + DeleteDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiDeleteDagBundleRequest + + // DeleteDagBundleExecute executes the request + DeleteDagBundleExecute(r ApiDeleteDagBundleRequest) error + + /* + DeleteInstance Method for DeleteInstance + + Deletes the given STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiDeleteInstanceRequest + */ + DeleteInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteInstanceRequest + + // DeleteInstanceExecute executes the request + DeleteInstanceExecute(r ApiDeleteInstanceRequest) error + + /* + GetDagBundle Method for GetDagBundle + + Returns the configuration of a single DAG bundle. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @param bundleName The unique name of the DAG bundle. Must be a valid DNS label (lowercase alphanumeric and hyphens, max 63 characters). + @return ApiGetDagBundleRequest + */ + GetDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiGetDagBundleRequest + + // GetDagBundleExecute executes the request + // @return DagBundleResponse + GetDagBundleExecute(r ApiGetDagBundleRequest) (*DagBundleResponse, error) + + /* + GetInstance Method for GetInstance + + Returns the details for the given STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiGetInstanceRequest + */ + GetInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetInstanceRequest + + // GetInstanceExecute executes the request + // @return Instance + GetInstanceExecute(r ApiGetInstanceRequest) (*Instance, error) + + /* + GetProviderOptions Get provider options + + Returns a list of supported configuration options for this region. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @return ApiGetProviderOptionsRequest + */ + GetProviderOptions(ctx context.Context, regionId string) ApiGetProviderOptionsRequest + + // GetProviderOptionsExecute executes the request + // @return ProviderOptions + GetProviderOptionsExecute(r ApiGetProviderOptionsRequest) (*ProviderOptions, error) + + /* + ListDagBundles Method for ListDagBundles + + Returns a list of all DAG bundles configured for this STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiListDagBundlesRequest + */ + ListDagBundles(ctx context.Context, projectId string, regionId string, instanceId string) ApiListDagBundlesRequest + + // ListDagBundlesExecute executes the request + // @return ListDagBundlesResponse + ListDagBundlesExecute(r ApiListDagBundlesRequest) (*ListDagBundlesResponse, error) + + /* + ListInstances Method for ListInstances + + Returns a list of all STACKIT Workflows instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @return ApiListInstancesRequest + */ + ListInstances(ctx context.Context, projectId string, regionId string) ApiListInstancesRequest + + // ListInstancesExecute executes the request + // @return ListInstancesResponse + ListInstancesExecute(r ApiListInstancesRequest) (*ListInstancesResponse, error) + + /* + UpdateDagBundle Method for UpdateDagBundle + + Updates an existing DAG bundle. The bundle type (git/s3) is inferred from the existing bundle and cannot be changed. To change the type, delete and recreate the bundle. Only supported for Airflow 3 instances. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @param bundleName The unique name of the DAG bundle. Must be a valid DNS label (lowercase alphanumeric and hyphens, max 63 characters). + @return ApiUpdateDagBundleRequest + */ + UpdateDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiUpdateDagBundleRequest + + // UpdateDagBundleExecute executes the request + // @return DagBundleResponse + UpdateDagBundleExecute(r ApiUpdateDagBundleRequest) (*DagBundleResponse, error) + + /* + UpdateDagsRepository Method for UpdateDagsRepository + + Updates the DAGs repository configuration for this STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiUpdateDagsRepositoryRequest + */ + UpdateDagsRepository(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateDagsRepositoryRequest + + // UpdateDagsRepositoryExecute executes the request + // @return Instance + UpdateDagsRepositoryExecute(r ApiUpdateDagsRepositoryRequest) (*Instance, error) + + /* + UpdateIdentityProvider Method for UpdateIdentityProvider + + Updates the identity provider configuration for this STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiUpdateIdentityProviderRequest + */ + UpdateIdentityProvider(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateIdentityProviderRequest + + // UpdateIdentityProviderExecute executes the request + // @return Instance + UpdateIdentityProviderExecute(r ApiUpdateIdentityProviderRequest) (*Instance, error) + + /* + UpdateInstance Method for UpdateInstance + + Updates core Attributes of this STACKIT Workflows Instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiUpdateInstanceRequest + */ + UpdateInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateInstanceRequest + + // UpdateInstanceExecute executes the request + // @return Instance + UpdateInstanceExecute(r ApiUpdateInstanceRequest) (*Instance, error) + + /* + UpdateObservability Method for UpdateObservability + + Updates the Observability configuration for this STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiUpdateObservabilityRequest + */ + UpdateObservability(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateObservabilityRequest + + // UpdateObservabilityExecute executes the request + // @return Instance + UpdateObservabilityExecute(r ApiUpdateObservabilityRequest) (*Instance, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateDagBundleRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + createDagBundlePayload *CreateDagBundlePayload +} + +func (r ApiCreateDagBundleRequest) CreateDagBundlePayload(createDagBundlePayload CreateDagBundlePayload) ApiCreateDagBundleRequest { + r.createDagBundlePayload = &createDagBundlePayload + return r +} + +func (r ApiCreateDagBundleRequest) Execute() (*DagBundleResponse, error) { + return r.ApiService.CreateDagBundleExecute(r) +} + +/* +CreateDagBundle Method for CreateDagBundle + +Adds a new DAG bundle to this STACKIT Workflows instance. Only supported for Airflow 3 instances. Maximum 10 bundles per instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiCreateDagBundleRequest +*/ +func (a *DefaultAPIService) CreateDagBundle(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateDagBundleRequest { + return ApiCreateDagBundleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return DagBundleResponse +func (a *DefaultAPIService) CreateDagBundleExecute(r ApiCreateDagBundleRequest) (*DagBundleResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DagBundleResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateDagBundle") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/dag-bundles" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDagBundlePayload == nil { + return localVarReturnValue, reportError("createDagBundlePayload 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.createDagBundlePayload + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiCreateInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + createInstancePayload *CreateInstancePayload +} + +func (r ApiCreateInstanceRequest) CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest { + r.createInstancePayload = &createInstancePayload + return r +} + +func (r ApiCreateInstanceRequest) Execute() (*Instance, error) { + return r.ApiService.CreateInstanceExecute(r) +} + +/* +CreateInstance Method for CreateInstance + +Creates a new STACKIT Workflows instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @return ApiCreateInstanceRequest +*/ +func (a *DefaultAPIService) CreateInstance(ctx context.Context, projectId string, regionId string) ApiCreateInstanceRequest { + return ApiCreateInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return Instance +func (a *DefaultAPIService) CreateInstanceExecute(r ApiCreateInstanceRequest) (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createInstancePayload == nil { + return localVarReturnValue, reportError("createInstancePayload 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.createInstancePayload + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiDeleteDagBundleRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + bundleName string +} + +func (r ApiDeleteDagBundleRequest) Execute() error { + return r.ApiService.DeleteDagBundleExecute(r) +} + +/* +DeleteDagBundle Method for DeleteDagBundle + +Removes a DAG bundle from this STACKIT Workflows instance. At least one bundle must remain configured. Only supported for Airflow 3 instances. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @param bundleName The unique name of the DAG bundle. Must be a valid DNS label (lowercase alphanumeric and hyphens, max 63 characters). + @return ApiDeleteDagBundleRequest +*/ +func (a *DefaultAPIService) DeleteDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiDeleteDagBundleRequest { + return ApiDeleteDagBundleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + bundleName: bundleName, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteDagBundleExecute(r ApiDeleteDagBundleRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteDagBundle") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/dag-bundles/{bundleName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"bundleName"+"}", url.PathEscape(parameterValueToString(r.bundleName, "bundleName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.bundleName) > 63 { + return reportError("bundleName must have less than 63 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiDeleteInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteInstanceRequest) Execute() error { + return r.ApiService.DeleteInstanceExecute(r) +} + +/* +DeleteInstance Method for DeleteInstance + +Deletes the given STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiDeleteInstanceRequest +*/ +func (a *DefaultAPIService) DeleteInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteInstanceRequest { + return ApiDeleteInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteInstanceExecute(r ApiDeleteInstanceRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteInstance") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiGetDagBundleRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + bundleName string +} + +func (r ApiGetDagBundleRequest) Execute() (*DagBundleResponse, error) { + return r.ApiService.GetDagBundleExecute(r) +} + +/* +GetDagBundle Method for GetDagBundle + +Returns the configuration of a single DAG bundle. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @param bundleName The unique name of the DAG bundle. Must be a valid DNS label (lowercase alphanumeric and hyphens, max 63 characters). + @return ApiGetDagBundleRequest +*/ +func (a *DefaultAPIService) GetDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiGetDagBundleRequest { + return ApiGetDagBundleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + bundleName: bundleName, + } +} + +// Execute executes the request +// +// @return DagBundleResponse +func (a *DefaultAPIService) GetDagBundleExecute(r ApiGetDagBundleRequest) (*DagBundleResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DagBundleResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetDagBundle") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/dag-bundles/{bundleName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"bundleName"+"}", url.PathEscape(parameterValueToString(r.bundleName, "bundleName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.bundleName) > 63 { + return localVarReturnValue, reportError("bundleName must have less than 63 elements") + } + + // 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiGetInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiGetInstanceRequest) Execute() (*Instance, error) { + return r.ApiService.GetInstanceExecute(r) +} + +/* +GetInstance Method for GetInstance + +Returns the details for the given STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiGetInstanceRequest +*/ +func (a *DefaultAPIService) GetInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetInstanceRequest { + return ApiGetInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return Instance +func (a *DefaultAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiGetProviderOptionsRequest struct { + ctx context.Context + ApiService DefaultAPI + regionId string +} + +func (r ApiGetProviderOptionsRequest) Execute() (*ProviderOptions, error) { + return r.ApiService.GetProviderOptionsExecute(r) +} + +/* +GetProviderOptions Get provider options + +Returns a list of supported configuration options for this region. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @return ApiGetProviderOptionsRequest +*/ +func (a *DefaultAPIService) GetProviderOptions(ctx context.Context, regionId string) ApiGetProviderOptionsRequest { + return ApiGetProviderOptionsRequest{ + ApiService: a, + ctx: ctx, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return ProviderOptions +func (a *DefaultAPIService) GetProviderOptionsExecute(r ApiGetProviderOptionsRequest) (*ProviderOptions, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProviderOptions + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetProviderOptions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/regions/{regionId}/provider-options" + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiListDagBundlesRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiListDagBundlesRequest) Execute() (*ListDagBundlesResponse, error) { + return r.ApiService.ListDagBundlesExecute(r) +} + +/* +ListDagBundles Method for ListDagBundles + +Returns a list of all DAG bundles configured for this STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiListDagBundlesRequest +*/ +func (a *DefaultAPIService) ListDagBundles(ctx context.Context, projectId string, regionId string, instanceId string) ApiListDagBundlesRequest { + return ApiListDagBundlesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return ListDagBundlesResponse +func (a *DefaultAPIService) ListDagBundlesExecute(r ApiListDagBundlesRequest) (*ListDagBundlesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListDagBundlesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListDagBundles") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/dag-bundles" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiListInstancesRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string +} + +func (r ApiListInstancesRequest) Execute() (*ListInstancesResponse, error) { + return r.ApiService.ListInstancesExecute(r) +} + +/* +ListInstances Method for ListInstances + +Returns a list of all STACKIT Workflows instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @return ApiListInstancesRequest +*/ +func (a *DefaultAPIService) ListInstances(ctx context.Context, projectId string, regionId string) ApiListInstancesRequest { + return ApiListInstancesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return ListInstancesResponse +func (a *DefaultAPIService) ListInstancesExecute(r ApiListInstancesRequest) (*ListInstancesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListInstancesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListInstances") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiUpdateDagBundleRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + bundleName string + updateDagBundlePayload *UpdateDagBundlePayload +} + +func (r ApiUpdateDagBundleRequest) UpdateDagBundlePayload(updateDagBundlePayload UpdateDagBundlePayload) ApiUpdateDagBundleRequest { + r.updateDagBundlePayload = &updateDagBundlePayload + return r +} + +func (r ApiUpdateDagBundleRequest) Execute() (*DagBundleResponse, error) { + return r.ApiService.UpdateDagBundleExecute(r) +} + +/* +UpdateDagBundle Method for UpdateDagBundle + +Updates an existing DAG bundle. The bundle type (git/s3) is inferred from the existing bundle and cannot be changed. To change the type, delete and recreate the bundle. Only supported for Airflow 3 instances. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @param bundleName The unique name of the DAG bundle. Must be a valid DNS label (lowercase alphanumeric and hyphens, max 63 characters). + @return ApiUpdateDagBundleRequest +*/ +func (a *DefaultAPIService) UpdateDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiUpdateDagBundleRequest { + return ApiUpdateDagBundleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + bundleName: bundleName, + } +} + +// Execute executes the request +// +// @return DagBundleResponse +func (a *DefaultAPIService) UpdateDagBundleExecute(r ApiUpdateDagBundleRequest) (*DagBundleResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DagBundleResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateDagBundle") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/dag-bundles/{bundleName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"bundleName"+"}", url.PathEscape(parameterValueToString(r.bundleName, "bundleName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.bundleName) > 63 { + return localVarReturnValue, reportError("bundleName must have less than 63 elements") + } + if r.updateDagBundlePayload == nil { + return localVarReturnValue, reportError("updateDagBundlePayload 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.updateDagBundlePayload + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiUpdateDagsRepositoryRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + updateDagsRepositoryPayload *UpdateDagsRepositoryPayload +} + +func (r ApiUpdateDagsRepositoryRequest) UpdateDagsRepositoryPayload(updateDagsRepositoryPayload UpdateDagsRepositoryPayload) ApiUpdateDagsRepositoryRequest { + r.updateDagsRepositoryPayload = &updateDagsRepositoryPayload + return r +} + +func (r ApiUpdateDagsRepositoryRequest) Execute() (*Instance, error) { + return r.ApiService.UpdateDagsRepositoryExecute(r) +} + +/* +UpdateDagsRepository Method for UpdateDagsRepository + +Updates the DAGs repository configuration for this STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiUpdateDagsRepositoryRequest +*/ +func (a *DefaultAPIService) UpdateDagsRepository(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateDagsRepositoryRequest { + return ApiUpdateDagsRepositoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return Instance +func (a *DefaultAPIService) UpdateDagsRepositoryExecute(r ApiUpdateDagsRepositoryRequest) (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateDagsRepository") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/dags-repository" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateDagsRepositoryPayload == nil { + return localVarReturnValue, reportError("updateDagsRepositoryPayload 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.updateDagsRepositoryPayload + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiUpdateIdentityProviderRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + updateIdentityProviderPayload *UpdateIdentityProviderPayload +} + +func (r ApiUpdateIdentityProviderRequest) UpdateIdentityProviderPayload(updateIdentityProviderPayload UpdateIdentityProviderPayload) ApiUpdateIdentityProviderRequest { + r.updateIdentityProviderPayload = &updateIdentityProviderPayload + return r +} + +func (r ApiUpdateIdentityProviderRequest) Execute() (*Instance, error) { + return r.ApiService.UpdateIdentityProviderExecute(r) +} + +/* +UpdateIdentityProvider Method for UpdateIdentityProvider + +Updates the identity provider configuration for this STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiUpdateIdentityProviderRequest +*/ +func (a *DefaultAPIService) UpdateIdentityProvider(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateIdentityProviderRequest { + return ApiUpdateIdentityProviderRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return Instance +func (a *DefaultAPIService) UpdateIdentityProviderExecute(r ApiUpdateIdentityProviderRequest) (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateIdentityProvider") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/identity-provider" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateIdentityProviderPayload == nil { + return localVarReturnValue, reportError("updateIdentityProviderPayload 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.updateIdentityProviderPayload + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiUpdateInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + updateInstancePayload *UpdateInstancePayload +} + +func (r ApiUpdateInstanceRequest) UpdateInstancePayload(updateInstancePayload UpdateInstancePayload) ApiUpdateInstanceRequest { + r.updateInstancePayload = &updateInstancePayload + return r +} + +func (r ApiUpdateInstanceRequest) Execute() (*Instance, error) { + return r.ApiService.UpdateInstanceExecute(r) +} + +/* +UpdateInstance Method for UpdateInstance + +Updates core Attributes of this STACKIT Workflows Instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiUpdateInstanceRequest +*/ +func (a *DefaultAPIService) UpdateInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateInstanceRequest { + return ApiUpdateInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return Instance +func (a *DefaultAPIService) UpdateInstanceExecute(r ApiUpdateInstanceRequest) (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateInstancePayload == nil { + return localVarReturnValue, reportError("updateInstancePayload 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.updateInstancePayload + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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 ApiUpdateObservabilityRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + updateObservabilityPayload *UpdateObservabilityPayload +} + +func (r ApiUpdateObservabilityRequest) UpdateObservabilityPayload(updateObservabilityPayload UpdateObservabilityPayload) ApiUpdateObservabilityRequest { + r.updateObservabilityPayload = &updateObservabilityPayload + return r +} + +func (r ApiUpdateObservabilityRequest) Execute() (*Instance, error) { + return r.ApiService.UpdateObservabilityExecute(r) +} + +/* +UpdateObservability Method for UpdateObservability + +Updates the Observability configuration for this STACKIT Workflows instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the STACKIT Workflows instance is part of. + @param regionId The STACKIT region the STACKIT Workflows instance is part of. + @param instanceId The STACKIT Workflows instance UUID. + @return ApiUpdateObservabilityRequest +*/ +func (a *DefaultAPIService) UpdateObservability(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateObservabilityRequest { + return ApiUpdateObservabilityRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return Instance +func (a *DefaultAPIService) UpdateObservabilityExecute(r ApiUpdateObservabilityRequest) (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateObservability") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/observability" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateObservabilityPayload == nil { + return localVarReturnValue, reportError("updateObservabilityPayload 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.updateObservabilityPayload + 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 ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResponse + 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/workflows/v1alphaapi/api_default_mock.go b/services/workflows/v1alphaapi/api_default_mock.go new file mode 100644 index 000000000..2faceb432 --- /dev/null +++ b/services/workflows/v1alphaapi/api_default_mock.go @@ -0,0 +1,328 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// 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 { + // CreateDagBundleExecuteMock can be populated to implement the behavior of the CreateDagBundleExecute function of this mock + CreateDagBundleExecuteMock *func(r ApiCreateDagBundleRequest) (*DagBundleResponse, error) + // CreateInstanceExecuteMock can be populated to implement the behavior of the CreateInstanceExecute function of this mock + CreateInstanceExecuteMock *func(r ApiCreateInstanceRequest) (*Instance, error) + // DeleteDagBundleExecuteMock can be populated to implement the behavior of the DeleteDagBundleExecute function of this mock + DeleteDagBundleExecuteMock *func(r ApiDeleteDagBundleRequest) error + // DeleteInstanceExecuteMock can be populated to implement the behavior of the DeleteInstanceExecute function of this mock + DeleteInstanceExecuteMock *func(r ApiDeleteInstanceRequest) error + // GetDagBundleExecuteMock can be populated to implement the behavior of the GetDagBundleExecute function of this mock + GetDagBundleExecuteMock *func(r ApiGetDagBundleRequest) (*DagBundleResponse, error) + // GetInstanceExecuteMock can be populated to implement the behavior of the GetInstanceExecute function of this mock + GetInstanceExecuteMock *func(r ApiGetInstanceRequest) (*Instance, error) + // GetProviderOptionsExecuteMock can be populated to implement the behavior of the GetProviderOptionsExecute function of this mock + GetProviderOptionsExecuteMock *func(r ApiGetProviderOptionsRequest) (*ProviderOptions, error) + // ListDagBundlesExecuteMock can be populated to implement the behavior of the ListDagBundlesExecute function of this mock + ListDagBundlesExecuteMock *func(r ApiListDagBundlesRequest) (*ListDagBundlesResponse, error) + // ListInstancesExecuteMock can be populated to implement the behavior of the ListInstancesExecute function of this mock + ListInstancesExecuteMock *func(r ApiListInstancesRequest) (*ListInstancesResponse, error) + // UpdateDagBundleExecuteMock can be populated to implement the behavior of the UpdateDagBundleExecute function of this mock + UpdateDagBundleExecuteMock *func(r ApiUpdateDagBundleRequest) (*DagBundleResponse, error) + // UpdateDagsRepositoryExecuteMock can be populated to implement the behavior of the UpdateDagsRepositoryExecute function of this mock + UpdateDagsRepositoryExecuteMock *func(r ApiUpdateDagsRepositoryRequest) (*Instance, error) + // UpdateIdentityProviderExecuteMock can be populated to implement the behavior of the UpdateIdentityProviderExecute function of this mock + UpdateIdentityProviderExecuteMock *func(r ApiUpdateIdentityProviderRequest) (*Instance, error) + // UpdateInstanceExecuteMock can be populated to implement the behavior of the UpdateInstanceExecute function of this mock + UpdateInstanceExecuteMock *func(r ApiUpdateInstanceRequest) (*Instance, error) + // UpdateObservabilityExecuteMock can be populated to implement the behavior of the UpdateObservabilityExecute function of this mock + UpdateObservabilityExecuteMock *func(r ApiUpdateObservabilityRequest) (*Instance, error) +} + +func (a DefaultAPIServiceMock) CreateDagBundle(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateDagBundleRequest { + return ApiCreateDagBundleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// CreateDagBundleExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateDagBundleExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateDagBundleExecute(r ApiCreateDagBundleRequest) (*DagBundleResponse, error) { + if a.CreateDagBundleExecuteMock == nil { + var localVarReturnValue *DagBundleResponse + return localVarReturnValue, nil + } + + return (*a.CreateDagBundleExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateInstance(ctx context.Context, projectId string, regionId string) ApiCreateInstanceRequest { + return ApiCreateInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// CreateInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateInstanceExecute(r ApiCreateInstanceRequest) (*Instance, error) { + if a.CreateInstanceExecuteMock == nil { + var localVarReturnValue *Instance + return localVarReturnValue, nil + } + + return (*a.CreateInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiDeleteDagBundleRequest { + return ApiDeleteDagBundleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + bundleName: bundleName, + } +} + +// DeleteDagBundleExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteDagBundleExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteDagBundleExecute(r ApiDeleteDagBundleRequest) error { + if a.DeleteDagBundleExecuteMock == nil { + return nil + } + + return (*a.DeleteDagBundleExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteInstanceRequest { + return ApiDeleteInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteInstanceExecute(r ApiDeleteInstanceRequest) error { + if a.DeleteInstanceExecuteMock == nil { + return nil + } + + return (*a.DeleteInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiGetDagBundleRequest { + return ApiGetDagBundleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + bundleName: bundleName, + } +} + +// GetDagBundleExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetDagBundleExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetDagBundleExecute(r ApiGetDagBundleRequest) (*DagBundleResponse, error) { + if a.GetDagBundleExecuteMock == nil { + var localVarReturnValue *DagBundleResponse + return localVarReturnValue, nil + } + + return (*a.GetDagBundleExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetInstanceRequest { + return ApiGetInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// GetInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetInstanceExecute(r ApiGetInstanceRequest) (*Instance, error) { + if a.GetInstanceExecuteMock == nil { + var localVarReturnValue *Instance + return localVarReturnValue, nil + } + + return (*a.GetInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetProviderOptions(ctx context.Context, regionId string) ApiGetProviderOptionsRequest { + return ApiGetProviderOptionsRequest{ + ApiService: a, + ctx: ctx, + regionId: regionId, + } +} + +// GetProviderOptionsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetProviderOptionsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetProviderOptionsExecute(r ApiGetProviderOptionsRequest) (*ProviderOptions, error) { + if a.GetProviderOptionsExecuteMock == nil { + var localVarReturnValue *ProviderOptions + return localVarReturnValue, nil + } + + return (*a.GetProviderOptionsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListDagBundles(ctx context.Context, projectId string, regionId string, instanceId string) ApiListDagBundlesRequest { + return ApiListDagBundlesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// ListDagBundlesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListDagBundlesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListDagBundlesExecute(r ApiListDagBundlesRequest) (*ListDagBundlesResponse, error) { + if a.ListDagBundlesExecuteMock == nil { + var localVarReturnValue *ListDagBundlesResponse + return localVarReturnValue, nil + } + + return (*a.ListDagBundlesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListInstances(ctx context.Context, projectId string, regionId string) ApiListInstancesRequest { + return ApiListInstancesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// ListInstancesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListInstancesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListInstancesExecute(r ApiListInstancesRequest) (*ListInstancesResponse, error) { + if a.ListInstancesExecuteMock == nil { + var localVarReturnValue *ListInstancesResponse + return localVarReturnValue, nil + } + + return (*a.ListInstancesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateDagBundle(ctx context.Context, projectId string, regionId string, instanceId string, bundleName string) ApiUpdateDagBundleRequest { + return ApiUpdateDagBundleRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + bundleName: bundleName, + } +} + +// UpdateDagBundleExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateDagBundleExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateDagBundleExecute(r ApiUpdateDagBundleRequest) (*DagBundleResponse, error) { + if a.UpdateDagBundleExecuteMock == nil { + var localVarReturnValue *DagBundleResponse + return localVarReturnValue, nil + } + + return (*a.UpdateDagBundleExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateDagsRepository(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateDagsRepositoryRequest { + return ApiUpdateDagsRepositoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// UpdateDagsRepositoryExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateDagsRepositoryExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateDagsRepositoryExecute(r ApiUpdateDagsRepositoryRequest) (*Instance, error) { + if a.UpdateDagsRepositoryExecuteMock == nil { + var localVarReturnValue *Instance + return localVarReturnValue, nil + } + + return (*a.UpdateDagsRepositoryExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateIdentityProvider(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateIdentityProviderRequest { + return ApiUpdateIdentityProviderRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// UpdateIdentityProviderExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateIdentityProviderExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateIdentityProviderExecute(r ApiUpdateIdentityProviderRequest) (*Instance, error) { + if a.UpdateIdentityProviderExecuteMock == nil { + var localVarReturnValue *Instance + return localVarReturnValue, nil + } + + return (*a.UpdateIdentityProviderExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateInstanceRequest { + return ApiUpdateInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// UpdateInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateInstanceExecute(r ApiUpdateInstanceRequest) (*Instance, error) { + if a.UpdateInstanceExecuteMock == nil { + var localVarReturnValue *Instance + return localVarReturnValue, nil + } + + return (*a.UpdateInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateObservability(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateObservabilityRequest { + return ApiUpdateObservabilityRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// UpdateObservabilityExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateObservabilityExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateObservabilityExecute(r ApiUpdateObservabilityRequest) (*Instance, error) { + if a.UpdateObservabilityExecuteMock == nil { + var localVarReturnValue *Instance + return localVarReturnValue, nil + } + + return (*a.UpdateObservabilityExecuteMock)(r) +} diff --git a/services/workflows/v1alphaapi/client.go b/services/workflows/v1alphaapi/client.go new file mode 100644 index 000000000..b4cd9e340 --- /dev/null +++ b/services/workflows/v1alphaapi/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// 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 Workflows API API v1alpha.0.1 +// 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/workflows/v1alphaapi/configuration.go b/services/workflows/v1alphaapi/configuration.go new file mode 100644 index 000000000..ffd845f13 --- /dev/null +++ b/services/workflows/v1alphaapi/configuration.go @@ -0,0 +1,37 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// 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/workflows", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://workflows.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/workflows/v1alphaapi/model_basic_auth.go b/services/workflows/v1alphaapi/model_basic_auth.go new file mode 100644 index 000000000..2b352ff8a --- /dev/null +++ b/services/workflows/v1alphaapi/model_basic_auth.go @@ -0,0 +1,230 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the BasicAuth type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BasicAuth{} + +// BasicAuth struct for BasicAuth +type BasicAuth struct { + // The password or token + Password *string `json:"password,omitempty"` + // Type of authentication + Type *string `json:"type,omitempty"` + // The username + Username *string `json:"username,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BasicAuth BasicAuth + +// NewBasicAuth instantiates a new BasicAuth 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 NewBasicAuth() *BasicAuth { + this := BasicAuth{} + return &this +} + +// NewBasicAuthWithDefaults instantiates a new BasicAuth 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 NewBasicAuthWithDefaults() *BasicAuth { + this := BasicAuth{} + return &this +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *BasicAuth) 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 *BasicAuth) 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 *BasicAuth) 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 *BasicAuth) SetPassword(v string) { + o.Password = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *BasicAuth) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BasicAuth) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *BasicAuth) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *BasicAuth) SetType(v string) { + o.Type = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *BasicAuth) GetUsername() string { + if o == nil || IsNil(o.Username) { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BasicAuth) GetUsernameOk() (*string, bool) { + if o == nil || IsNil(o.Username) { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *BasicAuth) HasUsername() bool { + if o != nil && !IsNil(o.Username) { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *BasicAuth) SetUsername(v string) { + o.Username = &v +} + +func (o BasicAuth) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BasicAuth) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Password) { + toSerialize["password"] = o.Password + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Username) { + toSerialize["username"] = o.Username + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BasicAuth) UnmarshalJSON(data []byte) (err error) { + varBasicAuth := _BasicAuth{} + + err = json.Unmarshal(data, &varBasicAuth) + + if err != nil { + return err + } + + *o = BasicAuth(varBasicAuth) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "password") + delete(additionalProperties, "type") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBasicAuth struct { + value *BasicAuth + isSet bool +} + +func (v NullableBasicAuth) Get() *BasicAuth { + return v.value +} + +func (v *NullableBasicAuth) Set(val *BasicAuth) { + v.value = val + v.isSet = true +} + +func (v NullableBasicAuth) IsSet() bool { + return v.isSet +} + +func (v *NullableBasicAuth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBasicAuth(val *BasicAuth) *NullableBasicAuth { + return &NullableBasicAuth{value: val, isSet: true} +} + +func (v NullableBasicAuth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBasicAuth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_basic_auth_response.go b/services/workflows/v1alphaapi/model_basic_auth_response.go new file mode 100644 index 000000000..2723522f2 --- /dev/null +++ b/services/workflows/v1alphaapi/model_basic_auth_response.go @@ -0,0 +1,230 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the BasicAuthResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BasicAuthResponse{} + +// BasicAuthResponse Basic authentication as returned in API responses. The password field is always masked (\"**********\") and never contains the real value. +type BasicAuthResponse struct { + // Always returned as \"**********\". The actual password is never exposed in API responses. + Password *string `json:"password,omitempty"` + // Type of authentication + Type *string `json:"type,omitempty"` + // The username + Username *string `json:"username,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _BasicAuthResponse BasicAuthResponse + +// NewBasicAuthResponse instantiates a new BasicAuthResponse 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 NewBasicAuthResponse() *BasicAuthResponse { + this := BasicAuthResponse{} + return &this +} + +// NewBasicAuthResponseWithDefaults instantiates a new BasicAuthResponse 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 NewBasicAuthResponseWithDefaults() *BasicAuthResponse { + this := BasicAuthResponse{} + return &this +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *BasicAuthResponse) 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 *BasicAuthResponse) 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 *BasicAuthResponse) 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 *BasicAuthResponse) SetPassword(v string) { + o.Password = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *BasicAuthResponse) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BasicAuthResponse) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *BasicAuthResponse) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *BasicAuthResponse) SetType(v string) { + o.Type = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *BasicAuthResponse) GetUsername() string { + if o == nil || IsNil(o.Username) { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BasicAuthResponse) GetUsernameOk() (*string, bool) { + if o == nil || IsNil(o.Username) { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *BasicAuthResponse) HasUsername() bool { + if o != nil && !IsNil(o.Username) { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *BasicAuthResponse) SetUsername(v string) { + o.Username = &v +} + +func (o BasicAuthResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BasicAuthResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Password) { + toSerialize["password"] = o.Password + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Username) { + toSerialize["username"] = o.Username + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BasicAuthResponse) UnmarshalJSON(data []byte) (err error) { + varBasicAuthResponse := _BasicAuthResponse{} + + err = json.Unmarshal(data, &varBasicAuthResponse) + + if err != nil { + return err + } + + *o = BasicAuthResponse(varBasicAuthResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "password") + delete(additionalProperties, "type") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBasicAuthResponse struct { + value *BasicAuthResponse + isSet bool +} + +func (v NullableBasicAuthResponse) Get() *BasicAuthResponse { + return v.value +} + +func (v *NullableBasicAuthResponse) Set(val *BasicAuthResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBasicAuthResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBasicAuthResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBasicAuthResponse(val *BasicAuthResponse) *NullableBasicAuthResponse { + return &NullableBasicAuthResponse{value: val, isSet: true} +} + +func (v NullableBasicAuthResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBasicAuthResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_create_dag_bundle_config.go b/services/workflows/v1alphaapi/model_create_dag_bundle_config.go new file mode 100644 index 000000000..435bbdb18 --- /dev/null +++ b/services/workflows/v1alphaapi/model_create_dag_bundle_config.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// CreateDagBundleConfig - A DAG bundle configuration for instance creation (same shape as DagBundle). +type CreateDagBundleConfig struct { + GitDagBundle *GitDagBundle + S3DagBundle *S3DagBundle +} + +// GitDagBundleAsCreateDagBundleConfig is a convenience function that returns GitDagBundle wrapped in CreateDagBundleConfig +func GitDagBundleAsCreateDagBundleConfig(v *GitDagBundle) CreateDagBundleConfig { + return CreateDagBundleConfig{ + GitDagBundle: v, + } +} + +// S3DagBundleAsCreateDagBundleConfig is a convenience function that returns S3DagBundle wrapped in CreateDagBundleConfig +func S3DagBundleAsCreateDagBundleConfig(v *S3DagBundle) CreateDagBundleConfig { + return CreateDagBundleConfig{ + S3DagBundle: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateDagBundleConfig) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'git' + if jsonDict["type"] == "git" { + // try to unmarshal JSON data into GitDagBundle + err = json.Unmarshal(data, &dst.GitDagBundle) + if err == nil { + return nil // data stored in dst.GitDagBundle, return on the first match + } else { + dst.GitDagBundle = nil + return fmt.Errorf("failed to unmarshal CreateDagBundleConfig as GitDagBundle: %s", err.Error()) + } + } + + // check if the discriminator value is 's3' + if jsonDict["type"] == "s3" { + // try to unmarshal JSON data into S3DagBundle + err = json.Unmarshal(data, &dst.S3DagBundle) + if err == nil { + return nil // data stored in dst.S3DagBundle, return on the first match + } else { + dst.S3DagBundle = nil + return fmt.Errorf("failed to unmarshal CreateDagBundleConfig as S3DagBundle: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateDagBundleConfig) MarshalJSON() ([]byte, error) { + if src.GitDagBundle != nil { + return json.Marshal(&src.GitDagBundle) + } + + if src.S3DagBundle != nil { + return json.Marshal(&src.S3DagBundle) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *CreateDagBundleConfig) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GitDagBundle != nil { + return obj.GitDagBundle + } + + if obj.S3DagBundle != nil { + return obj.S3DagBundle + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj CreateDagBundleConfig) GetActualInstanceValue() interface{} { + if obj.GitDagBundle != nil { + return *obj.GitDagBundle + } + + if obj.S3DagBundle != nil { + return *obj.S3DagBundle + } + + // all schemas are nil + return nil +} + +type NullableCreateDagBundleConfig struct { + value *CreateDagBundleConfig + isSet bool +} + +func (v NullableCreateDagBundleConfig) Get() *CreateDagBundleConfig { + return v.value +} + +func (v *NullableCreateDagBundleConfig) Set(val *CreateDagBundleConfig) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDagBundleConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDagBundleConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDagBundleConfig(val *CreateDagBundleConfig) *NullableCreateDagBundleConfig { + return &NullableCreateDagBundleConfig{value: val, isSet: true} +} + +func (v NullableCreateDagBundleConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDagBundleConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_create_dag_bundle_payload.go b/services/workflows/v1alphaapi/model_create_dag_bundle_payload.go new file mode 100644 index 000000000..5ccad8800 --- /dev/null +++ b/services/workflows/v1alphaapi/model_create_dag_bundle_payload.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// CreateDagBundlePayload - A DAG bundle configuration. Discriminated by the \"type\" field. Supported types are \"git\" and \"s3\". +type CreateDagBundlePayload struct { + GitDagBundle *GitDagBundle + S3DagBundle *S3DagBundle +} + +// GitDagBundleAsCreateDagBundlePayload is a convenience function that returns GitDagBundle wrapped in CreateDagBundlePayload +func GitDagBundleAsCreateDagBundlePayload(v *GitDagBundle) CreateDagBundlePayload { + return CreateDagBundlePayload{ + GitDagBundle: v, + } +} + +// S3DagBundleAsCreateDagBundlePayload is a convenience function that returns S3DagBundle wrapped in CreateDagBundlePayload +func S3DagBundleAsCreateDagBundlePayload(v *S3DagBundle) CreateDagBundlePayload { + return CreateDagBundlePayload{ + S3DagBundle: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateDagBundlePayload) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'git' + if jsonDict["type"] == "git" { + // try to unmarshal JSON data into GitDagBundle + err = json.Unmarshal(data, &dst.GitDagBundle) + if err == nil { + return nil // data stored in dst.GitDagBundle, return on the first match + } else { + dst.GitDagBundle = nil + return fmt.Errorf("failed to unmarshal CreateDagBundlePayload as GitDagBundle: %s", err.Error()) + } + } + + // check if the discriminator value is 's3' + if jsonDict["type"] == "s3" { + // try to unmarshal JSON data into S3DagBundle + err = json.Unmarshal(data, &dst.S3DagBundle) + if err == nil { + return nil // data stored in dst.S3DagBundle, return on the first match + } else { + dst.S3DagBundle = nil + return fmt.Errorf("failed to unmarshal CreateDagBundlePayload as S3DagBundle: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateDagBundlePayload) MarshalJSON() ([]byte, error) { + if src.GitDagBundle != nil { + return json.Marshal(&src.GitDagBundle) + } + + if src.S3DagBundle != nil { + return json.Marshal(&src.S3DagBundle) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *CreateDagBundlePayload) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GitDagBundle != nil { + return obj.GitDagBundle + } + + if obj.S3DagBundle != nil { + return obj.S3DagBundle + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj CreateDagBundlePayload) GetActualInstanceValue() interface{} { + if obj.GitDagBundle != nil { + return *obj.GitDagBundle + } + + if obj.S3DagBundle != nil { + return *obj.S3DagBundle + } + + // all schemas are nil + return nil +} + +type NullableCreateDagBundlePayload struct { + value *CreateDagBundlePayload + isSet bool +} + +func (v NullableCreateDagBundlePayload) Get() *CreateDagBundlePayload { + return v.value +} + +func (v *NullableCreateDagBundlePayload) Set(val *CreateDagBundlePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDagBundlePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDagBundlePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDagBundlePayload(val *CreateDagBundlePayload) *NullableCreateDagBundlePayload { + return &NullableCreateDagBundlePayload{value: val, isSet: true} +} + +func (v NullableCreateDagBundlePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDagBundlePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_create_instance_payload.go b/services/workflows/v1alphaapi/model_create_instance_payload.go new file mode 100644 index 000000000..c7be36e74 --- /dev/null +++ b/services/workflows/v1alphaapi/model_create_instance_payload.go @@ -0,0 +1,422 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateInstancePayload{} + +// CreateInstancePayload struct for CreateInstancePayload +type CreateInstancePayload struct { + // List of DAG bundles to configure. Supports Git and S3 sources. If provided, this takes precedence over dagsRepository. At least one bundle must be specified. Maximum 10 bundles. Only supported for Airflow 3 versions. + DagBundles []CreateDagBundleConfig `json:"dagBundles,omitempty"` + DagsRepository *GitRepository `json:"dagsRepository,omitempty"` + // A user chosen description to distinguish multiple STACKIT Workflows instances. + Description *string `json:"description,omitempty"` + // The displayed name to distinguish multiple STACKIT Workflows instances. + DisplayName string `json:"displayName"` + IdentityProvider *IdentityProvider `json:"identityProvider,omitempty"` + Network *Network `json:"network,omitempty"` + // Unique identifier of the customer's observability instance. + ObservabilityId *string `json:"observabilityId,omitempty"` + // The version of the STACKIT Workflows to use. For valid versions please take a look at [provider-options](#tag/provider-options/operation/get-provider-options) + Version string `json:"version"` + AdditionalProperties map[string]interface{} +} + +type _CreateInstancePayload CreateInstancePayload + +// NewCreateInstancePayload instantiates a new CreateInstancePayload 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 NewCreateInstancePayload(displayName string, version string) *CreateInstancePayload { + this := CreateInstancePayload{} + this.DisplayName = displayName + this.Version = version + return &this +} + +// NewCreateInstancePayloadWithDefaults instantiates a new CreateInstancePayload 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 NewCreateInstancePayloadWithDefaults() *CreateInstancePayload { + this := CreateInstancePayload{} + return &this +} + +// GetDagBundles returns the DagBundles field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetDagBundles() []CreateDagBundleConfig { + if o == nil || IsNil(o.DagBundles) { + var ret []CreateDagBundleConfig + return ret + } + return o.DagBundles +} + +// GetDagBundlesOk returns a tuple with the DagBundles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetDagBundlesOk() ([]CreateDagBundleConfig, bool) { + if o == nil || IsNil(o.DagBundles) { + return nil, false + } + return o.DagBundles, true +} + +// HasDagBundles returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasDagBundles() bool { + if o != nil && !IsNil(o.DagBundles) { + return true + } + + return false +} + +// SetDagBundles gets a reference to the given []CreateDagBundleConfig and assigns it to the DagBundles field. +func (o *CreateInstancePayload) SetDagBundles(v []CreateDagBundleConfig) { + o.DagBundles = v +} + +// GetDagsRepository returns the DagsRepository field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetDagsRepository() GitRepository { + if o == nil || IsNil(o.DagsRepository) { + var ret GitRepository + return ret + } + return *o.DagsRepository +} + +// GetDagsRepositoryOk returns a tuple with the DagsRepository field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetDagsRepositoryOk() (*GitRepository, bool) { + if o == nil || IsNil(o.DagsRepository) { + return nil, false + } + return o.DagsRepository, true +} + +// HasDagsRepository returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasDagsRepository() bool { + if o != nil && !IsNil(o.DagsRepository) { + return true + } + + return false +} + +// SetDagsRepository gets a reference to the given GitRepository and assigns it to the DagsRepository field. +func (o *CreateInstancePayload) SetDagsRepository(v GitRepository) { + o.DagsRepository = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateInstancePayload) 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 *CreateInstancePayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateInstancePayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetIdentityProvider returns the IdentityProvider field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetIdentityProvider() IdentityProvider { + if o == nil || IsNil(o.IdentityProvider) { + var ret IdentityProvider + return ret + } + return *o.IdentityProvider +} + +// GetIdentityProviderOk returns a tuple with the IdentityProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetIdentityProviderOk() (*IdentityProvider, bool) { + if o == nil || IsNil(o.IdentityProvider) { + return nil, false + } + return o.IdentityProvider, true +} + +// HasIdentityProvider returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasIdentityProvider() bool { + if o != nil && !IsNil(o.IdentityProvider) { + return true + } + + return false +} + +// SetIdentityProvider gets a reference to the given IdentityProvider and assigns it to the IdentityProvider field. +func (o *CreateInstancePayload) SetIdentityProvider(v IdentityProvider) { + o.IdentityProvider = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetNetwork() Network { + if o == nil || IsNil(o.Network) { + var ret Network + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetNetworkOk() (*Network, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given Network and assigns it to the Network field. +func (o *CreateInstancePayload) SetNetwork(v Network) { + o.Network = &v +} + +// GetObservabilityId returns the ObservabilityId field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetObservabilityId() string { + if o == nil || IsNil(o.ObservabilityId) { + var ret string + return ret + } + return *o.ObservabilityId +} + +// GetObservabilityIdOk returns a tuple with the ObservabilityId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetObservabilityIdOk() (*string, bool) { + if o == nil || IsNil(o.ObservabilityId) { + return nil, false + } + return o.ObservabilityId, true +} + +// HasObservabilityId returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasObservabilityId() bool { + if o != nil && !IsNil(o.ObservabilityId) { + return true + } + + return false +} + +// SetObservabilityId gets a reference to the given string and assigns it to the ObservabilityId field. +func (o *CreateInstancePayload) SetObservabilityId(v string) { + o.ObservabilityId = &v +} + +// GetVersion returns the Version field value +func (o *CreateInstancePayload) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *CreateInstancePayload) SetVersion(v string) { + o.Version = v +} + +func (o CreateInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DagBundles) { + toSerialize["dagBundles"] = o.DagBundles + } + if !IsNil(o.DagsRepository) { + toSerialize["dagsRepository"] = o.DagsRepository + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.IdentityProvider) { + toSerialize["identityProvider"] = o.IdentityProvider + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.ObservabilityId) { + toSerialize["observabilityId"] = o.ObservabilityId + } + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateInstancePayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + "version", + } + + 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) + } + } + + varCreateInstancePayload := _CreateInstancePayload{} + + err = json.Unmarshal(data, &varCreateInstancePayload) + + if err != nil { + return err + } + + *o = CreateInstancePayload(varCreateInstancePayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "dagBundles") + delete(additionalProperties, "dagsRepository") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "identityProvider") + delete(additionalProperties, "network") + delete(additionalProperties, "observabilityId") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateInstancePayload struct { + value *CreateInstancePayload + isSet bool +} + +func (v NullableCreateInstancePayload) Get() *CreateInstancePayload { + return v.value +} + +func (v *NullableCreateInstancePayload) Set(val *CreateInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstancePayload(val *CreateInstancePayload) *NullableCreateInstancePayload { + return &NullableCreateInstancePayload{value: val, isSet: true} +} + +func (v NullableCreateInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_dag_bundle.go b/services/workflows/v1alphaapi/model_dag_bundle.go new file mode 100644 index 000000000..319d16446 --- /dev/null +++ b/services/workflows/v1alphaapi/model_dag_bundle.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// DagBundle - A DAG bundle configuration. Discriminated by the \"type\" field. Supported types are \"git\" and \"s3\". +type DagBundle struct { + GitDagBundle *GitDagBundle + S3DagBundle *S3DagBundle +} + +// GitDagBundleAsDagBundle is a convenience function that returns GitDagBundle wrapped in DagBundle +func GitDagBundleAsDagBundle(v *GitDagBundle) DagBundle { + return DagBundle{ + GitDagBundle: v, + } +} + +// S3DagBundleAsDagBundle is a convenience function that returns S3DagBundle wrapped in DagBundle +func S3DagBundleAsDagBundle(v *S3DagBundle) DagBundle { + return DagBundle{ + S3DagBundle: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *DagBundle) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'git' + if jsonDict["type"] == "git" { + // try to unmarshal JSON data into GitDagBundle + err = json.Unmarshal(data, &dst.GitDagBundle) + if err == nil { + return nil // data stored in dst.GitDagBundle, return on the first match + } else { + dst.GitDagBundle = nil + return fmt.Errorf("failed to unmarshal DagBundle as GitDagBundle: %s", err.Error()) + } + } + + // check if the discriminator value is 's3' + if jsonDict["type"] == "s3" { + // try to unmarshal JSON data into S3DagBundle + err = json.Unmarshal(data, &dst.S3DagBundle) + if err == nil { + return nil // data stored in dst.S3DagBundle, return on the first match + } else { + dst.S3DagBundle = nil + return fmt.Errorf("failed to unmarshal DagBundle as S3DagBundle: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src DagBundle) MarshalJSON() ([]byte, error) { + if src.GitDagBundle != nil { + return json.Marshal(&src.GitDagBundle) + } + + if src.S3DagBundle != nil { + return json.Marshal(&src.S3DagBundle) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *DagBundle) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GitDagBundle != nil { + return obj.GitDagBundle + } + + if obj.S3DagBundle != nil { + return obj.S3DagBundle + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj DagBundle) GetActualInstanceValue() interface{} { + if obj.GitDagBundle != nil { + return *obj.GitDagBundle + } + + if obj.S3DagBundle != nil { + return *obj.S3DagBundle + } + + // all schemas are nil + return nil +} + +type NullableDagBundle struct { + value *DagBundle + isSet bool +} + +func (v NullableDagBundle) Get() *DagBundle { + return v.value +} + +func (v *NullableDagBundle) Set(val *DagBundle) { + v.value = val + v.isSet = true +} + +func (v NullableDagBundle) IsSet() bool { + return v.isSet +} + +func (v *NullableDagBundle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDagBundle(val *DagBundle) *NullableDagBundle { + return &NullableDagBundle{value: val, isSet: true} +} + +func (v NullableDagBundle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDagBundle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_dag_bundle_response.go b/services/workflows/v1alphaapi/model_dag_bundle_response.go new file mode 100644 index 000000000..5557fee64 --- /dev/null +++ b/services/workflows/v1alphaapi/model_dag_bundle_response.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// DagBundleResponse - A DAG bundle as returned by the API. Auth structure (type, username) is included but credentials (passwords, secret keys) are masked. Discriminated by the \"type\" field. +type DagBundleResponse struct { + GitDagBundleResponse *GitDagBundleResponse + S3DagBundleResponse *S3DagBundleResponse +} + +// GitDagBundleResponseAsDagBundleResponse is a convenience function that returns GitDagBundleResponse wrapped in DagBundleResponse +func GitDagBundleResponseAsDagBundleResponse(v *GitDagBundleResponse) DagBundleResponse { + return DagBundleResponse{ + GitDagBundleResponse: v, + } +} + +// S3DagBundleResponseAsDagBundleResponse is a convenience function that returns S3DagBundleResponse wrapped in DagBundleResponse +func S3DagBundleResponseAsDagBundleResponse(v *S3DagBundleResponse) DagBundleResponse { + return DagBundleResponse{ + S3DagBundleResponse: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *DagBundleResponse) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'git' + if jsonDict["type"] == "git" { + // try to unmarshal JSON data into GitDagBundleResponse + err = json.Unmarshal(data, &dst.GitDagBundleResponse) + if err == nil { + return nil // data stored in dst.GitDagBundleResponse, return on the first match + } else { + dst.GitDagBundleResponse = nil + return fmt.Errorf("failed to unmarshal DagBundleResponse as GitDagBundleResponse: %s", err.Error()) + } + } + + // check if the discriminator value is 's3' + if jsonDict["type"] == "s3" { + // try to unmarshal JSON data into S3DagBundleResponse + err = json.Unmarshal(data, &dst.S3DagBundleResponse) + if err == nil { + return nil // data stored in dst.S3DagBundleResponse, return on the first match + } else { + dst.S3DagBundleResponse = nil + return fmt.Errorf("failed to unmarshal DagBundleResponse as S3DagBundleResponse: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src DagBundleResponse) MarshalJSON() ([]byte, error) { + if src.GitDagBundleResponse != nil { + return json.Marshal(&src.GitDagBundleResponse) + } + + if src.S3DagBundleResponse != nil { + return json.Marshal(&src.S3DagBundleResponse) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *DagBundleResponse) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GitDagBundleResponse != nil { + return obj.GitDagBundleResponse + } + + if obj.S3DagBundleResponse != nil { + return obj.S3DagBundleResponse + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj DagBundleResponse) GetActualInstanceValue() interface{} { + if obj.GitDagBundleResponse != nil { + return *obj.GitDagBundleResponse + } + + if obj.S3DagBundleResponse != nil { + return *obj.S3DagBundleResponse + } + + // all schemas are nil + return nil +} + +type NullableDagBundleResponse struct { + value *DagBundleResponse + isSet bool +} + +func (v NullableDagBundleResponse) Get() *DagBundleResponse { + return v.value +} + +func (v *NullableDagBundleResponse) Set(val *DagBundleResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDagBundleResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDagBundleResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDagBundleResponse(val *DagBundleResponse) *NullableDagBundleResponse { + return &NullableDagBundleResponse{value: val, isSet: true} +} + +func (v NullableDagBundleResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDagBundleResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_endpoints.go b/services/workflows/v1alphaapi/model_endpoints.go new file mode 100644 index 000000000..0eac8f396 --- /dev/null +++ b/services/workflows/v1alphaapi/model_endpoints.go @@ -0,0 +1,197 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Endpoints type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Endpoints{} + +// Endpoints A collection of endpoints offered by the Workflows instance. +type Endpoints struct { + // The authentication callback URL. + RedirectUrl string `json:"redirectUrl"` + // The URL for the UI of the Workflows instance. + Url string `json:"url"` + AdditionalProperties map[string]interface{} +} + +type _Endpoints Endpoints + +// NewEndpoints instantiates a new Endpoints 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 NewEndpoints(redirectUrl string, url string) *Endpoints { + this := Endpoints{} + this.RedirectUrl = redirectUrl + this.Url = url + return &this +} + +// NewEndpointsWithDefaults instantiates a new Endpoints 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 NewEndpointsWithDefaults() *Endpoints { + this := Endpoints{} + return &this +} + +// GetRedirectUrl returns the RedirectUrl field value +func (o *Endpoints) GetRedirectUrl() string { + if o == nil { + var ret string + return ret + } + + return o.RedirectUrl +} + +// GetRedirectUrlOk returns a tuple with the RedirectUrl field value +// and a boolean to check if the value has been set. +func (o *Endpoints) GetRedirectUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RedirectUrl, true +} + +// SetRedirectUrl sets field value +func (o *Endpoints) SetRedirectUrl(v string) { + o.RedirectUrl = v +} + +// GetUrl returns the Url field value +func (o *Endpoints) 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 *Endpoints) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *Endpoints) SetUrl(v string) { + o.Url = v +} + +func (o Endpoints) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Endpoints) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["redirectUrl"] = o.RedirectUrl + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Endpoints) 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{ + "redirectUrl", + "url", + } + + 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) + } + } + + varEndpoints := _Endpoints{} + + err = json.Unmarshal(data, &varEndpoints) + + if err != nil { + return err + } + + *o = Endpoints(varEndpoints) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "redirectUrl") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEndpoints struct { + value *Endpoints + isSet bool +} + +func (v NullableEndpoints) Get() *Endpoints { + return v.value +} + +func (v *NullableEndpoints) Set(val *Endpoints) { + v.value = val + v.isSet = true +} + +func (v NullableEndpoints) IsSet() bool { + return v.isSet +} + +func (v *NullableEndpoints) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEndpoints(val *Endpoints) *NullableEndpoints { + return &NullableEndpoints{value: val, isSet: true} +} + +func (v NullableEndpoints) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEndpoints) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_error_response.go b/services/workflows/v1alphaapi/model_error_response.go new file mode 100644 index 000000000..968e02c2b --- /dev/null +++ b/services/workflows/v1alphaapi/model_error_response.go @@ -0,0 +1,261 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + Code int32 `json:"code"` + Fields *map[string][]string `json:"fields,omitempty"` + Message string `json:"message"` + Type string `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _ErrorResponse ErrorResponse + +// NewErrorResponse instantiates a new ErrorResponse 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 NewErrorResponse(code int32, message string, types string) *ErrorResponse { + this := ErrorResponse{} + this.Code = code + this.Message = message + this.Type = types + return &this +} + +// NewErrorResponseWithDefaults instantiates a new ErrorResponse 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 NewErrorResponseWithDefaults() *ErrorResponse { + this := ErrorResponse{} + return &this +} + +// GetCode returns the Code field value +func (o *ErrorResponse) GetCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value +func (o *ErrorResponse) SetCode(v int32) { + o.Code = v +} + +// GetFields returns the Fields field value if set, zero value otherwise. +func (o *ErrorResponse) GetFields() map[string][]string { + if o == nil || IsNil(o.Fields) { + var ret map[string][]string + return ret + } + return *o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetFieldsOk() (*map[string][]string, bool) { + if o == nil || IsNil(o.Fields) { + return nil, false + } + return o.Fields, true +} + +// HasFields returns a boolean if a field has been set. +func (o *ErrorResponse) HasFields() bool { + if o != nil && !IsNil(o.Fields) { + return true + } + + return false +} + +// SetFields gets a reference to the given map[string][]string and assigns it to the Fields field. +func (o *ErrorResponse) SetFields(v map[string][]string) { + o.Fields = &v +} + +// GetMessage returns the Message field value +func (o *ErrorResponse) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v string) { + o.Message = v +} + +// GetType returns the Type field value +func (o *ErrorResponse) 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 *ErrorResponse) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *ErrorResponse) SetType(v string) { + o.Type = v +} + +func (o ErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + if !IsNil(o.Fields) { + toSerialize["fields"] = o.Fields + } + toSerialize["message"] = o.Message + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ErrorResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "code", + "message", + "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) + } + } + + varErrorResponse := _ErrorResponse{} + + err = json.Unmarshal(data, &varErrorResponse) + + if err != nil { + return err + } + + *o = ErrorResponse(varErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "fields") + delete(additionalProperties, "message") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableErrorResponse struct { + value *ErrorResponse + isSet bool +} + +func (v NullableErrorResponse) Get() *ErrorResponse { + return v.value +} + +func (v *NullableErrorResponse) Set(val *ErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResponse(val *ErrorResponse) *NullableErrorResponse { + return &NullableErrorResponse{value: val, isSet: true} +} + +func (v NullableErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_git_auth.go b/services/workflows/v1alphaapi/model_git_auth.go new file mode 100644 index 000000000..a84039c5a --- /dev/null +++ b/services/workflows/v1alphaapi/model_git_auth.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// GitAuth - Authentication for Git repositories +type GitAuth struct { + BasicAuth *BasicAuth + NoAuth *NoAuth +} + +// BasicAuthAsGitAuth is a convenience function that returns BasicAuth wrapped in GitAuth +func BasicAuthAsGitAuth(v *BasicAuth) GitAuth { + return GitAuth{ + BasicAuth: v, + } +} + +// NoAuthAsGitAuth is a convenience function that returns NoAuth wrapped in GitAuth +func NoAuthAsGitAuth(v *NoAuth) GitAuth { + return GitAuth{ + NoAuth: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *GitAuth) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'basic' + if jsonDict["type"] == "basic" { + // try to unmarshal JSON data into BasicAuth + err = json.Unmarshal(data, &dst.BasicAuth) + if err == nil { + return nil // data stored in dst.BasicAuth, return on the first match + } else { + dst.BasicAuth = nil + return fmt.Errorf("failed to unmarshal GitAuth as BasicAuth: %s", err.Error()) + } + } + + // check if the discriminator value is 'none' + if jsonDict["type"] == "none" { + // try to unmarshal JSON data into NoAuth + err = json.Unmarshal(data, &dst.NoAuth) + if err == nil { + return nil // data stored in dst.NoAuth, return on the first match + } else { + dst.NoAuth = nil + return fmt.Errorf("failed to unmarshal GitAuth as NoAuth: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src GitAuth) MarshalJSON() ([]byte, error) { + if src.BasicAuth != nil { + return json.Marshal(&src.BasicAuth) + } + + if src.NoAuth != nil { + return json.Marshal(&src.NoAuth) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *GitAuth) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.BasicAuth != nil { + return obj.BasicAuth + } + + if obj.NoAuth != nil { + return obj.NoAuth + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj GitAuth) GetActualInstanceValue() interface{} { + if obj.BasicAuth != nil { + return *obj.BasicAuth + } + + if obj.NoAuth != nil { + return *obj.NoAuth + } + + // all schemas are nil + return nil +} + +type NullableGitAuth struct { + value *GitAuth + isSet bool +} + +func (v NullableGitAuth) Get() *GitAuth { + return v.value +} + +func (v *NullableGitAuth) Set(val *GitAuth) { + v.value = val + v.isSet = true +} + +func (v NullableGitAuth) IsSet() bool { + return v.isSet +} + +func (v *NullableGitAuth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGitAuth(val *GitAuth) *NullableGitAuth { + return &NullableGitAuth{value: val, isSet: true} +} + +func (v NullableGitAuth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGitAuth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_git_auth_response.go b/services/workflows/v1alphaapi/model_git_auth_response.go new file mode 100644 index 000000000..0702b9c1b --- /dev/null +++ b/services/workflows/v1alphaapi/model_git_auth_response.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// GitAuthResponse - Authentication configuration as returned in API responses. Credentials (passwords) are always masked and never returned in plain text. +type GitAuthResponse struct { + BasicAuthResponse *BasicAuthResponse + NoAuth *NoAuth +} + +// BasicAuthResponseAsGitAuthResponse is a convenience function that returns BasicAuthResponse wrapped in GitAuthResponse +func BasicAuthResponseAsGitAuthResponse(v *BasicAuthResponse) GitAuthResponse { + return GitAuthResponse{ + BasicAuthResponse: v, + } +} + +// NoAuthAsGitAuthResponse is a convenience function that returns NoAuth wrapped in GitAuthResponse +func NoAuthAsGitAuthResponse(v *NoAuth) GitAuthResponse { + return GitAuthResponse{ + NoAuth: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *GitAuthResponse) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'basic' + if jsonDict["type"] == "basic" { + // try to unmarshal JSON data into BasicAuthResponse + err = json.Unmarshal(data, &dst.BasicAuthResponse) + if err == nil { + return nil // data stored in dst.BasicAuthResponse, return on the first match + } else { + dst.BasicAuthResponse = nil + return fmt.Errorf("failed to unmarshal GitAuthResponse as BasicAuthResponse: %s", err.Error()) + } + } + + // check if the discriminator value is 'none' + if jsonDict["type"] == "none" { + // try to unmarshal JSON data into NoAuth + err = json.Unmarshal(data, &dst.NoAuth) + if err == nil { + return nil // data stored in dst.NoAuth, return on the first match + } else { + dst.NoAuth = nil + return fmt.Errorf("failed to unmarshal GitAuthResponse as NoAuth: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src GitAuthResponse) MarshalJSON() ([]byte, error) { + if src.BasicAuthResponse != nil { + return json.Marshal(&src.BasicAuthResponse) + } + + if src.NoAuth != nil { + return json.Marshal(&src.NoAuth) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *GitAuthResponse) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.BasicAuthResponse != nil { + return obj.BasicAuthResponse + } + + if obj.NoAuth != nil { + return obj.NoAuth + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj GitAuthResponse) GetActualInstanceValue() interface{} { + if obj.BasicAuthResponse != nil { + return *obj.BasicAuthResponse + } + + if obj.NoAuth != nil { + return *obj.NoAuth + } + + // all schemas are nil + return nil +} + +type NullableGitAuthResponse struct { + value *GitAuthResponse + isSet bool +} + +func (v NullableGitAuthResponse) Get() *GitAuthResponse { + return v.value +} + +func (v *NullableGitAuthResponse) Set(val *GitAuthResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGitAuthResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGitAuthResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGitAuthResponse(val *GitAuthResponse) *NullableGitAuthResponse { + return &NullableGitAuthResponse{value: val, isSet: true} +} + +func (v NullableGitAuthResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGitAuthResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_git_dag_bundle.go b/services/workflows/v1alphaapi/model_git_dag_bundle.go new file mode 100644 index 000000000..d2bdee5ac --- /dev/null +++ b/services/workflows/v1alphaapi/model_git_dag_bundle.go @@ -0,0 +1,361 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the GitDagBundle type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GitDagBundle{} + +// GitDagBundle A Git-based DAG bundle. Maps to airflow.providers.git.bundles.git.GitDagBundle. +type GitDagBundle struct { + Auth GitAuth `json:"auth"` + // The branch, tag or ref to track. + Branch string `json:"branch"` + // Unique name for this bundle within the instance. Must be a valid DNS label (lowercase alphanumeric and hyphens, starting with a letter, max 63 characters). + Name string `json:"name" validate:"regexp=^[a-z][a-z0-9-]{0,62}$"` + // How often (in seconds) to check for new commits. Defaults to 60. + RefreshInterval *int32 `json:"refreshInterval,omitempty"` + // Subdirectory within the repository containing DAG files. Defaults to root. Leading and trailing slashes are stripped automatically — the following four forms are all equivalent and stored as `dags/production`: `/dags/production/`, `dags/production/`, `/dags/production`, `dags/production`. + Subdir *string `json:"subdir,omitempty"` + Type GitDagBundleType `json:"type"` + // The URL of the Git repository. + Url string `json:"url"` + AdditionalProperties map[string]interface{} +} + +type _GitDagBundle GitDagBundle + +// NewGitDagBundle instantiates a new GitDagBundle 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 NewGitDagBundle(auth GitAuth, branch string, name string, types GitDagBundleType, url string) *GitDagBundle { + this := GitDagBundle{} + this.Auth = auth + this.Branch = branch + this.Name = name + this.Type = types + this.Url = url + return &this +} + +// NewGitDagBundleWithDefaults instantiates a new GitDagBundle 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 NewGitDagBundleWithDefaults() *GitDagBundle { + this := GitDagBundle{} + return &this +} + +// GetAuth returns the Auth field value +func (o *GitDagBundle) GetAuth() GitAuth { + if o == nil { + var ret GitAuth + return ret + } + + return o.Auth +} + +// GetAuthOk returns a tuple with the Auth field value +// and a boolean to check if the value has been set. +func (o *GitDagBundle) GetAuthOk() (*GitAuth, bool) { + if o == nil { + return nil, false + } + return &o.Auth, true +} + +// SetAuth sets field value +func (o *GitDagBundle) SetAuth(v GitAuth) { + o.Auth = v +} + +// GetBranch returns the Branch field value +func (o *GitDagBundle) GetBranch() string { + if o == nil { + var ret string + return ret + } + + return o.Branch +} + +// GetBranchOk returns a tuple with the Branch field value +// and a boolean to check if the value has been set. +func (o *GitDagBundle) GetBranchOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Branch, true +} + +// SetBranch sets field value +func (o *GitDagBundle) SetBranch(v string) { + o.Branch = v +} + +// GetName returns the Name field value +func (o *GitDagBundle) 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 *GitDagBundle) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GitDagBundle) SetName(v string) { + o.Name = v +} + +// GetRefreshInterval returns the RefreshInterval field value if set, zero value otherwise. +func (o *GitDagBundle) GetRefreshInterval() int32 { + if o == nil || IsNil(o.RefreshInterval) { + var ret int32 + return ret + } + return *o.RefreshInterval +} + +// GetRefreshIntervalOk returns a tuple with the RefreshInterval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GitDagBundle) GetRefreshIntervalOk() (*int32, bool) { + if o == nil || IsNil(o.RefreshInterval) { + return nil, false + } + return o.RefreshInterval, true +} + +// HasRefreshInterval returns a boolean if a field has been set. +func (o *GitDagBundle) HasRefreshInterval() bool { + if o != nil && !IsNil(o.RefreshInterval) { + return true + } + + return false +} + +// SetRefreshInterval gets a reference to the given int32 and assigns it to the RefreshInterval field. +func (o *GitDagBundle) SetRefreshInterval(v int32) { + o.RefreshInterval = &v +} + +// GetSubdir returns the Subdir field value if set, zero value otherwise. +func (o *GitDagBundle) GetSubdir() string { + if o == nil || IsNil(o.Subdir) { + var ret string + return ret + } + return *o.Subdir +} + +// GetSubdirOk returns a tuple with the Subdir field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GitDagBundle) GetSubdirOk() (*string, bool) { + if o == nil || IsNil(o.Subdir) { + return nil, false + } + return o.Subdir, true +} + +// HasSubdir returns a boolean if a field has been set. +func (o *GitDagBundle) HasSubdir() bool { + if o != nil && !IsNil(o.Subdir) { + return true + } + + return false +} + +// SetSubdir gets a reference to the given string and assigns it to the Subdir field. +func (o *GitDagBundle) SetSubdir(v string) { + o.Subdir = &v +} + +// GetType returns the Type field value +func (o *GitDagBundle) GetType() GitDagBundleType { + if o == nil { + var ret GitDagBundleType + 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 *GitDagBundle) GetTypeOk() (*GitDagBundleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *GitDagBundle) SetType(v GitDagBundleType) { + o.Type = v +} + +// GetUrl returns the Url field value +func (o *GitDagBundle) 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 *GitDagBundle) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *GitDagBundle) SetUrl(v string) { + o.Url = v +} + +func (o GitDagBundle) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GitDagBundle) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["auth"] = o.Auth + toSerialize["branch"] = o.Branch + toSerialize["name"] = o.Name + if !IsNil(o.RefreshInterval) { + toSerialize["refreshInterval"] = o.RefreshInterval + } + if !IsNil(o.Subdir) { + toSerialize["subdir"] = o.Subdir + } + toSerialize["type"] = o.Type + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GitDagBundle) 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{ + "auth", + "branch", + "name", + "type", + "url", + } + + 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) + } + } + + varGitDagBundle := _GitDagBundle{} + + err = json.Unmarshal(data, &varGitDagBundle) + + if err != nil { + return err + } + + *o = GitDagBundle(varGitDagBundle) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "auth") + delete(additionalProperties, "branch") + delete(additionalProperties, "name") + delete(additionalProperties, "refreshInterval") + delete(additionalProperties, "subdir") + delete(additionalProperties, "type") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGitDagBundle struct { + value *GitDagBundle + isSet bool +} + +func (v NullableGitDagBundle) Get() *GitDagBundle { + return v.value +} + +func (v *NullableGitDagBundle) Set(val *GitDagBundle) { + v.value = val + v.isSet = true +} + +func (v NullableGitDagBundle) IsSet() bool { + return v.isSet +} + +func (v *NullableGitDagBundle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGitDagBundle(val *GitDagBundle) *NullableGitDagBundle { + return &NullableGitDagBundle{value: val, isSet: true} +} + +func (v NullableGitDagBundle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGitDagBundle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_git_dag_bundle_response.go b/services/workflows/v1alphaapi/model_git_dag_bundle_response.go new file mode 100644 index 000000000..1032bfc20 --- /dev/null +++ b/services/workflows/v1alphaapi/model_git_dag_bundle_response.go @@ -0,0 +1,361 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the GitDagBundleResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GitDagBundleResponse{} + +// GitDagBundleResponse A Git-based DAG bundle as returned by the API. The auth structure (type, username) is included; passwords are masked. +type GitDagBundleResponse struct { + Auth GitAuthResponse `json:"auth"` + // The branch, tag or ref being tracked. + Branch string `json:"branch"` + // Unique name for this bundle within the instance. + Name string `json:"name" validate:"regexp=^[a-z][a-z0-9-]{0,62}$"` + // How often (in seconds) to check for new commits. + RefreshInterval *int32 `json:"refreshInterval,omitempty"` + // Subdirectory within the repository containing DAG files. Leading and trailing slashes are stripped automatically. Absent when set to root. + Subdir *string `json:"subdir,omitempty"` + Type GitDagBundleResponseType `json:"type"` + // The URL of the Git repository. + Url string `json:"url"` + AdditionalProperties map[string]interface{} +} + +type _GitDagBundleResponse GitDagBundleResponse + +// NewGitDagBundleResponse instantiates a new GitDagBundleResponse 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 NewGitDagBundleResponse(auth GitAuthResponse, branch string, name string, types GitDagBundleResponseType, url string) *GitDagBundleResponse { + this := GitDagBundleResponse{} + this.Auth = auth + this.Branch = branch + this.Name = name + this.Type = types + this.Url = url + return &this +} + +// NewGitDagBundleResponseWithDefaults instantiates a new GitDagBundleResponse 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 NewGitDagBundleResponseWithDefaults() *GitDagBundleResponse { + this := GitDagBundleResponse{} + return &this +} + +// GetAuth returns the Auth field value +func (o *GitDagBundleResponse) GetAuth() GitAuthResponse { + if o == nil { + var ret GitAuthResponse + return ret + } + + return o.Auth +} + +// GetAuthOk returns a tuple with the Auth field value +// and a boolean to check if the value has been set. +func (o *GitDagBundleResponse) GetAuthOk() (*GitAuthResponse, bool) { + if o == nil { + return nil, false + } + return &o.Auth, true +} + +// SetAuth sets field value +func (o *GitDagBundleResponse) SetAuth(v GitAuthResponse) { + o.Auth = v +} + +// GetBranch returns the Branch field value +func (o *GitDagBundleResponse) GetBranch() string { + if o == nil { + var ret string + return ret + } + + return o.Branch +} + +// GetBranchOk returns a tuple with the Branch field value +// and a boolean to check if the value has been set. +func (o *GitDagBundleResponse) GetBranchOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Branch, true +} + +// SetBranch sets field value +func (o *GitDagBundleResponse) SetBranch(v string) { + o.Branch = v +} + +// GetName returns the Name field value +func (o *GitDagBundleResponse) 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 *GitDagBundleResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GitDagBundleResponse) SetName(v string) { + o.Name = v +} + +// GetRefreshInterval returns the RefreshInterval field value if set, zero value otherwise. +func (o *GitDagBundleResponse) GetRefreshInterval() int32 { + if o == nil || IsNil(o.RefreshInterval) { + var ret int32 + return ret + } + return *o.RefreshInterval +} + +// GetRefreshIntervalOk returns a tuple with the RefreshInterval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GitDagBundleResponse) GetRefreshIntervalOk() (*int32, bool) { + if o == nil || IsNil(o.RefreshInterval) { + return nil, false + } + return o.RefreshInterval, true +} + +// HasRefreshInterval returns a boolean if a field has been set. +func (o *GitDagBundleResponse) HasRefreshInterval() bool { + if o != nil && !IsNil(o.RefreshInterval) { + return true + } + + return false +} + +// SetRefreshInterval gets a reference to the given int32 and assigns it to the RefreshInterval field. +func (o *GitDagBundleResponse) SetRefreshInterval(v int32) { + o.RefreshInterval = &v +} + +// GetSubdir returns the Subdir field value if set, zero value otherwise. +func (o *GitDagBundleResponse) GetSubdir() string { + if o == nil || IsNil(o.Subdir) { + var ret string + return ret + } + return *o.Subdir +} + +// GetSubdirOk returns a tuple with the Subdir field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GitDagBundleResponse) GetSubdirOk() (*string, bool) { + if o == nil || IsNil(o.Subdir) { + return nil, false + } + return o.Subdir, true +} + +// HasSubdir returns a boolean if a field has been set. +func (o *GitDagBundleResponse) HasSubdir() bool { + if o != nil && !IsNil(o.Subdir) { + return true + } + + return false +} + +// SetSubdir gets a reference to the given string and assigns it to the Subdir field. +func (o *GitDagBundleResponse) SetSubdir(v string) { + o.Subdir = &v +} + +// GetType returns the Type field value +func (o *GitDagBundleResponse) GetType() GitDagBundleResponseType { + if o == nil { + var ret GitDagBundleResponseType + 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 *GitDagBundleResponse) GetTypeOk() (*GitDagBundleResponseType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *GitDagBundleResponse) SetType(v GitDagBundleResponseType) { + o.Type = v +} + +// GetUrl returns the Url field value +func (o *GitDagBundleResponse) 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 *GitDagBundleResponse) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *GitDagBundleResponse) SetUrl(v string) { + o.Url = v +} + +func (o GitDagBundleResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GitDagBundleResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["auth"] = o.Auth + toSerialize["branch"] = o.Branch + toSerialize["name"] = o.Name + if !IsNil(o.RefreshInterval) { + toSerialize["refreshInterval"] = o.RefreshInterval + } + if !IsNil(o.Subdir) { + toSerialize["subdir"] = o.Subdir + } + toSerialize["type"] = o.Type + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GitDagBundleResponse) 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{ + "auth", + "branch", + "name", + "type", + "url", + } + + 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) + } + } + + varGitDagBundleResponse := _GitDagBundleResponse{} + + err = json.Unmarshal(data, &varGitDagBundleResponse) + + if err != nil { + return err + } + + *o = GitDagBundleResponse(varGitDagBundleResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "auth") + delete(additionalProperties, "branch") + delete(additionalProperties, "name") + delete(additionalProperties, "refreshInterval") + delete(additionalProperties, "subdir") + delete(additionalProperties, "type") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGitDagBundleResponse struct { + value *GitDagBundleResponse + isSet bool +} + +func (v NullableGitDagBundleResponse) Get() *GitDagBundleResponse { + return v.value +} + +func (v *NullableGitDagBundleResponse) Set(val *GitDagBundleResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGitDagBundleResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGitDagBundleResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGitDagBundleResponse(val *GitDagBundleResponse) *NullableGitDagBundleResponse { + return &NullableGitDagBundleResponse{value: val, isSet: true} +} + +func (v NullableGitDagBundleResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGitDagBundleResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_git_dag_bundle_response_type.go b/services/workflows/v1alphaapi/model_git_dag_bundle_response_type.go new file mode 100644 index 000000000..f35e17709 --- /dev/null +++ b/services/workflows/v1alphaapi/model_git_dag_bundle_response_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// GitDagBundleResponseType Bundle type identifier. +type GitDagBundleResponseType string + +// List of GitDagBundleResponse_type +const ( + GITDAGBUNDLERESPONSETYPE_GIT GitDagBundleResponseType = "git" + GITDAGBUNDLERESPONSETYPE_UNKNOWN_DEFAULT_OPEN_API GitDagBundleResponseType = "unknown_default_open_api" +) + +// All allowed values of GitDagBundleResponseType enum +var AllowedGitDagBundleResponseTypeEnumValues = []GitDagBundleResponseType{ + "git", + "unknown_default_open_api", +} + +func (v *GitDagBundleResponseType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := GitDagBundleResponseType(value) + for _, existing := range AllowedGitDagBundleResponseTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = GITDAGBUNDLERESPONSETYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewGitDagBundleResponseTypeFromValue returns a pointer to a valid GitDagBundleResponseType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGitDagBundleResponseTypeFromValue(v string) (*GitDagBundleResponseType, error) { + ev := GitDagBundleResponseType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GitDagBundleResponseType: valid values are %v", v, AllowedGitDagBundleResponseTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GitDagBundleResponseType) IsValid() bool { + for _, existing := range AllowedGitDagBundleResponseTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GitDagBundleResponse_type value +func (v GitDagBundleResponseType) Ptr() *GitDagBundleResponseType { + return &v +} + +type NullableGitDagBundleResponseType struct { + value *GitDagBundleResponseType + isSet bool +} + +func (v NullableGitDagBundleResponseType) Get() *GitDagBundleResponseType { + return v.value +} + +func (v *NullableGitDagBundleResponseType) Set(val *GitDagBundleResponseType) { + v.value = val + v.isSet = true +} + +func (v NullableGitDagBundleResponseType) IsSet() bool { + return v.isSet +} + +func (v *NullableGitDagBundleResponseType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGitDagBundleResponseType(val *GitDagBundleResponseType) *NullableGitDagBundleResponseType { + return &NullableGitDagBundleResponseType{value: val, isSet: true} +} + +func (v NullableGitDagBundleResponseType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGitDagBundleResponseType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_git_dag_bundle_type.go b/services/workflows/v1alphaapi/model_git_dag_bundle_type.go new file mode 100644 index 000000000..0f833ad2e --- /dev/null +++ b/services/workflows/v1alphaapi/model_git_dag_bundle_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// GitDagBundleType Bundle type identifier. +type GitDagBundleType string + +// List of GitDagBundle_type +const ( + GITDAGBUNDLETYPE_GIT GitDagBundleType = "git" + GITDAGBUNDLETYPE_UNKNOWN_DEFAULT_OPEN_API GitDagBundleType = "unknown_default_open_api" +) + +// All allowed values of GitDagBundleType enum +var AllowedGitDagBundleTypeEnumValues = []GitDagBundleType{ + "git", + "unknown_default_open_api", +} + +func (v *GitDagBundleType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := GitDagBundleType(value) + for _, existing := range AllowedGitDagBundleTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = GITDAGBUNDLETYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewGitDagBundleTypeFromValue returns a pointer to a valid GitDagBundleType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGitDagBundleTypeFromValue(v string) (*GitDagBundleType, error) { + ev := GitDagBundleType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GitDagBundleType: valid values are %v", v, AllowedGitDagBundleTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GitDagBundleType) IsValid() bool { + for _, existing := range AllowedGitDagBundleTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GitDagBundle_type value +func (v GitDagBundleType) Ptr() *GitDagBundleType { + return &v +} + +type NullableGitDagBundleType struct { + value *GitDagBundleType + isSet bool +} + +func (v NullableGitDagBundleType) Get() *GitDagBundleType { + return v.value +} + +func (v *NullableGitDagBundleType) Set(val *GitDagBundleType) { + v.value = val + v.isSet = true +} + +func (v NullableGitDagBundleType) IsSet() bool { + return v.isSet +} + +func (v *NullableGitDagBundleType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGitDagBundleType(val *GitDagBundleType) *NullableGitDagBundleType { + return &NullableGitDagBundleType{value: val, isSet: true} +} + +func (v NullableGitDagBundleType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGitDagBundleType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_git_repository.go b/services/workflows/v1alphaapi/model_git_repository.go new file mode 100644 index 000000000..2d4c8b758 --- /dev/null +++ b/services/workflows/v1alphaapi/model_git_repository.go @@ -0,0 +1,226 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the GitRepository type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GitRepository{} + +// GitRepository struct for GitRepository +type GitRepository struct { + Auth GitAuth `json:"auth"` + // The branch in the repository to use + Branch string `json:"branch"` + // The URL of the Git repository. + Url string `json:"url"` + AdditionalProperties map[string]interface{} +} + +type _GitRepository GitRepository + +// NewGitRepository instantiates a new GitRepository 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 NewGitRepository(auth GitAuth, branch string, url string) *GitRepository { + this := GitRepository{} + this.Auth = auth + this.Branch = branch + this.Url = url + return &this +} + +// NewGitRepositoryWithDefaults instantiates a new GitRepository 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 NewGitRepositoryWithDefaults() *GitRepository { + this := GitRepository{} + return &this +} + +// GetAuth returns the Auth field value +func (o *GitRepository) GetAuth() GitAuth { + if o == nil { + var ret GitAuth + return ret + } + + return o.Auth +} + +// GetAuthOk returns a tuple with the Auth field value +// and a boolean to check if the value has been set. +func (o *GitRepository) GetAuthOk() (*GitAuth, bool) { + if o == nil { + return nil, false + } + return &o.Auth, true +} + +// SetAuth sets field value +func (o *GitRepository) SetAuth(v GitAuth) { + o.Auth = v +} + +// GetBranch returns the Branch field value +func (o *GitRepository) GetBranch() string { + if o == nil { + var ret string + return ret + } + + return o.Branch +} + +// GetBranchOk returns a tuple with the Branch field value +// and a boolean to check if the value has been set. +func (o *GitRepository) GetBranchOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Branch, true +} + +// SetBranch sets field value +func (o *GitRepository) SetBranch(v string) { + o.Branch = v +} + +// GetUrl returns the Url field value +func (o *GitRepository) 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 *GitRepository) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *GitRepository) SetUrl(v string) { + o.Url = v +} + +func (o GitRepository) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GitRepository) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["auth"] = o.Auth + toSerialize["branch"] = o.Branch + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GitRepository) 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{ + "auth", + "branch", + "url", + } + + 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) + } + } + + varGitRepository := _GitRepository{} + + err = json.Unmarshal(data, &varGitRepository) + + if err != nil { + return err + } + + *o = GitRepository(varGitRepository) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "auth") + delete(additionalProperties, "branch") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGitRepository struct { + value *GitRepository + isSet bool +} + +func (v NullableGitRepository) Get() *GitRepository { + return v.value +} + +func (v *NullableGitRepository) Set(val *GitRepository) { + v.value = val + v.isSet = true +} + +func (v NullableGitRepository) IsSet() bool { + return v.isSet +} + +func (v *NullableGitRepository) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGitRepository(val *GitRepository) *NullableGitRepository { + return &NullableGitRepository{value: val, isSet: true} +} + +func (v NullableGitRepository) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGitRepository) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_identity_provider.go b/services/workflows/v1alphaapi/model_identity_provider.go new file mode 100644 index 000000000..6048443b5 --- /dev/null +++ b/services/workflows/v1alphaapi/model_identity_provider.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// IdentityProvider - Configuration for the identity provider used. +type IdentityProvider struct { + OAuth2IdentityProvider *OAuth2IdentityProvider + StackITIdentityProvider *StackITIdentityProvider +} + +// OAuth2IdentityProviderAsIdentityProvider is a convenience function that returns OAuth2IdentityProvider wrapped in IdentityProvider +func OAuth2IdentityProviderAsIdentityProvider(v *OAuth2IdentityProvider) IdentityProvider { + return IdentityProvider{ + OAuth2IdentityProvider: v, + } +} + +// StackITIdentityProviderAsIdentityProvider is a convenience function that returns StackITIdentityProvider wrapped in IdentityProvider +func StackITIdentityProviderAsIdentityProvider(v *StackITIdentityProvider) IdentityProvider { + return IdentityProvider{ + StackITIdentityProvider: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *IdentityProvider) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'oauth2' + if jsonDict["type"] == "oauth2" { + // try to unmarshal JSON data into OAuth2IdentityProvider + err = json.Unmarshal(data, &dst.OAuth2IdentityProvider) + if err == nil { + return nil // data stored in dst.OAuth2IdentityProvider, return on the first match + } else { + dst.OAuth2IdentityProvider = nil + return fmt.Errorf("failed to unmarshal IdentityProvider as OAuth2IdentityProvider: %s", err.Error()) + } + } + + // check if the discriminator value is 'stackit' + if jsonDict["type"] == "stackit" { + // try to unmarshal JSON data into StackITIdentityProvider + err = json.Unmarshal(data, &dst.StackITIdentityProvider) + if err == nil { + return nil // data stored in dst.StackITIdentityProvider, return on the first match + } else { + dst.StackITIdentityProvider = nil + return fmt.Errorf("failed to unmarshal IdentityProvider as StackITIdentityProvider: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src IdentityProvider) MarshalJSON() ([]byte, error) { + if src.OAuth2IdentityProvider != nil { + return json.Marshal(&src.OAuth2IdentityProvider) + } + + if src.StackITIdentityProvider != nil { + return json.Marshal(&src.StackITIdentityProvider) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *IdentityProvider) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.OAuth2IdentityProvider != nil { + return obj.OAuth2IdentityProvider + } + + if obj.StackITIdentityProvider != nil { + return obj.StackITIdentityProvider + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj IdentityProvider) GetActualInstanceValue() interface{} { + if obj.OAuth2IdentityProvider != nil { + return *obj.OAuth2IdentityProvider + } + + if obj.StackITIdentityProvider != nil { + return *obj.StackITIdentityProvider + } + + // all schemas are nil + return nil +} + +type NullableIdentityProvider struct { + value *IdentityProvider + isSet bool +} + +func (v NullableIdentityProvider) Get() *IdentityProvider { + return v.value +} + +func (v *NullableIdentityProvider) Set(val *IdentityProvider) { + v.value = val + v.isSet = true +} + +func (v NullableIdentityProvider) IsSet() bool { + return v.isSet +} + +func (v *NullableIdentityProvider) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIdentityProvider(val *IdentityProvider) *NullableIdentityProvider { + return &NullableIdentityProvider{value: val, isSet: true} +} + +func (v NullableIdentityProvider) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIdentityProvider) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_instance.go b/services/workflows/v1alphaapi/model_instance.go new file mode 100644 index 000000000..5ab26d9d9 --- /dev/null +++ b/services/workflows/v1alphaapi/model_instance.go @@ -0,0 +1,631 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Instance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Instance{} + +// Instance struct for Instance +type Instance struct { + // The date and time the creation of the STACKIT Workflows instance was triggered. + CreatedAt time.Time `json:"createdAt"` + // All configured DAG bundles. This is the canonical source of truth for DAG sources. Available for Airflow 3 instances. + DagBundles []DagBundle `json:"dagBundles,omitempty"` + DagsRepository *GitRepository `json:"dagsRepository,omitempty"` + // A user chosen description to distinguish multiple STACKIT Workflows instances. + Description *string `json:"description,omitempty"` + // The displayed name of the STACKIT Workflows instance. + DisplayName string `json:"displayName"` + Endpoints Endpoints `json:"endpoints"` + // A auto generated unique id which identifies the STACKIT Workflows instance. + Id string `json:"id"` + IdentityProvider IdentityProvider `json:"identityProvider"` + Network *Network `json:"network,omitempty"` + // Unique identifier of the customer's observability instance. + ObservabilityId *string `json:"observabilityId,omitempty"` + // The STACKIT portal project UUID the STACKIT Workflows instance is part of. + ProjectId string `json:"projectId"` + // The STACKIT region the STACKIT Workflows instance is part of. + RegionId string `json:"regionId"` + Status InstanceStatus `json:"status"` + // A message related to the current status. + StatusMessage *string `json:"statusMessage,omitempty"` + // The currently configured STACKIT Workflows instance version. + Version string `json:"version"` + 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(createdAt time.Time, displayName string, endpoints Endpoints, id string, identityProvider IdentityProvider, projectId string, regionId string, status InstanceStatus, version string) *Instance { + this := Instance{} + this.CreatedAt = createdAt + this.DisplayName = displayName + this.Endpoints = endpoints + this.Id = id + this.IdentityProvider = identityProvider + this.ProjectId = projectId + this.RegionId = regionId + this.Status = status + this.Version = version + 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{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Instance) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Instance) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *Instance) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetDagBundles returns the DagBundles field value if set, zero value otherwise. +func (o *Instance) GetDagBundles() []DagBundle { + if o == nil || IsNil(o.DagBundles) { + var ret []DagBundle + return ret + } + return o.DagBundles +} + +// GetDagBundlesOk returns a tuple with the DagBundles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetDagBundlesOk() ([]DagBundle, bool) { + if o == nil || IsNil(o.DagBundles) { + return nil, false + } + return o.DagBundles, true +} + +// HasDagBundles returns a boolean if a field has been set. +func (o *Instance) HasDagBundles() bool { + if o != nil && !IsNil(o.DagBundles) { + return true + } + + return false +} + +// SetDagBundles gets a reference to the given []DagBundle and assigns it to the DagBundles field. +func (o *Instance) SetDagBundles(v []DagBundle) { + o.DagBundles = v +} + +// GetDagsRepository returns the DagsRepository field value if set, zero value otherwise. +func (o *Instance) GetDagsRepository() GitRepository { + if o == nil || IsNil(o.DagsRepository) { + var ret GitRepository + return ret + } + return *o.DagsRepository +} + +// GetDagsRepositoryOk returns a tuple with the DagsRepository field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetDagsRepositoryOk() (*GitRepository, bool) { + if o == nil || IsNil(o.DagsRepository) { + return nil, false + } + return o.DagsRepository, true +} + +// HasDagsRepository returns a boolean if a field has been set. +func (o *Instance) HasDagsRepository() bool { + if o != nil && !IsNil(o.DagsRepository) { + return true + } + + return false +} + +// SetDagsRepository gets a reference to the given GitRepository and assigns it to the DagsRepository field. +func (o *Instance) SetDagsRepository(v GitRepository) { + o.DagsRepository = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Instance) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Instance) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Instance) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *Instance) 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 *Instance) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *Instance) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetEndpoints returns the Endpoints field value +func (o *Instance) GetEndpoints() Endpoints { + if o == nil { + var ret Endpoints + return ret + } + + return o.Endpoints +} + +// GetEndpointsOk returns a tuple with the Endpoints field value +// and a boolean to check if the value has been set. +func (o *Instance) GetEndpointsOk() (*Endpoints, bool) { + if o == nil { + return nil, false + } + return &o.Endpoints, true +} + +// SetEndpoints sets field value +func (o *Instance) SetEndpoints(v Endpoints) { + o.Endpoints = v +} + +// GetId returns the Id field value +func (o *Instance) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Instance) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Instance) SetId(v string) { + o.Id = v +} + +// GetIdentityProvider returns the IdentityProvider field value +func (o *Instance) GetIdentityProvider() IdentityProvider { + if o == nil { + var ret IdentityProvider + return ret + } + + return o.IdentityProvider +} + +// GetIdentityProviderOk returns a tuple with the IdentityProvider field value +// and a boolean to check if the value has been set. +func (o *Instance) GetIdentityProviderOk() (*IdentityProvider, bool) { + if o == nil { + return nil, false + } + return &o.IdentityProvider, true +} + +// SetIdentityProvider sets field value +func (o *Instance) SetIdentityProvider(v IdentityProvider) { + o.IdentityProvider = v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *Instance) GetNetwork() Network { + if o == nil || IsNil(o.Network) { + var ret Network + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetNetworkOk() (*Network, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *Instance) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given Network and assigns it to the Network field. +func (o *Instance) SetNetwork(v Network) { + o.Network = &v +} + +// GetObservabilityId returns the ObservabilityId field value if set, zero value otherwise. +func (o *Instance) GetObservabilityId() string { + if o == nil || IsNil(o.ObservabilityId) { + var ret string + return ret + } + return *o.ObservabilityId +} + +// GetObservabilityIdOk returns a tuple with the ObservabilityId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetObservabilityIdOk() (*string, bool) { + if o == nil || IsNil(o.ObservabilityId) { + return nil, false + } + return o.ObservabilityId, true +} + +// HasObservabilityId returns a boolean if a field has been set. +func (o *Instance) HasObservabilityId() bool { + if o != nil && !IsNil(o.ObservabilityId) { + return true + } + + return false +} + +// SetObservabilityId gets a reference to the given string and assigns it to the ObservabilityId field. +func (o *Instance) SetObservabilityId(v string) { + o.ObservabilityId = &v +} + +// GetProjectId returns the ProjectId field value +func (o *Instance) GetProjectId() string { + if o == nil { + var ret string + return ret + } + + return o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value +// and a boolean to check if the value has been set. +func (o *Instance) GetProjectIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProjectId, true +} + +// SetProjectId sets field value +func (o *Instance) SetProjectId(v string) { + o.ProjectId = v +} + +// GetRegionId returns the RegionId field value +func (o *Instance) GetRegionId() string { + if o == nil { + var ret string + return ret + } + + return o.RegionId +} + +// GetRegionIdOk returns a tuple with the RegionId field value +// and a boolean to check if the value has been set. +func (o *Instance) GetRegionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegionId, true +} + +// SetRegionId sets field value +func (o *Instance) SetRegionId(v string) { + o.RegionId = v +} + +// GetStatus returns the Status field value +func (o *Instance) GetStatus() InstanceStatus { + if o == nil { + var ret InstanceStatus + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Instance) GetStatusOk() (*InstanceStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *Instance) SetStatus(v InstanceStatus) { + o.Status = v +} + +// GetStatusMessage returns the StatusMessage field value if set, zero value otherwise. +func (o *Instance) GetStatusMessage() string { + if o == nil || IsNil(o.StatusMessage) { + var ret string + return ret + } + return *o.StatusMessage +} + +// GetStatusMessageOk returns a tuple with the StatusMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetStatusMessageOk() (*string, bool) { + if o == nil || IsNil(o.StatusMessage) { + return nil, false + } + return o.StatusMessage, true +} + +// HasStatusMessage returns a boolean if a field has been set. +func (o *Instance) HasStatusMessage() bool { + if o != nil && !IsNil(o.StatusMessage) { + return true + } + + return false +} + +// SetStatusMessage gets a reference to the given string and assigns it to the StatusMessage field. +func (o *Instance) SetStatusMessage(v string) { + o.StatusMessage = &v +} + +// GetVersion returns the Version field value +func (o *Instance) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *Instance) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *Instance) SetVersion(v string) { + o.Version = 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{}{} + toSerialize["createdAt"] = o.CreatedAt + if !IsNil(o.DagBundles) { + toSerialize["dagBundles"] = o.DagBundles + } + if !IsNil(o.DagsRepository) { + toSerialize["dagsRepository"] = o.DagsRepository + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["endpoints"] = o.Endpoints + toSerialize["id"] = o.Id + toSerialize["identityProvider"] = o.IdentityProvider + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.ObservabilityId) { + toSerialize["observabilityId"] = o.ObservabilityId + } + toSerialize["projectId"] = o.ProjectId + toSerialize["regionId"] = o.RegionId + toSerialize["status"] = o.Status + if !IsNil(o.StatusMessage) { + toSerialize["statusMessage"] = o.StatusMessage + } + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Instance) 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{ + "createdAt", + "displayName", + "endpoints", + "id", + "identityProvider", + "projectId", + "regionId", + "status", + "version", + } + + 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) + } + } + + 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, "createdAt") + delete(additionalProperties, "dagBundles") + delete(additionalProperties, "dagsRepository") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "endpoints") + delete(additionalProperties, "id") + delete(additionalProperties, "identityProvider") + delete(additionalProperties, "network") + delete(additionalProperties, "observabilityId") + delete(additionalProperties, "projectId") + delete(additionalProperties, "regionId") + delete(additionalProperties, "status") + delete(additionalProperties, "statusMessage") + delete(additionalProperties, "version") + 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/workflows/v1alphaapi/model_instance_status.go b/services/workflows/v1alphaapi/model_instance_status.go new file mode 100644 index 000000000..8663bba85 --- /dev/null +++ b/services/workflows/v1alphaapi/model_instance_status.go @@ -0,0 +1,119 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// InstanceStatus The current status of the STACKIT Workflows instance. +type InstanceStatus string + +// List of Instance_status +const ( + INSTANCESTATUS_CREATING InstanceStatus = "creating" + INSTANCESTATUS_ACTIVE InstanceStatus = "active" + INSTANCESTATUS_UPDATING InstanceStatus = "updating" + INSTANCESTATUS_DELETING InstanceStatus = "deleting" + INSTANCESTATUS_FAILED InstanceStatus = "failed" + INSTANCESTATUS_UNKNOWN_DEFAULT_OPEN_API InstanceStatus = "unknown_default_open_api" +) + +// All allowed values of InstanceStatus enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "creating", + "active", + "updating", + "deleting", + "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 Instance_status 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/workflows/v1alphaapi/model_list_dag_bundles_response.go b/services/workflows/v1alphaapi/model_list_dag_bundles_response.go new file mode 100644 index 000000000..f3c177335 --- /dev/null +++ b/services/workflows/v1alphaapi/model_list_dag_bundles_response.go @@ -0,0 +1,167 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListDagBundlesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDagBundlesResponse{} + +// ListDagBundlesResponse struct for ListDagBundlesResponse +type ListDagBundlesResponse struct { + // List of all configured DAG bundles. Authentication type and username are returned for informational purposes; passwords and secrets are always masked. + DagBundles []DagBundleResponse `json:"dagBundles"` + AdditionalProperties map[string]interface{} +} + +type _ListDagBundlesResponse ListDagBundlesResponse + +// NewListDagBundlesResponse instantiates a new ListDagBundlesResponse 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 NewListDagBundlesResponse(dagBundles []DagBundleResponse) *ListDagBundlesResponse { + this := ListDagBundlesResponse{} + this.DagBundles = dagBundles + return &this +} + +// NewListDagBundlesResponseWithDefaults instantiates a new ListDagBundlesResponse 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 NewListDagBundlesResponseWithDefaults() *ListDagBundlesResponse { + this := ListDagBundlesResponse{} + return &this +} + +// GetDagBundles returns the DagBundles field value +func (o *ListDagBundlesResponse) GetDagBundles() []DagBundleResponse { + if o == nil { + var ret []DagBundleResponse + return ret + } + + return o.DagBundles +} + +// GetDagBundlesOk returns a tuple with the DagBundles field value +// and a boolean to check if the value has been set. +func (o *ListDagBundlesResponse) GetDagBundlesOk() ([]DagBundleResponse, bool) { + if o == nil { + return nil, false + } + return o.DagBundles, true +} + +// SetDagBundles sets field value +func (o *ListDagBundlesResponse) SetDagBundles(v []DagBundleResponse) { + o.DagBundles = v +} + +func (o ListDagBundlesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListDagBundlesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["dagBundles"] = o.DagBundles + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListDagBundlesResponse) 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{ + "dagBundles", + } + + 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) + } + } + + varListDagBundlesResponse := _ListDagBundlesResponse{} + + err = json.Unmarshal(data, &varListDagBundlesResponse) + + if err != nil { + return err + } + + *o = ListDagBundlesResponse(varListDagBundlesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "dagBundles") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListDagBundlesResponse struct { + value *ListDagBundlesResponse + isSet bool +} + +func (v NullableListDagBundlesResponse) Get() *ListDagBundlesResponse { + return v.value +} + +func (v *NullableListDagBundlesResponse) Set(val *ListDagBundlesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListDagBundlesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListDagBundlesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDagBundlesResponse(val *ListDagBundlesResponse) *NullableListDagBundlesResponse { + return &NullableListDagBundlesResponse{value: val, isSet: true} +} + +func (v NullableListDagBundlesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDagBundlesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_list_instances_response.go b/services/workflows/v1alphaapi/model_list_instances_response.go new file mode 100644 index 000000000..e45804ce5 --- /dev/null +++ b/services/workflows/v1alphaapi/model_list_instances_response.go @@ -0,0 +1,166 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListInstancesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListInstancesResponse{} + +// ListInstancesResponse struct for ListInstancesResponse +type ListInstancesResponse struct { + Instances []Instance `json:"instances"` + AdditionalProperties map[string]interface{} +} + +type _ListInstancesResponse ListInstancesResponse + +// NewListInstancesResponse instantiates a new ListInstancesResponse 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 NewListInstancesResponse(instances []Instance) *ListInstancesResponse { + this := ListInstancesResponse{} + this.Instances = instances + return &this +} + +// NewListInstancesResponseWithDefaults instantiates a new ListInstancesResponse 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 NewListInstancesResponseWithDefaults() *ListInstancesResponse { + this := ListInstancesResponse{} + return &this +} + +// GetInstances returns the Instances field value +func (o *ListInstancesResponse) GetInstances() []Instance { + if o == nil { + var ret []Instance + 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 *ListInstancesResponse) GetInstancesOk() ([]Instance, bool) { + if o == nil { + return nil, false + } + return o.Instances, true +} + +// SetInstances sets field value +func (o *ListInstancesResponse) SetInstances(v []Instance) { + o.Instances = v +} + +func (o ListInstancesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListInstancesResponse) 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 *ListInstancesResponse) 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) + } + } + + varListInstancesResponse := _ListInstancesResponse{} + + err = json.Unmarshal(data, &varListInstancesResponse) + + if err != nil { + return err + } + + *o = ListInstancesResponse(varListInstancesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instances") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListInstancesResponse struct { + value *ListInstancesResponse + isSet bool +} + +func (v NullableListInstancesResponse) Get() *ListInstancesResponse { + return v.value +} + +func (v *NullableListInstancesResponse) Set(val *ListInstancesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListInstancesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListInstancesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListInstancesResponse(val *ListInstancesResponse) *NullableListInstancesResponse { + return &NullableListInstancesResponse{value: val, isSet: true} +} + +func (v NullableListInstancesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListInstancesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_network.go b/services/workflows/v1alphaapi/model_network.go new file mode 100644 index 000000000..12225148a --- /dev/null +++ b/services/workflows/v1alphaapi/model_network.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the Network type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Network{} + +// Network struct for Network +type Network struct { + Id *string `json:"id,omitempty"` + 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() *Network { + this := Network{} + 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 +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Network) 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 *Network) 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 *Network) 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 *Network) SetId(v string) { + o.Id = &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.Id) { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Network) UnmarshalJSON(data []byte) (err error) { + 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, "id") + 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/workflows/v1alphaapi/model_no_auth.go b/services/workflows/v1alphaapi/model_no_auth.go new file mode 100644 index 000000000..3ab604fd2 --- /dev/null +++ b/services/workflows/v1alphaapi/model_no_auth.go @@ -0,0 +1,154 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the NoAuth type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NoAuth{} + +// NoAuth No authentication required +type NoAuth struct { + // Type of authentication + Type *string `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _NoAuth NoAuth + +// NewNoAuth instantiates a new NoAuth 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 NewNoAuth() *NoAuth { + this := NoAuth{} + return &this +} + +// NewNoAuthWithDefaults instantiates a new NoAuth 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 NewNoAuthWithDefaults() *NoAuth { + this := NoAuth{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *NoAuth) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NoAuth) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *NoAuth) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *NoAuth) SetType(v string) { + o.Type = &v +} + +func (o NoAuth) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NoAuth) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *NoAuth) UnmarshalJSON(data []byte) (err error) { + varNoAuth := _NoAuth{} + + err = json.Unmarshal(data, &varNoAuth) + + if err != nil { + return err + } + + *o = NoAuth(varNoAuth) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNoAuth struct { + value *NoAuth + isSet bool +} + +func (v NullableNoAuth) Get() *NoAuth { + return v.value +} + +func (v *NullableNoAuth) Set(val *NoAuth) { + v.value = val + v.isSet = true +} + +func (v NullableNoAuth) IsSet() bool { + return v.isSet +} + +func (v *NullableNoAuth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNoAuth(val *NoAuth) *NullableNoAuth { + return &NullableNoAuth{value: val, isSet: true} +} + +func (v NullableNoAuth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNoAuth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_o_auth2_identity_provider.go b/services/workflows/v1alphaapi/model_o_auth2_identity_provider.go new file mode 100644 index 000000000..00782d9a1 --- /dev/null +++ b/services/workflows/v1alphaapi/model_o_auth2_identity_provider.go @@ -0,0 +1,430 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the OAuth2IdentityProvider type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OAuth2IdentityProvider{} + +// OAuth2IdentityProvider Configuration for the custom OAuth2 identity provider used. +type OAuth2IdentityProvider struct { + // Expected audience(s) for API token validation when using the session endpoint for token exchange. + ApiAudience []string `json:"apiAudience,omitempty"` + // The client id of the STACKIT Workflows application in the identity provider. + ClientId string `json:"clientId"` + // The client secret of the STACKIT Workflows application in the identity provider. + ClientSecret string `json:"clientSecret"` + // Discovery endpoint of the OAuth2 identity provider. This endpoint is used to fetch the OpenID configuration. Typically, this endpoint ends with `/.well-known/openid-configuration`. + DiscoveryEndpoint string `json:"discoveryEndpoint"` + // The name of the OAuth2 identity provider that will show in STACKIT Workflows instance. The following special values modify the way a token is parsed. If any of the following IdPs is used, please specify the corresponding value: `azure`, `okta`, `aws_cognito`, `keycloak` + Name string `json:"name"` + // RFC 8707 Resource Indicators for OAuth 2.0. Optional resource parameter to indicate which resource the token is intended for. + Resource *string `json:"resource,omitempty"` + // Dot-separated path to extract roles from JWT claims (e.g., \"realm_access.roles\" or \"resource_access.my_client.roles\"). If not specified, provider-specific defaults are used. + RolesClaim *string `json:"rolesClaim,omitempty"` + // Scopes to request for Authorization Code Flows. (UI login) + Scope string `json:"scope"` + Type OAuth2IdentityProviderType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _OAuth2IdentityProvider OAuth2IdentityProvider + +// NewOAuth2IdentityProvider instantiates a new OAuth2IdentityProvider 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 NewOAuth2IdentityProvider(clientId string, clientSecret string, discoveryEndpoint string, name string, scope string, types OAuth2IdentityProviderType) *OAuth2IdentityProvider { + this := OAuth2IdentityProvider{} + this.ClientId = clientId + this.ClientSecret = clientSecret + this.DiscoveryEndpoint = discoveryEndpoint + this.Name = name + this.Scope = scope + this.Type = types + return &this +} + +// NewOAuth2IdentityProviderWithDefaults instantiates a new OAuth2IdentityProvider 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 NewOAuth2IdentityProviderWithDefaults() *OAuth2IdentityProvider { + this := OAuth2IdentityProvider{} + return &this +} + +// GetApiAudience returns the ApiAudience field value if set, zero value otherwise. +func (o *OAuth2IdentityProvider) GetApiAudience() []string { + if o == nil || IsNil(o.ApiAudience) { + var ret []string + return ret + } + return o.ApiAudience +} + +// GetApiAudienceOk returns a tuple with the ApiAudience field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProvider) GetApiAudienceOk() ([]string, bool) { + if o == nil || IsNil(o.ApiAudience) { + return nil, false + } + return o.ApiAudience, true +} + +// HasApiAudience returns a boolean if a field has been set. +func (o *OAuth2IdentityProvider) HasApiAudience() bool { + if o != nil && !IsNil(o.ApiAudience) { + return true + } + + return false +} + +// SetApiAudience gets a reference to the given []string and assigns it to the ApiAudience field. +func (o *OAuth2IdentityProvider) SetApiAudience(v []string) { + o.ApiAudience = v +} + +// GetClientId returns the ClientId field value +func (o *OAuth2IdentityProvider) GetClientId() string { + if o == nil { + var ret string + return ret + } + + return o.ClientId +} + +// GetClientIdOk returns a tuple with the ClientId field value +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProvider) GetClientIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientId, true +} + +// SetClientId sets field value +func (o *OAuth2IdentityProvider) SetClientId(v string) { + o.ClientId = v +} + +// GetClientSecret returns the ClientSecret field value +func (o *OAuth2IdentityProvider) GetClientSecret() string { + if o == nil { + var ret string + return ret + } + + return o.ClientSecret +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProvider) GetClientSecretOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientSecret, true +} + +// SetClientSecret sets field value +func (o *OAuth2IdentityProvider) SetClientSecret(v string) { + o.ClientSecret = v +} + +// GetDiscoveryEndpoint returns the DiscoveryEndpoint field value +func (o *OAuth2IdentityProvider) GetDiscoveryEndpoint() string { + if o == nil { + var ret string + return ret + } + + return o.DiscoveryEndpoint +} + +// GetDiscoveryEndpointOk returns a tuple with the DiscoveryEndpoint field value +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProvider) GetDiscoveryEndpointOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DiscoveryEndpoint, true +} + +// SetDiscoveryEndpoint sets field value +func (o *OAuth2IdentityProvider) SetDiscoveryEndpoint(v string) { + o.DiscoveryEndpoint = v +} + +// GetName returns the Name field value +func (o *OAuth2IdentityProvider) 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 *OAuth2IdentityProvider) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *OAuth2IdentityProvider) SetName(v string) { + o.Name = v +} + +// GetResource returns the Resource field value if set, zero value otherwise. +func (o *OAuth2IdentityProvider) GetResource() string { + if o == nil || IsNil(o.Resource) { + var ret string + return ret + } + return *o.Resource +} + +// GetResourceOk returns a tuple with the Resource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProvider) GetResourceOk() (*string, bool) { + if o == nil || IsNil(o.Resource) { + return nil, false + } + return o.Resource, true +} + +// HasResource returns a boolean if a field has been set. +func (o *OAuth2IdentityProvider) HasResource() bool { + if o != nil && !IsNil(o.Resource) { + return true + } + + return false +} + +// SetResource gets a reference to the given string and assigns it to the Resource field. +func (o *OAuth2IdentityProvider) SetResource(v string) { + o.Resource = &v +} + +// GetRolesClaim returns the RolesClaim field value if set, zero value otherwise. +func (o *OAuth2IdentityProvider) GetRolesClaim() string { + if o == nil || IsNil(o.RolesClaim) { + var ret string + return ret + } + return *o.RolesClaim +} + +// GetRolesClaimOk returns a tuple with the RolesClaim field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProvider) GetRolesClaimOk() (*string, bool) { + if o == nil || IsNil(o.RolesClaim) { + return nil, false + } + return o.RolesClaim, true +} + +// HasRolesClaim returns a boolean if a field has been set. +func (o *OAuth2IdentityProvider) HasRolesClaim() bool { + if o != nil && !IsNil(o.RolesClaim) { + return true + } + + return false +} + +// SetRolesClaim gets a reference to the given string and assigns it to the RolesClaim field. +func (o *OAuth2IdentityProvider) SetRolesClaim(v string) { + o.RolesClaim = &v +} + +// GetScope returns the Scope field value +func (o *OAuth2IdentityProvider) GetScope() string { + if o == nil { + var ret string + return ret + } + + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProvider) GetScopeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Scope, true +} + +// SetScope sets field value +func (o *OAuth2IdentityProvider) SetScope(v string) { + o.Scope = v +} + +// GetType returns the Type field value +func (o *OAuth2IdentityProvider) GetType() OAuth2IdentityProviderType { + if o == nil { + var ret OAuth2IdentityProviderType + 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 *OAuth2IdentityProvider) GetTypeOk() (*OAuth2IdentityProviderType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *OAuth2IdentityProvider) SetType(v OAuth2IdentityProviderType) { + o.Type = v +} + +func (o OAuth2IdentityProvider) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OAuth2IdentityProvider) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ApiAudience) { + toSerialize["apiAudience"] = o.ApiAudience + } + toSerialize["clientId"] = o.ClientId + toSerialize["clientSecret"] = o.ClientSecret + toSerialize["discoveryEndpoint"] = o.DiscoveryEndpoint + toSerialize["name"] = o.Name + if !IsNil(o.Resource) { + toSerialize["resource"] = o.Resource + } + if !IsNil(o.RolesClaim) { + toSerialize["rolesClaim"] = o.RolesClaim + } + toSerialize["scope"] = o.Scope + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *OAuth2IdentityProvider) 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{ + "clientId", + "clientSecret", + "discoveryEndpoint", + "name", + "scope", + "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) + } + } + + varOAuth2IdentityProvider := _OAuth2IdentityProvider{} + + err = json.Unmarshal(data, &varOAuth2IdentityProvider) + + if err != nil { + return err + } + + *o = OAuth2IdentityProvider(varOAuth2IdentityProvider) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "apiAudience") + delete(additionalProperties, "clientId") + delete(additionalProperties, "clientSecret") + delete(additionalProperties, "discoveryEndpoint") + delete(additionalProperties, "name") + delete(additionalProperties, "resource") + delete(additionalProperties, "rolesClaim") + delete(additionalProperties, "scope") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOAuth2IdentityProvider struct { + value *OAuth2IdentityProvider + isSet bool +} + +func (v NullableOAuth2IdentityProvider) Get() *OAuth2IdentityProvider { + return v.value +} + +func (v *NullableOAuth2IdentityProvider) Set(val *OAuth2IdentityProvider) { + v.value = val + v.isSet = true +} + +func (v NullableOAuth2IdentityProvider) IsSet() bool { + return v.isSet +} + +func (v *NullableOAuth2IdentityProvider) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOAuth2IdentityProvider(val *OAuth2IdentityProvider) *NullableOAuth2IdentityProvider { + return &NullableOAuth2IdentityProvider{value: val, isSet: true} +} + +func (v NullableOAuth2IdentityProvider) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOAuth2IdentityProvider) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_o_auth2_identity_provider_type.go b/services/workflows/v1alphaapi/model_o_auth2_identity_provider_type.go new file mode 100644 index 000000000..cd1d951f7 --- /dev/null +++ b/services/workflows/v1alphaapi/model_o_auth2_identity_provider_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// OAuth2IdentityProviderType the model 'OAuth2IdentityProviderType' +type OAuth2IdentityProviderType string + +// List of OAuth2IdentityProvider_type +const ( + OAUTH2IDENTITYPROVIDERTYPE_OAUTH2 OAuth2IdentityProviderType = "oauth2" + OAUTH2IDENTITYPROVIDERTYPE_UNKNOWN_DEFAULT_OPEN_API OAuth2IdentityProviderType = "unknown_default_open_api" +) + +// All allowed values of OAuth2IdentityProviderType enum +var AllowedOAuth2IdentityProviderTypeEnumValues = []OAuth2IdentityProviderType{ + "oauth2", + "unknown_default_open_api", +} + +func (v *OAuth2IdentityProviderType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := OAuth2IdentityProviderType(value) + for _, existing := range AllowedOAuth2IdentityProviderTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = OAUTH2IDENTITYPROVIDERTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewOAuth2IdentityProviderTypeFromValue returns a pointer to a valid OAuth2IdentityProviderType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewOAuth2IdentityProviderTypeFromValue(v string) (*OAuth2IdentityProviderType, error) { + ev := OAuth2IdentityProviderType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for OAuth2IdentityProviderType: valid values are %v", v, AllowedOAuth2IdentityProviderTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v OAuth2IdentityProviderType) IsValid() bool { + for _, existing := range AllowedOAuth2IdentityProviderTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OAuth2IdentityProvider_type value +func (v OAuth2IdentityProviderType) Ptr() *OAuth2IdentityProviderType { + return &v +} + +type NullableOAuth2IdentityProviderType struct { + value *OAuth2IdentityProviderType + isSet bool +} + +func (v NullableOAuth2IdentityProviderType) Get() *OAuth2IdentityProviderType { + return v.value +} + +func (v *NullableOAuth2IdentityProviderType) Set(val *OAuth2IdentityProviderType) { + v.value = val + v.isSet = true +} + +func (v NullableOAuth2IdentityProviderType) IsSet() bool { + return v.isSet +} + +func (v *NullableOAuth2IdentityProviderType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOAuth2IdentityProviderType(val *OAuth2IdentityProviderType) *NullableOAuth2IdentityProviderType { + return &NullableOAuth2IdentityProviderType{value: val, isSet: true} +} + +func (v NullableOAuth2IdentityProviderType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOAuth2IdentityProviderType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_o_auth2_identity_provider_update.go b/services/workflows/v1alphaapi/model_o_auth2_identity_provider_update.go new file mode 100644 index 000000000..f4410eb69 --- /dev/null +++ b/services/workflows/v1alphaapi/model_o_auth2_identity_provider_update.go @@ -0,0 +1,420 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the OAuth2IdentityProviderUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OAuth2IdentityProviderUpdate{} + +// OAuth2IdentityProviderUpdate Request to update an OAuth2 identity provider configuration +type OAuth2IdentityProviderUpdate struct { + // Updated expected audience(s) for API token validation. Set to empty array to disable audience validation. + ApiAudience []string `json:"apiAudience,omitempty"` + // Updated client id of the STACKIT Workflows application in the identity provider. If changed, requires to also set the client secret. + ClientId *string `json:"clientId,omitempty"` + // Updated client secret of the STACKIT Workflows application in the identity provider. + ClientSecret *string `json:"clientSecret,omitempty"` + // Updated discovery endpoint of the OAuth2 identity provider. If changed, requires to also set the client id and client secret. + DiscoveryEndpoint *string `json:"discoveryEndpoint,omitempty"` + // Updated name of the OAuth2 identity provider. + Name *string `json:"name,omitempty"` + // Updated RFC 8707 resource parameter. Set to empty string to remove the resource parameter. + Resource *string `json:"resource,omitempty"` + // Updated dot-separated path to extract roles from JWT claims. Set to empty string to use provider-specific defaults. + RolesClaim *string `json:"rolesClaim,omitempty"` + // Updated scopes to request for Authorization Code Flows. (UI login) + Scope *string `json:"scope,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _OAuth2IdentityProviderUpdate OAuth2IdentityProviderUpdate + +// NewOAuth2IdentityProviderUpdate instantiates a new OAuth2IdentityProviderUpdate 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 NewOAuth2IdentityProviderUpdate() *OAuth2IdentityProviderUpdate { + this := OAuth2IdentityProviderUpdate{} + return &this +} + +// NewOAuth2IdentityProviderUpdateWithDefaults instantiates a new OAuth2IdentityProviderUpdate 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 NewOAuth2IdentityProviderUpdateWithDefaults() *OAuth2IdentityProviderUpdate { + this := OAuth2IdentityProviderUpdate{} + return &this +} + +// GetApiAudience returns the ApiAudience field value if set, zero value otherwise. +func (o *OAuth2IdentityProviderUpdate) GetApiAudience() []string { + if o == nil || IsNil(o.ApiAudience) { + var ret []string + return ret + } + return o.ApiAudience +} + +// GetApiAudienceOk returns a tuple with the ApiAudience field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProviderUpdate) GetApiAudienceOk() ([]string, bool) { + if o == nil || IsNil(o.ApiAudience) { + return nil, false + } + return o.ApiAudience, true +} + +// HasApiAudience returns a boolean if a field has been set. +func (o *OAuth2IdentityProviderUpdate) HasApiAudience() bool { + if o != nil && !IsNil(o.ApiAudience) { + return true + } + + return false +} + +// SetApiAudience gets a reference to the given []string and assigns it to the ApiAudience field. +func (o *OAuth2IdentityProviderUpdate) SetApiAudience(v []string) { + o.ApiAudience = v +} + +// GetClientId returns the ClientId field value if set, zero value otherwise. +func (o *OAuth2IdentityProviderUpdate) GetClientId() string { + if o == nil || IsNil(o.ClientId) { + var ret string + return ret + } + return *o.ClientId +} + +// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProviderUpdate) GetClientIdOk() (*string, bool) { + if o == nil || IsNil(o.ClientId) { + return nil, false + } + return o.ClientId, true +} + +// HasClientId returns a boolean if a field has been set. +func (o *OAuth2IdentityProviderUpdate) HasClientId() bool { + if o != nil && !IsNil(o.ClientId) { + return true + } + + return false +} + +// SetClientId gets a reference to the given string and assigns it to the ClientId field. +func (o *OAuth2IdentityProviderUpdate) SetClientId(v string) { + o.ClientId = &v +} + +// GetClientSecret returns the ClientSecret field value if set, zero value otherwise. +func (o *OAuth2IdentityProviderUpdate) GetClientSecret() string { + if o == nil || IsNil(o.ClientSecret) { + var ret string + return ret + } + return *o.ClientSecret +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProviderUpdate) GetClientSecretOk() (*string, bool) { + if o == nil || IsNil(o.ClientSecret) { + return nil, false + } + return o.ClientSecret, true +} + +// HasClientSecret returns a boolean if a field has been set. +func (o *OAuth2IdentityProviderUpdate) HasClientSecret() bool { + if o != nil && !IsNil(o.ClientSecret) { + return true + } + + return false +} + +// SetClientSecret gets a reference to the given string and assigns it to the ClientSecret field. +func (o *OAuth2IdentityProviderUpdate) SetClientSecret(v string) { + o.ClientSecret = &v +} + +// GetDiscoveryEndpoint returns the DiscoveryEndpoint field value if set, zero value otherwise. +func (o *OAuth2IdentityProviderUpdate) GetDiscoveryEndpoint() string { + if o == nil || IsNil(o.DiscoveryEndpoint) { + var ret string + return ret + } + return *o.DiscoveryEndpoint +} + +// GetDiscoveryEndpointOk returns a tuple with the DiscoveryEndpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProviderUpdate) GetDiscoveryEndpointOk() (*string, bool) { + if o == nil || IsNil(o.DiscoveryEndpoint) { + return nil, false + } + return o.DiscoveryEndpoint, true +} + +// HasDiscoveryEndpoint returns a boolean if a field has been set. +func (o *OAuth2IdentityProviderUpdate) HasDiscoveryEndpoint() bool { + if o != nil && !IsNil(o.DiscoveryEndpoint) { + return true + } + + return false +} + +// SetDiscoveryEndpoint gets a reference to the given string and assigns it to the DiscoveryEndpoint field. +func (o *OAuth2IdentityProviderUpdate) SetDiscoveryEndpoint(v string) { + o.DiscoveryEndpoint = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *OAuth2IdentityProviderUpdate) 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 *OAuth2IdentityProviderUpdate) 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 *OAuth2IdentityProviderUpdate) 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 *OAuth2IdentityProviderUpdate) SetName(v string) { + o.Name = &v +} + +// GetResource returns the Resource field value if set, zero value otherwise. +func (o *OAuth2IdentityProviderUpdate) GetResource() string { + if o == nil || IsNil(o.Resource) { + var ret string + return ret + } + return *o.Resource +} + +// GetResourceOk returns a tuple with the Resource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProviderUpdate) GetResourceOk() (*string, bool) { + if o == nil || IsNil(o.Resource) { + return nil, false + } + return o.Resource, true +} + +// HasResource returns a boolean if a field has been set. +func (o *OAuth2IdentityProviderUpdate) HasResource() bool { + if o != nil && !IsNil(o.Resource) { + return true + } + + return false +} + +// SetResource gets a reference to the given string and assigns it to the Resource field. +func (o *OAuth2IdentityProviderUpdate) SetResource(v string) { + o.Resource = &v +} + +// GetRolesClaim returns the RolesClaim field value if set, zero value otherwise. +func (o *OAuth2IdentityProviderUpdate) GetRolesClaim() string { + if o == nil || IsNil(o.RolesClaim) { + var ret string + return ret + } + return *o.RolesClaim +} + +// GetRolesClaimOk returns a tuple with the RolesClaim field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProviderUpdate) GetRolesClaimOk() (*string, bool) { + if o == nil || IsNil(o.RolesClaim) { + return nil, false + } + return o.RolesClaim, true +} + +// HasRolesClaim returns a boolean if a field has been set. +func (o *OAuth2IdentityProviderUpdate) HasRolesClaim() bool { + if o != nil && !IsNil(o.RolesClaim) { + return true + } + + return false +} + +// SetRolesClaim gets a reference to the given string and assigns it to the RolesClaim field. +func (o *OAuth2IdentityProviderUpdate) SetRolesClaim(v string) { + o.RolesClaim = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *OAuth2IdentityProviderUpdate) GetScope() string { + if o == nil || IsNil(o.Scope) { + var ret string + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OAuth2IdentityProviderUpdate) GetScopeOk() (*string, bool) { + if o == nil || IsNil(o.Scope) { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *OAuth2IdentityProviderUpdate) HasScope() bool { + if o != nil && !IsNil(o.Scope) { + return true + } + + return false +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *OAuth2IdentityProviderUpdate) SetScope(v string) { + o.Scope = &v +} + +func (o OAuth2IdentityProviderUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OAuth2IdentityProviderUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ApiAudience) { + toSerialize["apiAudience"] = o.ApiAudience + } + if !IsNil(o.ClientId) { + toSerialize["clientId"] = o.ClientId + } + if !IsNil(o.ClientSecret) { + toSerialize["clientSecret"] = o.ClientSecret + } + if !IsNil(o.DiscoveryEndpoint) { + toSerialize["discoveryEndpoint"] = o.DiscoveryEndpoint + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Resource) { + toSerialize["resource"] = o.Resource + } + if !IsNil(o.RolesClaim) { + toSerialize["rolesClaim"] = o.RolesClaim + } + if !IsNil(o.Scope) { + toSerialize["scope"] = o.Scope + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *OAuth2IdentityProviderUpdate) UnmarshalJSON(data []byte) (err error) { + varOAuth2IdentityProviderUpdate := _OAuth2IdentityProviderUpdate{} + + err = json.Unmarshal(data, &varOAuth2IdentityProviderUpdate) + + if err != nil { + return err + } + + *o = OAuth2IdentityProviderUpdate(varOAuth2IdentityProviderUpdate) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "apiAudience") + delete(additionalProperties, "clientId") + delete(additionalProperties, "clientSecret") + delete(additionalProperties, "discoveryEndpoint") + delete(additionalProperties, "name") + delete(additionalProperties, "resource") + delete(additionalProperties, "rolesClaim") + delete(additionalProperties, "scope") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOAuth2IdentityProviderUpdate struct { + value *OAuth2IdentityProviderUpdate + isSet bool +} + +func (v NullableOAuth2IdentityProviderUpdate) Get() *OAuth2IdentityProviderUpdate { + return v.value +} + +func (v *NullableOAuth2IdentityProviderUpdate) Set(val *OAuth2IdentityProviderUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableOAuth2IdentityProviderUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableOAuth2IdentityProviderUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOAuth2IdentityProviderUpdate(val *OAuth2IdentityProviderUpdate) *NullableOAuth2IdentityProviderUpdate { + return &NullableOAuth2IdentityProviderUpdate{value: val, isSet: true} +} + +func (v NullableOAuth2IdentityProviderUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOAuth2IdentityProviderUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_provider_options.go b/services/workflows/v1alphaapi/model_provider_options.go new file mode 100644 index 000000000..12c984a36 --- /dev/null +++ b/services/workflows/v1alphaapi/model_provider_options.go @@ -0,0 +1,166 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ProviderOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProviderOptions{} + +// ProviderOptions struct for ProviderOptions +type ProviderOptions struct { + Versions []SupportedVersion `json:"versions"` + AdditionalProperties map[string]interface{} +} + +type _ProviderOptions ProviderOptions + +// NewProviderOptions instantiates a new ProviderOptions 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 NewProviderOptions(versions []SupportedVersion) *ProviderOptions { + this := ProviderOptions{} + this.Versions = versions + return &this +} + +// NewProviderOptionsWithDefaults instantiates a new ProviderOptions 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 NewProviderOptionsWithDefaults() *ProviderOptions { + this := ProviderOptions{} + return &this +} + +// GetVersions returns the Versions field value +func (o *ProviderOptions) GetVersions() []SupportedVersion { + if o == nil { + var ret []SupportedVersion + return ret + } + + return o.Versions +} + +// GetVersionsOk returns a tuple with the Versions field value +// and a boolean to check if the value has been set. +func (o *ProviderOptions) GetVersionsOk() ([]SupportedVersion, bool) { + if o == nil { + return nil, false + } + return o.Versions, true +} + +// SetVersions sets field value +func (o *ProviderOptions) SetVersions(v []SupportedVersion) { + o.Versions = v +} + +func (o ProviderOptions) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProviderOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["versions"] = o.Versions + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProviderOptions) 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{ + "versions", + } + + 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) + } + } + + varProviderOptions := _ProviderOptions{} + + err = json.Unmarshal(data, &varProviderOptions) + + if err != nil { + return err + } + + *o = ProviderOptions(varProviderOptions) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "versions") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProviderOptions struct { + value *ProviderOptions + isSet bool +} + +func (v NullableProviderOptions) Get() *ProviderOptions { + return v.value +} + +func (v *NullableProviderOptions) Set(val *ProviderOptions) { + v.value = val + v.isSet = true +} + +func (v NullableProviderOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableProviderOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProviderOptions(val *ProviderOptions) *NullableProviderOptions { + return &NullableProviderOptions{value: val, isSet: true} +} + +func (v NullableProviderOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProviderOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_access_key_auth.go b/services/workflows/v1alphaapi/model_s3_access_key_auth.go new file mode 100644 index 000000000..2a63ad36e --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_access_key_auth.go @@ -0,0 +1,226 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the S3AccessKeyAuth type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3AccessKeyAuth{} + +// S3AccessKeyAuth S3 access key credentials (access key ID + secret access key). +type S3AccessKeyAuth struct { + // The S3 access key ID. + AccessKeyId string `json:"accessKeyId"` + // The S3 secret access key. This value is write-only and will not be returned in API responses. + SecretAccessKey string `json:"secretAccessKey"` + Type S3AccessKeyAuthType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _S3AccessKeyAuth S3AccessKeyAuth + +// NewS3AccessKeyAuth instantiates a new S3AccessKeyAuth 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 NewS3AccessKeyAuth(accessKeyId string, secretAccessKey string, types S3AccessKeyAuthType) *S3AccessKeyAuth { + this := S3AccessKeyAuth{} + this.AccessKeyId = accessKeyId + this.SecretAccessKey = secretAccessKey + this.Type = types + return &this +} + +// NewS3AccessKeyAuthWithDefaults instantiates a new S3AccessKeyAuth 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 NewS3AccessKeyAuthWithDefaults() *S3AccessKeyAuth { + this := S3AccessKeyAuth{} + return &this +} + +// GetAccessKeyId returns the AccessKeyId field value +func (o *S3AccessKeyAuth) GetAccessKeyId() string { + if o == nil { + var ret string + return ret + } + + return o.AccessKeyId +} + +// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value +// and a boolean to check if the value has been set. +func (o *S3AccessKeyAuth) GetAccessKeyIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccessKeyId, true +} + +// SetAccessKeyId sets field value +func (o *S3AccessKeyAuth) SetAccessKeyId(v string) { + o.AccessKeyId = v +} + +// GetSecretAccessKey returns the SecretAccessKey field value +func (o *S3AccessKeyAuth) GetSecretAccessKey() string { + if o == nil { + var ret string + return ret + } + + return o.SecretAccessKey +} + +// GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value +// and a boolean to check if the value has been set. +func (o *S3AccessKeyAuth) GetSecretAccessKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SecretAccessKey, true +} + +// SetSecretAccessKey sets field value +func (o *S3AccessKeyAuth) SetSecretAccessKey(v string) { + o.SecretAccessKey = v +} + +// GetType returns the Type field value +func (o *S3AccessKeyAuth) GetType() S3AccessKeyAuthType { + if o == nil { + var ret S3AccessKeyAuthType + 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 *S3AccessKeyAuth) GetTypeOk() (*S3AccessKeyAuthType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *S3AccessKeyAuth) SetType(v S3AccessKeyAuthType) { + o.Type = v +} + +func (o S3AccessKeyAuth) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o S3AccessKeyAuth) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["accessKeyId"] = o.AccessKeyId + toSerialize["secretAccessKey"] = o.SecretAccessKey + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *S3AccessKeyAuth) 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{ + "accessKeyId", + "secretAccessKey", + "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) + } + } + + varS3AccessKeyAuth := _S3AccessKeyAuth{} + + err = json.Unmarshal(data, &varS3AccessKeyAuth) + + if err != nil { + return err + } + + *o = S3AccessKeyAuth(varS3AccessKeyAuth) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "accessKeyId") + delete(additionalProperties, "secretAccessKey") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableS3AccessKeyAuth struct { + value *S3AccessKeyAuth + isSet bool +} + +func (v NullableS3AccessKeyAuth) Get() *S3AccessKeyAuth { + return v.value +} + +func (v *NullableS3AccessKeyAuth) Set(val *S3AccessKeyAuth) { + v.value = val + v.isSet = true +} + +func (v NullableS3AccessKeyAuth) IsSet() bool { + return v.isSet +} + +func (v *NullableS3AccessKeyAuth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3AccessKeyAuth(val *S3AccessKeyAuth) *NullableS3AccessKeyAuth { + return &NullableS3AccessKeyAuth{value: val, isSet: true} +} + +func (v NullableS3AccessKeyAuth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3AccessKeyAuth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_access_key_auth_response.go b/services/workflows/v1alphaapi/model_s3_access_key_auth_response.go new file mode 100644 index 000000000..47fb67d2a --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_access_key_auth_response.go @@ -0,0 +1,234 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the S3AccessKeyAuthResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3AccessKeyAuthResponse{} + +// S3AccessKeyAuthResponse S3 access key credentials as returned in API responses. The secret access key is always masked (\"**********\") and never contains the real value. +type S3AccessKeyAuthResponse struct { + // The S3 access key ID. + AccessKeyId string `json:"accessKeyId"` + // Always returned as \"**********\". The actual secret access key is never exposed in API responses. + SecretAccessKey *string `json:"secretAccessKey,omitempty"` + Type S3AccessKeyAuthResponseType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _S3AccessKeyAuthResponse S3AccessKeyAuthResponse + +// NewS3AccessKeyAuthResponse instantiates a new S3AccessKeyAuthResponse 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 NewS3AccessKeyAuthResponse(accessKeyId string, types S3AccessKeyAuthResponseType) *S3AccessKeyAuthResponse { + this := S3AccessKeyAuthResponse{} + this.AccessKeyId = accessKeyId + this.Type = types + return &this +} + +// NewS3AccessKeyAuthResponseWithDefaults instantiates a new S3AccessKeyAuthResponse 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 NewS3AccessKeyAuthResponseWithDefaults() *S3AccessKeyAuthResponse { + this := S3AccessKeyAuthResponse{} + return &this +} + +// GetAccessKeyId returns the AccessKeyId field value +func (o *S3AccessKeyAuthResponse) GetAccessKeyId() string { + if o == nil { + var ret string + return ret + } + + return o.AccessKeyId +} + +// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value +// and a boolean to check if the value has been set. +func (o *S3AccessKeyAuthResponse) GetAccessKeyIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccessKeyId, true +} + +// SetAccessKeyId sets field value +func (o *S3AccessKeyAuthResponse) SetAccessKeyId(v string) { + o.AccessKeyId = v +} + +// GetSecretAccessKey returns the SecretAccessKey field value if set, zero value otherwise. +func (o *S3AccessKeyAuthResponse) GetSecretAccessKey() string { + if o == nil || IsNil(o.SecretAccessKey) { + var ret string + return ret + } + return *o.SecretAccessKey +} + +// GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3AccessKeyAuthResponse) GetSecretAccessKeyOk() (*string, bool) { + if o == nil || IsNil(o.SecretAccessKey) { + return nil, false + } + return o.SecretAccessKey, true +} + +// HasSecretAccessKey returns a boolean if a field has been set. +func (o *S3AccessKeyAuthResponse) HasSecretAccessKey() bool { + if o != nil && !IsNil(o.SecretAccessKey) { + return true + } + + return false +} + +// SetSecretAccessKey gets a reference to the given string and assigns it to the SecretAccessKey field. +func (o *S3AccessKeyAuthResponse) SetSecretAccessKey(v string) { + o.SecretAccessKey = &v +} + +// GetType returns the Type field value +func (o *S3AccessKeyAuthResponse) GetType() S3AccessKeyAuthResponseType { + if o == nil { + var ret S3AccessKeyAuthResponseType + 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 *S3AccessKeyAuthResponse) GetTypeOk() (*S3AccessKeyAuthResponseType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *S3AccessKeyAuthResponse) SetType(v S3AccessKeyAuthResponseType) { + o.Type = v +} + +func (o S3AccessKeyAuthResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o S3AccessKeyAuthResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["accessKeyId"] = o.AccessKeyId + if !IsNil(o.SecretAccessKey) { + toSerialize["secretAccessKey"] = o.SecretAccessKey + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *S3AccessKeyAuthResponse) 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{ + "accessKeyId", + "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) + } + } + + varS3AccessKeyAuthResponse := _S3AccessKeyAuthResponse{} + + err = json.Unmarshal(data, &varS3AccessKeyAuthResponse) + + if err != nil { + return err + } + + *o = S3AccessKeyAuthResponse(varS3AccessKeyAuthResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "accessKeyId") + delete(additionalProperties, "secretAccessKey") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableS3AccessKeyAuthResponse struct { + value *S3AccessKeyAuthResponse + isSet bool +} + +func (v NullableS3AccessKeyAuthResponse) Get() *S3AccessKeyAuthResponse { + return v.value +} + +func (v *NullableS3AccessKeyAuthResponse) Set(val *S3AccessKeyAuthResponse) { + v.value = val + v.isSet = true +} + +func (v NullableS3AccessKeyAuthResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableS3AccessKeyAuthResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3AccessKeyAuthResponse(val *S3AccessKeyAuthResponse) *NullableS3AccessKeyAuthResponse { + return &NullableS3AccessKeyAuthResponse{value: val, isSet: true} +} + +func (v NullableS3AccessKeyAuthResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3AccessKeyAuthResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_access_key_auth_response_type.go b/services/workflows/v1alphaapi/model_s3_access_key_auth_response_type.go new file mode 100644 index 000000000..9ef0e473d --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_access_key_auth_response_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// S3AccessKeyAuthResponseType Type of authentication +type S3AccessKeyAuthResponseType string + +// List of S3AccessKeyAuthResponse_type +const ( + S3ACCESSKEYAUTHRESPONSETYPE_ACCESS_KEY S3AccessKeyAuthResponseType = "accessKey" + S3ACCESSKEYAUTHRESPONSETYPE_UNKNOWN_DEFAULT_OPEN_API S3AccessKeyAuthResponseType = "unknown_default_open_api" +) + +// All allowed values of S3AccessKeyAuthResponseType enum +var AllowedS3AccessKeyAuthResponseTypeEnumValues = []S3AccessKeyAuthResponseType{ + "accessKey", + "unknown_default_open_api", +} + +func (v *S3AccessKeyAuthResponseType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := S3AccessKeyAuthResponseType(value) + for _, existing := range AllowedS3AccessKeyAuthResponseTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = S3ACCESSKEYAUTHRESPONSETYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewS3AccessKeyAuthResponseTypeFromValue returns a pointer to a valid S3AccessKeyAuthResponseType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewS3AccessKeyAuthResponseTypeFromValue(v string) (*S3AccessKeyAuthResponseType, error) { + ev := S3AccessKeyAuthResponseType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for S3AccessKeyAuthResponseType: valid values are %v", v, AllowedS3AccessKeyAuthResponseTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v S3AccessKeyAuthResponseType) IsValid() bool { + for _, existing := range AllowedS3AccessKeyAuthResponseTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to S3AccessKeyAuthResponse_type value +func (v S3AccessKeyAuthResponseType) Ptr() *S3AccessKeyAuthResponseType { + return &v +} + +type NullableS3AccessKeyAuthResponseType struct { + value *S3AccessKeyAuthResponseType + isSet bool +} + +func (v NullableS3AccessKeyAuthResponseType) Get() *S3AccessKeyAuthResponseType { + return v.value +} + +func (v *NullableS3AccessKeyAuthResponseType) Set(val *S3AccessKeyAuthResponseType) { + v.value = val + v.isSet = true +} + +func (v NullableS3AccessKeyAuthResponseType) IsSet() bool { + return v.isSet +} + +func (v *NullableS3AccessKeyAuthResponseType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3AccessKeyAuthResponseType(val *S3AccessKeyAuthResponseType) *NullableS3AccessKeyAuthResponseType { + return &NullableS3AccessKeyAuthResponseType{value: val, isSet: true} +} + +func (v NullableS3AccessKeyAuthResponseType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3AccessKeyAuthResponseType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_access_key_auth_type.go b/services/workflows/v1alphaapi/model_s3_access_key_auth_type.go new file mode 100644 index 000000000..b85f33a61 --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_access_key_auth_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// S3AccessKeyAuthType Type of authentication +type S3AccessKeyAuthType string + +// List of S3AccessKeyAuth_type +const ( + S3ACCESSKEYAUTHTYPE_ACCESS_KEY S3AccessKeyAuthType = "accessKey" + S3ACCESSKEYAUTHTYPE_UNKNOWN_DEFAULT_OPEN_API S3AccessKeyAuthType = "unknown_default_open_api" +) + +// All allowed values of S3AccessKeyAuthType enum +var AllowedS3AccessKeyAuthTypeEnumValues = []S3AccessKeyAuthType{ + "accessKey", + "unknown_default_open_api", +} + +func (v *S3AccessKeyAuthType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := S3AccessKeyAuthType(value) + for _, existing := range AllowedS3AccessKeyAuthTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = S3ACCESSKEYAUTHTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewS3AccessKeyAuthTypeFromValue returns a pointer to a valid S3AccessKeyAuthType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewS3AccessKeyAuthTypeFromValue(v string) (*S3AccessKeyAuthType, error) { + ev := S3AccessKeyAuthType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for S3AccessKeyAuthType: valid values are %v", v, AllowedS3AccessKeyAuthTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v S3AccessKeyAuthType) IsValid() bool { + for _, existing := range AllowedS3AccessKeyAuthTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to S3AccessKeyAuth_type value +func (v S3AccessKeyAuthType) Ptr() *S3AccessKeyAuthType { + return &v +} + +type NullableS3AccessKeyAuthType struct { + value *S3AccessKeyAuthType + isSet bool +} + +func (v NullableS3AccessKeyAuthType) Get() *S3AccessKeyAuthType { + return v.value +} + +func (v *NullableS3AccessKeyAuthType) Set(val *S3AccessKeyAuthType) { + v.value = val + v.isSet = true +} + +func (v NullableS3AccessKeyAuthType) IsSet() bool { + return v.isSet +} + +func (v *NullableS3AccessKeyAuthType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3AccessKeyAuthType(val *S3AccessKeyAuthType) *NullableS3AccessKeyAuthType { + return &NullableS3AccessKeyAuthType{value: val, isSet: true} +} + +func (v NullableS3AccessKeyAuthType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3AccessKeyAuthType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_auth.go b/services/workflows/v1alphaapi/model_s3_auth.go new file mode 100644 index 000000000..204c5a41b --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_auth.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// S3Auth - Authentication for S3-compatible object storage +type S3Auth struct { + NoAuth *NoAuth + S3AccessKeyAuth *S3AccessKeyAuth +} + +// NoAuthAsS3Auth is a convenience function that returns NoAuth wrapped in S3Auth +func NoAuthAsS3Auth(v *NoAuth) S3Auth { + return S3Auth{ + NoAuth: v, + } +} + +// S3AccessKeyAuthAsS3Auth is a convenience function that returns S3AccessKeyAuth wrapped in S3Auth +func S3AccessKeyAuthAsS3Auth(v *S3AccessKeyAuth) S3Auth { + return S3Auth{ + S3AccessKeyAuth: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *S3Auth) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'accessKey' + if jsonDict["type"] == "accessKey" { + // try to unmarshal JSON data into S3AccessKeyAuth + err = json.Unmarshal(data, &dst.S3AccessKeyAuth) + if err == nil { + return nil // data stored in dst.S3AccessKeyAuth, return on the first match + } else { + dst.S3AccessKeyAuth = nil + return fmt.Errorf("failed to unmarshal S3Auth as S3AccessKeyAuth: %s", err.Error()) + } + } + + // check if the discriminator value is 'none' + if jsonDict["type"] == "none" { + // try to unmarshal JSON data into NoAuth + err = json.Unmarshal(data, &dst.NoAuth) + if err == nil { + return nil // data stored in dst.NoAuth, return on the first match + } else { + dst.NoAuth = nil + return fmt.Errorf("failed to unmarshal S3Auth as NoAuth: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src S3Auth) MarshalJSON() ([]byte, error) { + if src.NoAuth != nil { + return json.Marshal(&src.NoAuth) + } + + if src.S3AccessKeyAuth != nil { + return json.Marshal(&src.S3AccessKeyAuth) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *S3Auth) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.NoAuth != nil { + return obj.NoAuth + } + + if obj.S3AccessKeyAuth != nil { + return obj.S3AccessKeyAuth + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj S3Auth) GetActualInstanceValue() interface{} { + if obj.NoAuth != nil { + return *obj.NoAuth + } + + if obj.S3AccessKeyAuth != nil { + return *obj.S3AccessKeyAuth + } + + // all schemas are nil + return nil +} + +type NullableS3Auth struct { + value *S3Auth + isSet bool +} + +func (v NullableS3Auth) Get() *S3Auth { + return v.value +} + +func (v *NullableS3Auth) Set(val *S3Auth) { + v.value = val + v.isSet = true +} + +func (v NullableS3Auth) IsSet() bool { + return v.isSet +} + +func (v *NullableS3Auth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3Auth(val *S3Auth) *NullableS3Auth { + return &NullableS3Auth{value: val, isSet: true} +} + +func (v NullableS3Auth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3Auth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_auth_response.go b/services/workflows/v1alphaapi/model_s3_auth_response.go new file mode 100644 index 000000000..2630acab3 --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_auth_response.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// S3AuthResponse - S3 authentication configuration as returned in API responses. Secret keys are always masked and never returned in plain text. +type S3AuthResponse struct { + NoAuth *NoAuth + S3AccessKeyAuthResponse *S3AccessKeyAuthResponse +} + +// NoAuthAsS3AuthResponse is a convenience function that returns NoAuth wrapped in S3AuthResponse +func NoAuthAsS3AuthResponse(v *NoAuth) S3AuthResponse { + return S3AuthResponse{ + NoAuth: v, + } +} + +// S3AccessKeyAuthResponseAsS3AuthResponse is a convenience function that returns S3AccessKeyAuthResponse wrapped in S3AuthResponse +func S3AccessKeyAuthResponseAsS3AuthResponse(v *S3AccessKeyAuthResponse) S3AuthResponse { + return S3AuthResponse{ + S3AccessKeyAuthResponse: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *S3AuthResponse) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'accessKey' + if jsonDict["type"] == "accessKey" { + // try to unmarshal JSON data into S3AccessKeyAuthResponse + err = json.Unmarshal(data, &dst.S3AccessKeyAuthResponse) + if err == nil { + return nil // data stored in dst.S3AccessKeyAuthResponse, return on the first match + } else { + dst.S3AccessKeyAuthResponse = nil + return fmt.Errorf("failed to unmarshal S3AuthResponse as S3AccessKeyAuthResponse: %s", err.Error()) + } + } + + // check if the discriminator value is 'none' + if jsonDict["type"] == "none" { + // try to unmarshal JSON data into NoAuth + err = json.Unmarshal(data, &dst.NoAuth) + if err == nil { + return nil // data stored in dst.NoAuth, return on the first match + } else { + dst.NoAuth = nil + return fmt.Errorf("failed to unmarshal S3AuthResponse as NoAuth: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src S3AuthResponse) MarshalJSON() ([]byte, error) { + if src.NoAuth != nil { + return json.Marshal(&src.NoAuth) + } + + if src.S3AccessKeyAuthResponse != nil { + return json.Marshal(&src.S3AccessKeyAuthResponse) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *S3AuthResponse) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.NoAuth != nil { + return obj.NoAuth + } + + if obj.S3AccessKeyAuthResponse != nil { + return obj.S3AccessKeyAuthResponse + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj S3AuthResponse) GetActualInstanceValue() interface{} { + if obj.NoAuth != nil { + return *obj.NoAuth + } + + if obj.S3AccessKeyAuthResponse != nil { + return *obj.S3AccessKeyAuthResponse + } + + // all schemas are nil + return nil +} + +type NullableS3AuthResponse struct { + value *S3AuthResponse + isSet bool +} + +func (v NullableS3AuthResponse) Get() *S3AuthResponse { + return v.value +} + +func (v *NullableS3AuthResponse) Set(val *S3AuthResponse) { + v.value = val + v.isSet = true +} + +func (v NullableS3AuthResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableS3AuthResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3AuthResponse(val *S3AuthResponse) *NullableS3AuthResponse { + return &NullableS3AuthResponse{value: val, isSet: true} +} + +func (v NullableS3AuthResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3AuthResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_dag_bundle.go b/services/workflows/v1alphaapi/model_s3_dag_bundle.go new file mode 100644 index 000000000..d84904e43 --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_dag_bundle.go @@ -0,0 +1,369 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the S3DagBundle type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3DagBundle{} + +// S3DagBundle An S3-based DAG bundle. Maps to airflow.providers.amazon.aws.bundles.s3.S3DagBundle. Compatible with any S3-compatible object storage (e.g. STACKIT Object Storage). +type S3DagBundle struct { + // The S3 bucket name containing DAG files. + BucketName string `json:"bucketName"` + // S3-compatible endpoint URL. Defaults to https://object.storage.eu01.onstackit.cloud + Endpoint *string `json:"endpoint,omitempty"` + // Unique name for this bundle within the instance. Must be a valid DNS label (lowercase alphanumeric and hyphens, starting with a letter, max 63 characters). + Name string `json:"name" validate:"regexp=^[a-z][a-z0-9-]{0,62}$"` + // Key prefix (folder path) within the bucket. Defaults to root. + Prefix *string `json:"prefix,omitempty"` + // How often (in seconds) to check for new objects. Defaults to 60. + RefreshInterval *int32 `json:"refreshInterval,omitempty"` + S3Auth S3Auth `json:"s3Auth"` + Type S3DagBundleType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _S3DagBundle S3DagBundle + +// NewS3DagBundle instantiates a new S3DagBundle 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 NewS3DagBundle(bucketName string, name string, s3Auth S3Auth, types S3DagBundleType) *S3DagBundle { + this := S3DagBundle{} + this.BucketName = bucketName + this.Name = name + this.S3Auth = s3Auth + this.Type = types + return &this +} + +// NewS3DagBundleWithDefaults instantiates a new S3DagBundle 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 NewS3DagBundleWithDefaults() *S3DagBundle { + this := S3DagBundle{} + return &this +} + +// GetBucketName returns the BucketName field value +func (o *S3DagBundle) GetBucketName() string { + if o == nil { + var ret string + return ret + } + + return o.BucketName +} + +// GetBucketNameOk returns a tuple with the BucketName field value +// and a boolean to check if the value has been set. +func (o *S3DagBundle) GetBucketNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BucketName, true +} + +// SetBucketName sets field value +func (o *S3DagBundle) SetBucketName(v string) { + o.BucketName = v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *S3DagBundle) GetEndpoint() string { + if o == nil || IsNil(o.Endpoint) { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3DagBundle) GetEndpointOk() (*string, bool) { + if o == nil || IsNil(o.Endpoint) { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *S3DagBundle) HasEndpoint() bool { + if o != nil && !IsNil(o.Endpoint) { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *S3DagBundle) SetEndpoint(v string) { + o.Endpoint = &v +} + +// GetName returns the Name field value +func (o *S3DagBundle) 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 *S3DagBundle) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *S3DagBundle) SetName(v string) { + o.Name = v +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *S3DagBundle) GetPrefix() string { + if o == nil || IsNil(o.Prefix) { + var ret string + return ret + } + return *o.Prefix +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3DagBundle) GetPrefixOk() (*string, bool) { + if o == nil || IsNil(o.Prefix) { + return nil, false + } + return o.Prefix, true +} + +// HasPrefix returns a boolean if a field has been set. +func (o *S3DagBundle) HasPrefix() bool { + if o != nil && !IsNil(o.Prefix) { + return true + } + + return false +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *S3DagBundle) SetPrefix(v string) { + o.Prefix = &v +} + +// GetRefreshInterval returns the RefreshInterval field value if set, zero value otherwise. +func (o *S3DagBundle) GetRefreshInterval() int32 { + if o == nil || IsNil(o.RefreshInterval) { + var ret int32 + return ret + } + return *o.RefreshInterval +} + +// GetRefreshIntervalOk returns a tuple with the RefreshInterval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3DagBundle) GetRefreshIntervalOk() (*int32, bool) { + if o == nil || IsNil(o.RefreshInterval) { + return nil, false + } + return o.RefreshInterval, true +} + +// HasRefreshInterval returns a boolean if a field has been set. +func (o *S3DagBundle) HasRefreshInterval() bool { + if o != nil && !IsNil(o.RefreshInterval) { + return true + } + + return false +} + +// SetRefreshInterval gets a reference to the given int32 and assigns it to the RefreshInterval field. +func (o *S3DagBundle) SetRefreshInterval(v int32) { + o.RefreshInterval = &v +} + +// GetS3Auth returns the S3Auth field value +func (o *S3DagBundle) GetS3Auth() S3Auth { + if o == nil { + var ret S3Auth + return ret + } + + return o.S3Auth +} + +// GetS3AuthOk returns a tuple with the S3Auth field value +// and a boolean to check if the value has been set. +func (o *S3DagBundle) GetS3AuthOk() (*S3Auth, bool) { + if o == nil { + return nil, false + } + return &o.S3Auth, true +} + +// SetS3Auth sets field value +func (o *S3DagBundle) SetS3Auth(v S3Auth) { + o.S3Auth = v +} + +// GetType returns the Type field value +func (o *S3DagBundle) GetType() S3DagBundleType { + if o == nil { + var ret S3DagBundleType + 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 *S3DagBundle) GetTypeOk() (*S3DagBundleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *S3DagBundle) SetType(v S3DagBundleType) { + o.Type = v +} + +func (o S3DagBundle) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o S3DagBundle) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bucketName"] = o.BucketName + if !IsNil(o.Endpoint) { + toSerialize["endpoint"] = o.Endpoint + } + toSerialize["name"] = o.Name + if !IsNil(o.Prefix) { + toSerialize["prefix"] = o.Prefix + } + if !IsNil(o.RefreshInterval) { + toSerialize["refreshInterval"] = o.RefreshInterval + } + toSerialize["s3Auth"] = o.S3Auth + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *S3DagBundle) 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{ + "bucketName", + "name", + "s3Auth", + "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) + } + } + + varS3DagBundle := _S3DagBundle{} + + err = json.Unmarshal(data, &varS3DagBundle) + + if err != nil { + return err + } + + *o = S3DagBundle(varS3DagBundle) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bucketName") + delete(additionalProperties, "endpoint") + delete(additionalProperties, "name") + delete(additionalProperties, "prefix") + delete(additionalProperties, "refreshInterval") + delete(additionalProperties, "s3Auth") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableS3DagBundle struct { + value *S3DagBundle + isSet bool +} + +func (v NullableS3DagBundle) Get() *S3DagBundle { + return v.value +} + +func (v *NullableS3DagBundle) Set(val *S3DagBundle) { + v.value = val + v.isSet = true +} + +func (v NullableS3DagBundle) IsSet() bool { + return v.isSet +} + +func (v *NullableS3DagBundle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3DagBundle(val *S3DagBundle) *NullableS3DagBundle { + return &NullableS3DagBundle{value: val, isSet: true} +} + +func (v NullableS3DagBundle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3DagBundle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_dag_bundle_response.go b/services/workflows/v1alphaapi/model_s3_dag_bundle_response.go new file mode 100644 index 000000000..bc364db5d --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_dag_bundle_response.go @@ -0,0 +1,369 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the S3DagBundleResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3DagBundleResponse{} + +// S3DagBundleResponse An S3-based DAG bundle as returned by the API. The s3Auth structure (type, accessKeyId) is included; secret keys are masked. +type S3DagBundleResponse struct { + // The S3 bucket name containing DAG files. + BucketName string `json:"bucketName"` + // S3-compatible endpoint URL. + Endpoint *string `json:"endpoint,omitempty"` + // Unique name for this bundle within the instance. + Name string `json:"name" validate:"regexp=^[a-z][a-z0-9-]{0,62}$"` + // Key prefix (folder path) within the bucket. + Prefix *string `json:"prefix,omitempty"` + // How often (in seconds) to check for new objects. + RefreshInterval *int32 `json:"refreshInterval,omitempty"` + S3Auth S3AuthResponse `json:"s3Auth"` + Type S3DagBundleResponseType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _S3DagBundleResponse S3DagBundleResponse + +// NewS3DagBundleResponse instantiates a new S3DagBundleResponse 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 NewS3DagBundleResponse(bucketName string, name string, s3Auth S3AuthResponse, types S3DagBundleResponseType) *S3DagBundleResponse { + this := S3DagBundleResponse{} + this.BucketName = bucketName + this.Name = name + this.S3Auth = s3Auth + this.Type = types + return &this +} + +// NewS3DagBundleResponseWithDefaults instantiates a new S3DagBundleResponse 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 NewS3DagBundleResponseWithDefaults() *S3DagBundleResponse { + this := S3DagBundleResponse{} + return &this +} + +// GetBucketName returns the BucketName field value +func (o *S3DagBundleResponse) GetBucketName() string { + if o == nil { + var ret string + return ret + } + + return o.BucketName +} + +// GetBucketNameOk returns a tuple with the BucketName field value +// and a boolean to check if the value has been set. +func (o *S3DagBundleResponse) GetBucketNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BucketName, true +} + +// SetBucketName sets field value +func (o *S3DagBundleResponse) SetBucketName(v string) { + o.BucketName = v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *S3DagBundleResponse) GetEndpoint() string { + if o == nil || IsNil(o.Endpoint) { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3DagBundleResponse) GetEndpointOk() (*string, bool) { + if o == nil || IsNil(o.Endpoint) { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *S3DagBundleResponse) HasEndpoint() bool { + if o != nil && !IsNil(o.Endpoint) { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *S3DagBundleResponse) SetEndpoint(v string) { + o.Endpoint = &v +} + +// GetName returns the Name field value +func (o *S3DagBundleResponse) 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 *S3DagBundleResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *S3DagBundleResponse) SetName(v string) { + o.Name = v +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *S3DagBundleResponse) GetPrefix() string { + if o == nil || IsNil(o.Prefix) { + var ret string + return ret + } + return *o.Prefix +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3DagBundleResponse) GetPrefixOk() (*string, bool) { + if o == nil || IsNil(o.Prefix) { + return nil, false + } + return o.Prefix, true +} + +// HasPrefix returns a boolean if a field has been set. +func (o *S3DagBundleResponse) HasPrefix() bool { + if o != nil && !IsNil(o.Prefix) { + return true + } + + return false +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *S3DagBundleResponse) SetPrefix(v string) { + o.Prefix = &v +} + +// GetRefreshInterval returns the RefreshInterval field value if set, zero value otherwise. +func (o *S3DagBundleResponse) GetRefreshInterval() int32 { + if o == nil || IsNil(o.RefreshInterval) { + var ret int32 + return ret + } + return *o.RefreshInterval +} + +// GetRefreshIntervalOk returns a tuple with the RefreshInterval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3DagBundleResponse) GetRefreshIntervalOk() (*int32, bool) { + if o == nil || IsNil(o.RefreshInterval) { + return nil, false + } + return o.RefreshInterval, true +} + +// HasRefreshInterval returns a boolean if a field has been set. +func (o *S3DagBundleResponse) HasRefreshInterval() bool { + if o != nil && !IsNil(o.RefreshInterval) { + return true + } + + return false +} + +// SetRefreshInterval gets a reference to the given int32 and assigns it to the RefreshInterval field. +func (o *S3DagBundleResponse) SetRefreshInterval(v int32) { + o.RefreshInterval = &v +} + +// GetS3Auth returns the S3Auth field value +func (o *S3DagBundleResponse) GetS3Auth() S3AuthResponse { + if o == nil { + var ret S3AuthResponse + return ret + } + + return o.S3Auth +} + +// GetS3AuthOk returns a tuple with the S3Auth field value +// and a boolean to check if the value has been set. +func (o *S3DagBundleResponse) GetS3AuthOk() (*S3AuthResponse, bool) { + if o == nil { + return nil, false + } + return &o.S3Auth, true +} + +// SetS3Auth sets field value +func (o *S3DagBundleResponse) SetS3Auth(v S3AuthResponse) { + o.S3Auth = v +} + +// GetType returns the Type field value +func (o *S3DagBundleResponse) GetType() S3DagBundleResponseType { + if o == nil { + var ret S3DagBundleResponseType + 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 *S3DagBundleResponse) GetTypeOk() (*S3DagBundleResponseType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *S3DagBundleResponse) SetType(v S3DagBundleResponseType) { + o.Type = v +} + +func (o S3DagBundleResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o S3DagBundleResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bucketName"] = o.BucketName + if !IsNil(o.Endpoint) { + toSerialize["endpoint"] = o.Endpoint + } + toSerialize["name"] = o.Name + if !IsNil(o.Prefix) { + toSerialize["prefix"] = o.Prefix + } + if !IsNil(o.RefreshInterval) { + toSerialize["refreshInterval"] = o.RefreshInterval + } + toSerialize["s3Auth"] = o.S3Auth + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *S3DagBundleResponse) 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{ + "bucketName", + "name", + "s3Auth", + "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) + } + } + + varS3DagBundleResponse := _S3DagBundleResponse{} + + err = json.Unmarshal(data, &varS3DagBundleResponse) + + if err != nil { + return err + } + + *o = S3DagBundleResponse(varS3DagBundleResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bucketName") + delete(additionalProperties, "endpoint") + delete(additionalProperties, "name") + delete(additionalProperties, "prefix") + delete(additionalProperties, "refreshInterval") + delete(additionalProperties, "s3Auth") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableS3DagBundleResponse struct { + value *S3DagBundleResponse + isSet bool +} + +func (v NullableS3DagBundleResponse) Get() *S3DagBundleResponse { + return v.value +} + +func (v *NullableS3DagBundleResponse) Set(val *S3DagBundleResponse) { + v.value = val + v.isSet = true +} + +func (v NullableS3DagBundleResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableS3DagBundleResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3DagBundleResponse(val *S3DagBundleResponse) *NullableS3DagBundleResponse { + return &NullableS3DagBundleResponse{value: val, isSet: true} +} + +func (v NullableS3DagBundleResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3DagBundleResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_dag_bundle_response_type.go b/services/workflows/v1alphaapi/model_s3_dag_bundle_response_type.go new file mode 100644 index 000000000..df2f60d62 --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_dag_bundle_response_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// S3DagBundleResponseType Bundle type identifier. +type S3DagBundleResponseType string + +// List of S3DagBundleResponse_type +const ( + S3DAGBUNDLERESPONSETYPE_S3 S3DagBundleResponseType = "s3" + S3DAGBUNDLERESPONSETYPE_UNKNOWN_DEFAULT_OPEN_API S3DagBundleResponseType = "unknown_default_open_api" +) + +// All allowed values of S3DagBundleResponseType enum +var AllowedS3DagBundleResponseTypeEnumValues = []S3DagBundleResponseType{ + "s3", + "unknown_default_open_api", +} + +func (v *S3DagBundleResponseType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := S3DagBundleResponseType(value) + for _, existing := range AllowedS3DagBundleResponseTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = S3DAGBUNDLERESPONSETYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewS3DagBundleResponseTypeFromValue returns a pointer to a valid S3DagBundleResponseType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewS3DagBundleResponseTypeFromValue(v string) (*S3DagBundleResponseType, error) { + ev := S3DagBundleResponseType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for S3DagBundleResponseType: valid values are %v", v, AllowedS3DagBundleResponseTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v S3DagBundleResponseType) IsValid() bool { + for _, existing := range AllowedS3DagBundleResponseTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to S3DagBundleResponse_type value +func (v S3DagBundleResponseType) Ptr() *S3DagBundleResponseType { + return &v +} + +type NullableS3DagBundleResponseType struct { + value *S3DagBundleResponseType + isSet bool +} + +func (v NullableS3DagBundleResponseType) Get() *S3DagBundleResponseType { + return v.value +} + +func (v *NullableS3DagBundleResponseType) Set(val *S3DagBundleResponseType) { + v.value = val + v.isSet = true +} + +func (v NullableS3DagBundleResponseType) IsSet() bool { + return v.isSet +} + +func (v *NullableS3DagBundleResponseType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3DagBundleResponseType(val *S3DagBundleResponseType) *NullableS3DagBundleResponseType { + return &NullableS3DagBundleResponseType{value: val, isSet: true} +} + +func (v NullableS3DagBundleResponseType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3DagBundleResponseType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_s3_dag_bundle_type.go b/services/workflows/v1alphaapi/model_s3_dag_bundle_type.go new file mode 100644 index 000000000..2309b0b7c --- /dev/null +++ b/services/workflows/v1alphaapi/model_s3_dag_bundle_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// S3DagBundleType Bundle type identifier. +type S3DagBundleType string + +// List of S3DagBundle_type +const ( + S3DAGBUNDLETYPE_S3 S3DagBundleType = "s3" + S3DAGBUNDLETYPE_UNKNOWN_DEFAULT_OPEN_API S3DagBundleType = "unknown_default_open_api" +) + +// All allowed values of S3DagBundleType enum +var AllowedS3DagBundleTypeEnumValues = []S3DagBundleType{ + "s3", + "unknown_default_open_api", +} + +func (v *S3DagBundleType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := S3DagBundleType(value) + for _, existing := range AllowedS3DagBundleTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = S3DAGBUNDLETYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewS3DagBundleTypeFromValue returns a pointer to a valid S3DagBundleType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewS3DagBundleTypeFromValue(v string) (*S3DagBundleType, error) { + ev := S3DagBundleType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for S3DagBundleType: valid values are %v", v, AllowedS3DagBundleTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v S3DagBundleType) IsValid() bool { + for _, existing := range AllowedS3DagBundleTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to S3DagBundle_type value +func (v S3DagBundleType) Ptr() *S3DagBundleType { + return &v +} + +type NullableS3DagBundleType struct { + value *S3DagBundleType + isSet bool +} + +func (v NullableS3DagBundleType) Get() *S3DagBundleType { + return v.value +} + +func (v *NullableS3DagBundleType) Set(val *S3DagBundleType) { + v.value = val + v.isSet = true +} + +func (v NullableS3DagBundleType) IsSet() bool { + return v.isSet +} + +func (v *NullableS3DagBundleType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3DagBundleType(val *S3DagBundleType) *NullableS3DagBundleType { + return &NullableS3DagBundleType{value: val, isSet: true} +} + +func (v NullableS3DagBundleType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3DagBundleType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_stack_it_identity_provider.go b/services/workflows/v1alphaapi/model_stack_it_identity_provider.go new file mode 100644 index 000000000..c6b2125cb --- /dev/null +++ b/services/workflows/v1alphaapi/model_stack_it_identity_provider.go @@ -0,0 +1,166 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the StackITIdentityProvider type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StackITIdentityProvider{} + +// StackITIdentityProvider The default STACKIT identity provider. +type StackITIdentityProvider struct { + Type StackITIdentityProviderType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _StackITIdentityProvider StackITIdentityProvider + +// NewStackITIdentityProvider instantiates a new StackITIdentityProvider 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 NewStackITIdentityProvider(types StackITIdentityProviderType) *StackITIdentityProvider { + this := StackITIdentityProvider{} + this.Type = types + return &this +} + +// NewStackITIdentityProviderWithDefaults instantiates a new StackITIdentityProvider 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 NewStackITIdentityProviderWithDefaults() *StackITIdentityProvider { + this := StackITIdentityProvider{} + return &this +} + +// GetType returns the Type field value +func (o *StackITIdentityProvider) GetType() StackITIdentityProviderType { + if o == nil { + var ret StackITIdentityProviderType + 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 *StackITIdentityProvider) GetTypeOk() (*StackITIdentityProviderType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *StackITIdentityProvider) SetType(v StackITIdentityProviderType) { + o.Type = v +} + +func (o StackITIdentityProvider) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o StackITIdentityProvider) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *StackITIdentityProvider) 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) + } + } + + varStackITIdentityProvider := _StackITIdentityProvider{} + + err = json.Unmarshal(data, &varStackITIdentityProvider) + + if err != nil { + return err + } + + *o = StackITIdentityProvider(varStackITIdentityProvider) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableStackITIdentityProvider struct { + value *StackITIdentityProvider + isSet bool +} + +func (v NullableStackITIdentityProvider) Get() *StackITIdentityProvider { + return v.value +} + +func (v *NullableStackITIdentityProvider) Set(val *StackITIdentityProvider) { + v.value = val + v.isSet = true +} + +func (v NullableStackITIdentityProvider) IsSet() bool { + return v.isSet +} + +func (v *NullableStackITIdentityProvider) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStackITIdentityProvider(val *StackITIdentityProvider) *NullableStackITIdentityProvider { + return &NullableStackITIdentityProvider{value: val, isSet: true} +} + +func (v NullableStackITIdentityProvider) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStackITIdentityProvider) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_stack_it_identity_provider_type.go b/services/workflows/v1alphaapi/model_stack_it_identity_provider_type.go new file mode 100644 index 000000000..18bfc976c --- /dev/null +++ b/services/workflows/v1alphaapi/model_stack_it_identity_provider_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// StackITIdentityProviderType the model 'StackITIdentityProviderType' +type StackITIdentityProviderType string + +// List of StackITIdentityProvider_type +const ( + STACKITIDENTITYPROVIDERTYPE_STACKIT StackITIdentityProviderType = "stackit" + STACKITIDENTITYPROVIDERTYPE_UNKNOWN_DEFAULT_OPEN_API StackITIdentityProviderType = "unknown_default_open_api" +) + +// All allowed values of StackITIdentityProviderType enum +var AllowedStackITIdentityProviderTypeEnumValues = []StackITIdentityProviderType{ + "stackit", + "unknown_default_open_api", +} + +func (v *StackITIdentityProviderType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := StackITIdentityProviderType(value) + for _, existing := range AllowedStackITIdentityProviderTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = STACKITIDENTITYPROVIDERTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewStackITIdentityProviderTypeFromValue returns a pointer to a valid StackITIdentityProviderType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewStackITIdentityProviderTypeFromValue(v string) (*StackITIdentityProviderType, error) { + ev := StackITIdentityProviderType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for StackITIdentityProviderType: valid values are %v", v, AllowedStackITIdentityProviderTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v StackITIdentityProviderType) IsValid() bool { + for _, existing := range AllowedStackITIdentityProviderTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StackITIdentityProvider_type value +func (v StackITIdentityProviderType) Ptr() *StackITIdentityProviderType { + return &v +} + +type NullableStackITIdentityProviderType struct { + value *StackITIdentityProviderType + isSet bool +} + +func (v NullableStackITIdentityProviderType) Get() *StackITIdentityProviderType { + return v.value +} + +func (v *NullableStackITIdentityProviderType) Set(val *StackITIdentityProviderType) { + v.value = val + v.isSet = true +} + +func (v NullableStackITIdentityProviderType) IsSet() bool { + return v.isSet +} + +func (v *NullableStackITIdentityProviderType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStackITIdentityProviderType(val *StackITIdentityProviderType) *NullableStackITIdentityProviderType { + return &NullableStackITIdentityProviderType{value: val, isSet: true} +} + +func (v NullableStackITIdentityProviderType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStackITIdentityProviderType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_supported_version.go b/services/workflows/v1alphaapi/model_supported_version.go new file mode 100644 index 000000000..96cb7dbb2 --- /dev/null +++ b/services/workflows/v1alphaapi/model_supported_version.go @@ -0,0 +1,233 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the SupportedVersion type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SupportedVersion{} + +// SupportedVersion struct for SupportedVersion +type SupportedVersion struct { + ExpirationDate *time.Time `json:"expirationDate,omitempty"` + State string `json:"state"` + Version string `json:"version"` + AdditionalProperties map[string]interface{} +} + +type _SupportedVersion SupportedVersion + +// NewSupportedVersion instantiates a new SupportedVersion 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 NewSupportedVersion(state string, version string) *SupportedVersion { + this := SupportedVersion{} + this.State = state + this.Version = version + return &this +} + +// NewSupportedVersionWithDefaults instantiates a new SupportedVersion 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 NewSupportedVersionWithDefaults() *SupportedVersion { + this := SupportedVersion{} + return &this +} + +// GetExpirationDate returns the ExpirationDate field value if set, zero value otherwise. +func (o *SupportedVersion) GetExpirationDate() time.Time { + if o == nil || IsNil(o.ExpirationDate) { + var ret time.Time + return ret + } + return *o.ExpirationDate +} + +// GetExpirationDateOk returns a tuple with the ExpirationDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SupportedVersion) GetExpirationDateOk() (*time.Time, bool) { + if o == nil || IsNil(o.ExpirationDate) { + return nil, false + } + return o.ExpirationDate, true +} + +// HasExpirationDate returns a boolean if a field has been set. +func (o *SupportedVersion) HasExpirationDate() bool { + if o != nil && !IsNil(o.ExpirationDate) { + return true + } + + return false +} + +// SetExpirationDate gets a reference to the given time.Time and assigns it to the ExpirationDate field. +func (o *SupportedVersion) SetExpirationDate(v time.Time) { + o.ExpirationDate = &v +} + +// GetState returns the State field value +func (o *SupportedVersion) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *SupportedVersion) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *SupportedVersion) SetState(v string) { + o.State = v +} + +// GetVersion returns the Version field value +func (o *SupportedVersion) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *SupportedVersion) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *SupportedVersion) SetVersion(v string) { + o.Version = v +} + +func (o SupportedVersion) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SupportedVersion) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ExpirationDate) { + toSerialize["expirationDate"] = o.ExpirationDate + } + toSerialize["state"] = o.State + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SupportedVersion) 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{ + "state", + "version", + } + + 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) + } + } + + varSupportedVersion := _SupportedVersion{} + + err = json.Unmarshal(data, &varSupportedVersion) + + if err != nil { + return err + } + + *o = SupportedVersion(varSupportedVersion) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "expirationDate") + delete(additionalProperties, "state") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSupportedVersion struct { + value *SupportedVersion + isSet bool +} + +func (v NullableSupportedVersion) Get() *SupportedVersion { + return v.value +} + +func (v *NullableSupportedVersion) Set(val *SupportedVersion) { + v.value = val + v.isSet = true +} + +func (v NullableSupportedVersion) IsSet() bool { + return v.isSet +} + +func (v *NullableSupportedVersion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSupportedVersion(val *SupportedVersion) *NullableSupportedVersion { + return &NullableSupportedVersion{value: val, isSet: true} +} + +func (v NullableSupportedVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSupportedVersion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_dag_bundle_payload.go b/services/workflows/v1alphaapi/model_update_dag_bundle_payload.go new file mode 100644 index 000000000..4da536a97 --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_dag_bundle_payload.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// UpdateDagBundlePayload - Partial update payload for a DAG bundle. The \"type\" field must be provided and must match the existing bundle's type (\"git\" or \"s3\"). Only the provided fields will be updated. Supplying fields that belong to the wrong type will be rejected. +type UpdateDagBundlePayload struct { + UpdateGitDagBundlePayload *UpdateGitDagBundlePayload + UpdateS3DagBundlePayload *UpdateS3DagBundlePayload +} + +// UpdateGitDagBundlePayloadAsUpdateDagBundlePayload is a convenience function that returns UpdateGitDagBundlePayload wrapped in UpdateDagBundlePayload +func UpdateGitDagBundlePayloadAsUpdateDagBundlePayload(v *UpdateGitDagBundlePayload) UpdateDagBundlePayload { + return UpdateDagBundlePayload{ + UpdateGitDagBundlePayload: v, + } +} + +// UpdateS3DagBundlePayloadAsUpdateDagBundlePayload is a convenience function that returns UpdateS3DagBundlePayload wrapped in UpdateDagBundlePayload +func UpdateS3DagBundlePayloadAsUpdateDagBundlePayload(v *UpdateS3DagBundlePayload) UpdateDagBundlePayload { + return UpdateDagBundlePayload{ + UpdateS3DagBundlePayload: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *UpdateDagBundlePayload) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'git' + if jsonDict["type"] == "git" { + // try to unmarshal JSON data into UpdateGitDagBundlePayload + err = json.Unmarshal(data, &dst.UpdateGitDagBundlePayload) + if err == nil { + return nil // data stored in dst.UpdateGitDagBundlePayload, return on the first match + } else { + dst.UpdateGitDagBundlePayload = nil + return fmt.Errorf("failed to unmarshal UpdateDagBundlePayload as UpdateGitDagBundlePayload: %s", err.Error()) + } + } + + // check if the discriminator value is 's3' + if jsonDict["type"] == "s3" { + // try to unmarshal JSON data into UpdateS3DagBundlePayload + err = json.Unmarshal(data, &dst.UpdateS3DagBundlePayload) + if err == nil { + return nil // data stored in dst.UpdateS3DagBundlePayload, return on the first match + } else { + dst.UpdateS3DagBundlePayload = nil + return fmt.Errorf("failed to unmarshal UpdateDagBundlePayload as UpdateS3DagBundlePayload: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src UpdateDagBundlePayload) MarshalJSON() ([]byte, error) { + if src.UpdateGitDagBundlePayload != nil { + return json.Marshal(&src.UpdateGitDagBundlePayload) + } + + if src.UpdateS3DagBundlePayload != nil { + return json.Marshal(&src.UpdateS3DagBundlePayload) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *UpdateDagBundlePayload) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.UpdateGitDagBundlePayload != nil { + return obj.UpdateGitDagBundlePayload + } + + if obj.UpdateS3DagBundlePayload != nil { + return obj.UpdateS3DagBundlePayload + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj UpdateDagBundlePayload) GetActualInstanceValue() interface{} { + if obj.UpdateGitDagBundlePayload != nil { + return *obj.UpdateGitDagBundlePayload + } + + if obj.UpdateS3DagBundlePayload != nil { + return *obj.UpdateS3DagBundlePayload + } + + // all schemas are nil + return nil +} + +type NullableUpdateDagBundlePayload struct { + value *UpdateDagBundlePayload + isSet bool +} + +func (v NullableUpdateDagBundlePayload) Get() *UpdateDagBundlePayload { + return v.value +} + +func (v *NullableUpdateDagBundlePayload) Set(val *UpdateDagBundlePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDagBundlePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDagBundlePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDagBundlePayload(val *UpdateDagBundlePayload) *NullableUpdateDagBundlePayload { + return &NullableUpdateDagBundlePayload{value: val, isSet: true} +} + +func (v NullableUpdateDagBundlePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDagBundlePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_dags_repository_payload.go b/services/workflows/v1alphaapi/model_update_dags_repository_payload.go new file mode 100644 index 000000000..f81d2ebcf --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_dags_repository_payload.go @@ -0,0 +1,229 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the UpdateDagsRepositoryPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDagsRepositoryPayload{} + +// UpdateDagsRepositoryPayload Request to update a DAGs repository configuration +type UpdateDagsRepositoryPayload struct { + Auth *GitAuth `json:"auth,omitempty"` + // The branch in the repository to use + Branch *string `json:"branch,omitempty"` + // The URL of the Git repository. + Url *string `json:"url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateDagsRepositoryPayload UpdateDagsRepositoryPayload + +// NewUpdateDagsRepositoryPayload instantiates a new UpdateDagsRepositoryPayload 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 NewUpdateDagsRepositoryPayload() *UpdateDagsRepositoryPayload { + this := UpdateDagsRepositoryPayload{} + return &this +} + +// NewUpdateDagsRepositoryPayloadWithDefaults instantiates a new UpdateDagsRepositoryPayload 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 NewUpdateDagsRepositoryPayloadWithDefaults() *UpdateDagsRepositoryPayload { + this := UpdateDagsRepositoryPayload{} + return &this +} + +// GetAuth returns the Auth field value if set, zero value otherwise. +func (o *UpdateDagsRepositoryPayload) GetAuth() GitAuth { + if o == nil || IsNil(o.Auth) { + var ret GitAuth + return ret + } + return *o.Auth +} + +// GetAuthOk returns a tuple with the Auth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateDagsRepositoryPayload) GetAuthOk() (*GitAuth, bool) { + if o == nil || IsNil(o.Auth) { + return nil, false + } + return o.Auth, true +} + +// HasAuth returns a boolean if a field has been set. +func (o *UpdateDagsRepositoryPayload) HasAuth() bool { + if o != nil && !IsNil(o.Auth) { + return true + } + + return false +} + +// SetAuth gets a reference to the given GitAuth and assigns it to the Auth field. +func (o *UpdateDagsRepositoryPayload) SetAuth(v GitAuth) { + o.Auth = &v +} + +// GetBranch returns the Branch field value if set, zero value otherwise. +func (o *UpdateDagsRepositoryPayload) GetBranch() string { + if o == nil || IsNil(o.Branch) { + var ret string + return ret + } + return *o.Branch +} + +// GetBranchOk returns a tuple with the Branch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateDagsRepositoryPayload) GetBranchOk() (*string, bool) { + if o == nil || IsNil(o.Branch) { + return nil, false + } + return o.Branch, true +} + +// HasBranch returns a boolean if a field has been set. +func (o *UpdateDagsRepositoryPayload) HasBranch() bool { + if o != nil && !IsNil(o.Branch) { + return true + } + + return false +} + +// SetBranch gets a reference to the given string and assigns it to the Branch field. +func (o *UpdateDagsRepositoryPayload) SetBranch(v string) { + o.Branch = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *UpdateDagsRepositoryPayload) 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 *UpdateDagsRepositoryPayload) 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 *UpdateDagsRepositoryPayload) 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 *UpdateDagsRepositoryPayload) SetUrl(v string) { + o.Url = &v +} + +func (o UpdateDagsRepositoryPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDagsRepositoryPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Auth) { + toSerialize["auth"] = o.Auth + } + if !IsNil(o.Branch) { + toSerialize["branch"] = o.Branch + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateDagsRepositoryPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateDagsRepositoryPayload := _UpdateDagsRepositoryPayload{} + + err = json.Unmarshal(data, &varUpdateDagsRepositoryPayload) + + if err != nil { + return err + } + + *o = UpdateDagsRepositoryPayload(varUpdateDagsRepositoryPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "auth") + delete(additionalProperties, "branch") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateDagsRepositoryPayload struct { + value *UpdateDagsRepositoryPayload + isSet bool +} + +func (v NullableUpdateDagsRepositoryPayload) Get() *UpdateDagsRepositoryPayload { + return v.value +} + +func (v *NullableUpdateDagsRepositoryPayload) Set(val *UpdateDagsRepositoryPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDagsRepositoryPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDagsRepositoryPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDagsRepositoryPayload(val *UpdateDagsRepositoryPayload) *NullableUpdateDagsRepositoryPayload { + return &NullableUpdateDagsRepositoryPayload{value: val, isSet: true} +} + +func (v NullableUpdateDagsRepositoryPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDagsRepositoryPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_git_dag_bundle_payload.go b/services/workflows/v1alphaapi/model_update_git_dag_bundle_payload.go new file mode 100644 index 000000000..ef974ed6d --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_git_dag_bundle_payload.go @@ -0,0 +1,355 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateGitDagBundlePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGitDagBundlePayload{} + +// UpdateGitDagBundlePayload Partial update payload for a Git DAG bundle. All fields except \"type\" are optional; only the provided fields will be updated. +type UpdateGitDagBundlePayload struct { + Auth *GitAuth `json:"auth,omitempty"` + // Updated branch/tag/ref to track. + Branch *string `json:"branch,omitempty"` + // Updated refresh interval in seconds. + RefreshInterval *int32 `json:"refreshInterval,omitempty"` + // Updated subdirectory within the repository. Set to empty string or \"/\" to clear an existing subdir. + Subdir *string `json:"subdir,omitempty"` + Type UpdateGitDagBundlePayloadType `json:"type"` + // Updated Git repository URL. If changed, auth must also be provided. + Url *string `json:"url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGitDagBundlePayload UpdateGitDagBundlePayload + +// NewUpdateGitDagBundlePayload instantiates a new UpdateGitDagBundlePayload 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 NewUpdateGitDagBundlePayload(types UpdateGitDagBundlePayloadType) *UpdateGitDagBundlePayload { + this := UpdateGitDagBundlePayload{} + this.Type = types + return &this +} + +// NewUpdateGitDagBundlePayloadWithDefaults instantiates a new UpdateGitDagBundlePayload 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 NewUpdateGitDagBundlePayloadWithDefaults() *UpdateGitDagBundlePayload { + this := UpdateGitDagBundlePayload{} + return &this +} + +// GetAuth returns the Auth field value if set, zero value otherwise. +func (o *UpdateGitDagBundlePayload) GetAuth() GitAuth { + if o == nil || IsNil(o.Auth) { + var ret GitAuth + return ret + } + return *o.Auth +} + +// GetAuthOk returns a tuple with the Auth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGitDagBundlePayload) GetAuthOk() (*GitAuth, bool) { + if o == nil || IsNil(o.Auth) { + return nil, false + } + return o.Auth, true +} + +// HasAuth returns a boolean if a field has been set. +func (o *UpdateGitDagBundlePayload) HasAuth() bool { + if o != nil && !IsNil(o.Auth) { + return true + } + + return false +} + +// SetAuth gets a reference to the given GitAuth and assigns it to the Auth field. +func (o *UpdateGitDagBundlePayload) SetAuth(v GitAuth) { + o.Auth = &v +} + +// GetBranch returns the Branch field value if set, zero value otherwise. +func (o *UpdateGitDagBundlePayload) GetBranch() string { + if o == nil || IsNil(o.Branch) { + var ret string + return ret + } + return *o.Branch +} + +// GetBranchOk returns a tuple with the Branch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGitDagBundlePayload) GetBranchOk() (*string, bool) { + if o == nil || IsNil(o.Branch) { + return nil, false + } + return o.Branch, true +} + +// HasBranch returns a boolean if a field has been set. +func (o *UpdateGitDagBundlePayload) HasBranch() bool { + if o != nil && !IsNil(o.Branch) { + return true + } + + return false +} + +// SetBranch gets a reference to the given string and assigns it to the Branch field. +func (o *UpdateGitDagBundlePayload) SetBranch(v string) { + o.Branch = &v +} + +// GetRefreshInterval returns the RefreshInterval field value if set, zero value otherwise. +func (o *UpdateGitDagBundlePayload) GetRefreshInterval() int32 { + if o == nil || IsNil(o.RefreshInterval) { + var ret int32 + return ret + } + return *o.RefreshInterval +} + +// GetRefreshIntervalOk returns a tuple with the RefreshInterval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGitDagBundlePayload) GetRefreshIntervalOk() (*int32, bool) { + if o == nil || IsNil(o.RefreshInterval) { + return nil, false + } + return o.RefreshInterval, true +} + +// HasRefreshInterval returns a boolean if a field has been set. +func (o *UpdateGitDagBundlePayload) HasRefreshInterval() bool { + if o != nil && !IsNil(o.RefreshInterval) { + return true + } + + return false +} + +// SetRefreshInterval gets a reference to the given int32 and assigns it to the RefreshInterval field. +func (o *UpdateGitDagBundlePayload) SetRefreshInterval(v int32) { + o.RefreshInterval = &v +} + +// GetSubdir returns the Subdir field value if set, zero value otherwise. +func (o *UpdateGitDagBundlePayload) GetSubdir() string { + if o == nil || IsNil(o.Subdir) { + var ret string + return ret + } + return *o.Subdir +} + +// GetSubdirOk returns a tuple with the Subdir field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGitDagBundlePayload) GetSubdirOk() (*string, bool) { + if o == nil || IsNil(o.Subdir) { + return nil, false + } + return o.Subdir, true +} + +// HasSubdir returns a boolean if a field has been set. +func (o *UpdateGitDagBundlePayload) HasSubdir() bool { + if o != nil && !IsNil(o.Subdir) { + return true + } + + return false +} + +// SetSubdir gets a reference to the given string and assigns it to the Subdir field. +func (o *UpdateGitDagBundlePayload) SetSubdir(v string) { + o.Subdir = &v +} + +// GetType returns the Type field value +func (o *UpdateGitDagBundlePayload) GetType() UpdateGitDagBundlePayloadType { + if o == nil { + var ret UpdateGitDagBundlePayloadType + 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 *UpdateGitDagBundlePayload) GetTypeOk() (*UpdateGitDagBundlePayloadType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *UpdateGitDagBundlePayload) SetType(v UpdateGitDagBundlePayloadType) { + o.Type = v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *UpdateGitDagBundlePayload) 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 *UpdateGitDagBundlePayload) 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 *UpdateGitDagBundlePayload) 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 *UpdateGitDagBundlePayload) SetUrl(v string) { + o.Url = &v +} + +func (o UpdateGitDagBundlePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGitDagBundlePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Auth) { + toSerialize["auth"] = o.Auth + } + if !IsNil(o.Branch) { + toSerialize["branch"] = o.Branch + } + if !IsNil(o.RefreshInterval) { + toSerialize["refreshInterval"] = o.RefreshInterval + } + if !IsNil(o.Subdir) { + toSerialize["subdir"] = o.Subdir + } + toSerialize["type"] = o.Type + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGitDagBundlePayload) 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) + } + } + + varUpdateGitDagBundlePayload := _UpdateGitDagBundlePayload{} + + err = json.Unmarshal(data, &varUpdateGitDagBundlePayload) + + if err != nil { + return err + } + + *o = UpdateGitDagBundlePayload(varUpdateGitDagBundlePayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "auth") + delete(additionalProperties, "branch") + delete(additionalProperties, "refreshInterval") + delete(additionalProperties, "subdir") + delete(additionalProperties, "type") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGitDagBundlePayload struct { + value *UpdateGitDagBundlePayload + isSet bool +} + +func (v NullableUpdateGitDagBundlePayload) Get() *UpdateGitDagBundlePayload { + return v.value +} + +func (v *NullableUpdateGitDagBundlePayload) Set(val *UpdateGitDagBundlePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGitDagBundlePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGitDagBundlePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGitDagBundlePayload(val *UpdateGitDagBundlePayload) *NullableUpdateGitDagBundlePayload { + return &NullableUpdateGitDagBundlePayload{value: val, isSet: true} +} + +func (v NullableUpdateGitDagBundlePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGitDagBundlePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_git_dag_bundle_payload_type.go b/services/workflows/v1alphaapi/model_update_git_dag_bundle_payload_type.go new file mode 100644 index 000000000..da9112b7f --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_git_dag_bundle_payload_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// UpdateGitDagBundlePayloadType Bundle type identifier — must match the existing bundle's type. +type UpdateGitDagBundlePayloadType string + +// List of UpdateGitDagBundlePayload_type +const ( + UPDATEGITDAGBUNDLEPAYLOADTYPE_GIT UpdateGitDagBundlePayloadType = "git" + UPDATEGITDAGBUNDLEPAYLOADTYPE_UNKNOWN_DEFAULT_OPEN_API UpdateGitDagBundlePayloadType = "unknown_default_open_api" +) + +// All allowed values of UpdateGitDagBundlePayloadType enum +var AllowedUpdateGitDagBundlePayloadTypeEnumValues = []UpdateGitDagBundlePayloadType{ + "git", + "unknown_default_open_api", +} + +func (v *UpdateGitDagBundlePayloadType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := UpdateGitDagBundlePayloadType(value) + for _, existing := range AllowedUpdateGitDagBundlePayloadTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = UPDATEGITDAGBUNDLEPAYLOADTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewUpdateGitDagBundlePayloadTypeFromValue returns a pointer to a valid UpdateGitDagBundlePayloadType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateGitDagBundlePayloadTypeFromValue(v string) (*UpdateGitDagBundlePayloadType, error) { + ev := UpdateGitDagBundlePayloadType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateGitDagBundlePayloadType: valid values are %v", v, AllowedUpdateGitDagBundlePayloadTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateGitDagBundlePayloadType) IsValid() bool { + for _, existing := range AllowedUpdateGitDagBundlePayloadTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UpdateGitDagBundlePayload_type value +func (v UpdateGitDagBundlePayloadType) Ptr() *UpdateGitDagBundlePayloadType { + return &v +} + +type NullableUpdateGitDagBundlePayloadType struct { + value *UpdateGitDagBundlePayloadType + isSet bool +} + +func (v NullableUpdateGitDagBundlePayloadType) Get() *UpdateGitDagBundlePayloadType { + return v.value +} + +func (v *NullableUpdateGitDagBundlePayloadType) Set(val *UpdateGitDagBundlePayloadType) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGitDagBundlePayloadType) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGitDagBundlePayloadType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGitDagBundlePayloadType(val *UpdateGitDagBundlePayloadType) *NullableUpdateGitDagBundlePayloadType { + return &NullableUpdateGitDagBundlePayloadType{value: val, isSet: true} +} + +func (v NullableUpdateGitDagBundlePayloadType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGitDagBundlePayloadType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_identity_provider_payload.go b/services/workflows/v1alphaapi/model_update_identity_provider_payload.go new file mode 100644 index 000000000..8e286c3e8 --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_identity_provider_payload.go @@ -0,0 +1,153 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// UpdateIdentityProviderPayload - Request to update an identity provider configuration +type UpdateIdentityProviderPayload struct { + OAuth2IdentityProviderUpdate *OAuth2IdentityProviderUpdate + StackITIdentityProvider *StackITIdentityProvider +} + +// OAuth2IdentityProviderUpdateAsUpdateIdentityProviderPayload is a convenience function that returns OAuth2IdentityProviderUpdate wrapped in UpdateIdentityProviderPayload +func OAuth2IdentityProviderUpdateAsUpdateIdentityProviderPayload(v *OAuth2IdentityProviderUpdate) UpdateIdentityProviderPayload { + return UpdateIdentityProviderPayload{ + OAuth2IdentityProviderUpdate: v, + } +} + +// StackITIdentityProviderAsUpdateIdentityProviderPayload is a convenience function that returns StackITIdentityProvider wrapped in UpdateIdentityProviderPayload +func StackITIdentityProviderAsUpdateIdentityProviderPayload(v *StackITIdentityProvider) UpdateIdentityProviderPayload { + return UpdateIdentityProviderPayload{ + StackITIdentityProvider: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *UpdateIdentityProviderPayload) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'oauth2' + if jsonDict["type"] == "oauth2" { + // try to unmarshal JSON data into OAuth2IdentityProviderUpdate + err = json.Unmarshal(data, &dst.OAuth2IdentityProviderUpdate) + if err == nil { + return nil // data stored in dst.OAuth2IdentityProviderUpdate, return on the first match + } else { + dst.OAuth2IdentityProviderUpdate = nil + return fmt.Errorf("failed to unmarshal UpdateIdentityProviderPayload as OAuth2IdentityProviderUpdate: %s", err.Error()) + } + } + + // check if the discriminator value is 'stackit' + if jsonDict["type"] == "stackit" { + // try to unmarshal JSON data into StackITIdentityProvider + err = json.Unmarshal(data, &dst.StackITIdentityProvider) + if err == nil { + return nil // data stored in dst.StackITIdentityProvider, return on the first match + } else { + dst.StackITIdentityProvider = nil + return fmt.Errorf("failed to unmarshal UpdateIdentityProviderPayload as StackITIdentityProvider: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src UpdateIdentityProviderPayload) MarshalJSON() ([]byte, error) { + if src.OAuth2IdentityProviderUpdate != nil { + return json.Marshal(&src.OAuth2IdentityProviderUpdate) + } + + if src.StackITIdentityProvider != nil { + return json.Marshal(&src.StackITIdentityProvider) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *UpdateIdentityProviderPayload) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.OAuth2IdentityProviderUpdate != nil { + return obj.OAuth2IdentityProviderUpdate + } + + if obj.StackITIdentityProvider != nil { + return obj.StackITIdentityProvider + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj UpdateIdentityProviderPayload) GetActualInstanceValue() interface{} { + if obj.OAuth2IdentityProviderUpdate != nil { + return *obj.OAuth2IdentityProviderUpdate + } + + if obj.StackITIdentityProvider != nil { + return *obj.StackITIdentityProvider + } + + // all schemas are nil + return nil +} + +type NullableUpdateIdentityProviderPayload struct { + value *UpdateIdentityProviderPayload + isSet bool +} + +func (v NullableUpdateIdentityProviderPayload) Get() *UpdateIdentityProviderPayload { + return v.value +} + +func (v *NullableUpdateIdentityProviderPayload) Set(val *UpdateIdentityProviderPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateIdentityProviderPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateIdentityProviderPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateIdentityProviderPayload(val *UpdateIdentityProviderPayload) *NullableUpdateIdentityProviderPayload { + return &NullableUpdateIdentityProviderPayload{value: val, isSet: true} +} + +func (v NullableUpdateIdentityProviderPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateIdentityProviderPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_instance_payload.go b/services/workflows/v1alphaapi/model_update_instance_payload.go new file mode 100644 index 000000000..3a95f8fc5 --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_instance_payload.go @@ -0,0 +1,230 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the UpdateInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateInstancePayload{} + +// UpdateInstancePayload struct for UpdateInstancePayload +type UpdateInstancePayload struct { + // A user chosen description to distinguish multiple STACKIT Workflows instances. If not provided, the description won't be updated. Set to empty string to remove the description. + Description *string `json:"description,omitempty"` + // The displayed name to distinguish multiple STACKIT Workflows instances. If not provided, the display name won't be updated. + DisplayName *string `json:"displayName,omitempty"` + // The STACKIT Workflows version to use. For valid versions please take a look at [provider-options](#tag/provider-options/operation/get-provider-options) If not provided, the version won't be updated. + Version *string `json:"version,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateInstancePayload UpdateInstancePayload + +// NewUpdateInstancePayload instantiates a new UpdateInstancePayload 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 NewUpdateInstancePayload() *UpdateInstancePayload { + this := UpdateInstancePayload{} + return &this +} + +// NewUpdateInstancePayloadWithDefaults instantiates a new UpdateInstancePayload 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 NewUpdateInstancePayloadWithDefaults() *UpdateInstancePayload { + this := UpdateInstancePayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateInstancePayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateInstancePayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateInstancePayload) 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 *UpdateInstancePayload) 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 *UpdateInstancePayload) 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 *UpdateInstancePayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *UpdateInstancePayload) GetVersion() string { + if o == nil || IsNil(o.Version) { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePayload) GetVersionOk() (*string, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *UpdateInstancePayload) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *UpdateInstancePayload) SetVersion(v string) { + o.Version = &v +} + +func (o UpdateInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateInstancePayload) UnmarshalJSON(data []byte) (err error) { + varUpdateInstancePayload := _UpdateInstancePayload{} + + err = json.Unmarshal(data, &varUpdateInstancePayload) + + if err != nil { + return err + } + + *o = UpdateInstancePayload(varUpdateInstancePayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateInstancePayload struct { + value *UpdateInstancePayload + isSet bool +} + +func (v NullableUpdateInstancePayload) Get() *UpdateInstancePayload { + return v.value +} + +func (v *NullableUpdateInstancePayload) Set(val *UpdateInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateInstancePayload(val *UpdateInstancePayload) *NullableUpdateInstancePayload { + return &NullableUpdateInstancePayload{value: val, isSet: true} +} + +func (v NullableUpdateInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_observability_payload.go b/services/workflows/v1alphaapi/model_update_observability_payload.go new file mode 100644 index 000000000..91d7ad9ac --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_observability_payload.go @@ -0,0 +1,154 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the UpdateObservabilityPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateObservabilityPayload{} + +// UpdateObservabilityPayload Request to update the Observability configuration +type UpdateObservabilityPayload struct { + // Unique identifier of the customer's observability instance. + ObservabilityId *string `json:"observabilityId,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateObservabilityPayload UpdateObservabilityPayload + +// NewUpdateObservabilityPayload instantiates a new UpdateObservabilityPayload 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 NewUpdateObservabilityPayload() *UpdateObservabilityPayload { + this := UpdateObservabilityPayload{} + return &this +} + +// NewUpdateObservabilityPayloadWithDefaults instantiates a new UpdateObservabilityPayload 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 NewUpdateObservabilityPayloadWithDefaults() *UpdateObservabilityPayload { + this := UpdateObservabilityPayload{} + return &this +} + +// GetObservabilityId returns the ObservabilityId field value if set, zero value otherwise. +func (o *UpdateObservabilityPayload) GetObservabilityId() string { + if o == nil || IsNil(o.ObservabilityId) { + var ret string + return ret + } + return *o.ObservabilityId +} + +// GetObservabilityIdOk returns a tuple with the ObservabilityId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateObservabilityPayload) GetObservabilityIdOk() (*string, bool) { + if o == nil || IsNil(o.ObservabilityId) { + return nil, false + } + return o.ObservabilityId, true +} + +// HasObservabilityId returns a boolean if a field has been set. +func (o *UpdateObservabilityPayload) HasObservabilityId() bool { + if o != nil && !IsNil(o.ObservabilityId) { + return true + } + + return false +} + +// SetObservabilityId gets a reference to the given string and assigns it to the ObservabilityId field. +func (o *UpdateObservabilityPayload) SetObservabilityId(v string) { + o.ObservabilityId = &v +} + +func (o UpdateObservabilityPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateObservabilityPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ObservabilityId) { + toSerialize["observabilityId"] = o.ObservabilityId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateObservabilityPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateObservabilityPayload := _UpdateObservabilityPayload{} + + err = json.Unmarshal(data, &varUpdateObservabilityPayload) + + if err != nil { + return err + } + + *o = UpdateObservabilityPayload(varUpdateObservabilityPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "observabilityId") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateObservabilityPayload struct { + value *UpdateObservabilityPayload + isSet bool +} + +func (v NullableUpdateObservabilityPayload) Get() *UpdateObservabilityPayload { + return v.value +} + +func (v *NullableUpdateObservabilityPayload) Set(val *UpdateObservabilityPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateObservabilityPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateObservabilityPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateObservabilityPayload(val *UpdateObservabilityPayload) *NullableUpdateObservabilityPayload { + return &NullableUpdateObservabilityPayload{value: val, isSet: true} +} + +func (v NullableUpdateObservabilityPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateObservabilityPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_s3_dag_bundle_payload.go b/services/workflows/v1alphaapi/model_update_s3_dag_bundle_payload.go new file mode 100644 index 000000000..7f834ef98 --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_s3_dag_bundle_payload.go @@ -0,0 +1,355 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateS3DagBundlePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateS3DagBundlePayload{} + +// UpdateS3DagBundlePayload Partial update payload for an S3 DAG bundle. All fields except \"type\" are optional; only the provided fields will be updated. +type UpdateS3DagBundlePayload struct { + // Updated S3 bucket name. If changed, s3Auth must also be provided. + BucketName *string `json:"bucketName,omitempty"` + // Updated S3-compatible endpoint URL. If changed, s3Auth must also be provided. + Endpoint *string `json:"endpoint,omitempty"` + // Updated key prefix within the bucket. + Prefix *string `json:"prefix,omitempty"` + // Updated refresh interval in seconds. + RefreshInterval *int32 `json:"refreshInterval,omitempty"` + S3Auth *S3Auth `json:"s3Auth,omitempty"` + Type UpdateS3DagBundlePayloadType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _UpdateS3DagBundlePayload UpdateS3DagBundlePayload + +// NewUpdateS3DagBundlePayload instantiates a new UpdateS3DagBundlePayload 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 NewUpdateS3DagBundlePayload(types UpdateS3DagBundlePayloadType) *UpdateS3DagBundlePayload { + this := UpdateS3DagBundlePayload{} + this.Type = types + return &this +} + +// NewUpdateS3DagBundlePayloadWithDefaults instantiates a new UpdateS3DagBundlePayload 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 NewUpdateS3DagBundlePayloadWithDefaults() *UpdateS3DagBundlePayload { + this := UpdateS3DagBundlePayload{} + return &this +} + +// GetBucketName returns the BucketName field value if set, zero value otherwise. +func (o *UpdateS3DagBundlePayload) GetBucketName() string { + if o == nil || IsNil(o.BucketName) { + var ret string + return ret + } + return *o.BucketName +} + +// GetBucketNameOk returns a tuple with the BucketName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateS3DagBundlePayload) GetBucketNameOk() (*string, bool) { + if o == nil || IsNil(o.BucketName) { + return nil, false + } + return o.BucketName, true +} + +// HasBucketName returns a boolean if a field has been set. +func (o *UpdateS3DagBundlePayload) HasBucketName() bool { + if o != nil && !IsNil(o.BucketName) { + return true + } + + return false +} + +// SetBucketName gets a reference to the given string and assigns it to the BucketName field. +func (o *UpdateS3DagBundlePayload) SetBucketName(v string) { + o.BucketName = &v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *UpdateS3DagBundlePayload) GetEndpoint() string { + if o == nil || IsNil(o.Endpoint) { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateS3DagBundlePayload) GetEndpointOk() (*string, bool) { + if o == nil || IsNil(o.Endpoint) { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *UpdateS3DagBundlePayload) HasEndpoint() bool { + if o != nil && !IsNil(o.Endpoint) { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *UpdateS3DagBundlePayload) SetEndpoint(v string) { + o.Endpoint = &v +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *UpdateS3DagBundlePayload) GetPrefix() string { + if o == nil || IsNil(o.Prefix) { + var ret string + return ret + } + return *o.Prefix +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateS3DagBundlePayload) GetPrefixOk() (*string, bool) { + if o == nil || IsNil(o.Prefix) { + return nil, false + } + return o.Prefix, true +} + +// HasPrefix returns a boolean if a field has been set. +func (o *UpdateS3DagBundlePayload) HasPrefix() bool { + if o != nil && !IsNil(o.Prefix) { + return true + } + + return false +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *UpdateS3DagBundlePayload) SetPrefix(v string) { + o.Prefix = &v +} + +// GetRefreshInterval returns the RefreshInterval field value if set, zero value otherwise. +func (o *UpdateS3DagBundlePayload) GetRefreshInterval() int32 { + if o == nil || IsNil(o.RefreshInterval) { + var ret int32 + return ret + } + return *o.RefreshInterval +} + +// GetRefreshIntervalOk returns a tuple with the RefreshInterval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateS3DagBundlePayload) GetRefreshIntervalOk() (*int32, bool) { + if o == nil || IsNil(o.RefreshInterval) { + return nil, false + } + return o.RefreshInterval, true +} + +// HasRefreshInterval returns a boolean if a field has been set. +func (o *UpdateS3DagBundlePayload) HasRefreshInterval() bool { + if o != nil && !IsNil(o.RefreshInterval) { + return true + } + + return false +} + +// SetRefreshInterval gets a reference to the given int32 and assigns it to the RefreshInterval field. +func (o *UpdateS3DagBundlePayload) SetRefreshInterval(v int32) { + o.RefreshInterval = &v +} + +// GetS3Auth returns the S3Auth field value if set, zero value otherwise. +func (o *UpdateS3DagBundlePayload) GetS3Auth() S3Auth { + if o == nil || IsNil(o.S3Auth) { + var ret S3Auth + return ret + } + return *o.S3Auth +} + +// GetS3AuthOk returns a tuple with the S3Auth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateS3DagBundlePayload) GetS3AuthOk() (*S3Auth, bool) { + if o == nil || IsNil(o.S3Auth) { + return nil, false + } + return o.S3Auth, true +} + +// HasS3Auth returns a boolean if a field has been set. +func (o *UpdateS3DagBundlePayload) HasS3Auth() bool { + if o != nil && !IsNil(o.S3Auth) { + return true + } + + return false +} + +// SetS3Auth gets a reference to the given S3Auth and assigns it to the S3Auth field. +func (o *UpdateS3DagBundlePayload) SetS3Auth(v S3Auth) { + o.S3Auth = &v +} + +// GetType returns the Type field value +func (o *UpdateS3DagBundlePayload) GetType() UpdateS3DagBundlePayloadType { + if o == nil { + var ret UpdateS3DagBundlePayloadType + 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 *UpdateS3DagBundlePayload) GetTypeOk() (*UpdateS3DagBundlePayloadType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *UpdateS3DagBundlePayload) SetType(v UpdateS3DagBundlePayloadType) { + o.Type = v +} + +func (o UpdateS3DagBundlePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateS3DagBundlePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BucketName) { + toSerialize["bucketName"] = o.BucketName + } + if !IsNil(o.Endpoint) { + toSerialize["endpoint"] = o.Endpoint + } + if !IsNil(o.Prefix) { + toSerialize["prefix"] = o.Prefix + } + if !IsNil(o.RefreshInterval) { + toSerialize["refreshInterval"] = o.RefreshInterval + } + if !IsNil(o.S3Auth) { + toSerialize["s3Auth"] = o.S3Auth + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateS3DagBundlePayload) 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) + } + } + + varUpdateS3DagBundlePayload := _UpdateS3DagBundlePayload{} + + err = json.Unmarshal(data, &varUpdateS3DagBundlePayload) + + if err != nil { + return err + } + + *o = UpdateS3DagBundlePayload(varUpdateS3DagBundlePayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "bucketName") + delete(additionalProperties, "endpoint") + delete(additionalProperties, "prefix") + delete(additionalProperties, "refreshInterval") + delete(additionalProperties, "s3Auth") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateS3DagBundlePayload struct { + value *UpdateS3DagBundlePayload + isSet bool +} + +func (v NullableUpdateS3DagBundlePayload) Get() *UpdateS3DagBundlePayload { + return v.value +} + +func (v *NullableUpdateS3DagBundlePayload) Set(val *UpdateS3DagBundlePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateS3DagBundlePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateS3DagBundlePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateS3DagBundlePayload(val *UpdateS3DagBundlePayload) *NullableUpdateS3DagBundlePayload { + return &NullableUpdateS3DagBundlePayload{value: val, isSet: true} +} + +func (v NullableUpdateS3DagBundlePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateS3DagBundlePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/model_update_s3_dag_bundle_payload_type.go b/services/workflows/v1alphaapi/model_update_s3_dag_bundle_payload_type.go new file mode 100644 index 000000000..167581580 --- /dev/null +++ b/services/workflows/v1alphaapi/model_update_s3_dag_bundle_payload_type.go @@ -0,0 +1,111 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// UpdateS3DagBundlePayloadType Bundle type identifier — must match the existing bundle's type. +type UpdateS3DagBundlePayloadType string + +// List of UpdateS3DagBundlePayload_type +const ( + UPDATES3DAGBUNDLEPAYLOADTYPE_S3 UpdateS3DagBundlePayloadType = "s3" + UPDATES3DAGBUNDLEPAYLOADTYPE_UNKNOWN_DEFAULT_OPEN_API UpdateS3DagBundlePayloadType = "unknown_default_open_api" +) + +// All allowed values of UpdateS3DagBundlePayloadType enum +var AllowedUpdateS3DagBundlePayloadTypeEnumValues = []UpdateS3DagBundlePayloadType{ + "s3", + "unknown_default_open_api", +} + +func (v *UpdateS3DagBundlePayloadType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := UpdateS3DagBundlePayloadType(value) + for _, existing := range AllowedUpdateS3DagBundlePayloadTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = UPDATES3DAGBUNDLEPAYLOADTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewUpdateS3DagBundlePayloadTypeFromValue returns a pointer to a valid UpdateS3DagBundlePayloadType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateS3DagBundlePayloadTypeFromValue(v string) (*UpdateS3DagBundlePayloadType, error) { + ev := UpdateS3DagBundlePayloadType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateS3DagBundlePayloadType: valid values are %v", v, AllowedUpdateS3DagBundlePayloadTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateS3DagBundlePayloadType) IsValid() bool { + for _, existing := range AllowedUpdateS3DagBundlePayloadTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UpdateS3DagBundlePayload_type value +func (v UpdateS3DagBundlePayloadType) Ptr() *UpdateS3DagBundlePayloadType { + return &v +} + +type NullableUpdateS3DagBundlePayloadType struct { + value *UpdateS3DagBundlePayloadType + isSet bool +} + +func (v NullableUpdateS3DagBundlePayloadType) Get() *UpdateS3DagBundlePayloadType { + return v.value +} + +func (v *NullableUpdateS3DagBundlePayloadType) Set(val *UpdateS3DagBundlePayloadType) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateS3DagBundlePayloadType) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateS3DagBundlePayloadType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateS3DagBundlePayloadType(val *UpdateS3DagBundlePayloadType) *NullableUpdateS3DagBundlePayloadType { + return &NullableUpdateS3DagBundlePayloadType{value: val, isSet: true} +} + +func (v NullableUpdateS3DagBundlePayloadType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateS3DagBundlePayloadType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/workflows/v1alphaapi/response.go b/services/workflows/v1alphaapi/response.go new file mode 100644 index 000000000..ca6338796 --- /dev/null +++ b/services/workflows/v1alphaapi/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// 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/workflows/v1alphaapi/utils.go b/services/workflows/v1alphaapi/utils.go new file mode 100644 index 000000000..d5f91b670 --- /dev/null +++ b/services/workflows/v1alphaapi/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Workflows API + +This API provides endpoints for managing Workflows. + +API version: 1alpha.0.1 +*/ + +// 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...) +}