diff --git a/go.work b/go.work index 86a8ffc3c..05db305b1 100644 --- a/go.work +++ b/go.work @@ -71,6 +71,7 @@ use ( ./services/postgresflex ./services/rabbitmq ./services/redis + ./services/registry ./services/resourcemanager ./services/runcommand ./services/scf diff --git a/services/registry/LICENSE.md b/services/registry/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/registry/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/registry/go.mod b/services/registry/go.mod new file mode 100644 index 000000000..9a36fa4f6 --- /dev/null +++ b/services/registry/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/registry + +go 1.25 + +require github.com/stackitcloud/stackit-sdk-go/core v0.27.0 + +require ( + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/registry/go.sum b/services/registry/go.sum new file mode 100644 index 000000000..042f4a71a --- /dev/null +++ b/services/registry/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.27.0 h1:7lc6qStcFDFf8zHP4ORPa9joybw+Sa2LtB6BVjKQ+ek= +github.com/stackitcloud/stackit-sdk-go/core v0.27.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/registry/oas_commit b/services/registry/oas_commit new file mode 100644 index 000000000..f97a377b0 --- /dev/null +++ b/services/registry/oas_commit @@ -0,0 +1 @@ +7408ea178847022c7d5f93abb83d4baac983d677 diff --git a/services/registry/package.go b/services/registry/package.go new file mode 100644 index 000000000..b2a276fb4 --- /dev/null +++ b/services/registry/package.go @@ -0,0 +1 @@ +package registry diff --git a/services/registry/v1api/api_default.go b/services/registry/v1api/api_default.go new file mode 100644 index 000000000..7773e4796 --- /dev/null +++ b/services/registry/v1api/api_default.go @@ -0,0 +1,1262 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@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 { + + /* + CreateArtifactory Creates an artifactory + + Creates an artifactory associated to the specified project. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @return ApiCreateArtifactoryRequest + */ + CreateArtifactory(ctx context.Context, projectId string, regionId string) ApiCreateArtifactoryRequest + + // CreateArtifactoryExecute executes the request + // @return Artifactory + CreateArtifactoryExecute(r ApiCreateArtifactoryRequest) (*Artifactory, error) + + /* + DeleteArtifactory Soft delete the artifactory. + + Deletes the artifactory associated to the specified project. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @param artifactoryId Artifactory identifier. + @return ApiDeleteArtifactoryRequest + */ + DeleteArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiDeleteArtifactoryRequest + + // DeleteArtifactoryExecute executes the request + DeleteArtifactoryExecute(r ApiDeleteArtifactoryRequest) error + + /* + GetArtifactory Get Artifactory information. + + Retrieves information about a STACKIT Artifactory. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @param artifactoryId Artifactory identifier. + @return ApiGetArtifactoryRequest + */ + GetArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiGetArtifactoryRequest + + // GetArtifactoryExecute executes the request + // @return Artifactory + GetArtifactoryExecute(r ApiGetArtifactoryRequest) (*Artifactory, error) + + /* + ListArtifactories List artifactories inside a STACKIT project + + Lists all artifactories associated to the specified project. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @return ApiListArtifactoriesRequest + */ + ListArtifactories(ctx context.Context, projectId string, regionId string) ApiListArtifactoriesRequest + + // ListArtifactoriesExecute executes the request + // @return ArtifactoryList + ListArtifactoriesExecute(r ApiListArtifactoriesRequest) (*ArtifactoryList, error) + + /* + ListReplicationAdapters Method for ListReplicationAdapters + + List available adapters for replication to/from other registries + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @return ApiListReplicationAdaptersRequest + */ + ListReplicationAdapters(ctx context.Context, projectId string, regionId string) ApiListReplicationAdaptersRequest + + // ListReplicationAdaptersExecute executes the request + // @return ReplicationAdapterList + ListReplicationAdaptersExecute(r ApiListReplicationAdaptersRequest) (*ReplicationAdapterList, error) + + /* + PatchArtifactory Method for PatchArtifactory + + Update Artifactory + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @param artifactoryId Artifactory identifier. + @return ApiPatchArtifactoryRequest + */ + PatchArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiPatchArtifactoryRequest + + // PatchArtifactoryExecute executes the request + // @return Artifactory + PatchArtifactoryExecute(r ApiPatchArtifactoryRequest) (*Artifactory, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateArtifactoryRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + createArtifactoryPayload *CreateArtifactoryPayload + claim *bool +} + +// CreateArtifactory request data +func (r ApiCreateArtifactoryRequest) CreateArtifactoryPayload(createArtifactoryPayload CreateArtifactoryPayload) ApiCreateArtifactoryRequest { + r.createArtifactoryPayload = &createArtifactoryPayload + return r +} + +// If true, claims ownership of an existing Harbor project instead of creating a new one. +func (r ApiCreateArtifactoryRequest) Claim(claim bool) ApiCreateArtifactoryRequest { + r.claim = &claim + return r +} + +func (r ApiCreateArtifactoryRequest) Execute() (*Artifactory, error) { + return r.ApiService.CreateArtifactoryExecute(r) +} + +/* +CreateArtifactory Creates an artifactory + +Creates an artifactory associated to the specified project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @return ApiCreateArtifactoryRequest +*/ +func (a *DefaultAPIService) CreateArtifactory(ctx context.Context, projectId string, regionId string) ApiCreateArtifactoryRequest { + return ApiCreateArtifactoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return Artifactory +func (a *DefaultAPIService) CreateArtifactoryExecute(r ApiCreateArtifactoryRequest) (*Artifactory, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Artifactory + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateArtifactory") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/artifactories" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + if r.createArtifactoryPayload == nil { + return localVarReturnValue, reportError("createArtifactoryPayload is required and must be specified") + } + + if r.claim != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "claim", r.claim, "form", "") + } else { + var defaultValue bool = false + parameterAddToHeaderOrQuery(localVarQueryParams, "claim", defaultValue, "form", "") + r.claim = &defaultValue + } + // 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.createArtifactoryPayload + 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 BadRequestErrorResponse + 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 UnauthorizedErrorResponse + 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 ForbiddenErrorResponse + 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 NotFoundErrorResponse + 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 ConflictErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v InternalServerErrorResponse + 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 ApiDeleteArtifactoryRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + artifactoryId string +} + +func (r ApiDeleteArtifactoryRequest) Execute() error { + return r.ApiService.DeleteArtifactoryExecute(r) +} + +/* +DeleteArtifactory Soft delete the artifactory. + +Deletes the artifactory associated to the specified project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @param artifactoryId Artifactory identifier. + @return ApiDeleteArtifactoryRequest +*/ +func (a *DefaultAPIService) DeleteArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiDeleteArtifactoryRequest { + return ApiDeleteArtifactoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + artifactoryId: artifactoryId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteArtifactoryExecute(r ApiDeleteArtifactoryRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteArtifactory") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/artifactories/{artifactoryId}" + 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, "{"+"artifactoryId"+"}", url.PathEscape(parameterValueToString(r.artifactoryId, "artifactoryId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return reportError("projectId must have less than 36 elements") + } + if strlen(r.artifactoryId) < 36 { + return reportError("artifactoryId must have at least 36 elements") + } + if strlen(r.artifactoryId) > 36 { + return reportError("artifactoryId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ForbiddenErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiGetArtifactoryRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + artifactoryId string +} + +func (r ApiGetArtifactoryRequest) Execute() (*Artifactory, error) { + return r.ApiService.GetArtifactoryExecute(r) +} + +/* +GetArtifactory Get Artifactory information. + +Retrieves information about a STACKIT Artifactory. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @param artifactoryId Artifactory identifier. + @return ApiGetArtifactoryRequest +*/ +func (a *DefaultAPIService) GetArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiGetArtifactoryRequest { + return ApiGetArtifactoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + artifactoryId: artifactoryId, + } +} + +// Execute executes the request +// +// @return Artifactory +func (a *DefaultAPIService) GetArtifactoryExecute(r ApiGetArtifactoryRequest) (*Artifactory, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Artifactory + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetArtifactory") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/artifactories/{artifactoryId}" + 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, "{"+"artifactoryId"+"}", url.PathEscape(parameterValueToString(r.artifactoryId, "artifactoryId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + if strlen(r.artifactoryId) < 36 { + return localVarReturnValue, reportError("artifactoryId must have at least 36 elements") + } + if strlen(r.artifactoryId) > 36 { + return localVarReturnValue, reportError("artifactoryId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + 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 UnauthorizedErrorResponse + 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 ForbiddenErrorResponse + 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 GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + 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 ApiListArtifactoriesRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + pageSize *int32 + nextPageToken *string +} + +// The maximum number of artifactories to return. The service may return fewer than this value. +func (r ApiListArtifactoriesRequest) PageSize(pageSize int32) ApiListArtifactoriesRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListArtifactories` call. Provide this to retrieve the subsequent page. +func (r ApiListArtifactoriesRequest) NextPageToken(nextPageToken string) ApiListArtifactoriesRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiListArtifactoriesRequest) Execute() (*ArtifactoryList, error) { + return r.ApiService.ListArtifactoriesExecute(r) +} + +/* +ListArtifactories List artifactories inside a STACKIT project + +Lists all artifactories associated to the specified project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @return ApiListArtifactoriesRequest +*/ +func (a *DefaultAPIService) ListArtifactories(ctx context.Context, projectId string, regionId string) ApiListArtifactoriesRequest { + return ApiListArtifactoriesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return ArtifactoryList +func (a *DefaultAPIService) ListArtifactoriesExecute(r ApiListArtifactoriesRequest) (*ArtifactoryList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ArtifactoryList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListArtifactories") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/artifactories" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "form", "") + } else { + var defaultValue int32 = 50 + parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", defaultValue, "form", "") + r.pageSize = &defaultValue + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "next_page_token", r.nextPageToken, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequestErrorResponse + 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 UnauthorizedErrorResponse + 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 ForbiddenErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v InternalServerErrorResponse + 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 ApiListReplicationAdaptersRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string +} + +func (r ApiListReplicationAdaptersRequest) Execute() (*ReplicationAdapterList, error) { + return r.ApiService.ListReplicationAdaptersExecute(r) +} + +/* +ListReplicationAdapters Method for ListReplicationAdapters + +List available adapters for replication to/from other registries + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @return ApiListReplicationAdaptersRequest +*/ +func (a *DefaultAPIService) ListReplicationAdapters(ctx context.Context, projectId string, regionId string) ApiListReplicationAdaptersRequest { + return ApiListReplicationAdaptersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return ReplicationAdapterList +func (a *DefaultAPIService) ListReplicationAdaptersExecute(r ApiListReplicationAdaptersRequest) (*ReplicationAdapterList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ReplicationAdapterList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListReplicationAdapters") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/replication/adapters" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequestErrorResponse + 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 UnauthorizedErrorResponse + 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 ApiPatchArtifactoryRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + artifactoryId string + patchArtifactoryPayload *PatchArtifactoryPayload +} + +// Patch artifactory request +func (r ApiPatchArtifactoryRequest) PatchArtifactoryPayload(patchArtifactoryPayload PatchArtifactoryPayload) ApiPatchArtifactoryRequest { + r.patchArtifactoryPayload = &patchArtifactoryPayload + return r +} + +func (r ApiPatchArtifactoryRequest) Execute() (*Artifactory, error) { + return r.ApiService.PatchArtifactoryExecute(r) +} + +/* +PatchArtifactory Method for PatchArtifactory + +Update Artifactory + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param regionId STACKIT region identification + @param artifactoryId Artifactory identifier. + @return ApiPatchArtifactoryRequest +*/ +func (a *DefaultAPIService) PatchArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiPatchArtifactoryRequest { + return ApiPatchArtifactoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + artifactoryId: artifactoryId, + } +} + +// Execute executes the request +// +// @return Artifactory +func (a *DefaultAPIService) PatchArtifactoryExecute(r ApiPatchArtifactoryRequest) (*Artifactory, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Artifactory + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.PatchArtifactory") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/artifactories/{artifactoryId}" + 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, "{"+"artifactoryId"+"}", url.PathEscape(parameterValueToString(r.artifactoryId, "artifactoryId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + if strlen(r.artifactoryId) < 36 { + return localVarReturnValue, reportError("artifactoryId must have at least 36 elements") + } + if strlen(r.artifactoryId) > 36 { + return localVarReturnValue, reportError("artifactoryId must have less than 36 elements") + } + if r.patchArtifactoryPayload == nil { + return localVarReturnValue, reportError("patchArtifactoryPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.patchArtifactoryPayload + 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 GenericErrorResponse + 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 UnauthorizedErrorResponse + 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 ForbiddenErrorResponse + 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 GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + 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/registry/v1api/api_default_mock.go b/services/registry/v1api/api_default_mock.go new file mode 100644 index 000000000..8c5f7c586 --- /dev/null +++ b/services/registry/v1api/api_default_mock.go @@ -0,0 +1,152 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@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 { + // CreateArtifactoryExecuteMock can be populated to implement the behavior of the CreateArtifactoryExecute function of this mock + CreateArtifactoryExecuteMock *func(r ApiCreateArtifactoryRequest) (*Artifactory, error) + // DeleteArtifactoryExecuteMock can be populated to implement the behavior of the DeleteArtifactoryExecute function of this mock + DeleteArtifactoryExecuteMock *func(r ApiDeleteArtifactoryRequest) error + // GetArtifactoryExecuteMock can be populated to implement the behavior of the GetArtifactoryExecute function of this mock + GetArtifactoryExecuteMock *func(r ApiGetArtifactoryRequest) (*Artifactory, error) + // ListArtifactoriesExecuteMock can be populated to implement the behavior of the ListArtifactoriesExecute function of this mock + ListArtifactoriesExecuteMock *func(r ApiListArtifactoriesRequest) (*ArtifactoryList, error) + // ListReplicationAdaptersExecuteMock can be populated to implement the behavior of the ListReplicationAdaptersExecute function of this mock + ListReplicationAdaptersExecuteMock *func(r ApiListReplicationAdaptersRequest) (*ReplicationAdapterList, error) + // PatchArtifactoryExecuteMock can be populated to implement the behavior of the PatchArtifactoryExecute function of this mock + PatchArtifactoryExecuteMock *func(r ApiPatchArtifactoryRequest) (*Artifactory, error) +} + +func (a DefaultAPIServiceMock) CreateArtifactory(ctx context.Context, projectId string, regionId string) ApiCreateArtifactoryRequest { + return ApiCreateArtifactoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// CreateArtifactoryExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateArtifactoryExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateArtifactoryExecute(r ApiCreateArtifactoryRequest) (*Artifactory, error) { + if a.CreateArtifactoryExecuteMock == nil { + var localVarReturnValue *Artifactory + return localVarReturnValue, nil + } + + return (*a.CreateArtifactoryExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiDeleteArtifactoryRequest { + return ApiDeleteArtifactoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + artifactoryId: artifactoryId, + } +} + +// DeleteArtifactoryExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteArtifactoryExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteArtifactoryExecute(r ApiDeleteArtifactoryRequest) error { + if a.DeleteArtifactoryExecuteMock == nil { + return nil + } + + return (*a.DeleteArtifactoryExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiGetArtifactoryRequest { + return ApiGetArtifactoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + artifactoryId: artifactoryId, + } +} + +// GetArtifactoryExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetArtifactoryExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetArtifactoryExecute(r ApiGetArtifactoryRequest) (*Artifactory, error) { + if a.GetArtifactoryExecuteMock == nil { + var localVarReturnValue *Artifactory + return localVarReturnValue, nil + } + + return (*a.GetArtifactoryExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListArtifactories(ctx context.Context, projectId string, regionId string) ApiListArtifactoriesRequest { + return ApiListArtifactoriesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// ListArtifactoriesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListArtifactoriesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListArtifactoriesExecute(r ApiListArtifactoriesRequest) (*ArtifactoryList, error) { + if a.ListArtifactoriesExecuteMock == nil { + var localVarReturnValue *ArtifactoryList + return localVarReturnValue, nil + } + + return (*a.ListArtifactoriesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListReplicationAdapters(ctx context.Context, projectId string, regionId string) ApiListReplicationAdaptersRequest { + return ApiListReplicationAdaptersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// ListReplicationAdaptersExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListReplicationAdaptersExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListReplicationAdaptersExecute(r ApiListReplicationAdaptersRequest) (*ReplicationAdapterList, error) { + if a.ListReplicationAdaptersExecuteMock == nil { + var localVarReturnValue *ReplicationAdapterList + return localVarReturnValue, nil + } + + return (*a.ListReplicationAdaptersExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) PatchArtifactory(ctx context.Context, projectId string, regionId string, artifactoryId string) ApiPatchArtifactoryRequest { + return ApiPatchArtifactoryRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + artifactoryId: artifactoryId, + } +} + +// PatchArtifactoryExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the PatchArtifactoryExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) PatchArtifactoryExecute(r ApiPatchArtifactoryRequest) (*Artifactory, error) { + if a.PatchArtifactoryExecuteMock == nil { + var localVarReturnValue *Artifactory + return localVarReturnValue, nil + } + + return (*a.PatchArtifactoryExecuteMock)(r) +} diff --git a/services/registry/v1api/client.go b/services/registry/v1api/client.go new file mode 100644 index 000000000..55160cb2d --- /dev/null +++ b/services/registry/v1api/client.go @@ -0,0 +1,668 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@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 Container Registry 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 r, ok := v.(*io.Reader); ok { + *r = bytes.NewReader(b) + return nil + } + // Must stay before the JSON branch: json.Unmarshal would base64-decode into *[]byte. + if p, ok := v.(*[]byte); ok { + *p = 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/registry/v1api/configuration.go b/services/registry/v1api/configuration.go new file mode 100644 index 000000000..265107bb1 --- /dev/null +++ b/services/registry/v1api/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@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/registry", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://registry.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/registry/v1api/model_artifactory.go b/services/registry/v1api/model_artifactory.go new file mode 100644 index 000000000..7c7e0415f --- /dev/null +++ b/services/registry/v1api/model_artifactory.go @@ -0,0 +1,386 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Artifactory type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Artifactory{} + +// Artifactory Artifactory Information. +type Artifactory struct { + // How many bytes of quota is consumed. Read Only. + ConsumedQuotaBytes int64 `json:"consumed_quota_bytes"` + // The date and time the creation of the STACKIT Artifactory was triggered. + CreateTime time.Time `json:"create_time"` + // A auto generated unique id which identifies the STACKIT Artifactory. + Id string `json:"id"` + // A user chosen name to distinguish multiple STACKIT Artifactories. + Name string `json:"name"` + Proxy *Proxy `json:"proxy,omitempty"` + // The current state of the STACKIT Artifactory. + State string `json:"state"` + // The base URL of the STACKIT Artifactory. + Url string `json:"url"` + // How many users does this artifactory have. Read Only. + UserCount int64 `json:"user_count"` + AdditionalProperties map[string]interface{} +} + +type _Artifactory Artifactory + +// NewArtifactory instantiates a new Artifactory 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 NewArtifactory(consumedQuotaBytes int64, createTime time.Time, id string, name string, state string, url string, userCount int64) *Artifactory { + this := Artifactory{} + this.ConsumedQuotaBytes = consumedQuotaBytes + this.CreateTime = createTime + this.Id = id + this.Name = name + this.State = state + this.Url = url + this.UserCount = userCount + return &this +} + +// NewArtifactoryWithDefaults instantiates a new Artifactory 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 NewArtifactoryWithDefaults() *Artifactory { + this := Artifactory{} + return &this +} + +// GetConsumedQuotaBytes returns the ConsumedQuotaBytes field value +func (o *Artifactory) GetConsumedQuotaBytes() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.ConsumedQuotaBytes +} + +// GetConsumedQuotaBytesOk returns a tuple with the ConsumedQuotaBytes field value +// and a boolean to check if the value has been set. +func (o *Artifactory) GetConsumedQuotaBytesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.ConsumedQuotaBytes, true +} + +// SetConsumedQuotaBytes sets field value +func (o *Artifactory) SetConsumedQuotaBytes(v int64) { + o.ConsumedQuotaBytes = v +} + +// GetCreateTime returns the CreateTime field value +func (o *Artifactory) GetCreateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *Artifactory) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *Artifactory) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetId returns the Id field value +func (o *Artifactory) 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 *Artifactory) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Artifactory) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *Artifactory) 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 *Artifactory) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Artifactory) SetName(v string) { + o.Name = v +} + +// GetProxy returns the Proxy field value if set, zero value otherwise. +func (o *Artifactory) GetProxy() Proxy { + if o == nil || IsNil(o.Proxy) { + var ret Proxy + return ret + } + return *o.Proxy +} + +// GetProxyOk returns a tuple with the Proxy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Artifactory) GetProxyOk() (*Proxy, bool) { + if o == nil || IsNil(o.Proxy) { + return nil, false + } + return o.Proxy, true +} + +// HasProxy returns a boolean if a field has been set. +func (o *Artifactory) HasProxy() bool { + if o != nil && !IsNil(o.Proxy) { + return true + } + + return false +} + +// SetProxy gets a reference to the given Proxy and assigns it to the Proxy field. +func (o *Artifactory) SetProxy(v Proxy) { + o.Proxy = &v +} + +// GetState returns the State field value +func (o *Artifactory) 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 *Artifactory) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *Artifactory) SetState(v string) { + o.State = v +} + +// GetUrl returns the Url field value +func (o *Artifactory) 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 *Artifactory) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *Artifactory) SetUrl(v string) { + o.Url = v +} + +// GetUserCount returns the UserCount field value +func (o *Artifactory) GetUserCount() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.UserCount +} + +// GetUserCountOk returns a tuple with the UserCount field value +// and a boolean to check if the value has been set. +func (o *Artifactory) GetUserCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.UserCount, true +} + +// SetUserCount sets field value +func (o *Artifactory) SetUserCount(v int64) { + o.UserCount = v +} + +func (o Artifactory) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Artifactory) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["consumed_quota_bytes"] = o.ConsumedQuotaBytes + toSerialize["create_time"] = o.CreateTime + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + if !IsNil(o.Proxy) { + toSerialize["proxy"] = o.Proxy + } + toSerialize["state"] = o.State + toSerialize["url"] = o.Url + toSerialize["user_count"] = o.UserCount + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Artifactory) 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{ + "consumed_quota_bytes", + "create_time", + "id", + "name", + "state", + "url", + "user_count", + } + + 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) + } + } + + varArtifactory := _Artifactory{} + + err = json.Unmarshal(data, &varArtifactory) + + if err != nil { + return err + } + + *o = Artifactory(varArtifactory) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "consumed_quota_bytes") + delete(additionalProperties, "create_time") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "proxy") + delete(additionalProperties, "state") + delete(additionalProperties, "url") + delete(additionalProperties, "user_count") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableArtifactory struct { + value *Artifactory + isSet bool +} + +func (v NullableArtifactory) Get() *Artifactory { + return v.value +} + +func (v *NullableArtifactory) Set(val *Artifactory) { + v.value = val + v.isSet = true +} + +func (v NullableArtifactory) IsSet() bool { + return v.isSet +} + +func (v *NullableArtifactory) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArtifactory(val *Artifactory) *NullableArtifactory { + return &NullableArtifactory{value: val, isSet: true} +} + +func (v NullableArtifactory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArtifactory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_artifactory_list.go b/services/registry/v1api/model_artifactory_list.go new file mode 100644 index 000000000..db7a7c64b --- /dev/null +++ b/services/registry/v1api/model_artifactory_list.go @@ -0,0 +1,205 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ArtifactoryList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ArtifactoryList{} + +// ArtifactoryList A list of artifactories inside a STACKIT project. +type ArtifactoryList struct { + Artifactories []Artifactory `json:"artifactories"` + // A token to retrieve the next page of results. Pass this value as `page_token` in the subsequent request. If empty, there are no more pages. + NextPageToken *string `json:"next_page_token,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ArtifactoryList ArtifactoryList + +// NewArtifactoryList instantiates a new ArtifactoryList 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 NewArtifactoryList(artifactories []Artifactory) *ArtifactoryList { + this := ArtifactoryList{} + this.Artifactories = artifactories + return &this +} + +// NewArtifactoryListWithDefaults instantiates a new ArtifactoryList 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 NewArtifactoryListWithDefaults() *ArtifactoryList { + this := ArtifactoryList{} + return &this +} + +// GetArtifactories returns the Artifactories field value +func (o *ArtifactoryList) GetArtifactories() []Artifactory { + if o == nil { + var ret []Artifactory + return ret + } + + return o.Artifactories +} + +// GetArtifactoriesOk returns a tuple with the Artifactories field value +// and a boolean to check if the value has been set. +func (o *ArtifactoryList) GetArtifactoriesOk() ([]Artifactory, bool) { + if o == nil { + return nil, false + } + return o.Artifactories, true +} + +// SetArtifactories sets field value +func (o *ArtifactoryList) SetArtifactories(v []Artifactory) { + o.Artifactories = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ArtifactoryList) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArtifactoryList) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ArtifactoryList) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ArtifactoryList) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ArtifactoryList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ArtifactoryList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["artifactories"] = o.Artifactories + if !IsNil(o.NextPageToken) { + toSerialize["next_page_token"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ArtifactoryList) 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{ + "artifactories", + } + + 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) + } + } + + varArtifactoryList := _ArtifactoryList{} + + err = json.Unmarshal(data, &varArtifactoryList) + + if err != nil { + return err + } + + *o = ArtifactoryList(varArtifactoryList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "artifactories") + delete(additionalProperties, "next_page_token") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableArtifactoryList struct { + value *ArtifactoryList + isSet bool +} + +func (v NullableArtifactoryList) Get() *ArtifactoryList { + return v.value +} + +func (v *NullableArtifactoryList) Set(val *ArtifactoryList) { + v.value = val + v.isSet = true +} + +func (v NullableArtifactoryList) IsSet() bool { + return v.isSet +} + +func (v *NullableArtifactoryList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArtifactoryList(val *ArtifactoryList) *NullableArtifactoryList { + return &NullableArtifactoryList{value: val, isSet: true} +} + +func (v NullableArtifactoryList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArtifactoryList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_bad_request_error_response.go b/services/registry/v1api/model_bad_request_error_response.go new file mode 100644 index 000000000..404714b96 --- /dev/null +++ b/services/registry/v1api/model_bad_request_error_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the BadRequestErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BadRequestErrorResponse{} + +// BadRequestErrorResponse 400 Error Response. +type BadRequestErrorResponse struct { + Error *string `json:"error,omitempty"` + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _BadRequestErrorResponse BadRequestErrorResponse + +// NewBadRequestErrorResponse instantiates a new BadRequestErrorResponse 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 NewBadRequestErrorResponse(message string) *BadRequestErrorResponse { + this := BadRequestErrorResponse{} + this.Message = message + return &this +} + +// NewBadRequestErrorResponseWithDefaults instantiates a new BadRequestErrorResponse 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 NewBadRequestErrorResponseWithDefaults() *BadRequestErrorResponse { + this := BadRequestErrorResponse{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *BadRequestErrorResponse) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BadRequestErrorResponse) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *BadRequestErrorResponse) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *BadRequestErrorResponse) SetError(v string) { + o.Error = &v +} + +// GetMessage returns the Message field value +func (o *BadRequestErrorResponse) 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 *BadRequestErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *BadRequestErrorResponse) SetMessage(v string) { + o.Message = v +} + +func (o BadRequestErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BadRequestErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BadRequestErrorResponse) 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{ + "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) + } + } + + varBadRequestErrorResponse := _BadRequestErrorResponse{} + + err = json.Unmarshal(data, &varBadRequestErrorResponse) + + if err != nil { + return err + } + + *o = BadRequestErrorResponse(varBadRequestErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBadRequestErrorResponse struct { + value *BadRequestErrorResponse + isSet bool +} + +func (v NullableBadRequestErrorResponse) Get() *BadRequestErrorResponse { + return v.value +} + +func (v *NullableBadRequestErrorResponse) Set(val *BadRequestErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBadRequestErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBadRequestErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBadRequestErrorResponse(val *BadRequestErrorResponse) *NullableBadRequestErrorResponse { + return &NullableBadRequestErrorResponse{value: val, isSet: true} +} + +func (v NullableBadRequestErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBadRequestErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_conflict_error_response.go b/services/registry/v1api/model_conflict_error_response.go new file mode 100644 index 000000000..74a7ec4c3 --- /dev/null +++ b/services/registry/v1api/model_conflict_error_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ConflictErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConflictErrorResponse{} + +// ConflictErrorResponse 409 Error Response. +type ConflictErrorResponse struct { + Error *string `json:"error,omitempty"` + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _ConflictErrorResponse ConflictErrorResponse + +// NewConflictErrorResponse instantiates a new ConflictErrorResponse 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 NewConflictErrorResponse(message string) *ConflictErrorResponse { + this := ConflictErrorResponse{} + this.Message = message + return &this +} + +// NewConflictErrorResponseWithDefaults instantiates a new ConflictErrorResponse 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 NewConflictErrorResponseWithDefaults() *ConflictErrorResponse { + this := ConflictErrorResponse{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *ConflictErrorResponse) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConflictErrorResponse) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *ConflictErrorResponse) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *ConflictErrorResponse) SetError(v string) { + o.Error = &v +} + +// GetMessage returns the Message field value +func (o *ConflictErrorResponse) 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 *ConflictErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ConflictErrorResponse) SetMessage(v string) { + o.Message = v +} + +func (o ConflictErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConflictErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ConflictErrorResponse) 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{ + "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) + } + } + + varConflictErrorResponse := _ConflictErrorResponse{} + + err = json.Unmarshal(data, &varConflictErrorResponse) + + if err != nil { + return err + } + + *o = ConflictErrorResponse(varConflictErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableConflictErrorResponse struct { + value *ConflictErrorResponse + isSet bool +} + +func (v NullableConflictErrorResponse) Get() *ConflictErrorResponse { + return v.value +} + +func (v *NullableConflictErrorResponse) Set(val *ConflictErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableConflictErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableConflictErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConflictErrorResponse(val *ConflictErrorResponse) *NullableConflictErrorResponse { + return &NullableConflictErrorResponse{value: val, isSet: true} +} + +func (v NullableConflictErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConflictErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_create_artifactory_payload.go b/services/registry/v1api/model_create_artifactory_payload.go new file mode 100644 index 000000000..c34f997e4 --- /dev/null +++ b/services/registry/v1api/model_create_artifactory_payload.go @@ -0,0 +1,206 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateArtifactoryPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateArtifactoryPayload{} + +// CreateArtifactoryPayload CreateArtifactory request data. +type CreateArtifactoryPayload struct { + // A user chosen name to distinguish multiple STACKIT Artifactories. + Name string `json:"name" validate:"regexp=^[a-z0-9]+(?:[._-][a-z0-9]+)*$"` + // If proxy configuration is provided, this project will be created as a proxy-cache for the upstream registry. + Proxy *CreateProxyRequest `json:"proxy,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateArtifactoryPayload CreateArtifactoryPayload + +// NewCreateArtifactoryPayload instantiates a new CreateArtifactoryPayload 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 NewCreateArtifactoryPayload(name string) *CreateArtifactoryPayload { + this := CreateArtifactoryPayload{} + this.Name = name + return &this +} + +// NewCreateArtifactoryPayloadWithDefaults instantiates a new CreateArtifactoryPayload 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 NewCreateArtifactoryPayloadWithDefaults() *CreateArtifactoryPayload { + this := CreateArtifactoryPayload{} + return &this +} + +// GetName returns the Name field value +func (o *CreateArtifactoryPayload) 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 *CreateArtifactoryPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateArtifactoryPayload) SetName(v string) { + o.Name = v +} + +// GetProxy returns the Proxy field value if set, zero value otherwise. +func (o *CreateArtifactoryPayload) GetProxy() CreateProxyRequest { + if o == nil || IsNil(o.Proxy) { + var ret CreateProxyRequest + return ret + } + return *o.Proxy +} + +// GetProxyOk returns a tuple with the Proxy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateArtifactoryPayload) GetProxyOk() (*CreateProxyRequest, bool) { + if o == nil || IsNil(o.Proxy) { + return nil, false + } + return o.Proxy, true +} + +// HasProxy returns a boolean if a field has been set. +func (o *CreateArtifactoryPayload) HasProxy() bool { + if o != nil && !IsNil(o.Proxy) { + return true + } + + return false +} + +// SetProxy gets a reference to the given CreateProxyRequest and assigns it to the Proxy field. +func (o *CreateArtifactoryPayload) SetProxy(v CreateProxyRequest) { + o.Proxy = &v +} + +func (o CreateArtifactoryPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateArtifactoryPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Proxy) { + toSerialize["proxy"] = o.Proxy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateArtifactoryPayload) 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) + } + } + + varCreateArtifactoryPayload := _CreateArtifactoryPayload{} + + err = json.Unmarshal(data, &varCreateArtifactoryPayload) + + if err != nil { + return err + } + + *o = CreateArtifactoryPayload(varCreateArtifactoryPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "proxy") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateArtifactoryPayload struct { + value *CreateArtifactoryPayload + isSet bool +} + +func (v NullableCreateArtifactoryPayload) Get() *CreateArtifactoryPayload { + return v.value +} + +func (v *NullableCreateArtifactoryPayload) Set(val *CreateArtifactoryPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateArtifactoryPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateArtifactoryPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateArtifactoryPayload(val *CreateArtifactoryPayload) *NullableCreateArtifactoryPayload { + return &NullableCreateArtifactoryPayload{value: val, isSet: true} +} + +func (v NullableCreateArtifactoryPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateArtifactoryPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_create_proxy_request.go b/services/registry/v1api/model_create_proxy_request.go new file mode 100644 index 000000000..09b23ee65 --- /dev/null +++ b/services/registry/v1api/model_create_proxy_request.go @@ -0,0 +1,273 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateProxyRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateProxyRequest{} + +// CreateProxyRequest Provide an upstream repository this project is a proxy for +type CreateProxyRequest struct { + Credentials *Credentials `json:"credentials,omitempty"` + // Description of the registry. + Description *string `json:"description,omitempty"` + // Which replication adapter to use for this registry. Discover the list of supported replication adapters, and therefore supported registry types, by calling GET /v1/projects/{projectId}/regions/{regionId}/replication/adapters + RegistryType string `json:"registry_type"` + // Upstream registry url to proxy + Url string `json:"url"` + AdditionalProperties map[string]interface{} +} + +type _CreateProxyRequest CreateProxyRequest + +// NewCreateProxyRequest instantiates a new CreateProxyRequest 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 NewCreateProxyRequest(registryType string, url string) *CreateProxyRequest { + this := CreateProxyRequest{} + this.RegistryType = registryType + this.Url = url + return &this +} + +// NewCreateProxyRequestWithDefaults instantiates a new CreateProxyRequest 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 NewCreateProxyRequestWithDefaults() *CreateProxyRequest { + this := CreateProxyRequest{} + return &this +} + +// GetCredentials returns the Credentials field value if set, zero value otherwise. +func (o *CreateProxyRequest) GetCredentials() Credentials { + if o == nil || IsNil(o.Credentials) { + var ret Credentials + return ret + } + return *o.Credentials +} + +// GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateProxyRequest) GetCredentialsOk() (*Credentials, bool) { + if o == nil || IsNil(o.Credentials) { + return nil, false + } + return o.Credentials, true +} + +// HasCredentials returns a boolean if a field has been set. +func (o *CreateProxyRequest) HasCredentials() bool { + if o != nil && !IsNil(o.Credentials) { + return true + } + + return false +} + +// SetCredentials gets a reference to the given Credentials and assigns it to the Credentials field. +func (o *CreateProxyRequest) SetCredentials(v Credentials) { + o.Credentials = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateProxyRequest) 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 *CreateProxyRequest) 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 *CreateProxyRequest) 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 *CreateProxyRequest) SetDescription(v string) { + o.Description = &v +} + +// GetRegistryType returns the RegistryType field value +func (o *CreateProxyRequest) GetRegistryType() string { + if o == nil { + var ret string + return ret + } + + return o.RegistryType +} + +// GetRegistryTypeOk returns a tuple with the RegistryType field value +// and a boolean to check if the value has been set. +func (o *CreateProxyRequest) GetRegistryTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegistryType, true +} + +// SetRegistryType sets field value +func (o *CreateProxyRequest) SetRegistryType(v string) { + o.RegistryType = v +} + +// GetUrl returns the Url field value +func (o *CreateProxyRequest) 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 *CreateProxyRequest) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *CreateProxyRequest) SetUrl(v string) { + o.Url = v +} + +func (o CreateProxyRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateProxyRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Credentials) { + toSerialize["credentials"] = o.Credentials + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["registry_type"] = o.RegistryType + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateProxyRequest) 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{ + "registry_type", + "url", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateProxyRequest := _CreateProxyRequest{} + + err = json.Unmarshal(data, &varCreateProxyRequest) + + if err != nil { + return err + } + + *o = CreateProxyRequest(varCreateProxyRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "credentials") + delete(additionalProperties, "description") + delete(additionalProperties, "registry_type") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateProxyRequest struct { + value *CreateProxyRequest + isSet bool +} + +func (v NullableCreateProxyRequest) Get() *CreateProxyRequest { + return v.value +} + +func (v *NullableCreateProxyRequest) Set(val *CreateProxyRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateProxyRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateProxyRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateProxyRequest(val *CreateProxyRequest) *NullableCreateProxyRequest { + return &NullableCreateProxyRequest{value: val, isSet: true} +} + +func (v NullableCreateProxyRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateProxyRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_credentials.go b/services/registry/v1api/model_credentials.go new file mode 100644 index 000000000..c10b5a357 --- /dev/null +++ b/services/registry/v1api/model_credentials.go @@ -0,0 +1,191 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the Credentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Credentials{} + +// Credentials Credentials for upstream registry +type Credentials struct { + AccessKey *string `json:"access_key,omitempty"` + AccessSecret *string `json:"access_secret,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Credentials Credentials + +// NewCredentials instantiates a new Credentials 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 NewCredentials() *Credentials { + this := Credentials{} + return &this +} + +// NewCredentialsWithDefaults instantiates a new Credentials 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 NewCredentialsWithDefaults() *Credentials { + this := Credentials{} + return &this +} + +// GetAccessKey returns the AccessKey field value if set, zero value otherwise. +func (o *Credentials) GetAccessKey() string { + if o == nil || IsNil(o.AccessKey) { + var ret string + return ret + } + return *o.AccessKey +} + +// GetAccessKeyOk returns a tuple with the AccessKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credentials) GetAccessKeyOk() (*string, bool) { + if o == nil || IsNil(o.AccessKey) { + return nil, false + } + return o.AccessKey, true +} + +// HasAccessKey returns a boolean if a field has been set. +func (o *Credentials) HasAccessKey() bool { + if o != nil && !IsNil(o.AccessKey) { + return true + } + + return false +} + +// SetAccessKey gets a reference to the given string and assigns it to the AccessKey field. +func (o *Credentials) SetAccessKey(v string) { + o.AccessKey = &v +} + +// GetAccessSecret returns the AccessSecret field value if set, zero value otherwise. +func (o *Credentials) GetAccessSecret() string { + if o == nil || IsNil(o.AccessSecret) { + var ret string + return ret + } + return *o.AccessSecret +} + +// GetAccessSecretOk returns a tuple with the AccessSecret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Credentials) GetAccessSecretOk() (*string, bool) { + if o == nil || IsNil(o.AccessSecret) { + return nil, false + } + return o.AccessSecret, true +} + +// HasAccessSecret returns a boolean if a field has been set. +func (o *Credentials) HasAccessSecret() bool { + if o != nil && !IsNil(o.AccessSecret) { + return true + } + + return false +} + +// SetAccessSecret gets a reference to the given string and assigns it to the AccessSecret field. +func (o *Credentials) SetAccessSecret(v string) { + o.AccessSecret = &v +} + +func (o Credentials) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Credentials) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessKey) { + toSerialize["access_key"] = o.AccessKey + } + if !IsNil(o.AccessSecret) { + toSerialize["access_secret"] = o.AccessSecret + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Credentials) UnmarshalJSON(data []byte) (err error) { + varCredentials := _Credentials{} + + err = json.Unmarshal(data, &varCredentials) + + if err != nil { + return err + } + + *o = Credentials(varCredentials) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "access_key") + delete(additionalProperties, "access_secret") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCredentials struct { + value *Credentials + isSet bool +} + +func (v NullableCredentials) Get() *Credentials { + return v.value +} + +func (v *NullableCredentials) Set(val *Credentials) { + v.value = val + v.isSet = true +} + +func (v NullableCredentials) IsSet() bool { + return v.isSet +} + +func (v *NullableCredentials) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCredentials(val *Credentials) *NullableCredentials { + return &NullableCredentials{value: val, isSet: true} +} + +func (v NullableCredentials) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCredentials) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_forbidden_error_response.go b/services/registry/v1api/model_forbidden_error_response.go new file mode 100644 index 000000000..8c821be7b --- /dev/null +++ b/services/registry/v1api/model_forbidden_error_response.go @@ -0,0 +1,316 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the ForbiddenErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ForbiddenErrorResponse{} + +// ForbiddenErrorResponse Forbidden Error Response. +type ForbiddenErrorResponse struct { + Error *string `json:"error,omitempty"` + Message string `json:"message"` + Path *string `json:"path,omitempty"` + Status *int64 `json:"status,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ForbiddenErrorResponse ForbiddenErrorResponse + +// NewForbiddenErrorResponse instantiates a new ForbiddenErrorResponse 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 NewForbiddenErrorResponse(message string) *ForbiddenErrorResponse { + this := ForbiddenErrorResponse{} + this.Message = message + return &this +} + +// NewForbiddenErrorResponseWithDefaults instantiates a new ForbiddenErrorResponse 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 NewForbiddenErrorResponseWithDefaults() *ForbiddenErrorResponse { + this := ForbiddenErrorResponse{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *ForbiddenErrorResponse) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ForbiddenErrorResponse) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *ForbiddenErrorResponse) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *ForbiddenErrorResponse) SetError(v string) { + o.Error = &v +} + +// GetMessage returns the Message field value +func (o *ForbiddenErrorResponse) 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 *ForbiddenErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ForbiddenErrorResponse) SetMessage(v string) { + o.Message = v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *ForbiddenErrorResponse) GetPath() string { + if o == nil || IsNil(o.Path) { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ForbiddenErrorResponse) GetPathOk() (*string, bool) { + if o == nil || IsNil(o.Path) { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *ForbiddenErrorResponse) HasPath() bool { + if o != nil && !IsNil(o.Path) { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *ForbiddenErrorResponse) SetPath(v string) { + o.Path = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *ForbiddenErrorResponse) GetStatus() int64 { + if o == nil || IsNil(o.Status) { + var ret int64 + 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 *ForbiddenErrorResponse) GetStatusOk() (*int64, 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 *ForbiddenErrorResponse) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given int64 and assigns it to the Status field. +func (o *ForbiddenErrorResponse) SetStatus(v int64) { + o.Status = &v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *ForbiddenErrorResponse) GetTimestamp() time.Time { + if o == nil || IsNil(o.Timestamp) { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ForbiddenErrorResponse) GetTimestampOk() (*time.Time, bool) { + if o == nil || IsNil(o.Timestamp) { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *ForbiddenErrorResponse) HasTimestamp() bool { + if o != nil && !IsNil(o.Timestamp) { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *ForbiddenErrorResponse) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +func (o ForbiddenErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ForbiddenErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + toSerialize["message"] = o.Message + if !IsNil(o.Path) { + toSerialize["path"] = o.Path + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Timestamp) { + toSerialize["timestamp"] = o.Timestamp + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ForbiddenErrorResponse) 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{ + "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) + } + } + + varForbiddenErrorResponse := _ForbiddenErrorResponse{} + + err = json.Unmarshal(data, &varForbiddenErrorResponse) + + if err != nil { + return err + } + + *o = ForbiddenErrorResponse(varForbiddenErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "message") + delete(additionalProperties, "path") + delete(additionalProperties, "status") + delete(additionalProperties, "timestamp") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableForbiddenErrorResponse struct { + value *ForbiddenErrorResponse + isSet bool +} + +func (v NullableForbiddenErrorResponse) Get() *ForbiddenErrorResponse { + return v.value +} + +func (v *NullableForbiddenErrorResponse) Set(val *ForbiddenErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableForbiddenErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableForbiddenErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableForbiddenErrorResponse(val *ForbiddenErrorResponse) *NullableForbiddenErrorResponse { + return &NullableForbiddenErrorResponse{value: val, isSet: true} +} + +func (v NullableForbiddenErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableForbiddenErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_generic_error_response.go b/services/registry/v1api/model_generic_error_response.go new file mode 100644 index 000000000..1df28f8cc --- /dev/null +++ b/services/registry/v1api/model_generic_error_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GenericErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GenericErrorResponse{} + +// GenericErrorResponse Generic Error Response. +type GenericErrorResponse struct { + Details []string `json:"details,omitempty"` + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _GenericErrorResponse GenericErrorResponse + +// NewGenericErrorResponse instantiates a new GenericErrorResponse 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 NewGenericErrorResponse(message string) *GenericErrorResponse { + this := GenericErrorResponse{} + this.Message = message + return &this +} + +// NewGenericErrorResponseWithDefaults instantiates a new GenericErrorResponse 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 NewGenericErrorResponseWithDefaults() *GenericErrorResponse { + this := GenericErrorResponse{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *GenericErrorResponse) GetDetails() []string { + if o == nil || IsNil(o.Details) { + var ret []string + return ret + } + return o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GenericErrorResponse) GetDetailsOk() ([]string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *GenericErrorResponse) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given []string and assigns it to the Details field. +func (o *GenericErrorResponse) SetDetails(v []string) { + o.Details = v +} + +// GetMessage returns the Message field value +func (o *GenericErrorResponse) 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 *GenericErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *GenericErrorResponse) SetMessage(v string) { + o.Message = v +} + +func (o GenericErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GenericErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GenericErrorResponse) 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{ + "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) + } + } + + varGenericErrorResponse := _GenericErrorResponse{} + + err = json.Unmarshal(data, &varGenericErrorResponse) + + if err != nil { + return err + } + + *o = GenericErrorResponse(varGenericErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "details") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGenericErrorResponse struct { + value *GenericErrorResponse + isSet bool +} + +func (v NullableGenericErrorResponse) Get() *GenericErrorResponse { + return v.value +} + +func (v *NullableGenericErrorResponse) Set(val *GenericErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGenericErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGenericErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGenericErrorResponse(val *GenericErrorResponse) *NullableGenericErrorResponse { + return &NullableGenericErrorResponse{value: val, isSet: true} +} + +func (v NullableGenericErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGenericErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_internal_server_error_response.go b/services/registry/v1api/model_internal_server_error_response.go new file mode 100644 index 000000000..9e0be0cc8 --- /dev/null +++ b/services/registry/v1api/model_internal_server_error_response.go @@ -0,0 +1,191 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the InternalServerErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InternalServerErrorResponse{} + +// InternalServerErrorResponse Internal server error. +type InternalServerErrorResponse struct { + Details *string `json:"details,omitempty"` + Error *string `json:"error,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InternalServerErrorResponse InternalServerErrorResponse + +// NewInternalServerErrorResponse instantiates a new InternalServerErrorResponse 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 NewInternalServerErrorResponse() *InternalServerErrorResponse { + this := InternalServerErrorResponse{} + return &this +} + +// NewInternalServerErrorResponseWithDefaults instantiates a new InternalServerErrorResponse 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 NewInternalServerErrorResponseWithDefaults() *InternalServerErrorResponse { + this := InternalServerErrorResponse{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *InternalServerErrorResponse) GetDetails() string { + if o == nil || IsNil(o.Details) { + var ret string + return ret + } + return *o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InternalServerErrorResponse) GetDetailsOk() (*string, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *InternalServerErrorResponse) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *InternalServerErrorResponse) SetDetails(v string) { + o.Details = &v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *InternalServerErrorResponse) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InternalServerErrorResponse) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *InternalServerErrorResponse) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *InternalServerErrorResponse) SetError(v string) { + o.Error = &v +} + +func (o InternalServerErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InternalServerErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InternalServerErrorResponse) UnmarshalJSON(data []byte) (err error) { + varInternalServerErrorResponse := _InternalServerErrorResponse{} + + err = json.Unmarshal(data, &varInternalServerErrorResponse) + + if err != nil { + return err + } + + *o = InternalServerErrorResponse(varInternalServerErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "details") + delete(additionalProperties, "error") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInternalServerErrorResponse struct { + value *InternalServerErrorResponse + isSet bool +} + +func (v NullableInternalServerErrorResponse) Get() *InternalServerErrorResponse { + return v.value +} + +func (v *NullableInternalServerErrorResponse) Set(val *InternalServerErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableInternalServerErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableInternalServerErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInternalServerErrorResponse(val *InternalServerErrorResponse) *NullableInternalServerErrorResponse { + return &NullableInternalServerErrorResponse{value: val, isSet: true} +} + +func (v NullableInternalServerErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInternalServerErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_not_found_error_response.go b/services/registry/v1api/model_not_found_error_response.go new file mode 100644 index 000000000..bb9e3dd92 --- /dev/null +++ b/services/registry/v1api/model_not_found_error_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the NotFoundErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NotFoundErrorResponse{} + +// NotFoundErrorResponse 404 Error Response. +type NotFoundErrorResponse struct { + Error *string `json:"error,omitempty"` + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _NotFoundErrorResponse NotFoundErrorResponse + +// NewNotFoundErrorResponse instantiates a new NotFoundErrorResponse 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 NewNotFoundErrorResponse(message string) *NotFoundErrorResponse { + this := NotFoundErrorResponse{} + this.Message = message + return &this +} + +// NewNotFoundErrorResponseWithDefaults instantiates a new NotFoundErrorResponse 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 NewNotFoundErrorResponseWithDefaults() *NotFoundErrorResponse { + this := NotFoundErrorResponse{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *NotFoundErrorResponse) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NotFoundErrorResponse) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *NotFoundErrorResponse) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *NotFoundErrorResponse) SetError(v string) { + o.Error = &v +} + +// GetMessage returns the Message field value +func (o *NotFoundErrorResponse) 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 *NotFoundErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *NotFoundErrorResponse) SetMessage(v string) { + o.Message = v +} + +func (o NotFoundErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NotFoundErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *NotFoundErrorResponse) 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{ + "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) + } + } + + varNotFoundErrorResponse := _NotFoundErrorResponse{} + + err = json.Unmarshal(data, &varNotFoundErrorResponse) + + if err != nil { + return err + } + + *o = NotFoundErrorResponse(varNotFoundErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNotFoundErrorResponse struct { + value *NotFoundErrorResponse + isSet bool +} + +func (v NullableNotFoundErrorResponse) Get() *NotFoundErrorResponse { + return v.value +} + +func (v *NullableNotFoundErrorResponse) Set(val *NotFoundErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNotFoundErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNotFoundErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNotFoundErrorResponse(val *NotFoundErrorResponse) *NullableNotFoundErrorResponse { + return &NullableNotFoundErrorResponse{value: val, isSet: true} +} + +func (v NullableNotFoundErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNotFoundErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_patch_artifactory_payload.go b/services/registry/v1api/model_patch_artifactory_payload.go new file mode 100644 index 000000000..b6d49b036 --- /dev/null +++ b/services/registry/v1api/model_patch_artifactory_payload.go @@ -0,0 +1,154 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the PatchArtifactoryPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchArtifactoryPayload{} + +// PatchArtifactoryPayload Patch artifactory request +type PatchArtifactoryPayload struct { + Proxy *UpdateProxyRequest `json:"proxy,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PatchArtifactoryPayload PatchArtifactoryPayload + +// NewPatchArtifactoryPayload instantiates a new PatchArtifactoryPayload 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 NewPatchArtifactoryPayload() *PatchArtifactoryPayload { + this := PatchArtifactoryPayload{} + return &this +} + +// NewPatchArtifactoryPayloadWithDefaults instantiates a new PatchArtifactoryPayload 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 NewPatchArtifactoryPayloadWithDefaults() *PatchArtifactoryPayload { + this := PatchArtifactoryPayload{} + return &this +} + +// GetProxy returns the Proxy field value if set, zero value otherwise. +func (o *PatchArtifactoryPayload) GetProxy() UpdateProxyRequest { + if o == nil || IsNil(o.Proxy) { + var ret UpdateProxyRequest + return ret + } + return *o.Proxy +} + +// GetProxyOk returns a tuple with the Proxy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchArtifactoryPayload) GetProxyOk() (*UpdateProxyRequest, bool) { + if o == nil || IsNil(o.Proxy) { + return nil, false + } + return o.Proxy, true +} + +// HasProxy returns a boolean if a field has been set. +func (o *PatchArtifactoryPayload) HasProxy() bool { + if o != nil && !IsNil(o.Proxy) { + return true + } + + return false +} + +// SetProxy gets a reference to the given UpdateProxyRequest and assigns it to the Proxy field. +func (o *PatchArtifactoryPayload) SetProxy(v UpdateProxyRequest) { + o.Proxy = &v +} + +func (o PatchArtifactoryPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PatchArtifactoryPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Proxy) { + toSerialize["proxy"] = o.Proxy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PatchArtifactoryPayload) UnmarshalJSON(data []byte) (err error) { + varPatchArtifactoryPayload := _PatchArtifactoryPayload{} + + err = json.Unmarshal(data, &varPatchArtifactoryPayload) + + if err != nil { + return err + } + + *o = PatchArtifactoryPayload(varPatchArtifactoryPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "proxy") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePatchArtifactoryPayload struct { + value *PatchArtifactoryPayload + isSet bool +} + +func (v NullablePatchArtifactoryPayload) Get() *PatchArtifactoryPayload { + return v.value +} + +func (v *NullablePatchArtifactoryPayload) Set(val *PatchArtifactoryPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePatchArtifactoryPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchArtifactoryPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchArtifactoryPayload(val *PatchArtifactoryPayload) *NullablePatchArtifactoryPayload { + return &NullablePatchArtifactoryPayload{value: val, isSet: true} +} + +func (v NullablePatchArtifactoryPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchArtifactoryPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_proxy.go b/services/registry/v1api/model_proxy.go new file mode 100644 index 000000000..ef804f903 --- /dev/null +++ b/services/registry/v1api/model_proxy.go @@ -0,0 +1,273 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the Proxy type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Proxy{} + +// Proxy Replication settings for a proxy-cache artifactory +type Proxy struct { + Credentials *RedactedCredentials `json:"credentials,omitempty"` + // Description of the registry. + Description *string `json:"description,omitempty"` + // Which replication adapter to use for this registry. Discover the list of supported replication adapters, and therefore supported registry types, by calling GET /v1/projects/{projectId}/regions/{regionId}/replication/adapters + RegistryType string `json:"registry_type"` + // Upstream registry url to proxy + Url string `json:"url"` + AdditionalProperties map[string]interface{} +} + +type _Proxy Proxy + +// NewProxy instantiates a new Proxy 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 NewProxy(registryType string, url string) *Proxy { + this := Proxy{} + this.RegistryType = registryType + this.Url = url + return &this +} + +// NewProxyWithDefaults instantiates a new Proxy 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 NewProxyWithDefaults() *Proxy { + this := Proxy{} + return &this +} + +// GetCredentials returns the Credentials field value if set, zero value otherwise. +func (o *Proxy) GetCredentials() RedactedCredentials { + if o == nil || IsNil(o.Credentials) { + var ret RedactedCredentials + return ret + } + return *o.Credentials +} + +// GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Proxy) GetCredentialsOk() (*RedactedCredentials, bool) { + if o == nil || IsNil(o.Credentials) { + return nil, false + } + return o.Credentials, true +} + +// HasCredentials returns a boolean if a field has been set. +func (o *Proxy) HasCredentials() bool { + if o != nil && !IsNil(o.Credentials) { + return true + } + + return false +} + +// SetCredentials gets a reference to the given RedactedCredentials and assigns it to the Credentials field. +func (o *Proxy) SetCredentials(v RedactedCredentials) { + o.Credentials = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Proxy) 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 *Proxy) 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 *Proxy) 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 *Proxy) SetDescription(v string) { + o.Description = &v +} + +// GetRegistryType returns the RegistryType field value +func (o *Proxy) GetRegistryType() string { + if o == nil { + var ret string + return ret + } + + return o.RegistryType +} + +// GetRegistryTypeOk returns a tuple with the RegistryType field value +// and a boolean to check if the value has been set. +func (o *Proxy) GetRegistryTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegistryType, true +} + +// SetRegistryType sets field value +func (o *Proxy) SetRegistryType(v string) { + o.RegistryType = v +} + +// GetUrl returns the Url field value +func (o *Proxy) 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 *Proxy) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *Proxy) SetUrl(v string) { + o.Url = v +} + +func (o Proxy) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Proxy) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Credentials) { + toSerialize["credentials"] = o.Credentials + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["registry_type"] = o.RegistryType + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Proxy) 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{ + "registry_type", + "url", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varProxy := _Proxy{} + + err = json.Unmarshal(data, &varProxy) + + if err != nil { + return err + } + + *o = Proxy(varProxy) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "credentials") + delete(additionalProperties, "description") + delete(additionalProperties, "registry_type") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProxy struct { + value *Proxy + isSet bool +} + +func (v NullableProxy) Get() *Proxy { + return v.value +} + +func (v *NullableProxy) Set(val *Proxy) { + v.value = val + v.isSet = true +} + +func (v NullableProxy) IsSet() bool { + return v.isSet +} + +func (v *NullableProxy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProxy(val *Proxy) *NullableProxy { + return &NullableProxy{value: val, isSet: true} +} + +func (v NullableProxy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProxy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_redacted_credentials.go b/services/registry/v1api/model_redacted_credentials.go new file mode 100644 index 000000000..c707be49e --- /dev/null +++ b/services/registry/v1api/model_redacted_credentials.go @@ -0,0 +1,154 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the RedactedCredentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RedactedCredentials{} + +// RedactedCredentials Credentials for upstream registry, redacted +type RedactedCredentials struct { + AccessKey *string `json:"access_key,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _RedactedCredentials RedactedCredentials + +// NewRedactedCredentials instantiates a new RedactedCredentials 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 NewRedactedCredentials() *RedactedCredentials { + this := RedactedCredentials{} + return &this +} + +// NewRedactedCredentialsWithDefaults instantiates a new RedactedCredentials 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 NewRedactedCredentialsWithDefaults() *RedactedCredentials { + this := RedactedCredentials{} + return &this +} + +// GetAccessKey returns the AccessKey field value if set, zero value otherwise. +func (o *RedactedCredentials) GetAccessKey() string { + if o == nil || IsNil(o.AccessKey) { + var ret string + return ret + } + return *o.AccessKey +} + +// GetAccessKeyOk returns a tuple with the AccessKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RedactedCredentials) GetAccessKeyOk() (*string, bool) { + if o == nil || IsNil(o.AccessKey) { + return nil, false + } + return o.AccessKey, true +} + +// HasAccessKey returns a boolean if a field has been set. +func (o *RedactedCredentials) HasAccessKey() bool { + if o != nil && !IsNil(o.AccessKey) { + return true + } + + return false +} + +// SetAccessKey gets a reference to the given string and assigns it to the AccessKey field. +func (o *RedactedCredentials) SetAccessKey(v string) { + o.AccessKey = &v +} + +func (o RedactedCredentials) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RedactedCredentials) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessKey) { + toSerialize["access_key"] = o.AccessKey + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RedactedCredentials) UnmarshalJSON(data []byte) (err error) { + varRedactedCredentials := _RedactedCredentials{} + + err = json.Unmarshal(data, &varRedactedCredentials) + + if err != nil { + return err + } + + *o = RedactedCredentials(varRedactedCredentials) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "access_key") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRedactedCredentials struct { + value *RedactedCredentials + isSet bool +} + +func (v NullableRedactedCredentials) Get() *RedactedCredentials { + return v.value +} + +func (v *NullableRedactedCredentials) Set(val *RedactedCredentials) { + v.value = val + v.isSet = true +} + +func (v NullableRedactedCredentials) IsSet() bool { + return v.isSet +} + +func (v *NullableRedactedCredentials) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRedactedCredentials(val *RedactedCredentials) *NullableRedactedCredentials { + return &NullableRedactedCredentials{value: val, isSet: true} +} + +func (v NullableRedactedCredentials) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRedactedCredentials) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_replication_adapter.go b/services/registry/v1api/model_replication_adapter.go new file mode 100644 index 000000000..13a458d94 --- /dev/null +++ b/services/registry/v1api/model_replication_adapter.go @@ -0,0 +1,198 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ReplicationAdapter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReplicationAdapter{} + +// ReplicationAdapter struct for ReplicationAdapter +type ReplicationAdapter struct { + // Human-friendly name of the provider the adapter relates to. + DisplayName string `json:"display_name"` + // Identifies the replication adapter + RegistryType string `json:"registry_type"` + AdditionalProperties map[string]interface{} +} + +type _ReplicationAdapter ReplicationAdapter + +// NewReplicationAdapter instantiates a new ReplicationAdapter 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 NewReplicationAdapter(displayName string, registryType string) *ReplicationAdapter { + this := ReplicationAdapter{} + this.DisplayName = displayName + this.RegistryType = registryType + return &this +} + +// NewReplicationAdapterWithDefaults instantiates a new ReplicationAdapter 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 NewReplicationAdapterWithDefaults() *ReplicationAdapter { + this := ReplicationAdapter{} + return &this +} + +// GetDisplayName returns the DisplayName field value +func (o *ReplicationAdapter) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *ReplicationAdapter) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *ReplicationAdapter) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetRegistryType returns the RegistryType field value +func (o *ReplicationAdapter) GetRegistryType() string { + if o == nil { + var ret string + return ret + } + + return o.RegistryType +} + +// GetRegistryTypeOk returns a tuple with the RegistryType field value +// and a boolean to check if the value has been set. +func (o *ReplicationAdapter) GetRegistryTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegistryType, true +} + +// SetRegistryType sets field value +func (o *ReplicationAdapter) SetRegistryType(v string) { + o.RegistryType = v +} + +func (o ReplicationAdapter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReplicationAdapter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["display_name"] = o.DisplayName + toSerialize["registry_type"] = o.RegistryType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ReplicationAdapter) 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{ + "display_name", + "registry_type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varReplicationAdapter := _ReplicationAdapter{} + + err = json.Unmarshal(data, &varReplicationAdapter) + + if err != nil { + return err + } + + *o = ReplicationAdapter(varReplicationAdapter) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "display_name") + delete(additionalProperties, "registry_type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableReplicationAdapter struct { + value *ReplicationAdapter + isSet bool +} + +func (v NullableReplicationAdapter) Get() *ReplicationAdapter { + return v.value +} + +func (v *NullableReplicationAdapter) Set(val *ReplicationAdapter) { + v.value = val + v.isSet = true +} + +func (v NullableReplicationAdapter) IsSet() bool { + return v.isSet +} + +func (v *NullableReplicationAdapter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReplicationAdapter(val *ReplicationAdapter) *NullableReplicationAdapter { + return &NullableReplicationAdapter{value: val, isSet: true} +} + +func (v NullableReplicationAdapter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReplicationAdapter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_replication_adapter_list.go b/services/registry/v1api/model_replication_adapter_list.go new file mode 100644 index 000000000..2b21ae65c --- /dev/null +++ b/services/registry/v1api/model_replication_adapter_list.go @@ -0,0 +1,205 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ReplicationAdapterList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReplicationAdapterList{} + +// ReplicationAdapterList A list of replication adapters +type ReplicationAdapterList struct { + // A token to retrieve the next page of results. Pass this value as `page_token` in the subsequent request. If empty, there are no more pages. + NextPageToken *string `json:"next_page_token,omitempty"` + ReplicationAdapters []ReplicationAdapter `json:"replication_adapters"` + AdditionalProperties map[string]interface{} +} + +type _ReplicationAdapterList ReplicationAdapterList + +// NewReplicationAdapterList instantiates a new ReplicationAdapterList 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 NewReplicationAdapterList(replicationAdapters []ReplicationAdapter) *ReplicationAdapterList { + this := ReplicationAdapterList{} + this.ReplicationAdapters = replicationAdapters + return &this +} + +// NewReplicationAdapterListWithDefaults instantiates a new ReplicationAdapterList 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 NewReplicationAdapterListWithDefaults() *ReplicationAdapterList { + this := ReplicationAdapterList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ReplicationAdapterList) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReplicationAdapterList) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ReplicationAdapterList) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ReplicationAdapterList) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +// GetReplicationAdapters returns the ReplicationAdapters field value +func (o *ReplicationAdapterList) GetReplicationAdapters() []ReplicationAdapter { + if o == nil { + var ret []ReplicationAdapter + return ret + } + + return o.ReplicationAdapters +} + +// GetReplicationAdaptersOk returns a tuple with the ReplicationAdapters field value +// and a boolean to check if the value has been set. +func (o *ReplicationAdapterList) GetReplicationAdaptersOk() ([]ReplicationAdapter, bool) { + if o == nil { + return nil, false + } + return o.ReplicationAdapters, true +} + +// SetReplicationAdapters sets field value +func (o *ReplicationAdapterList) SetReplicationAdapters(v []ReplicationAdapter) { + o.ReplicationAdapters = v +} + +func (o ReplicationAdapterList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReplicationAdapterList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NextPageToken) { + toSerialize["next_page_token"] = o.NextPageToken + } + toSerialize["replication_adapters"] = o.ReplicationAdapters + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ReplicationAdapterList) 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{ + "replication_adapters", + } + + 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) + } + } + + varReplicationAdapterList := _ReplicationAdapterList{} + + err = json.Unmarshal(data, &varReplicationAdapterList) + + if err != nil { + return err + } + + *o = ReplicationAdapterList(varReplicationAdapterList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "next_page_token") + delete(additionalProperties, "replication_adapters") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableReplicationAdapterList struct { + value *ReplicationAdapterList + isSet bool +} + +func (v NullableReplicationAdapterList) Get() *ReplicationAdapterList { + return v.value +} + +func (v *NullableReplicationAdapterList) Set(val *ReplicationAdapterList) { + v.value = val + v.isSet = true +} + +func (v NullableReplicationAdapterList) IsSet() bool { + return v.isSet +} + +func (v *NullableReplicationAdapterList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReplicationAdapterList(val *ReplicationAdapterList) *NullableReplicationAdapterList { + return &NullableReplicationAdapterList{value: val, isSet: true} +} + +func (v NullableReplicationAdapterList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReplicationAdapterList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_unauthorized_error_response.go b/services/registry/v1api/model_unauthorized_error_response.go new file mode 100644 index 000000000..ac8febbca --- /dev/null +++ b/services/registry/v1api/model_unauthorized_error_response.go @@ -0,0 +1,316 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the UnauthorizedErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UnauthorizedErrorResponse{} + +// UnauthorizedErrorResponse Unauthorized Error Response. +type UnauthorizedErrorResponse struct { + Error *string `json:"error,omitempty"` + Message string `json:"message"` + Path *string `json:"path,omitempty"` + Status *int64 `json:"status,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UnauthorizedErrorResponse UnauthorizedErrorResponse + +// NewUnauthorizedErrorResponse instantiates a new UnauthorizedErrorResponse 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 NewUnauthorizedErrorResponse(message string) *UnauthorizedErrorResponse { + this := UnauthorizedErrorResponse{} + this.Message = message + return &this +} + +// NewUnauthorizedErrorResponseWithDefaults instantiates a new UnauthorizedErrorResponse 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 NewUnauthorizedErrorResponseWithDefaults() *UnauthorizedErrorResponse { + this := UnauthorizedErrorResponse{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *UnauthorizedErrorResponse) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnauthorizedErrorResponse) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *UnauthorizedErrorResponse) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *UnauthorizedErrorResponse) SetError(v string) { + o.Error = &v +} + +// GetMessage returns the Message field value +func (o *UnauthorizedErrorResponse) 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 *UnauthorizedErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *UnauthorizedErrorResponse) SetMessage(v string) { + o.Message = v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *UnauthorizedErrorResponse) GetPath() string { + if o == nil || IsNil(o.Path) { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnauthorizedErrorResponse) GetPathOk() (*string, bool) { + if o == nil || IsNil(o.Path) { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *UnauthorizedErrorResponse) HasPath() bool { + if o != nil && !IsNil(o.Path) { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *UnauthorizedErrorResponse) SetPath(v string) { + o.Path = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *UnauthorizedErrorResponse) GetStatus() int64 { + if o == nil || IsNil(o.Status) { + var ret int64 + 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 *UnauthorizedErrorResponse) GetStatusOk() (*int64, 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 *UnauthorizedErrorResponse) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given int64 and assigns it to the Status field. +func (o *UnauthorizedErrorResponse) SetStatus(v int64) { + o.Status = &v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *UnauthorizedErrorResponse) GetTimestamp() time.Time { + if o == nil || IsNil(o.Timestamp) { + var ret time.Time + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnauthorizedErrorResponse) GetTimestampOk() (*time.Time, bool) { + if o == nil || IsNil(o.Timestamp) { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *UnauthorizedErrorResponse) HasTimestamp() bool { + if o != nil && !IsNil(o.Timestamp) { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *UnauthorizedErrorResponse) SetTimestamp(v time.Time) { + o.Timestamp = &v +} + +func (o UnauthorizedErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UnauthorizedErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + toSerialize["message"] = o.Message + if !IsNil(o.Path) { + toSerialize["path"] = o.Path + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.Timestamp) { + toSerialize["timestamp"] = o.Timestamp + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UnauthorizedErrorResponse) 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{ + "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) + } + } + + varUnauthorizedErrorResponse := _UnauthorizedErrorResponse{} + + err = json.Unmarshal(data, &varUnauthorizedErrorResponse) + + if err != nil { + return err + } + + *o = UnauthorizedErrorResponse(varUnauthorizedErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "message") + delete(additionalProperties, "path") + delete(additionalProperties, "status") + delete(additionalProperties, "timestamp") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUnauthorizedErrorResponse struct { + value *UnauthorizedErrorResponse + isSet bool +} + +func (v NullableUnauthorizedErrorResponse) Get() *UnauthorizedErrorResponse { + return v.value +} + +func (v *NullableUnauthorizedErrorResponse) Set(val *UnauthorizedErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUnauthorizedErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUnauthorizedErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUnauthorizedErrorResponse(val *UnauthorizedErrorResponse) *NullableUnauthorizedErrorResponse { + return &NullableUnauthorizedErrorResponse{value: val, isSet: true} +} + +func (v NullableUnauthorizedErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUnauthorizedErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/model_update_proxy_request.go b/services/registry/v1api/model_update_proxy_request.go new file mode 100644 index 000000000..3c51364cb --- /dev/null +++ b/services/registry/v1api/model_update_proxy_request.go @@ -0,0 +1,230 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the UpdateProxyRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateProxyRequest{} + +// UpdateProxyRequest Update an upstream repository for a proxy-cache project +type UpdateProxyRequest struct { + Credentials *Credentials `json:"credentials,omitempty"` + // Description of the registry. + Description *string `json:"description,omitempty"` + // Upstream registry url to proxy + Url *string `json:"url,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateProxyRequest UpdateProxyRequest + +// NewUpdateProxyRequest instantiates a new UpdateProxyRequest 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 NewUpdateProxyRequest() *UpdateProxyRequest { + this := UpdateProxyRequest{} + return &this +} + +// NewUpdateProxyRequestWithDefaults instantiates a new UpdateProxyRequest 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 NewUpdateProxyRequestWithDefaults() *UpdateProxyRequest { + this := UpdateProxyRequest{} + return &this +} + +// GetCredentials returns the Credentials field value if set, zero value otherwise. +func (o *UpdateProxyRequest) GetCredentials() Credentials { + if o == nil || IsNil(o.Credentials) { + var ret Credentials + return ret + } + return *o.Credentials +} + +// GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateProxyRequest) GetCredentialsOk() (*Credentials, bool) { + if o == nil || IsNil(o.Credentials) { + return nil, false + } + return o.Credentials, true +} + +// HasCredentials returns a boolean if a field has been set. +func (o *UpdateProxyRequest) HasCredentials() bool { + if o != nil && !IsNil(o.Credentials) { + return true + } + + return false +} + +// SetCredentials gets a reference to the given Credentials and assigns it to the Credentials field. +func (o *UpdateProxyRequest) SetCredentials(v Credentials) { + o.Credentials = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateProxyRequest) 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 *UpdateProxyRequest) 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 *UpdateProxyRequest) 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 *UpdateProxyRequest) SetDescription(v string) { + o.Description = &v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *UpdateProxyRequest) GetUrl() string { + if o == nil || IsNil(o.Url) { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateProxyRequest) GetUrlOk() (*string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *UpdateProxyRequest) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *UpdateProxyRequest) SetUrl(v string) { + o.Url = &v +} + +func (o UpdateProxyRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateProxyRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Credentials) { + toSerialize["credentials"] = o.Credentials + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateProxyRequest) UnmarshalJSON(data []byte) (err error) { + varUpdateProxyRequest := _UpdateProxyRequest{} + + err = json.Unmarshal(data, &varUpdateProxyRequest) + + if err != nil { + return err + } + + *o = UpdateProxyRequest(varUpdateProxyRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "credentials") + delete(additionalProperties, "description") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateProxyRequest struct { + value *UpdateProxyRequest + isSet bool +} + +func (v NullableUpdateProxyRequest) Get() *UpdateProxyRequest { + return v.value +} + +func (v *NullableUpdateProxyRequest) Set(val *UpdateProxyRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateProxyRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateProxyRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateProxyRequest(val *UpdateProxyRequest) *NullableUpdateProxyRequest { + return &NullableUpdateProxyRequest{value: val, isSet: true} +} + +func (v NullableUpdateProxyRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateProxyRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/registry/v1api/response.go b/services/registry/v1api/response.go new file mode 100644 index 000000000..fec3820b5 --- /dev/null +++ b/services/registry/v1api/response.go @@ -0,0 +1,48 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@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/registry/v1api/utils.go b/services/registry/v1api/utils.go new file mode 100644 index 000000000..4de211f05 --- /dev/null +++ b/services/registry/v1api/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT Container Registry API + +STACKIT Container Registry management API. + +API version: 1.0.0 +Contact: devex_development@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...) +}