From 76c7fa111c88a8c09cdbde545e817045bee03fec Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 4 May 2026 14:51:36 +0000 Subject: [PATCH] Generate modelexperiments --- go.work | 1 + services/modelexperiments/LICENSE.md | 201 ++ services/modelexperiments/go.mod | 10 + services/modelexperiments/go.sum | 8 + services/modelexperiments/oas_commit | 1 + services/modelexperiments/package.go | 1 + .../modelexperiments/v1api/api_default.go | 2050 +++++++++++++++++ .../v1api/api_default_mock.go | 245 ++ services/modelexperiments/v1api/client.go | 659 ++++++ .../modelexperiments/v1api/configuration.go | 38 + .../v1api/model_create_instance_payload.go | 280 +++ .../v1api/model_create_instance_response.go | 204 ++ .../model_create_instance_token_payload.go | 280 +++ .../v1api/model_create_token_response.go | 204 ++ .../v1api/model_delete_instance_response.go | 204 ++ .../v1api/model_delete_token_response.go | 204 ++ .../v1api/model_error_response.go | 236 ++ .../v1api/model_get_instance_response.go | 204 ++ .../v1api/model_get_token_response.go | 204 ++ .../modelexperiments/v1api/model_instance.go | 478 ++++ .../v1api/model_list_instance_response.go | 204 ++ .../v1api/model_list_token_response.go | 204 ++ .../model_partial_update_instance_payload.go | 267 +++ .../model_partial_update_instance_response.go | 204 ++ ...l_partial_update_instance_token_payload.go | 229 ++ .../model_partial_update_token_response.go | 204 ++ .../modelexperiments/v1api/model_token.go | 388 ++++ .../v1api/model_token_metadata.go | 359 +++ .../v1api/model_token_state.go | 118 + services/modelexperiments/v1api/response.go | 48 + services/modelexperiments/v1api/utils.go | 362 +++ 31 files changed, 8299 insertions(+) create mode 100644 services/modelexperiments/LICENSE.md create mode 100644 services/modelexperiments/go.mod create mode 100644 services/modelexperiments/go.sum create mode 100644 services/modelexperiments/oas_commit create mode 100644 services/modelexperiments/package.go create mode 100644 services/modelexperiments/v1api/api_default.go create mode 100644 services/modelexperiments/v1api/api_default_mock.go create mode 100644 services/modelexperiments/v1api/client.go create mode 100644 services/modelexperiments/v1api/configuration.go create mode 100644 services/modelexperiments/v1api/model_create_instance_payload.go create mode 100644 services/modelexperiments/v1api/model_create_instance_response.go create mode 100644 services/modelexperiments/v1api/model_create_instance_token_payload.go create mode 100644 services/modelexperiments/v1api/model_create_token_response.go create mode 100644 services/modelexperiments/v1api/model_delete_instance_response.go create mode 100644 services/modelexperiments/v1api/model_delete_token_response.go create mode 100644 services/modelexperiments/v1api/model_error_response.go create mode 100644 services/modelexperiments/v1api/model_get_instance_response.go create mode 100644 services/modelexperiments/v1api/model_get_token_response.go create mode 100644 services/modelexperiments/v1api/model_instance.go create mode 100644 services/modelexperiments/v1api/model_list_instance_response.go create mode 100644 services/modelexperiments/v1api/model_list_token_response.go create mode 100644 services/modelexperiments/v1api/model_partial_update_instance_payload.go create mode 100644 services/modelexperiments/v1api/model_partial_update_instance_response.go create mode 100644 services/modelexperiments/v1api/model_partial_update_instance_token_payload.go create mode 100644 services/modelexperiments/v1api/model_partial_update_token_response.go create mode 100644 services/modelexperiments/v1api/model_token.go create mode 100644 services/modelexperiments/v1api/model_token_metadata.go create mode 100644 services/modelexperiments/v1api/model_token_state.go create mode 100644 services/modelexperiments/v1api/response.go create mode 100644 services/modelexperiments/v1api/utils.go diff --git a/go.work b/go.work index 570ca9e4d..eca4966ba 100644 --- a/go.work +++ b/go.work @@ -55,6 +55,7 @@ use ( ./services/logme ./services/logs ./services/mariadb + ./services/modelexperiments ./services/modelserving ./services/mongodbflex ./services/objectstorage diff --git a/services/modelexperiments/LICENSE.md b/services/modelexperiments/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/modelexperiments/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/modelexperiments/go.mod b/services/modelexperiments/go.mod new file mode 100644 index 000000000..6ea1a4c6f --- /dev/null +++ b/services/modelexperiments/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/modelexperiments + +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/modelexperiments/go.sum b/services/modelexperiments/go.sum new file mode 100644 index 000000000..3712a0c87 --- /dev/null +++ b/services/modelexperiments/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/modelexperiments/oas_commit b/services/modelexperiments/oas_commit new file mode 100644 index 000000000..e9709bac1 --- /dev/null +++ b/services/modelexperiments/oas_commit @@ -0,0 +1 @@ +ab1981b26da8ccd28bb0fb761ce81584235a2ff4 diff --git a/services/modelexperiments/package.go b/services/modelexperiments/package.go new file mode 100644 index 000000000..68d73732c --- /dev/null +++ b/services/modelexperiments/package.go @@ -0,0 +1 @@ +package modelexperiments diff --git a/services/modelexperiments/v1api/api_default.go b/services/modelexperiments/v1api/api_default.go new file mode 100644 index 000000000..7c85f431c --- /dev/null +++ b/services/modelexperiments/v1api/api_default.go @@ -0,0 +1,2050 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +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 { + + /* + CreateInstance create an instance in a project + + create an instance in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @return ApiCreateInstanceRequest + */ + CreateInstance(ctx context.Context, projectId string, regionId string) ApiCreateInstanceRequest + + // CreateInstanceExecute executes the request + // @return CreateInstanceResponse + CreateInstanceExecute(r ApiCreateInstanceRequest) (*CreateInstanceResponse, error) + + /* + CreateInstanceToken create an auth token for an instance + + create an auth token for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @return ApiCreateInstanceTokenRequest + */ + CreateInstanceToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateInstanceTokenRequest + + // CreateInstanceTokenExecute executes the request + // @return CreateTokenResponse + CreateInstanceTokenExecute(r ApiCreateInstanceTokenRequest) (*CreateTokenResponse, error) + + /* + DeleteInstance delete an instance in a project + + delete an instance in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @return ApiDeleteInstanceRequest + */ + DeleteInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteInstanceRequest + + // DeleteInstanceExecute executes the request + // @return DeleteInstanceResponse + DeleteInstanceExecute(r ApiDeleteInstanceRequest) (*DeleteInstanceResponse, error) + + /* + DeleteInstanceToken delete an auth token in an instance + + delete an auth token in an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param tId token id + @param instanceId instance id + @return ApiDeleteInstanceTokenRequest + */ + DeleteInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiDeleteInstanceTokenRequest + + // DeleteInstanceTokenExecute executes the request + // @return DeleteTokenResponse + DeleteInstanceTokenExecute(r ApiDeleteInstanceTokenRequest) (*DeleteTokenResponse, error) + + /* + GetInstance get an instance in a project + + get an instance in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @return ApiGetInstanceRequest + */ + GetInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetInstanceRequest + + // GetInstanceExecute executes the request + // @return GetInstanceResponse + GetInstanceExecute(r ApiGetInstanceRequest) (*GetInstanceResponse, error) + + /* + GetInstanceToken get an auth token for an instance + + get an auth token for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param tId token id + @param instanceId instance id + @return ApiGetInstanceTokenRequest + */ + GetInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiGetInstanceTokenRequest + + // GetInstanceTokenExecute executes the request + // @return GetTokenResponse + GetInstanceTokenExecute(r ApiGetInstanceTokenRequest) (*GetTokenResponse, error) + + /* + ListInstanceTokens list all auth tokens for an instance + + list all auth tokens for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @return ApiListInstanceTokensRequest + */ + ListInstanceTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListInstanceTokensRequest + + // ListInstanceTokensExecute executes the request + // @return ListTokenResponse + ListInstanceTokensExecute(r ApiListInstanceTokensRequest) (*ListTokenResponse, error) + + /* + ListInstances list instances in a project + + list instances in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @return ApiListInstancesRequest + */ + ListInstances(ctx context.Context, projectId string, regionId string) ApiListInstancesRequest + + // ListInstancesExecute executes the request + // @return ListInstanceResponse + ListInstancesExecute(r ApiListInstancesRequest) (*ListInstanceResponse, error) + + /* + PartialUpdateInstance partial update an instance in a project + + partial update an instance in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @return ApiPartialUpdateInstanceRequest + */ + PartialUpdateInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiPartialUpdateInstanceRequest + + // PartialUpdateInstanceExecute executes the request + // @return PartialUpdateInstanceResponse + PartialUpdateInstanceExecute(r ApiPartialUpdateInstanceRequest) (*PartialUpdateInstanceResponse, error) + + /* + PartialUpdateInstanceToken partial update an auth token for an instance + + partial update an auth token for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param tId token id + @param instanceId instance id + @return ApiPartialUpdateInstanceTokenRequest + */ + PartialUpdateInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiPartialUpdateInstanceTokenRequest + + // PartialUpdateInstanceTokenExecute executes the request + // @return PartialUpdateTokenResponse + PartialUpdateInstanceTokenExecute(r ApiPartialUpdateInstanceTokenRequest) (*PartialUpdateTokenResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +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() (*CreateInstanceResponse, error) { + return r.ApiService.CreateInstanceExecute(r) +} + +/* +CreateInstance create an instance in a project + +create an instance in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @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 CreateInstanceResponse +func (a *DefaultAPIService) CreateInstanceExecute(r ApiCreateInstanceRequest) (*CreateInstanceResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateInstanceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/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{"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 == 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 == 429 { + 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 ApiCreateInstanceTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + createInstanceTokenPayload *CreateInstanceTokenPayload +} + +func (r ApiCreateInstanceTokenRequest) CreateInstanceTokenPayload(createInstanceTokenPayload CreateInstanceTokenPayload) ApiCreateInstanceTokenRequest { + r.createInstanceTokenPayload = &createInstanceTokenPayload + return r +} + +func (r ApiCreateInstanceTokenRequest) Execute() (*CreateTokenResponse, error) { + return r.ApiService.CreateInstanceTokenExecute(r) +} + +/* +CreateInstanceToken create an auth token for an instance + +create an auth token for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @return ApiCreateInstanceTokenRequest +*/ +func (a *DefaultAPIService) CreateInstanceToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateInstanceTokenRequest { + return ApiCreateInstanceTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return CreateTokenResponse +func (a *DefaultAPIService) CreateInstanceTokenExecute(r ApiCreateInstanceTokenRequest) (*CreateTokenResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateTokenResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateInstanceToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/tokens" + 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{"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.createInstanceTokenPayload + 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 == 429 { + 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 ApiDeleteInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteInstanceRequest) Execute() (*DeleteInstanceResponse, error) { + return r.ApiService.DeleteInstanceExecute(r) +} + +/* +DeleteInstance delete an instance in a project + +delete an instance in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @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 +// +// @return DeleteInstanceResponse +func (a *DefaultAPIService) DeleteInstanceExecute(r ApiDeleteInstanceRequest) (*DeleteInstanceResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteInstanceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/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 == 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 == 429 { + 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 ApiDeleteInstanceTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + tId string + instanceId string +} + +func (r ApiDeleteInstanceTokenRequest) Execute() (*DeleteTokenResponse, error) { + return r.ApiService.DeleteInstanceTokenExecute(r) +} + +/* +DeleteInstanceToken delete an auth token in an instance + +delete an auth token in an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param tId token id + @param instanceId instance id + @return ApiDeleteInstanceTokenRequest +*/ +func (a *DefaultAPIService) DeleteInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiDeleteInstanceTokenRequest { + return ApiDeleteInstanceTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + tId: tId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return DeleteTokenResponse +func (a *DefaultAPIService) DeleteInstanceTokenExecute(r ApiDeleteInstanceTokenRequest) (*DeleteTokenResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteTokenResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteInstanceToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/tokens/{tId}" + 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, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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 == 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 == 429 { + 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() (*GetInstanceResponse, error) { + return r.ApiService.GetInstanceExecute(r) +} + +/* +GetInstance get an instance in a project + +get an instance in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @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 GetInstanceResponse +func (a *DefaultAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*GetInstanceResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetInstanceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/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 == 429 { + 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 ApiGetInstanceTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + tId string + instanceId string +} + +func (r ApiGetInstanceTokenRequest) Execute() (*GetTokenResponse, error) { + return r.ApiService.GetInstanceTokenExecute(r) +} + +/* +GetInstanceToken get an auth token for an instance + +get an auth token for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param tId token id + @param instanceId instance id + @return ApiGetInstanceTokenRequest +*/ +func (a *DefaultAPIService) GetInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiGetInstanceTokenRequest { + return ApiGetInstanceTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + tId: tId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return GetTokenResponse +func (a *DefaultAPIService) GetInstanceTokenExecute(r ApiGetInstanceTokenRequest) (*GetTokenResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetTokenResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetInstanceToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/tokens/{tId}" + 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, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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 == 429 { + 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 ApiListInstanceTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiListInstanceTokensRequest) Execute() (*ListTokenResponse, error) { + return r.ApiService.ListInstanceTokensExecute(r) +} + +/* +ListInstanceTokens list all auth tokens for an instance + +list all auth tokens for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @return ApiListInstanceTokensRequest +*/ +func (a *DefaultAPIService) ListInstanceTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListInstanceTokensRequest { + return ApiListInstanceTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return ListTokenResponse +func (a *DefaultAPIService) ListInstanceTokensExecute(r ApiListInstanceTokensRequest) (*ListTokenResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListTokenResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListInstanceTokens") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/tokens" + 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 == 429 { + 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() (*ListInstanceResponse, error) { + return r.ApiService.ListInstancesExecute(r) +} + +/* +ListInstances list instances in a project + +list instances in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @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 ListInstanceResponse +func (a *DefaultAPIService) ListInstancesExecute(r ApiListInstancesRequest) (*ListInstanceResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListInstanceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListInstances") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/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 == 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 == 429 { + 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 ApiPartialUpdateInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + partialUpdateInstancePayload *PartialUpdateInstancePayload +} + +func (r ApiPartialUpdateInstanceRequest) PartialUpdateInstancePayload(partialUpdateInstancePayload PartialUpdateInstancePayload) ApiPartialUpdateInstanceRequest { + r.partialUpdateInstancePayload = &partialUpdateInstancePayload + return r +} + +func (r ApiPartialUpdateInstanceRequest) Execute() (*PartialUpdateInstanceResponse, error) { + return r.ApiService.PartialUpdateInstanceExecute(r) +} + +/* +PartialUpdateInstance partial update an instance in a project + +partial update an instance in a project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param instanceId instance id + @return ApiPartialUpdateInstanceRequest +*/ +func (a *DefaultAPIService) PartialUpdateInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiPartialUpdateInstanceRequest { + return ApiPartialUpdateInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return PartialUpdateInstanceResponse +func (a *DefaultAPIService) PartialUpdateInstanceExecute(r ApiPartialUpdateInstanceRequest) (*PartialUpdateInstanceResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PartialUpdateInstanceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.PartialUpdateInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/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{"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.partialUpdateInstancePayload + 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 == 429 { + 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 ApiPartialUpdateInstanceTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + tId string + instanceId string + partialUpdateInstanceTokenPayload *PartialUpdateInstanceTokenPayload +} + +func (r ApiPartialUpdateInstanceTokenRequest) PartialUpdateInstanceTokenPayload(partialUpdateInstanceTokenPayload PartialUpdateInstanceTokenPayload) ApiPartialUpdateInstanceTokenRequest { + r.partialUpdateInstanceTokenPayload = &partialUpdateInstanceTokenPayload + return r +} + +func (r ApiPartialUpdateInstanceTokenRequest) Execute() (*PartialUpdateTokenResponse, error) { + return r.ApiService.PartialUpdateInstanceTokenExecute(r) +} + +/* +PartialUpdateInstanceToken partial update an auth token for an instance + +partial update an auth token for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId portal project id + @param regionId region id + @param tId token id + @param instanceId instance id + @return ApiPartialUpdateInstanceTokenRequest +*/ +func (a *DefaultAPIService) PartialUpdateInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiPartialUpdateInstanceTokenRequest { + return ApiPartialUpdateInstanceTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + tId: tId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return PartialUpdateTokenResponse +func (a *DefaultAPIService) PartialUpdateInstanceTokenExecute(r ApiPartialUpdateInstanceTokenRequest) (*PartialUpdateTokenResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PartialUpdateTokenResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.PartialUpdateInstanceToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/tokens/{tId}" + 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, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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{"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.partialUpdateInstanceTokenPayload + 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 == 429 { + 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/modelexperiments/v1api/api_default_mock.go b/services/modelexperiments/v1api/api_default_mock.go new file mode 100644 index 000000000..732d662ec --- /dev/null +++ b/services/modelexperiments/v1api/api_default_mock.go @@ -0,0 +1,245 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +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 { + // CreateInstanceExecuteMock can be populated to implement the behavior of the CreateInstanceExecute function of this mock + CreateInstanceExecuteMock *func(r ApiCreateInstanceRequest) (*CreateInstanceResponse, error) + // CreateInstanceTokenExecuteMock can be populated to implement the behavior of the CreateInstanceTokenExecute function of this mock + CreateInstanceTokenExecuteMock *func(r ApiCreateInstanceTokenRequest) (*CreateTokenResponse, error) + // DeleteInstanceExecuteMock can be populated to implement the behavior of the DeleteInstanceExecute function of this mock + DeleteInstanceExecuteMock *func(r ApiDeleteInstanceRequest) (*DeleteInstanceResponse, error) + // DeleteInstanceTokenExecuteMock can be populated to implement the behavior of the DeleteInstanceTokenExecute function of this mock + DeleteInstanceTokenExecuteMock *func(r ApiDeleteInstanceTokenRequest) (*DeleteTokenResponse, error) + // GetInstanceExecuteMock can be populated to implement the behavior of the GetInstanceExecute function of this mock + GetInstanceExecuteMock *func(r ApiGetInstanceRequest) (*GetInstanceResponse, error) + // GetInstanceTokenExecuteMock can be populated to implement the behavior of the GetInstanceTokenExecute function of this mock + GetInstanceTokenExecuteMock *func(r ApiGetInstanceTokenRequest) (*GetTokenResponse, error) + // ListInstanceTokensExecuteMock can be populated to implement the behavior of the ListInstanceTokensExecute function of this mock + ListInstanceTokensExecuteMock *func(r ApiListInstanceTokensRequest) (*ListTokenResponse, error) + // ListInstancesExecuteMock can be populated to implement the behavior of the ListInstancesExecute function of this mock + ListInstancesExecuteMock *func(r ApiListInstancesRequest) (*ListInstanceResponse, error) + // PartialUpdateInstanceExecuteMock can be populated to implement the behavior of the PartialUpdateInstanceExecute function of this mock + PartialUpdateInstanceExecuteMock *func(r ApiPartialUpdateInstanceRequest) (*PartialUpdateInstanceResponse, error) + // PartialUpdateInstanceTokenExecuteMock can be populated to implement the behavior of the PartialUpdateInstanceTokenExecute function of this mock + PartialUpdateInstanceTokenExecuteMock *func(r ApiPartialUpdateInstanceTokenRequest) (*PartialUpdateTokenResponse, error) +} + +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) (*CreateInstanceResponse, error) { + if a.CreateInstanceExecuteMock == nil { + var localVarReturnValue *CreateInstanceResponse + return localVarReturnValue, nil + } + + return (*a.CreateInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateInstanceToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateInstanceTokenRequest { + return ApiCreateInstanceTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// CreateInstanceTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateInstanceTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateInstanceTokenExecute(r ApiCreateInstanceTokenRequest) (*CreateTokenResponse, error) { + if a.CreateInstanceTokenExecuteMock == nil { + var localVarReturnValue *CreateTokenResponse + return localVarReturnValue, nil + } + + return (*a.CreateInstanceTokenExecuteMock)(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) (*DeleteInstanceResponse, error) { + if a.DeleteInstanceExecuteMock == nil { + var localVarReturnValue *DeleteInstanceResponse + return localVarReturnValue, nil + } + + return (*a.DeleteInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiDeleteInstanceTokenRequest { + return ApiDeleteInstanceTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + tId: tId, + instanceId: instanceId, + } +} + +// DeleteInstanceTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteInstanceTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteInstanceTokenExecute(r ApiDeleteInstanceTokenRequest) (*DeleteTokenResponse, error) { + if a.DeleteInstanceTokenExecuteMock == nil { + var localVarReturnValue *DeleteTokenResponse + return localVarReturnValue, nil + } + + return (*a.DeleteInstanceTokenExecuteMock)(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) (*GetInstanceResponse, error) { + if a.GetInstanceExecuteMock == nil { + var localVarReturnValue *GetInstanceResponse + return localVarReturnValue, nil + } + + return (*a.GetInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiGetInstanceTokenRequest { + return ApiGetInstanceTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + tId: tId, + instanceId: instanceId, + } +} + +// GetInstanceTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetInstanceTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetInstanceTokenExecute(r ApiGetInstanceTokenRequest) (*GetTokenResponse, error) { + if a.GetInstanceTokenExecuteMock == nil { + var localVarReturnValue *GetTokenResponse + return localVarReturnValue, nil + } + + return (*a.GetInstanceTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListInstanceTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListInstanceTokensRequest { + return ApiListInstanceTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// ListInstanceTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListInstanceTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListInstanceTokensExecute(r ApiListInstanceTokensRequest) (*ListTokenResponse, error) { + if a.ListInstanceTokensExecuteMock == nil { + var localVarReturnValue *ListTokenResponse + return localVarReturnValue, nil + } + + return (*a.ListInstanceTokensExecuteMock)(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) (*ListInstanceResponse, error) { + if a.ListInstancesExecuteMock == nil { + var localVarReturnValue *ListInstanceResponse + return localVarReturnValue, nil + } + + return (*a.ListInstancesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) PartialUpdateInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiPartialUpdateInstanceRequest { + return ApiPartialUpdateInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// PartialUpdateInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the PartialUpdateInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) PartialUpdateInstanceExecute(r ApiPartialUpdateInstanceRequest) (*PartialUpdateInstanceResponse, error) { + if a.PartialUpdateInstanceExecuteMock == nil { + var localVarReturnValue *PartialUpdateInstanceResponse + return localVarReturnValue, nil + } + + return (*a.PartialUpdateInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) PartialUpdateInstanceToken(ctx context.Context, projectId string, regionId string, tId string, instanceId string) ApiPartialUpdateInstanceTokenRequest { + return ApiPartialUpdateInstanceTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + tId: tId, + instanceId: instanceId, + } +} + +// PartialUpdateInstanceTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the PartialUpdateInstanceTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) PartialUpdateInstanceTokenExecute(r ApiPartialUpdateInstanceTokenRequest) (*PartialUpdateTokenResponse, error) { + if a.PartialUpdateInstanceTokenExecuteMock == nil { + var localVarReturnValue *PartialUpdateTokenResponse + return localVarReturnValue, nil + } + + return (*a.PartialUpdateInstanceTokenExecuteMock)(r) +} diff --git a/services/modelexperiments/v1api/client.go b/services/modelexperiments/v1api/client.go new file mode 100644 index 000000000..36c63b15e --- /dev/null +++ b/services/modelexperiments/v1api/client.go @@ -0,0 +1,659 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +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 AI Model Experiments API API v1.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/modelexperiments/v1api/configuration.go b/services/modelexperiments/v1api/configuration.go new file mode 100644 index 000000000..3662175cf --- /dev/null +++ b/services/modelexperiments/v1api/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +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/modelexperiments", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://model-experiments.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/modelexperiments/v1api/model_create_instance_payload.go b/services/modelexperiments/v1api/model_create_instance_payload.go new file mode 100644 index 000000000..bcb282e87 --- /dev/null +++ b/services/modelexperiments/v1api/model_create_instance_payload.go @@ -0,0 +1,280 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +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 { + // The duration to retain experiments marked for deletion before they are permanently purged. Min: 1d, Max: 90d. + DeletedExperimentRetention *string `json:"deletedExperimentRetention,omitempty" validate:"regexp=^([0-9]+(\\\\.[0-9]+)?d)?([0-9]+(\\\\.[0-9]+)?h)?([0-9]+(\\\\.[0-9]+)?m)?([0-9]+(\\\\.[0-9]+)?s)?$"` + Description *string `json:"description,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s.:\\/\\\\-]*$"` + // Object that represents the labels of an object. Regex for keys: `^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + Name string `json:"name" validate:"regexp=^[0-9a-zA-Z\\\\s_-]+$"` + 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(name string) *CreateInstancePayload { + this := CreateInstancePayload{} + this.Name = name + 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 +} + +// GetDeletedExperimentRetention returns the DeletedExperimentRetention field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetDeletedExperimentRetention() string { + if o == nil || IsNil(o.DeletedExperimentRetention) { + var ret string + return ret + } + return *o.DeletedExperimentRetention +} + +// GetDeletedExperimentRetentionOk returns a tuple with the DeletedExperimentRetention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetDeletedExperimentRetentionOk() (*string, bool) { + if o == nil || IsNil(o.DeletedExperimentRetention) { + return nil, false + } + return o.DeletedExperimentRetention, true +} + +// HasDeletedExperimentRetention returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasDeletedExperimentRetention() bool { + if o != nil && !IsNil(o.DeletedExperimentRetention) { + return true + } + + return false +} + +// SetDeletedExperimentRetention gets a reference to the given string and assigns it to the DeletedExperimentRetention field. +func (o *CreateInstancePayload) SetDeletedExperimentRetention(v string) { + o.DeletedExperimentRetention = &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 +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateInstancePayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *CreateInstancePayload) 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 *CreateInstancePayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateInstancePayload) SetName(v string) { + o.Name = 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.DeletedExperimentRetention) { + toSerialize["deletedExperimentRetention"] = o.DeletedExperimentRetention + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + + 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{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + 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, "deletedExperimentRetention") + delete(additionalProperties, "description") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + 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/modelexperiments/v1api/model_create_instance_response.go b/services/modelexperiments/v1api/model_create_instance_response.go new file mode 100644 index 000000000..8bec06400 --- /dev/null +++ b/services/modelexperiments/v1api/model_create_instance_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateInstanceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateInstanceResponse{} + +// CreateInstanceResponse struct for CreateInstanceResponse +type CreateInstanceResponse struct { + Instance Instance `json:"instance"` + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateInstanceResponse CreateInstanceResponse + +// NewCreateInstanceResponse instantiates a new CreateInstanceResponse 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 NewCreateInstanceResponse(instance Instance) *CreateInstanceResponse { + this := CreateInstanceResponse{} + this.Instance = instance + return &this +} + +// NewCreateInstanceResponseWithDefaults instantiates a new CreateInstanceResponse 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 NewCreateInstanceResponseWithDefaults() *CreateInstanceResponse { + this := CreateInstanceResponse{} + return &this +} + +// GetInstance returns the Instance field value +func (o *CreateInstanceResponse) GetInstance() Instance { + if o == nil { + var ret Instance + return ret + } + + return o.Instance +} + +// GetInstanceOk returns a tuple with the Instance field value +// and a boolean to check if the value has been set. +func (o *CreateInstanceResponse) GetInstanceOk() (*Instance, bool) { + if o == nil { + return nil, false + } + return &o.Instance, true +} + +// SetInstance sets field value +func (o *CreateInstanceResponse) SetInstance(v Instance) { + o.Instance = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *CreateInstanceResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstanceResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *CreateInstanceResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *CreateInstanceResponse) SetMessage(v string) { + o.Message = &v +} + +func (o CreateInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateInstanceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instance"] = o.Instance + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateInstanceResponse) 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{ + "instance", + } + + 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) + } + } + + varCreateInstanceResponse := _CreateInstanceResponse{} + + err = json.Unmarshal(data, &varCreateInstanceResponse) + + if err != nil { + return err + } + + *o = CreateInstanceResponse(varCreateInstanceResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instance") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateInstanceResponse struct { + value *CreateInstanceResponse + isSet bool +} + +func (v NullableCreateInstanceResponse) Get() *CreateInstanceResponse { + return v.value +} + +func (v *NullableCreateInstanceResponse) Set(val *CreateInstanceResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstanceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstanceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstanceResponse(val *CreateInstanceResponse) *NullableCreateInstanceResponse { + return &NullableCreateInstanceResponse{value: val, isSet: true} +} + +func (v NullableCreateInstanceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstanceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_create_instance_token_payload.go b/services/modelexperiments/v1api/model_create_instance_token_payload.go new file mode 100644 index 000000000..c5423aef7 --- /dev/null +++ b/services/modelexperiments/v1api/model_create_instance_token_payload.go @@ -0,0 +1,280 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateInstanceTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateInstanceTokenPayload{} + +// CreateInstanceTokenPayload struct for CreateInstanceTokenPayload +type CreateInstanceTokenPayload struct { + Description *string `json:"description,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s.:\\/\\\\-]*$"` + // Object that represents the labels of an object. Regex for keys: `^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + Name string `json:"name" validate:"regexp=^[0-9a-zA-Z\\\\s_-]+$"` + // time to live duration. Must be valid duration string. Maximum allowed duration is 6 months. If not set, defaults to 6 months. + TtlDuration *string `json:"ttlDuration,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateInstanceTokenPayload CreateInstanceTokenPayload + +// NewCreateInstanceTokenPayload instantiates a new CreateInstanceTokenPayload 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 NewCreateInstanceTokenPayload(name string) *CreateInstanceTokenPayload { + this := CreateInstanceTokenPayload{} + this.Name = name + return &this +} + +// NewCreateInstanceTokenPayloadWithDefaults instantiates a new CreateInstanceTokenPayload 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 NewCreateInstanceTokenPayloadWithDefaults() *CreateInstanceTokenPayload { + this := CreateInstanceTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateInstanceTokenPayload) 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 *CreateInstanceTokenPayload) 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 *CreateInstanceTokenPayload) 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 *CreateInstanceTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateInstanceTokenPayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstanceTokenPayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateInstanceTokenPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateInstanceTokenPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *CreateInstanceTokenPayload) 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 *CreateInstanceTokenPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateInstanceTokenPayload) SetName(v string) { + o.Name = v +} + +// GetTtlDuration returns the TtlDuration field value if set, zero value otherwise. +func (o *CreateInstanceTokenPayload) GetTtlDuration() string { + if o == nil || IsNil(o.TtlDuration) { + var ret string + return ret + } + return *o.TtlDuration +} + +// GetTtlDurationOk returns a tuple with the TtlDuration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstanceTokenPayload) GetTtlDurationOk() (*string, bool) { + if o == nil || IsNil(o.TtlDuration) { + return nil, false + } + return o.TtlDuration, true +} + +// HasTtlDuration returns a boolean if a field has been set. +func (o *CreateInstanceTokenPayload) HasTtlDuration() bool { + if o != nil && !IsNil(o.TtlDuration) { + return true + } + + return false +} + +// SetTtlDuration gets a reference to the given string and assigns it to the TtlDuration field. +func (o *CreateInstanceTokenPayload) SetTtlDuration(v string) { + o.TtlDuration = &v +} + +func (o CreateInstanceTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateInstanceTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + if !IsNil(o.TtlDuration) { + toSerialize["ttlDuration"] = o.TtlDuration + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateInstanceTokenPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateInstanceTokenPayload := _CreateInstanceTokenPayload{} + + err = json.Unmarshal(data, &varCreateInstanceTokenPayload) + + if err != nil { + return err + } + + *o = CreateInstanceTokenPayload(varCreateInstanceTokenPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "ttlDuration") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateInstanceTokenPayload struct { + value *CreateInstanceTokenPayload + isSet bool +} + +func (v NullableCreateInstanceTokenPayload) Get() *CreateInstanceTokenPayload { + return v.value +} + +func (v *NullableCreateInstanceTokenPayload) Set(val *CreateInstanceTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstanceTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstanceTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstanceTokenPayload(val *CreateInstanceTokenPayload) *NullableCreateInstanceTokenPayload { + return &NullableCreateInstanceTokenPayload{value: val, isSet: true} +} + +func (v NullableCreateInstanceTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstanceTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_create_token_response.go b/services/modelexperiments/v1api/model_create_token_response.go new file mode 100644 index 000000000..3c09d2ead --- /dev/null +++ b/services/modelexperiments/v1api/model_create_token_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateTokenResponse{} + +// CreateTokenResponse struct for CreateTokenResponse +type CreateTokenResponse struct { + Message *string `json:"message,omitempty"` + Token Token `json:"token"` + AdditionalProperties map[string]interface{} +} + +type _CreateTokenResponse CreateTokenResponse + +// NewCreateTokenResponse instantiates a new CreateTokenResponse 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 NewCreateTokenResponse(token Token) *CreateTokenResponse { + this := CreateTokenResponse{} + this.Token = token + return &this +} + +// NewCreateTokenResponseWithDefaults instantiates a new CreateTokenResponse 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 NewCreateTokenResponseWithDefaults() *CreateTokenResponse { + this := CreateTokenResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *CreateTokenResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTokenResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *CreateTokenResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *CreateTokenResponse) SetMessage(v string) { + o.Message = &v +} + +// GetToken returns the Token field value +func (o *CreateTokenResponse) GetToken() Token { + if o == nil { + var ret Token + return ret + } + + return o.Token +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *CreateTokenResponse) GetTokenOk() (*Token, bool) { + if o == nil { + return nil, false + } + return &o.Token, true +} + +// SetToken sets field value +func (o *CreateTokenResponse) SetToken(v Token) { + o.Token = v +} + +func (o CreateTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + toSerialize["token"] = o.Token + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateTokenResponse) 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{ + "token", + } + + 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) + } + } + + varCreateTokenResponse := _CreateTokenResponse{} + + err = json.Unmarshal(data, &varCreateTokenResponse) + + if err != nil { + return err + } + + *o = CreateTokenResponse(varCreateTokenResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + delete(additionalProperties, "token") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateTokenResponse struct { + value *CreateTokenResponse + isSet bool +} + +func (v NullableCreateTokenResponse) Get() *CreateTokenResponse { + return v.value +} + +func (v *NullableCreateTokenResponse) Set(val *CreateTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateTokenResponse(val *CreateTokenResponse) *NullableCreateTokenResponse { + return &NullableCreateTokenResponse{value: val, isSet: true} +} + +func (v NullableCreateTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_delete_instance_response.go b/services/modelexperiments/v1api/model_delete_instance_response.go new file mode 100644 index 000000000..db62eaa21 --- /dev/null +++ b/services/modelexperiments/v1api/model_delete_instance_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the DeleteInstanceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteInstanceResponse{} + +// DeleteInstanceResponse struct for DeleteInstanceResponse +type DeleteInstanceResponse struct { + Instance Instance `json:"instance"` + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DeleteInstanceResponse DeleteInstanceResponse + +// NewDeleteInstanceResponse instantiates a new DeleteInstanceResponse 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 NewDeleteInstanceResponse(instance Instance) *DeleteInstanceResponse { + this := DeleteInstanceResponse{} + this.Instance = instance + return &this +} + +// NewDeleteInstanceResponseWithDefaults instantiates a new DeleteInstanceResponse 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 NewDeleteInstanceResponseWithDefaults() *DeleteInstanceResponse { + this := DeleteInstanceResponse{} + return &this +} + +// GetInstance returns the Instance field value +func (o *DeleteInstanceResponse) GetInstance() Instance { + if o == nil { + var ret Instance + return ret + } + + return o.Instance +} + +// GetInstanceOk returns a tuple with the Instance field value +// and a boolean to check if the value has been set. +func (o *DeleteInstanceResponse) GetInstanceOk() (*Instance, bool) { + if o == nil { + return nil, false + } + return &o.Instance, true +} + +// SetInstance sets field value +func (o *DeleteInstanceResponse) SetInstance(v Instance) { + o.Instance = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *DeleteInstanceResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeleteInstanceResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *DeleteInstanceResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *DeleteInstanceResponse) SetMessage(v string) { + o.Message = &v +} + +func (o DeleteInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteInstanceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instance"] = o.Instance + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeleteInstanceResponse) 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{ + "instance", + } + + 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) + } + } + + varDeleteInstanceResponse := _DeleteInstanceResponse{} + + err = json.Unmarshal(data, &varDeleteInstanceResponse) + + if err != nil { + return err + } + + *o = DeleteInstanceResponse(varDeleteInstanceResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instance") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeleteInstanceResponse struct { + value *DeleteInstanceResponse + isSet bool +} + +func (v NullableDeleteInstanceResponse) Get() *DeleteInstanceResponse { + return v.value +} + +func (v *NullableDeleteInstanceResponse) Set(val *DeleteInstanceResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteInstanceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteInstanceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteInstanceResponse(val *DeleteInstanceResponse) *NullableDeleteInstanceResponse { + return &NullableDeleteInstanceResponse{value: val, isSet: true} +} + +func (v NullableDeleteInstanceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteInstanceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_delete_token_response.go b/services/modelexperiments/v1api/model_delete_token_response.go new file mode 100644 index 000000000..ca8bbaded --- /dev/null +++ b/services/modelexperiments/v1api/model_delete_token_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the DeleteTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteTokenResponse{} + +// DeleteTokenResponse struct for DeleteTokenResponse +type DeleteTokenResponse struct { + Message *string `json:"message,omitempty"` + Token TokenMetadata `json:"token"` + AdditionalProperties map[string]interface{} +} + +type _DeleteTokenResponse DeleteTokenResponse + +// NewDeleteTokenResponse instantiates a new DeleteTokenResponse 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 NewDeleteTokenResponse(token TokenMetadata) *DeleteTokenResponse { + this := DeleteTokenResponse{} + this.Token = token + return &this +} + +// NewDeleteTokenResponseWithDefaults instantiates a new DeleteTokenResponse 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 NewDeleteTokenResponseWithDefaults() *DeleteTokenResponse { + this := DeleteTokenResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *DeleteTokenResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeleteTokenResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *DeleteTokenResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *DeleteTokenResponse) SetMessage(v string) { + o.Message = &v +} + +// GetToken returns the Token field value +func (o *DeleteTokenResponse) GetToken() TokenMetadata { + if o == nil { + var ret TokenMetadata + return ret + } + + return o.Token +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *DeleteTokenResponse) GetTokenOk() (*TokenMetadata, bool) { + if o == nil { + return nil, false + } + return &o.Token, true +} + +// SetToken sets field value +func (o *DeleteTokenResponse) SetToken(v TokenMetadata) { + o.Token = v +} + +func (o DeleteTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + toSerialize["token"] = o.Token + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DeleteTokenResponse) 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{ + "token", + } + + 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) + } + } + + varDeleteTokenResponse := _DeleteTokenResponse{} + + err = json.Unmarshal(data, &varDeleteTokenResponse) + + if err != nil { + return err + } + + *o = DeleteTokenResponse(varDeleteTokenResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + delete(additionalProperties, "token") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDeleteTokenResponse struct { + value *DeleteTokenResponse + isSet bool +} + +func (v NullableDeleteTokenResponse) Get() *DeleteTokenResponse { + return v.value +} + +func (v *NullableDeleteTokenResponse) Set(val *DeleteTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteTokenResponse(val *DeleteTokenResponse) *NullableDeleteTokenResponse { + return &NullableDeleteTokenResponse{value: val, isSet: true} +} + +func (v NullableDeleteTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_error_response.go b/services/modelexperiments/v1api/model_error_response.go new file mode 100644 index 000000000..a9e1d4296 --- /dev/null +++ b/services/modelexperiments/v1api/model_error_response.go @@ -0,0 +1,236 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +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 { + // The HTTP status code. + Code int32 `json:"code"` + // User facing error message. + Message string `json:"message"` + // The canonical error code. + Status *string `json:"status,omitempty"` + 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) *ErrorResponse { + this := ErrorResponse{} + this.Code = code + this.Message = message + 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 +} + +// 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 +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *ErrorResponse) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *ErrorResponse) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *ErrorResponse) SetStatus(v string) { + o.Status = &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 + toSerialize["message"] = o.Message + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + + 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", + } + + 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, "message") + delete(additionalProperties, "status") + 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/modelexperiments/v1api/model_get_instance_response.go b/services/modelexperiments/v1api/model_get_instance_response.go new file mode 100644 index 000000000..92653f53d --- /dev/null +++ b/services/modelexperiments/v1api/model_get_instance_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetInstanceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetInstanceResponse{} + +// GetInstanceResponse struct for GetInstanceResponse +type GetInstanceResponse struct { + Instance Instance `json:"instance"` + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GetInstanceResponse GetInstanceResponse + +// NewGetInstanceResponse instantiates a new GetInstanceResponse 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 NewGetInstanceResponse(instance Instance) *GetInstanceResponse { + this := GetInstanceResponse{} + this.Instance = instance + return &this +} + +// NewGetInstanceResponseWithDefaults instantiates a new GetInstanceResponse 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 NewGetInstanceResponseWithDefaults() *GetInstanceResponse { + this := GetInstanceResponse{} + return &this +} + +// GetInstance returns the Instance field value +func (o *GetInstanceResponse) GetInstance() Instance { + if o == nil { + var ret Instance + return ret + } + + return o.Instance +} + +// GetInstanceOk returns a tuple with the Instance field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetInstanceOk() (*Instance, bool) { + if o == nil { + return nil, false + } + return &o.Instance, true +} + +// SetInstance sets field value +func (o *GetInstanceResponse) SetInstance(v Instance) { + o.Instance = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *GetInstanceResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *GetInstanceResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *GetInstanceResponse) SetMessage(v string) { + o.Message = &v +} + +func (o GetInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetInstanceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instance"] = o.Instance + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetInstanceResponse) 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{ + "instance", + } + + 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) + } + } + + varGetInstanceResponse := _GetInstanceResponse{} + + err = json.Unmarshal(data, &varGetInstanceResponse) + + if err != nil { + return err + } + + *o = GetInstanceResponse(varGetInstanceResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instance") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetInstanceResponse struct { + value *GetInstanceResponse + isSet bool +} + +func (v NullableGetInstanceResponse) Get() *GetInstanceResponse { + return v.value +} + +func (v *NullableGetInstanceResponse) Set(val *GetInstanceResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetInstanceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetInstanceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetInstanceResponse(val *GetInstanceResponse) *NullableGetInstanceResponse { + return &NullableGetInstanceResponse{value: val, isSet: true} +} + +func (v NullableGetInstanceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetInstanceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_get_token_response.go b/services/modelexperiments/v1api/model_get_token_response.go new file mode 100644 index 000000000..33909cd9a --- /dev/null +++ b/services/modelexperiments/v1api/model_get_token_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetTokenResponse{} + +// GetTokenResponse struct for GetTokenResponse +type GetTokenResponse struct { + Message *string `json:"message,omitempty"` + Token TokenMetadata `json:"token"` + AdditionalProperties map[string]interface{} +} + +type _GetTokenResponse GetTokenResponse + +// NewGetTokenResponse instantiates a new GetTokenResponse 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 NewGetTokenResponse(token TokenMetadata) *GetTokenResponse { + this := GetTokenResponse{} + this.Token = token + return &this +} + +// NewGetTokenResponseWithDefaults instantiates a new GetTokenResponse 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 NewGetTokenResponseWithDefaults() *GetTokenResponse { + this := GetTokenResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *GetTokenResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetTokenResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *GetTokenResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *GetTokenResponse) SetMessage(v string) { + o.Message = &v +} + +// GetToken returns the Token field value +func (o *GetTokenResponse) GetToken() TokenMetadata { + if o == nil { + var ret TokenMetadata + return ret + } + + return o.Token +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *GetTokenResponse) GetTokenOk() (*TokenMetadata, bool) { + if o == nil { + return nil, false + } + return &o.Token, true +} + +// SetToken sets field value +func (o *GetTokenResponse) SetToken(v TokenMetadata) { + o.Token = v +} + +func (o GetTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + toSerialize["token"] = o.Token + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetTokenResponse) 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{ + "token", + } + + 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) + } + } + + varGetTokenResponse := _GetTokenResponse{} + + err = json.Unmarshal(data, &varGetTokenResponse) + + if err != nil { + return err + } + + *o = GetTokenResponse(varGetTokenResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + delete(additionalProperties, "token") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetTokenResponse struct { + value *GetTokenResponse + isSet bool +} + +func (v NullableGetTokenResponse) Get() *GetTokenResponse { + return v.value +} + +func (v *NullableGetTokenResponse) Set(val *GetTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetTokenResponse(val *GetTokenResponse) *NullableGetTokenResponse { + return &NullableGetTokenResponse{value: val, isSet: true} +} + +func (v NullableGetTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_instance.go b/services/modelexperiments/v1api/model_instance.go new file mode 100644 index 000000000..5315aa8c2 --- /dev/null +++ b/services/modelexperiments/v1api/model_instance.go @@ -0,0 +1,478 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the Instance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Instance{} + +// Instance struct for Instance +type Instance struct { + BucketName *string `json:"bucketName,omitempty" validate:"regexp=^model-experiments-[a-zA-Z0-9]+$"` + // The duration to retain experiments marked for deletion before they are permanently purged. Min: 1d, Max: 90d. + DeletedExperimentRetention *string `json:"deletedExperimentRetention,omitempty" validate:"regexp=^([0-9]+(\\\\.[0-9]+)?d)?([0-9]+(\\\\.[0-9]+)?h)?([0-9]+(\\\\.[0-9]+)?m)?([0-9]+(\\\\.[0-9]+)?s)?$"` + Description *string `json:"description,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s.:\\/\\\\-]+$"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Id string `json:"id"` + // Object that represents the labels of an object. Regex for keys: `^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + Name string `json:"name" validate:"regexp=^[0-9a-zA-Z\\\\s_-]+$"` + Region *string `json:"region,omitempty"` + State string `json:"state"` + Url string `json:"url" validate:"regexp=^[0-9a-zA-Z\\\\s.:\\/\\\\-]+$"` + 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(id string, name string, state string, url string) *Instance { + this := Instance{} + this.Id = id + this.Name = name + this.State = state + this.Url = url + 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 +} + +// GetBucketName returns the BucketName field value if set, zero value otherwise. +func (o *Instance) 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 *Instance) 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 *Instance) 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 *Instance) SetBucketName(v string) { + o.BucketName = &v +} + +// GetDeletedExperimentRetention returns the DeletedExperimentRetention field value if set, zero value otherwise. +func (o *Instance) GetDeletedExperimentRetention() string { + if o == nil || IsNil(o.DeletedExperimentRetention) { + var ret string + return ret + } + return *o.DeletedExperimentRetention +} + +// GetDeletedExperimentRetentionOk returns a tuple with the DeletedExperimentRetention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetDeletedExperimentRetentionOk() (*string, bool) { + if o == nil || IsNil(o.DeletedExperimentRetention) { + return nil, false + } + return o.DeletedExperimentRetention, true +} + +// HasDeletedExperimentRetention returns a boolean if a field has been set. +func (o *Instance) HasDeletedExperimentRetention() bool { + if o != nil && !IsNil(o.DeletedExperimentRetention) { + return true + } + + return false +} + +// SetDeletedExperimentRetention gets a reference to the given string and assigns it to the DeletedExperimentRetention field. +func (o *Instance) SetDeletedExperimentRetention(v string) { + o.DeletedExperimentRetention = &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 +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *Instance) GetErrorMessage() string { + if o == nil || IsNil(o.ErrorMessage) { + var ret string + return ret + } + return *o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetErrorMessageOk() (*string, bool) { + if o == nil || IsNil(o.ErrorMessage) { + return nil, false + } + return o.ErrorMessage, true +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *Instance) HasErrorMessage() bool { + if o != nil && !IsNil(o.ErrorMessage) { + return true + } + + return false +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *Instance) SetErrorMessage(v string) { + o.ErrorMessage = &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 +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Instance) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Instance) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *Instance) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *Instance) 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 *Instance) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Instance) SetName(v string) { + o.Name = v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *Instance) GetRegion() string { + if o == nil || IsNil(o.Region) { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetRegionOk() (*string, bool) { + if o == nil || IsNil(o.Region) { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *Instance) HasRegion() bool { + if o != nil && !IsNil(o.Region) { + return true + } + + return false +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *Instance) SetRegion(v string) { + o.Region = &v +} + +// GetState returns the State field value +func (o *Instance) 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 *Instance) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *Instance) SetState(v string) { + o.State = v +} + +// GetUrl returns the Url field value +func (o *Instance) 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 *Instance) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *Instance) SetUrl(v string) { + o.Url = v +} + +func (o Instance) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Instance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BucketName) { + toSerialize["bucketName"] = o.BucketName + } + if !IsNil(o.DeletedExperimentRetention) { + toSerialize["deletedExperimentRetention"] = o.DeletedExperimentRetention + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.ErrorMessage) { + toSerialize["errorMessage"] = o.ErrorMessage + } + toSerialize["id"] = o.Id + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + if !IsNil(o.Region) { + toSerialize["region"] = o.Region + } + toSerialize["state"] = o.State + toSerialize["url"] = o.Url + + 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{ + "id", + "name", + "state", + "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) + } + } + + 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, "bucketName") + delete(additionalProperties, "deletedExperimentRetention") + delete(additionalProperties, "description") + delete(additionalProperties, "errorMessage") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "region") + delete(additionalProperties, "state") + delete(additionalProperties, "url") + 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/modelexperiments/v1api/model_list_instance_response.go b/services/modelexperiments/v1api/model_list_instance_response.go new file mode 100644 index 000000000..23a19ac7d --- /dev/null +++ b/services/modelexperiments/v1api/model_list_instance_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListInstanceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListInstanceResponse{} + +// ListInstanceResponse struct for ListInstanceResponse +type ListInstanceResponse struct { + Instances []Instance `json:"instances"` + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListInstanceResponse ListInstanceResponse + +// NewListInstanceResponse instantiates a new ListInstanceResponse 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 NewListInstanceResponse(instances []Instance) *ListInstanceResponse { + this := ListInstanceResponse{} + this.Instances = instances + return &this +} + +// NewListInstanceResponseWithDefaults instantiates a new ListInstanceResponse 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 NewListInstanceResponseWithDefaults() *ListInstanceResponse { + this := ListInstanceResponse{} + return &this +} + +// GetInstances returns the Instances field value +func (o *ListInstanceResponse) 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 *ListInstanceResponse) GetInstancesOk() ([]Instance, bool) { + if o == nil { + return nil, false + } + return o.Instances, true +} + +// SetInstances sets field value +func (o *ListInstanceResponse) SetInstances(v []Instance) { + o.Instances = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ListInstanceResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListInstanceResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *ListInstanceResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ListInstanceResponse) SetMessage(v string) { + o.Message = &v +} + +func (o ListInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListInstanceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instances"] = o.Instances + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListInstanceResponse) 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) + } + } + + varListInstanceResponse := _ListInstanceResponse{} + + err = json.Unmarshal(data, &varListInstanceResponse) + + if err != nil { + return err + } + + *o = ListInstanceResponse(varListInstanceResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instances") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListInstanceResponse struct { + value *ListInstanceResponse + isSet bool +} + +func (v NullableListInstanceResponse) Get() *ListInstanceResponse { + return v.value +} + +func (v *NullableListInstanceResponse) Set(val *ListInstanceResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListInstanceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListInstanceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListInstanceResponse(val *ListInstanceResponse) *NullableListInstanceResponse { + return &NullableListInstanceResponse{value: val, isSet: true} +} + +func (v NullableListInstanceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListInstanceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_list_token_response.go b/services/modelexperiments/v1api/model_list_token_response.go new file mode 100644 index 000000000..9fcbeb0b0 --- /dev/null +++ b/services/modelexperiments/v1api/model_list_token_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListTokenResponse{} + +// ListTokenResponse struct for ListTokenResponse +type ListTokenResponse struct { + Message *string `json:"message,omitempty"` + Tokens []TokenMetadata `json:"tokens"` + AdditionalProperties map[string]interface{} +} + +type _ListTokenResponse ListTokenResponse + +// NewListTokenResponse instantiates a new ListTokenResponse 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 NewListTokenResponse(tokens []TokenMetadata) *ListTokenResponse { + this := ListTokenResponse{} + this.Tokens = tokens + return &this +} + +// NewListTokenResponseWithDefaults instantiates a new ListTokenResponse 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 NewListTokenResponseWithDefaults() *ListTokenResponse { + this := ListTokenResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ListTokenResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListTokenResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *ListTokenResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ListTokenResponse) SetMessage(v string) { + o.Message = &v +} + +// GetTokens returns the Tokens field value +func (o *ListTokenResponse) GetTokens() []TokenMetadata { + if o == nil { + var ret []TokenMetadata + return ret + } + + return o.Tokens +} + +// GetTokensOk returns a tuple with the Tokens field value +// and a boolean to check if the value has been set. +func (o *ListTokenResponse) GetTokensOk() ([]TokenMetadata, bool) { + if o == nil { + return nil, false + } + return o.Tokens, true +} + +// SetTokens sets field value +func (o *ListTokenResponse) SetTokens(v []TokenMetadata) { + o.Tokens = v +} + +func (o ListTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + toSerialize["tokens"] = o.Tokens + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListTokenResponse) 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{ + "tokens", + } + + 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) + } + } + + varListTokenResponse := _ListTokenResponse{} + + err = json.Unmarshal(data, &varListTokenResponse) + + if err != nil { + return err + } + + *o = ListTokenResponse(varListTokenResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + delete(additionalProperties, "tokens") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListTokenResponse struct { + value *ListTokenResponse + isSet bool +} + +func (v NullableListTokenResponse) Get() *ListTokenResponse { + return v.value +} + +func (v *NullableListTokenResponse) Set(val *ListTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListTokenResponse(val *ListTokenResponse) *NullableListTokenResponse { + return &NullableListTokenResponse{value: val, isSet: true} +} + +func (v NullableListTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_partial_update_instance_payload.go b/services/modelexperiments/v1api/model_partial_update_instance_payload.go new file mode 100644 index 000000000..4ead36420 --- /dev/null +++ b/services/modelexperiments/v1api/model_partial_update_instance_payload.go @@ -0,0 +1,267 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the PartialUpdateInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateInstancePayload{} + +// PartialUpdateInstancePayload struct for PartialUpdateInstancePayload +type PartialUpdateInstancePayload struct { + // The duration to retain experiments marked for deletion before they are permanently purged. Min: 1d, Max: 90d. + DeletedExperimentRetention *string `json:"deletedExperimentRetention,omitempty" validate:"regexp=^([0-9]+(\\\\.[0-9]+)?d)?([0-9]+(\\\\.[0-9]+)?h)?([0-9]+(\\\\.[0-9]+)?m)?([0-9]+(\\\\.[0-9]+)?s)?$"` + Description *string `json:"description,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s.:\\/\\\\-]*$"` + // Object that represents the labels of an object. Regex for keys: `^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + Name *string `json:"name,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s_-]*$"` + AdditionalProperties map[string]interface{} +} + +type _PartialUpdateInstancePayload PartialUpdateInstancePayload + +// NewPartialUpdateInstancePayload instantiates a new PartialUpdateInstancePayload 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 NewPartialUpdateInstancePayload() *PartialUpdateInstancePayload { + this := PartialUpdateInstancePayload{} + return &this +} + +// NewPartialUpdateInstancePayloadWithDefaults instantiates a new PartialUpdateInstancePayload 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 NewPartialUpdateInstancePayloadWithDefaults() *PartialUpdateInstancePayload { + this := PartialUpdateInstancePayload{} + return &this +} + +// GetDeletedExperimentRetention returns the DeletedExperimentRetention field value if set, zero value otherwise. +func (o *PartialUpdateInstancePayload) GetDeletedExperimentRetention() string { + if o == nil || IsNil(o.DeletedExperimentRetention) { + var ret string + return ret + } + return *o.DeletedExperimentRetention +} + +// GetDeletedExperimentRetentionOk returns a tuple with the DeletedExperimentRetention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateInstancePayload) GetDeletedExperimentRetentionOk() (*string, bool) { + if o == nil || IsNil(o.DeletedExperimentRetention) { + return nil, false + } + return o.DeletedExperimentRetention, true +} + +// HasDeletedExperimentRetention returns a boolean if a field has been set. +func (o *PartialUpdateInstancePayload) HasDeletedExperimentRetention() bool { + if o != nil && !IsNil(o.DeletedExperimentRetention) { + return true + } + + return false +} + +// SetDeletedExperimentRetention gets a reference to the given string and assigns it to the DeletedExperimentRetention field. +func (o *PartialUpdateInstancePayload) SetDeletedExperimentRetention(v string) { + o.DeletedExperimentRetention = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *PartialUpdateInstancePayload) 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 *PartialUpdateInstancePayload) 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 *PartialUpdateInstancePayload) 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 *PartialUpdateInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PartialUpdateInstancePayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateInstancePayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *PartialUpdateInstancePayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *PartialUpdateInstancePayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialUpdateInstancePayload) 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 *PartialUpdateInstancePayload) 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 *PartialUpdateInstancePayload) 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 *PartialUpdateInstancePayload) SetName(v string) { + o.Name = &v +} + +func (o PartialUpdateInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PartialUpdateInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DeletedExperimentRetention) { + toSerialize["deletedExperimentRetention"] = o.DeletedExperimentRetention + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PartialUpdateInstancePayload) UnmarshalJSON(data []byte) (err error) { + varPartialUpdateInstancePayload := _PartialUpdateInstancePayload{} + + err = json.Unmarshal(data, &varPartialUpdateInstancePayload) + + if err != nil { + return err + } + + *o = PartialUpdateInstancePayload(varPartialUpdateInstancePayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "deletedExperimentRetention") + delete(additionalProperties, "description") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePartialUpdateInstancePayload struct { + value *PartialUpdateInstancePayload + isSet bool +} + +func (v NullablePartialUpdateInstancePayload) Get() *PartialUpdateInstancePayload { + return v.value +} + +func (v *NullablePartialUpdateInstancePayload) Set(val *PartialUpdateInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateInstancePayload(val *PartialUpdateInstancePayload) *NullablePartialUpdateInstancePayload { + return &NullablePartialUpdateInstancePayload{value: val, isSet: true} +} + +func (v NullablePartialUpdateInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_partial_update_instance_response.go b/services/modelexperiments/v1api/model_partial_update_instance_response.go new file mode 100644 index 000000000..b9c33d0f1 --- /dev/null +++ b/services/modelexperiments/v1api/model_partial_update_instance_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the PartialUpdateInstanceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateInstanceResponse{} + +// PartialUpdateInstanceResponse struct for PartialUpdateInstanceResponse +type PartialUpdateInstanceResponse struct { + Instance Instance `json:"instance"` + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PartialUpdateInstanceResponse PartialUpdateInstanceResponse + +// NewPartialUpdateInstanceResponse instantiates a new PartialUpdateInstanceResponse 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 NewPartialUpdateInstanceResponse(instance Instance) *PartialUpdateInstanceResponse { + this := PartialUpdateInstanceResponse{} + this.Instance = instance + return &this +} + +// NewPartialUpdateInstanceResponseWithDefaults instantiates a new PartialUpdateInstanceResponse 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 NewPartialUpdateInstanceResponseWithDefaults() *PartialUpdateInstanceResponse { + this := PartialUpdateInstanceResponse{} + return &this +} + +// GetInstance returns the Instance field value +func (o *PartialUpdateInstanceResponse) GetInstance() Instance { + if o == nil { + var ret Instance + return ret + } + + return o.Instance +} + +// GetInstanceOk returns a tuple with the Instance field value +// and a boolean to check if the value has been set. +func (o *PartialUpdateInstanceResponse) GetInstanceOk() (*Instance, bool) { + if o == nil { + return nil, false + } + return &o.Instance, true +} + +// SetInstance sets field value +func (o *PartialUpdateInstanceResponse) SetInstance(v Instance) { + o.Instance = v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *PartialUpdateInstanceResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateInstanceResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *PartialUpdateInstanceResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *PartialUpdateInstanceResponse) SetMessage(v string) { + o.Message = &v +} + +func (o PartialUpdateInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PartialUpdateInstanceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instance"] = o.Instance + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PartialUpdateInstanceResponse) 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{ + "instance", + } + + 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) + } + } + + varPartialUpdateInstanceResponse := _PartialUpdateInstanceResponse{} + + err = json.Unmarshal(data, &varPartialUpdateInstanceResponse) + + if err != nil { + return err + } + + *o = PartialUpdateInstanceResponse(varPartialUpdateInstanceResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instance") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePartialUpdateInstanceResponse struct { + value *PartialUpdateInstanceResponse + isSet bool +} + +func (v NullablePartialUpdateInstanceResponse) Get() *PartialUpdateInstanceResponse { + return v.value +} + +func (v *NullablePartialUpdateInstanceResponse) Set(val *PartialUpdateInstanceResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateInstanceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateInstanceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateInstanceResponse(val *PartialUpdateInstanceResponse) *NullablePartialUpdateInstanceResponse { + return &NullablePartialUpdateInstanceResponse{value: val, isSet: true} +} + +func (v NullablePartialUpdateInstanceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateInstanceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_partial_update_instance_token_payload.go b/services/modelexperiments/v1api/model_partial_update_instance_token_payload.go new file mode 100644 index 000000000..4736104ac --- /dev/null +++ b/services/modelexperiments/v1api/model_partial_update_instance_token_payload.go @@ -0,0 +1,229 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the PartialUpdateInstanceTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateInstanceTokenPayload{} + +// PartialUpdateInstanceTokenPayload struct for PartialUpdateInstanceTokenPayload +type PartialUpdateInstanceTokenPayload struct { + Description *string `json:"description,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s.:\\/\\\\-]*$"` + // Object that represents the labels of an object. Regex for keys: `^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + Name *string `json:"name,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s_-]*$"` + AdditionalProperties map[string]interface{} +} + +type _PartialUpdateInstanceTokenPayload PartialUpdateInstanceTokenPayload + +// NewPartialUpdateInstanceTokenPayload instantiates a new PartialUpdateInstanceTokenPayload 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 NewPartialUpdateInstanceTokenPayload() *PartialUpdateInstanceTokenPayload { + this := PartialUpdateInstanceTokenPayload{} + return &this +} + +// NewPartialUpdateInstanceTokenPayloadWithDefaults instantiates a new PartialUpdateInstanceTokenPayload 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 NewPartialUpdateInstanceTokenPayloadWithDefaults() *PartialUpdateInstanceTokenPayload { + this := PartialUpdateInstanceTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *PartialUpdateInstanceTokenPayload) 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 *PartialUpdateInstanceTokenPayload) 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 *PartialUpdateInstanceTokenPayload) 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 *PartialUpdateInstanceTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PartialUpdateInstanceTokenPayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateInstanceTokenPayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *PartialUpdateInstanceTokenPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *PartialUpdateInstanceTokenPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialUpdateInstanceTokenPayload) 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 *PartialUpdateInstanceTokenPayload) 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 *PartialUpdateInstanceTokenPayload) 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 *PartialUpdateInstanceTokenPayload) SetName(v string) { + o.Name = &v +} + +func (o PartialUpdateInstanceTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PartialUpdateInstanceTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PartialUpdateInstanceTokenPayload) UnmarshalJSON(data []byte) (err error) { + varPartialUpdateInstanceTokenPayload := _PartialUpdateInstanceTokenPayload{} + + err = json.Unmarshal(data, &varPartialUpdateInstanceTokenPayload) + + if err != nil { + return err + } + + *o = PartialUpdateInstanceTokenPayload(varPartialUpdateInstanceTokenPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePartialUpdateInstanceTokenPayload struct { + value *PartialUpdateInstanceTokenPayload + isSet bool +} + +func (v NullablePartialUpdateInstanceTokenPayload) Get() *PartialUpdateInstanceTokenPayload { + return v.value +} + +func (v *NullablePartialUpdateInstanceTokenPayload) Set(val *PartialUpdateInstanceTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateInstanceTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateInstanceTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateInstanceTokenPayload(val *PartialUpdateInstanceTokenPayload) *NullablePartialUpdateInstanceTokenPayload { + return &NullablePartialUpdateInstanceTokenPayload{value: val, isSet: true} +} + +func (v NullablePartialUpdateInstanceTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateInstanceTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_partial_update_token_response.go b/services/modelexperiments/v1api/model_partial_update_token_response.go new file mode 100644 index 000000000..aca62436b --- /dev/null +++ b/services/modelexperiments/v1api/model_partial_update_token_response.go @@ -0,0 +1,204 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the PartialUpdateTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateTokenResponse{} + +// PartialUpdateTokenResponse struct for PartialUpdateTokenResponse +type PartialUpdateTokenResponse struct { + Message *string `json:"message,omitempty"` + Token TokenMetadata `json:"token"` + AdditionalProperties map[string]interface{} +} + +type _PartialUpdateTokenResponse PartialUpdateTokenResponse + +// NewPartialUpdateTokenResponse instantiates a new PartialUpdateTokenResponse 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 NewPartialUpdateTokenResponse(token TokenMetadata) *PartialUpdateTokenResponse { + this := PartialUpdateTokenResponse{} + this.Token = token + return &this +} + +// NewPartialUpdateTokenResponseWithDefaults instantiates a new PartialUpdateTokenResponse 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 NewPartialUpdateTokenResponseWithDefaults() *PartialUpdateTokenResponse { + this := PartialUpdateTokenResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *PartialUpdateTokenResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateTokenResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *PartialUpdateTokenResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *PartialUpdateTokenResponse) SetMessage(v string) { + o.Message = &v +} + +// GetToken returns the Token field value +func (o *PartialUpdateTokenResponse) GetToken() TokenMetadata { + if o == nil { + var ret TokenMetadata + return ret + } + + return o.Token +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *PartialUpdateTokenResponse) GetTokenOk() (*TokenMetadata, bool) { + if o == nil { + return nil, false + } + return &o.Token, true +} + +// SetToken sets field value +func (o *PartialUpdateTokenResponse) SetToken(v TokenMetadata) { + o.Token = v +} + +func (o PartialUpdateTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PartialUpdateTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + toSerialize["token"] = o.Token + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PartialUpdateTokenResponse) 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{ + "token", + } + + 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) + } + } + + varPartialUpdateTokenResponse := _PartialUpdateTokenResponse{} + + err = json.Unmarshal(data, &varPartialUpdateTokenResponse) + + if err != nil { + return err + } + + *o = PartialUpdateTokenResponse(varPartialUpdateTokenResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + delete(additionalProperties, "token") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePartialUpdateTokenResponse struct { + value *PartialUpdateTokenResponse + isSet bool +} + +func (v NullablePartialUpdateTokenResponse) Get() *PartialUpdateTokenResponse { + return v.value +} + +func (v *NullablePartialUpdateTokenResponse) Set(val *PartialUpdateTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateTokenResponse(val *PartialUpdateTokenResponse) *NullablePartialUpdateTokenResponse { + return &NullablePartialUpdateTokenResponse{value: val, isSet: true} +} + +func (v NullablePartialUpdateTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_token.go b/services/modelexperiments/v1api/model_token.go new file mode 100644 index 000000000..b97166179 --- /dev/null +++ b/services/modelexperiments/v1api/model_token.go @@ -0,0 +1,388 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Token type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Token{} + +// Token struct for Token +type Token struct { + Content string `json:"content" validate:"regexp=^[A-Za-z0-9-_]+\\\\.[A-Za-z0-9-_]+\\\\.[A-Za-z0-9-_]+$"` + Description *string `json:"description,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s.:\\/\\\\-]+$"` + Id string `json:"id"` + // Object that represents the labels of an object. Regex for keys: `^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + Name string `json:"name" validate:"regexp=^[0-9a-zA-Z\\\\s_-]+$"` + Region string `json:"region"` + State TokenState `json:"state"` + ValidUntil time.Time `json:"validUntil"` + AdditionalProperties map[string]interface{} +} + +type _Token Token + +// NewToken instantiates a new Token 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 NewToken(content string, id string, name string, region string, state TokenState, validUntil time.Time) *Token { + this := Token{} + this.Content = content + this.Id = id + this.Name = name + this.Region = region + this.State = state + this.ValidUntil = validUntil + return &this +} + +// NewTokenWithDefaults instantiates a new Token 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 NewTokenWithDefaults() *Token { + this := Token{} + return &this +} + +// GetContent returns the Content field value +func (o *Token) GetContent() string { + if o == nil { + var ret string + return ret + } + + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *Token) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value +func (o *Token) SetContent(v string) { + o.Content = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Token) 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 *Token) 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 *Token) 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 *Token) SetDescription(v string) { + o.Description = &v +} + +// GetId returns the Id field value +func (o *Token) 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 *Token) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Token) SetId(v string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Token) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Token) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *Token) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *Token) 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 *Token) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Token) SetName(v string) { + o.Name = v +} + +// GetRegion returns the Region field value +func (o *Token) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *Token) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *Token) SetRegion(v string) { + o.Region = v +} + +// GetState returns the State field value +func (o *Token) GetState() TokenState { + if o == nil { + var ret TokenState + 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 *Token) GetStateOk() (*TokenState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *Token) SetState(v TokenState) { + o.State = v +} + +// GetValidUntil returns the ValidUntil field value +func (o *Token) GetValidUntil() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.ValidUntil +} + +// GetValidUntilOk returns a tuple with the ValidUntil field value +// and a boolean to check if the value has been set. +func (o *Token) GetValidUntilOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ValidUntil, true +} + +// SetValidUntil sets field value +func (o *Token) SetValidUntil(v time.Time) { + o.ValidUntil = v +} + +func (o Token) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Token) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["content"] = o.Content + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["id"] = o.Id + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["region"] = o.Region + toSerialize["state"] = o.State + toSerialize["validUntil"] = o.ValidUntil + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Token) 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{ + "content", + "id", + "name", + "region", + "state", + "validUntil", + } + + 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) + } + } + + varToken := _Token{} + + err = json.Unmarshal(data, &varToken) + + if err != nil { + return err + } + + *o = Token(varToken) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "content") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "region") + delete(additionalProperties, "state") + delete(additionalProperties, "validUntil") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableToken struct { + value *Token + isSet bool +} + +func (v NullableToken) Get() *Token { + return v.value +} + +func (v *NullableToken) Set(val *Token) { + v.value = val + v.isSet = true +} + +func (v NullableToken) IsSet() bool { + return v.isSet +} + +func (v *NullableToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableToken(val *Token) *NullableToken { + return &NullableToken{value: val, isSet: true} +} + +func (v NullableToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_token_metadata.go b/services/modelexperiments/v1api/model_token_metadata.go new file mode 100644 index 000000000..0f14d23b1 --- /dev/null +++ b/services/modelexperiments/v1api/model_token_metadata.go @@ -0,0 +1,359 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the TokenMetadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TokenMetadata{} + +// TokenMetadata struct for TokenMetadata +type TokenMetadata struct { + Description *string `json:"description,omitempty" validate:"regexp=^[0-9a-zA-Z\\\\s.:\\/\\\\-]+$"` + Id string `json:"id"` + // Object that represents the labels of an object. Regex for keys: `^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + Name string `json:"name" validate:"regexp=^[0-9a-zA-Z\\\\s_-]+$"` + Region string `json:"region"` + State TokenState `json:"state"` + ValidUntil time.Time `json:"validUntil"` + AdditionalProperties map[string]interface{} +} + +type _TokenMetadata TokenMetadata + +// NewTokenMetadata instantiates a new TokenMetadata 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 NewTokenMetadata(id string, name string, region string, state TokenState, validUntil time.Time) *TokenMetadata { + this := TokenMetadata{} + this.Id = id + this.Name = name + this.Region = region + this.State = state + this.ValidUntil = validUntil + return &this +} + +// NewTokenMetadataWithDefaults instantiates a new TokenMetadata 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 NewTokenMetadataWithDefaults() *TokenMetadata { + this := TokenMetadata{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *TokenMetadata) 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 *TokenMetadata) 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 *TokenMetadata) 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 *TokenMetadata) SetDescription(v string) { + o.Description = &v +} + +// GetId returns the Id field value +func (o *TokenMetadata) 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 *TokenMetadata) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *TokenMetadata) SetId(v string) { + o.Id = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *TokenMetadata) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TokenMetadata) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *TokenMetadata) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *TokenMetadata) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *TokenMetadata) 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 *TokenMetadata) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *TokenMetadata) SetName(v string) { + o.Name = v +} + +// GetRegion returns the Region field value +func (o *TokenMetadata) GetRegion() string { + if o == nil { + var ret string + return ret + } + + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *TokenMetadata) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value +func (o *TokenMetadata) SetRegion(v string) { + o.Region = v +} + +// GetState returns the State field value +func (o *TokenMetadata) GetState() TokenState { + if o == nil { + var ret TokenState + 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 *TokenMetadata) GetStateOk() (*TokenState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *TokenMetadata) SetState(v TokenState) { + o.State = v +} + +// GetValidUntil returns the ValidUntil field value +func (o *TokenMetadata) GetValidUntil() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.ValidUntil +} + +// GetValidUntilOk returns a tuple with the ValidUntil field value +// and a boolean to check if the value has been set. +func (o *TokenMetadata) GetValidUntilOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ValidUntil, true +} + +// SetValidUntil sets field value +func (o *TokenMetadata) SetValidUntil(v time.Time) { + o.ValidUntil = v +} + +func (o TokenMetadata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TokenMetadata) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["id"] = o.Id + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["region"] = o.Region + toSerialize["state"] = o.State + toSerialize["validUntil"] = o.ValidUntil + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TokenMetadata) 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{ + "id", + "name", + "region", + "state", + "validUntil", + } + + 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) + } + } + + varTokenMetadata := _TokenMetadata{} + + err = json.Unmarshal(data, &varTokenMetadata) + + if err != nil { + return err + } + + *o = TokenMetadata(varTokenMetadata) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "region") + delete(additionalProperties, "state") + delete(additionalProperties, "validUntil") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTokenMetadata struct { + value *TokenMetadata + isSet bool +} + +func (v NullableTokenMetadata) Get() *TokenMetadata { + return v.value +} + +func (v *NullableTokenMetadata) Set(val *TokenMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableTokenMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableTokenMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTokenMetadata(val *TokenMetadata) *NullableTokenMetadata { + return &NullableTokenMetadata{value: val, isSet: true} +} + +func (v NullableTokenMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTokenMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/model_token_state.go b/services/modelexperiments/v1api/model_token_state.go new file mode 100644 index 000000000..ef5e7d15d --- /dev/null +++ b/services/modelexperiments/v1api/model_token_state.go @@ -0,0 +1,118 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// TokenState The lifecycle state of the token. +type TokenState string + +// List of TokenState +const ( + TOKENSTATE_CREATING TokenState = "creating" + TOKENSTATE_ACTIVE TokenState = "active" + TOKENSTATE_DELETING TokenState = "deleting" + TOKENSTATE_INACTIVE TokenState = "inactive" + TOKENSTATE_UNKNOWN_DEFAULT_OPEN_API TokenState = "unknown_default_open_api" +) + +// All allowed values of TokenState enum +var AllowedTokenStateEnumValues = []TokenState{ + "creating", + "active", + "deleting", + "inactive", + "unknown_default_open_api", +} + +func (v *TokenState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := TokenState(value) + for _, existing := range AllowedTokenStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = TOKENSTATE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewTokenStateFromValue returns a pointer to a valid TokenState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTokenStateFromValue(v string) (*TokenState, error) { + ev := TokenState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TokenState: valid values are %v", v, AllowedTokenStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TokenState) IsValid() bool { + for _, existing := range AllowedTokenStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TokenState value +func (v TokenState) Ptr() *TokenState { + return &v +} + +type NullableTokenState struct { + value *TokenState + isSet bool +} + +func (v NullableTokenState) Get() *TokenState { + return v.value +} + +func (v *NullableTokenState) Set(val *TokenState) { + v.value = val + v.isSet = true +} + +func (v NullableTokenState) IsSet() bool { + return v.isSet +} + +func (v *NullableTokenState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTokenState(val *TokenState) *NullableTokenState { + return &NullableTokenState{value: val, isSet: true} +} + +func (v NullableTokenState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTokenState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/modelexperiments/v1api/response.go b/services/modelexperiments/v1api/response.go new file mode 100644 index 000000000..1cea720f4 --- /dev/null +++ b/services/modelexperiments/v1api/response.go @@ -0,0 +1,48 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +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/modelexperiments/v1api/utils.go b/services/modelexperiments/v1api/utils.go new file mode 100644 index 000000000..041307e10 --- /dev/null +++ b/services/modelexperiments/v1api/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT AI Model Experiments API + +This API provides endpoints for the STACKIT AI Model Experiments api + +API version: 1.0.0 +Contact: stackit-model-experiments@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +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...) +}