diff --git a/go.work b/go.work index 0df93c57e..e8d33004a 100644 --- a/go.work +++ b/go.work @@ -44,6 +44,7 @@ use ( ./services/certificates ./services/cost ./services/dns + ./services/dremio ./services/edge ./services/git ./services/iaas diff --git a/services/dremio/LICENSE.md b/services/dremio/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/dremio/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/dremio/go.mod b/services/dremio/go.mod new file mode 100644 index 000000000..b8748042a --- /dev/null +++ b/services/dremio/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/dremio + +go 1.25 + +require github.com/stackitcloud/stackit-sdk-go/core v0.25.0 + +require ( + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/dremio/go.sum b/services/dremio/go.sum new file mode 100644 index 000000000..f66cfd445 --- /dev/null +++ b/services/dremio/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.25.0 h1:ra3VEk684MNoq741g+xbZrKjZzhyztq5liUAwwew4DY= +github.com/stackitcloud/stackit-sdk-go/core v0.25.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/dremio/oas_commit b/services/dremio/oas_commit new file mode 100644 index 000000000..d01bb47d4 --- /dev/null +++ b/services/dremio/oas_commit @@ -0,0 +1 @@ +5793499f4cb2699a3b86f38e4e986cb560e832f3 diff --git a/services/dremio/package.go b/services/dremio/package.go new file mode 100644 index 000000000..8dc0f480d --- /dev/null +++ b/services/dremio/package.go @@ -0,0 +1 @@ +package dremio diff --git a/services/dremio/v1alphaapi/api_default.go b/services/dremio/v1alphaapi/api_default.go new file mode 100644 index 000000000..b5608cd58 --- /dev/null +++ b/services/dremio/v1alphaapi/api_default.go @@ -0,0 +1,1341 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + CreateDremio Method for CreateDremio + + Creates a new Dremio within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateDremioRequest + */ + CreateDremio(ctx context.Context, projectId string, regionId string) ApiCreateDremioRequest + + // CreateDremioExecute executes the request + // @return DremioResponse + CreateDremioExecute(r ApiCreateDremioRequest) (*DremioResponse, error) + + /* + CreateDremioUser Method for CreateDremioUser + + Creates a new dremio admin user for the given dremio instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiCreateDremioUserRequest + */ + CreateDremioUser(ctx context.Context, projectId string, regionId string, dremioId string) ApiCreateDremioUserRequest + + // CreateDremioUserExecute executes the request + // @return DremioUserResponse + CreateDremioUserExecute(r ApiCreateDremioUserRequest) (*DremioUserResponse, error) + + /* + DeleteDremio Method for DeleteDremio + + Deletes the given Dremio. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiDeleteDremioRequest + */ + DeleteDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiDeleteDremioRequest + + // DeleteDremioExecute executes the request + DeleteDremioExecute(r ApiDeleteDremioRequest) error + + /* + DeleteDremioUser Method for DeleteDremioUser + + Deletes the given dremio admin user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @param dremioUserId The dremio user UUID. + @return ApiDeleteDremioUserRequest + */ + DeleteDremioUser(ctx context.Context, projectId string, regionId string, dremioId string, dremioUserId string) ApiDeleteDremioUserRequest + + // DeleteDremioUserExecute executes the request + DeleteDremioUserExecute(r ApiDeleteDremioUserRequest) error + + /* + GetDremio Method for GetDremio + + Returns the details for the given Dremio. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiGetDremioRequest + */ + GetDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiGetDremioRequest + + // GetDremioExecute executes the request + // @return DremioResponse + GetDremioExecute(r ApiGetDremioRequest) (*DremioResponse, error) + + /* + GetDremioUser Method for GetDremioUser + + Returns the details for the given dremio admin user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @param dremioUserId The dremio user UUID. + @return ApiGetDremioUserRequest + */ + GetDremioUser(ctx context.Context, projectId string, regionId string, dremioId string, dremioUserId string) ApiGetDremioUserRequest + + // GetDremioUserExecute executes the request + // @return DremioUserResponse + GetDremioUserExecute(r ApiGetDremioUserRequest) (*DremioUserResponse, error) + + /* + ListDremioUsers Method for ListDremioUsers + + Returns a list of all dremio admin users for the given dremio instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiListDremioUsersRequest + */ + ListDremioUsers(ctx context.Context, projectId string, regionId string, dremioId string) ApiListDremioUsersRequest + + // ListDremioUsersExecute executes the request + // @return ListDremioUsersResponse + ListDremioUsersExecute(r ApiListDremioUsersRequest) (*ListDremioUsersResponse, error) + + /* + ListDremios Method for ListDremios + + Returns a list of all dremio instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListDremiosRequest + */ + ListDremios(ctx context.Context, projectId string, regionId string) ApiListDremiosRequest + + // ListDremiosExecute executes the request + // @return ListDremiosResponse + ListDremiosExecute(r ApiListDremiosRequest) (*ListDremiosResponse, error) + + /* + UpdateDremio Method for UpdateDremio + + Updates the given Dremio. Please note that changing certain fields will trigger a Dremio restart and will incur downtime. See the request body information for more details. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiUpdateDremioRequest + */ + UpdateDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiUpdateDremioRequest + + // UpdateDremioExecute executes the request + // @return DremioResponse + UpdateDremioExecute(r ApiUpdateDremioRequest) (*DremioResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateDremioRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + createDremioPayload *CreateDremioPayload +} + +func (r ApiCreateDremioRequest) CreateDremioPayload(createDremioPayload CreateDremioPayload) ApiCreateDremioRequest { + r.createDremioPayload = &createDremioPayload + return r +} + +func (r ApiCreateDremioRequest) Execute() (*DremioResponse, error) { + return r.ApiService.CreateDremioExecute(r) +} + +/* +CreateDremio Method for CreateDremio + +Creates a new Dremio within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateDremioRequest +*/ +func (a *DefaultAPIService) CreateDremio(ctx context.Context, projectId string, regionId string) ApiCreateDremioRequest { + return ApiCreateDremioRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return DremioResponse +func (a *DefaultAPIService) CreateDremioExecute(r ApiCreateDremioRequest) (*DremioResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DremioResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateDremio") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDremioPayload == nil { + return localVarReturnValue, reportError("createDremioPayload 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.createDremioPayload + 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, + } + 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 ApiCreateDremioUserRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + dremioId string + createDremioUserPayload *CreateDremioUserPayload +} + +func (r ApiCreateDremioUserRequest) CreateDremioUserPayload(createDremioUserPayload CreateDremioUserPayload) ApiCreateDremioUserRequest { + r.createDremioUserPayload = &createDremioUserPayload + return r +} + +func (r ApiCreateDremioUserRequest) Execute() (*DremioUserResponse, error) { + return r.ApiService.CreateDremioUserExecute(r) +} + +/* +CreateDremioUser Method for CreateDremioUser + +Creates a new dremio admin user for the given dremio instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiCreateDremioUserRequest +*/ +func (a *DefaultAPIService) CreateDremioUser(ctx context.Context, projectId string, regionId string, dremioId string) ApiCreateDremioUserRequest { + return ApiCreateDremioUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// Execute executes the request +// +// @return DremioUserResponse +func (a *DefaultAPIService) CreateDremioUserExecute(r ApiCreateDremioUserRequest) (*DremioUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DremioUserResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateDremioUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios/{dremioId}/users" + 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, "{"+"dremioId"+"}", url.PathEscape(parameterValueToString(r.dremioId, "dremioId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDremioUserPayload == nil { + return localVarReturnValue, reportError("createDremioUserPayload 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.createDremioUserPayload + 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, + } + 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 ApiDeleteDremioRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + dremioId string +} + +func (r ApiDeleteDremioRequest) Execute() error { + return r.ApiService.DeleteDremioExecute(r) +} + +/* +DeleteDremio Method for DeleteDremio + +Deletes the given Dremio. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiDeleteDremioRequest +*/ +func (a *DefaultAPIService) DeleteDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiDeleteDremioRequest { + return ApiDeleteDremioRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteDremioExecute(r ApiDeleteDremioRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteDremio") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios/{dremioId}" + 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, "{"+"dremioId"+"}", url.PathEscape(parameterValueToString(r.dremioId, "dremioId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // 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, + } + return newErr + } + + return nil +} + +type ApiDeleteDremioUserRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + dremioId string + dremioUserId string +} + +func (r ApiDeleteDremioUserRequest) Execute() error { + return r.ApiService.DeleteDremioUserExecute(r) +} + +/* +DeleteDremioUser Method for DeleteDremioUser + +Deletes the given dremio admin user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @param dremioUserId The dremio user UUID. + @return ApiDeleteDremioUserRequest +*/ +func (a *DefaultAPIService) DeleteDremioUser(ctx context.Context, projectId string, regionId string, dremioId string, dremioUserId string) ApiDeleteDremioUserRequest { + return ApiDeleteDremioUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + dremioUserId: dremioUserId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteDremioUserExecute(r ApiDeleteDremioUserRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteDremioUser") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios/{dremioId}/users/{dremioUserId}" + 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, "{"+"dremioId"+"}", url.PathEscape(parameterValueToString(r.dremioId, "dremioId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dremioUserId"+"}", url.PathEscape(parameterValueToString(r.dremioUserId, "dremioUserId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // 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, + } + return newErr + } + + return nil +} + +type ApiGetDremioRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + dremioId string +} + +func (r ApiGetDremioRequest) Execute() (*DremioResponse, error) { + return r.ApiService.GetDremioExecute(r) +} + +/* +GetDremio Method for GetDremio + +Returns the details for the given Dremio. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiGetDremioRequest +*/ +func (a *DefaultAPIService) GetDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiGetDremioRequest { + return ApiGetDremioRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// Execute executes the request +// +// @return DremioResponse +func (a *DefaultAPIService) GetDremioExecute(r ApiGetDremioRequest) (*DremioResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DremioResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetDremio") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios/{dremioId}" + 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, "{"+"dremioId"+"}", url.PathEscape(parameterValueToString(r.dremioId, "dremioId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + 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 ApiGetDremioUserRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + dremioId string + dremioUserId string +} + +func (r ApiGetDremioUserRequest) Execute() (*DremioUserResponse, error) { + return r.ApiService.GetDremioUserExecute(r) +} + +/* +GetDremioUser Method for GetDremioUser + +Returns the details for the given dremio admin user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @param dremioUserId The dremio user UUID. + @return ApiGetDremioUserRequest +*/ +func (a *DefaultAPIService) GetDremioUser(ctx context.Context, projectId string, regionId string, dremioId string, dremioUserId string) ApiGetDremioUserRequest { + return ApiGetDremioUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + dremioUserId: dremioUserId, + } +} + +// Execute executes the request +// +// @return DremioUserResponse +func (a *DefaultAPIService) GetDremioUserExecute(r ApiGetDremioUserRequest) (*DremioUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DremioUserResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetDremioUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios/{dremioId}/users/{dremioUserId}" + 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, "{"+"dremioId"+"}", url.PathEscape(parameterValueToString(r.dremioId, "dremioId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dremioUserId"+"}", url.PathEscape(parameterValueToString(r.dremioUserId, "dremioUserId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + 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 ApiListDremioUsersRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + dremioId string + pageToken *string + pageSize *int32 +} + +// A token to retrieve the next page of results. +func (r ApiListDremioUsersRequest) PageToken(pageToken string) ApiListDremioUsersRequest { + r.pageToken = &pageToken + return r +} + +// Maximum number of items to return +func (r ApiListDremioUsersRequest) PageSize(pageSize int32) ApiListDremioUsersRequest { + r.pageSize = &pageSize + return r +} + +func (r ApiListDremioUsersRequest) Execute() (*ListDremioUsersResponse, error) { + return r.ApiService.ListDremioUsersExecute(r) +} + +/* +ListDremioUsers Method for ListDremioUsers + +Returns a list of all dremio admin users for the given dremio instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiListDremioUsersRequest +*/ +func (a *DefaultAPIService) ListDremioUsers(ctx context.Context, projectId string, regionId string, dremioId string) ApiListDremioUsersRequest { + return ApiListDremioUsersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// Execute executes the request +// +// @return ListDremioUsersResponse +func (a *DefaultAPIService) ListDremioUsersExecute(r ApiListDremioUsersRequest) (*ListDremioUsersResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListDremioUsersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListDremioUsers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios/{dremioId}/users" + 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, "{"+"dremioId"+"}", url.PathEscape(parameterValueToString(r.dremioId, "dremioId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "form", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + // 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, + } + 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 ApiListDremiosRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + pageToken *string + pageSize *int32 +} + +// A token to retrieve the next page of results. +func (r ApiListDremiosRequest) PageToken(pageToken string) ApiListDremiosRequest { + r.pageToken = &pageToken + return r +} + +// Maximum number of items to return +func (r ApiListDremiosRequest) PageSize(pageSize int32) ApiListDremiosRequest { + r.pageSize = &pageSize + return r +} + +func (r ApiListDremiosRequest) Execute() (*ListDremiosResponse, error) { + return r.ApiService.ListDremiosExecute(r) +} + +/* +ListDremios Method for ListDremios + +Returns a list of all dremio instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListDremiosRequest +*/ +func (a *DefaultAPIService) ListDremios(ctx context.Context, projectId string, regionId string) ApiListDremiosRequest { + return ApiListDremiosRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return ListDremiosResponse +func (a *DefaultAPIService) ListDremiosExecute(r ApiListDremiosRequest) (*ListDremiosResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListDremiosResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListDremios") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "form", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + // 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, + } + 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 ApiUpdateDremioRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + dremioId string + updateDremioPayload *UpdateDremioPayload +} + +func (r ApiUpdateDremioRequest) UpdateDremioPayload(updateDremioPayload UpdateDremioPayload) ApiUpdateDremioRequest { + r.updateDremioPayload = &updateDremioPayload + return r +} + +func (r ApiUpdateDremioRequest) Execute() (*DremioResponse, error) { + return r.ApiService.UpdateDremioExecute(r) +} + +/* +UpdateDremio Method for UpdateDremio + +Updates the given Dremio. Please note that changing certain fields will trigger a Dremio restart and will incur downtime. See the request body information for more details. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param dremioId The Dremio UUID. + @return ApiUpdateDremioRequest +*/ +func (a *DefaultAPIService) UpdateDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiUpdateDremioRequest { + return ApiUpdateDremioRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// Execute executes the request +// +// @return DremioResponse +func (a *DefaultAPIService) UpdateDremioExecute(r ApiUpdateDremioRequest) (*DremioResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DremioResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateDremio") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/dremios/{dremioId}" + 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, "{"+"dremioId"+"}", url.PathEscape(parameterValueToString(r.dremioId, "dremioId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateDremioPayload == nil { + return localVarReturnValue, reportError("updateDremioPayload 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.updateDremioPayload + 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, + } + 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/dremio/v1alphaapi/api_default_mock.go b/services/dremio/v1alphaapi/api_default_mock.go new file mode 100644 index 000000000..3ff85ac1f --- /dev/null +++ b/services/dremio/v1alphaapi/api_default_mock.go @@ -0,0 +1,219 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "context" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateDremioExecuteMock can be populated to implement the behavior of the CreateDremioExecute function of this mock + CreateDremioExecuteMock *func(r ApiCreateDremioRequest) (*DremioResponse, error) + // CreateDremioUserExecuteMock can be populated to implement the behavior of the CreateDremioUserExecute function of this mock + CreateDremioUserExecuteMock *func(r ApiCreateDremioUserRequest) (*DremioUserResponse, error) + // DeleteDremioExecuteMock can be populated to implement the behavior of the DeleteDremioExecute function of this mock + DeleteDremioExecuteMock *func(r ApiDeleteDremioRequest) error + // DeleteDremioUserExecuteMock can be populated to implement the behavior of the DeleteDremioUserExecute function of this mock + DeleteDremioUserExecuteMock *func(r ApiDeleteDremioUserRequest) error + // GetDremioExecuteMock can be populated to implement the behavior of the GetDremioExecute function of this mock + GetDremioExecuteMock *func(r ApiGetDremioRequest) (*DremioResponse, error) + // GetDremioUserExecuteMock can be populated to implement the behavior of the GetDremioUserExecute function of this mock + GetDremioUserExecuteMock *func(r ApiGetDremioUserRequest) (*DremioUserResponse, error) + // ListDremioUsersExecuteMock can be populated to implement the behavior of the ListDremioUsersExecute function of this mock + ListDremioUsersExecuteMock *func(r ApiListDremioUsersRequest) (*ListDremioUsersResponse, error) + // ListDremiosExecuteMock can be populated to implement the behavior of the ListDremiosExecute function of this mock + ListDremiosExecuteMock *func(r ApiListDremiosRequest) (*ListDremiosResponse, error) + // UpdateDremioExecuteMock can be populated to implement the behavior of the UpdateDremioExecute function of this mock + UpdateDremioExecuteMock *func(r ApiUpdateDremioRequest) (*DremioResponse, error) +} + +func (a DefaultAPIServiceMock) CreateDremio(ctx context.Context, projectId string, regionId string) ApiCreateDremioRequest { + return ApiCreateDremioRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// CreateDremioExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateDremioExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateDremioExecute(r ApiCreateDremioRequest) (*DremioResponse, error) { + if a.CreateDremioExecuteMock == nil { + var localVarReturnValue *DremioResponse + return localVarReturnValue, nil + } + + return (*a.CreateDremioExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateDremioUser(ctx context.Context, projectId string, regionId string, dremioId string) ApiCreateDremioUserRequest { + return ApiCreateDremioUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// CreateDremioUserExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateDremioUserExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateDremioUserExecute(r ApiCreateDremioUserRequest) (*DremioUserResponse, error) { + if a.CreateDremioUserExecuteMock == nil { + var localVarReturnValue *DremioUserResponse + return localVarReturnValue, nil + } + + return (*a.CreateDremioUserExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiDeleteDremioRequest { + return ApiDeleteDremioRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// DeleteDremioExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteDremioExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteDremioExecute(r ApiDeleteDremioRequest) error { + if a.DeleteDremioExecuteMock == nil { + return nil + } + + return (*a.DeleteDremioExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteDremioUser(ctx context.Context, projectId string, regionId string, dremioId string, dremioUserId string) ApiDeleteDremioUserRequest { + return ApiDeleteDremioUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + dremioUserId: dremioUserId, + } +} + +// DeleteDremioUserExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteDremioUserExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteDremioUserExecute(r ApiDeleteDremioUserRequest) error { + if a.DeleteDremioUserExecuteMock == nil { + return nil + } + + return (*a.DeleteDremioUserExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiGetDremioRequest { + return ApiGetDremioRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// GetDremioExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetDremioExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetDremioExecute(r ApiGetDremioRequest) (*DremioResponse, error) { + if a.GetDremioExecuteMock == nil { + var localVarReturnValue *DremioResponse + return localVarReturnValue, nil + } + + return (*a.GetDremioExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetDremioUser(ctx context.Context, projectId string, regionId string, dremioId string, dremioUserId string) ApiGetDremioUserRequest { + return ApiGetDremioUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + dremioUserId: dremioUserId, + } +} + +// GetDremioUserExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetDremioUserExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetDremioUserExecute(r ApiGetDremioUserRequest) (*DremioUserResponse, error) { + if a.GetDremioUserExecuteMock == nil { + var localVarReturnValue *DremioUserResponse + return localVarReturnValue, nil + } + + return (*a.GetDremioUserExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListDremioUsers(ctx context.Context, projectId string, regionId string, dremioId string) ApiListDremioUsersRequest { + return ApiListDremioUsersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// ListDremioUsersExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListDremioUsersExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListDremioUsersExecute(r ApiListDremioUsersRequest) (*ListDremioUsersResponse, error) { + if a.ListDremioUsersExecuteMock == nil { + var localVarReturnValue *ListDremioUsersResponse + return localVarReturnValue, nil + } + + return (*a.ListDremioUsersExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListDremios(ctx context.Context, projectId string, regionId string) ApiListDremiosRequest { + return ApiListDremiosRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// ListDremiosExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListDremiosExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListDremiosExecute(r ApiListDremiosRequest) (*ListDremiosResponse, error) { + if a.ListDremiosExecuteMock == nil { + var localVarReturnValue *ListDremiosResponse + return localVarReturnValue, nil + } + + return (*a.ListDremiosExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateDremio(ctx context.Context, projectId string, regionId string, dremioId string) ApiUpdateDremioRequest { + return ApiUpdateDremioRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + dremioId: dremioId, + } +} + +// UpdateDremioExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateDremioExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateDremioExecute(r ApiUpdateDremioRequest) (*DremioResponse, error) { + if a.UpdateDremioExecuteMock == nil { + var localVarReturnValue *DremioResponse + return localVarReturnValue, nil + } + + return (*a.UpdateDremioExecuteMock)(r) +} diff --git a/services/dremio/v1alphaapi/client.go b/services/dremio/v1alphaapi/client.go new file mode 100644 index 000000000..6101759c1 --- /dev/null +++ b/services/dremio/v1alphaapi/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Dremio API API v1alpha.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/dremio/v1alphaapi/configuration.go b/services/dremio/v1alphaapi/configuration.go new file mode 100644 index 000000000..0ddc9c9df --- /dev/null +++ b/services/dremio/v1alphaapi/configuration.go @@ -0,0 +1,40 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/dremio", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://dremio.api.{region}stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "eu01.", + EnumValues: []string{ + "eu01.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/dremio/v1alphaapi/model_auth_parameters.go b/services/dremio/v1alphaapi/model_auth_parameters.go new file mode 100644 index 000000000..42b8f3a01 --- /dev/null +++ b/services/dremio/v1alphaapi/model_auth_parameters.go @@ -0,0 +1,195 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the AuthParameters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthParameters{} + +// AuthParameters An additional parameter the Identity Provider requires. +type AuthParameters struct { + Name string `json:"name"` + Value string `json:"value"` + AdditionalProperties map[string]interface{} +} + +type _AuthParameters AuthParameters + +// NewAuthParameters instantiates a new AuthParameters 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 NewAuthParameters(name string, value string) *AuthParameters { + this := AuthParameters{} + this.Name = name + this.Value = value + return &this +} + +// NewAuthParametersWithDefaults instantiates a new AuthParameters 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 NewAuthParametersWithDefaults() *AuthParameters { + this := AuthParameters{} + return &this +} + +// GetName returns the Name field value +func (o *AuthParameters) 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 *AuthParameters) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *AuthParameters) SetName(v string) { + o.Name = v +} + +// GetValue returns the Value field value +func (o *AuthParameters) GetValue() string { + if o == nil { + var ret string + return ret + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *AuthParameters) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value +func (o *AuthParameters) SetValue(v string) { + o.Value = v +} + +func (o AuthParameters) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AuthParameters) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AuthParameters) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "value", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAuthParameters := _AuthParameters{} + + err = json.Unmarshal(data, &varAuthParameters) + + if err != nil { + return err + } + + *o = AuthParameters(varAuthParameters) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "value") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAuthParameters struct { + value *AuthParameters + isSet bool +} + +func (v NullableAuthParameters) Get() *AuthParameters { + return v.value +} + +func (v *NullableAuthParameters) Set(val *AuthParameters) { + v.value = val + v.isSet = true +} + +func (v NullableAuthParameters) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthParameters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthParameters(val *AuthParameters) *NullableAuthParameters { + return &NullableAuthParameters{value: val, isSet: true} +} + +func (v NullableAuthParameters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthParameters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_authentication.go b/services/dremio/v1alphaapi/model_authentication.go new file mode 100644 index 000000000..3f4f08fcd --- /dev/null +++ b/services/dremio/v1alphaapi/model_authentication.go @@ -0,0 +1,240 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Authentication type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Authentication{} + +// Authentication Dremio authentication settings. A change here triggers a Dremio restart and will incur downtime. +type Authentication struct { + Azuread *Azuread `json:"azuread,omitempty"` + Oauth *Oauth `json:"oauth,omitempty"` + Type string `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _Authentication Authentication + +// NewAuthentication instantiates a new Authentication 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 NewAuthentication(types string) *Authentication { + this := Authentication{} + this.Type = types + return &this +} + +// NewAuthenticationWithDefaults instantiates a new Authentication 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 NewAuthenticationWithDefaults() *Authentication { + this := Authentication{} + return &this +} + +// GetAzuread returns the Azuread field value if set, zero value otherwise. +func (o *Authentication) GetAzuread() Azuread { + if o == nil || IsNil(o.Azuread) { + var ret Azuread + return ret + } + return *o.Azuread +} + +// GetAzureadOk returns a tuple with the Azuread field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Authentication) GetAzureadOk() (*Azuread, bool) { + if o == nil || IsNil(o.Azuread) { + return nil, false + } + return o.Azuread, true +} + +// HasAzuread returns a boolean if a field has been set. +func (o *Authentication) HasAzuread() bool { + if o != nil && !IsNil(o.Azuread) { + return true + } + + return false +} + +// SetAzuread gets a reference to the given Azuread and assigns it to the Azuread field. +func (o *Authentication) SetAzuread(v Azuread) { + o.Azuread = &v +} + +// GetOauth returns the Oauth field value if set, zero value otherwise. +func (o *Authentication) GetOauth() Oauth { + if o == nil || IsNil(o.Oauth) { + var ret Oauth + return ret + } + return *o.Oauth +} + +// GetOauthOk returns a tuple with the Oauth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Authentication) GetOauthOk() (*Oauth, bool) { + if o == nil || IsNil(o.Oauth) { + return nil, false + } + return o.Oauth, true +} + +// HasOauth returns a boolean if a field has been set. +func (o *Authentication) HasOauth() bool { + if o != nil && !IsNil(o.Oauth) { + return true + } + + return false +} + +// SetOauth gets a reference to the given Oauth and assigns it to the Oauth field. +func (o *Authentication) SetOauth(v Oauth) { + o.Oauth = &v +} + +// GetType returns the Type field value +func (o *Authentication) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *Authentication) SetType(v string) { + o.Type = v +} + +func (o Authentication) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Authentication) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Azuread) { + toSerialize["azuread"] = o.Azuread + } + if !IsNil(o.Oauth) { + toSerialize["oauth"] = o.Oauth + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Authentication) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAuthentication := _Authentication{} + + err = json.Unmarshal(data, &varAuthentication) + + if err != nil { + return err + } + + *o = Authentication(varAuthentication) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "azuread") + delete(additionalProperties, "oauth") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAuthentication struct { + value *Authentication + isSet bool +} + +func (v NullableAuthentication) Get() *Authentication { + return v.value +} + +func (v *NullableAuthentication) Set(val *Authentication) { + v.value = val + v.isSet = true +} + +func (v NullableAuthentication) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthentication) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthentication(val *Authentication) *NullableAuthentication { + return &NullableAuthentication{value: val, isSet: true} +} + +func (v NullableAuthentication) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthentication) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_azuread.go b/services/dremio/v1alphaapi/model_azuread.go new file mode 100644 index 000000000..b001d5f91 --- /dev/null +++ b/services/dremio/v1alphaapi/model_azuread.go @@ -0,0 +1,265 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Azuread type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Azuread{} + +// Azuread Azure Active Directory authentication configuration. +type Azuread struct { + // The Azure AD authority URL. + AuthorityUrl string `json:"authorityUrl"` + // The Azure AD client ID. + ClientId string `json:"clientId"` + // The Azure AD client secret. + ClientSecret string `json:"clientSecret"` + // The Azure AD redirect URL. + RedirectUrl *string `json:"redirectUrl,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Azuread Azuread + +// NewAzuread instantiates a new Azuread 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 NewAzuread(authorityUrl string, clientId string, clientSecret string) *Azuread { + this := Azuread{} + this.AuthorityUrl = authorityUrl + this.ClientId = clientId + this.ClientSecret = clientSecret + return &this +} + +// NewAzureadWithDefaults instantiates a new Azuread 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 NewAzureadWithDefaults() *Azuread { + this := Azuread{} + return &this +} + +// GetAuthorityUrl returns the AuthorityUrl field value +func (o *Azuread) GetAuthorityUrl() string { + if o == nil { + var ret string + return ret + } + + return o.AuthorityUrl +} + +// GetAuthorityUrlOk returns a tuple with the AuthorityUrl field value +// and a boolean to check if the value has been set. +func (o *Azuread) GetAuthorityUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AuthorityUrl, true +} + +// SetAuthorityUrl sets field value +func (o *Azuread) SetAuthorityUrl(v string) { + o.AuthorityUrl = v +} + +// GetClientId returns the ClientId field value +func (o *Azuread) GetClientId() string { + if o == nil { + var ret string + return ret + } + + return o.ClientId +} + +// GetClientIdOk returns a tuple with the ClientId field value +// and a boolean to check if the value has been set. +func (o *Azuread) GetClientIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientId, true +} + +// SetClientId sets field value +func (o *Azuread) SetClientId(v string) { + o.ClientId = v +} + +// GetClientSecret returns the ClientSecret field value +func (o *Azuread) GetClientSecret() string { + if o == nil { + var ret string + return ret + } + + return o.ClientSecret +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value +// and a boolean to check if the value has been set. +func (o *Azuread) GetClientSecretOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientSecret, true +} + +// SetClientSecret sets field value +func (o *Azuread) SetClientSecret(v string) { + o.ClientSecret = v +} + +// GetRedirectUrl returns the RedirectUrl field value if set, zero value otherwise. +func (o *Azuread) GetRedirectUrl() string { + if o == nil || IsNil(o.RedirectUrl) { + var ret string + return ret + } + return *o.RedirectUrl +} + +// GetRedirectUrlOk returns a tuple with the RedirectUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Azuread) GetRedirectUrlOk() (*string, bool) { + if o == nil || IsNil(o.RedirectUrl) { + return nil, false + } + return o.RedirectUrl, true +} + +// HasRedirectUrl returns a boolean if a field has been set. +func (o *Azuread) HasRedirectUrl() bool { + if o != nil && !IsNil(o.RedirectUrl) { + return true + } + + return false +} + +// SetRedirectUrl gets a reference to the given string and assigns it to the RedirectUrl field. +func (o *Azuread) SetRedirectUrl(v string) { + o.RedirectUrl = &v +} + +func (o Azuread) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Azuread) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["authorityUrl"] = o.AuthorityUrl + toSerialize["clientId"] = o.ClientId + toSerialize["clientSecret"] = o.ClientSecret + if !IsNil(o.RedirectUrl) { + toSerialize["redirectUrl"] = o.RedirectUrl + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Azuread) 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{ + "authorityUrl", + "clientId", + "clientSecret", + } + + 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) + } + } + + varAzuread := _Azuread{} + + err = json.Unmarshal(data, &varAzuread) + + if err != nil { + return err + } + + *o = Azuread(varAzuread) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "authorityUrl") + delete(additionalProperties, "clientId") + delete(additionalProperties, "clientSecret") + delete(additionalProperties, "redirectUrl") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAzuread struct { + value *Azuread + isSet bool +} + +func (v NullableAzuread) Get() *Azuread { + return v.value +} + +func (v *NullableAzuread) Set(val *Azuread) { + v.value = val + v.isSet = true +} + +func (v NullableAzuread) IsSet() bool { + return v.isSet +} + +func (v *NullableAzuread) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAzuread(val *Azuread) *NullableAzuread { + return &NullableAzuread{value: val, isSet: true} +} + +func (v NullableAzuread) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAzuread) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_create_dremio_payload.go b/services/dremio/v1alphaapi/model_create_dremio_payload.go new file mode 100644 index 000000000..033b14c15 --- /dev/null +++ b/services/dremio/v1alphaapi/model_create_dremio_payload.go @@ -0,0 +1,242 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateDremioPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDremioPayload{} + +// CreateDremioPayload struct for CreateDremioPayload +type CreateDremioPayload struct { + Authentication *Authentication `json:"authentication,omitempty"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9 ]*$"` + AdditionalProperties map[string]interface{} +} + +type _CreateDremioPayload CreateDremioPayload + +// NewCreateDremioPayload instantiates a new CreateDremioPayload 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 NewCreateDremioPayload(displayName string) *CreateDremioPayload { + this := CreateDremioPayload{} + this.DisplayName = displayName + return &this +} + +// NewCreateDremioPayloadWithDefaults instantiates a new CreateDremioPayload 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 NewCreateDremioPayloadWithDefaults() *CreateDremioPayload { + this := CreateDremioPayload{} + return &this +} + +// GetAuthentication returns the Authentication field value if set, zero value otherwise. +func (o *CreateDremioPayload) GetAuthentication() Authentication { + if o == nil || IsNil(o.Authentication) { + var ret Authentication + return ret + } + return *o.Authentication +} + +// GetAuthenticationOk returns a tuple with the Authentication field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDremioPayload) GetAuthenticationOk() (*Authentication, bool) { + if o == nil || IsNil(o.Authentication) { + return nil, false + } + return o.Authentication, true +} + +// HasAuthentication returns a boolean if a field has been set. +func (o *CreateDremioPayload) HasAuthentication() bool { + if o != nil && !IsNil(o.Authentication) { + return true + } + + return false +} + +// SetAuthentication gets a reference to the given Authentication and assigns it to the Authentication field. +func (o *CreateDremioPayload) SetAuthentication(v Authentication) { + o.Authentication = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateDremioPayload) 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 *CreateDremioPayload) 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 *CreateDremioPayload) 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 *CreateDremioPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateDremioPayload) 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 *CreateDremioPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateDremioPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +func (o CreateDremioPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateDremioPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Authentication) { + toSerialize["authentication"] = o.Authentication + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateDremioPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + } + + 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) + } + } + + varCreateDremioPayload := _CreateDremioPayload{} + + err = json.Unmarshal(data, &varCreateDremioPayload) + + if err != nil { + return err + } + + *o = CreateDremioPayload(varCreateDremioPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "authentication") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateDremioPayload struct { + value *CreateDremioPayload + isSet bool +} + +func (v NullableCreateDremioPayload) Get() *CreateDremioPayload { + return v.value +} + +func (v *NullableCreateDremioPayload) Set(val *CreateDremioPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDremioPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDremioPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDremioPayload(val *CreateDremioPayload) *NullableCreateDremioPayload { + return &NullableCreateDremioPayload{value: val, isSet: true} +} + +func (v NullableCreateDremioPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDremioPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_create_dremio_user_payload.go b/services/dremio/v1alphaapi/model_create_dremio_user_payload.go new file mode 100644 index 000000000..cd2703302 --- /dev/null +++ b/services/dremio/v1alphaapi/model_create_dremio_user_payload.go @@ -0,0 +1,325 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateDremioUserPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDremioUserPayload{} + +// CreateDremioUserPayload struct for CreateDremioUserPayload +type CreateDremioUserPayload struct { + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // This is the admin user's email address. + Email string `json:"email"` + // This is the admin user's first name. + FirstName string `json:"firstName"` + // This is the admin user's last name. + LastName string `json:"lastName"` + // This is the username used to login the admin user. + Name string `json:"name"` + // A password chosen by the user. + Password string `json:"password"` + AdditionalProperties map[string]interface{} +} + +type _CreateDremioUserPayload CreateDremioUserPayload + +// NewCreateDremioUserPayload instantiates a new CreateDremioUserPayload 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 NewCreateDremioUserPayload(email string, firstName string, lastName string, name string, password string) *CreateDremioUserPayload { + this := CreateDremioUserPayload{} + this.Email = email + this.FirstName = firstName + this.LastName = lastName + this.Name = name + this.Password = password + return &this +} + +// NewCreateDremioUserPayloadWithDefaults instantiates a new CreateDremioUserPayload 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 NewCreateDremioUserPayloadWithDefaults() *CreateDremioUserPayload { + this := CreateDremioUserPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateDremioUserPayload) 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 *CreateDremioUserPayload) 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 *CreateDremioUserPayload) 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 *CreateDremioUserPayload) SetDescription(v string) { + o.Description = &v +} + +// GetEmail returns the Email field value +func (o *CreateDremioUserPayload) GetEmail() string { + if o == nil { + var ret string + return ret + } + + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *CreateDremioUserPayload) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value +func (o *CreateDremioUserPayload) SetEmail(v string) { + o.Email = v +} + +// GetFirstName returns the FirstName field value +func (o *CreateDremioUserPayload) GetFirstName() string { + if o == nil { + var ret string + return ret + } + + return o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value +// and a boolean to check if the value has been set. +func (o *CreateDremioUserPayload) GetFirstNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FirstName, true +} + +// SetFirstName sets field value +func (o *CreateDremioUserPayload) SetFirstName(v string) { + o.FirstName = v +} + +// GetLastName returns the LastName field value +func (o *CreateDremioUserPayload) GetLastName() string { + if o == nil { + var ret string + return ret + } + + return o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value +// and a boolean to check if the value has been set. +func (o *CreateDremioUserPayload) GetLastNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.LastName, true +} + +// SetLastName sets field value +func (o *CreateDremioUserPayload) SetLastName(v string) { + o.LastName = v +} + +// GetName returns the Name field value +func (o *CreateDremioUserPayload) 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 *CreateDremioUserPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateDremioUserPayload) SetName(v string) { + o.Name = v +} + +// GetPassword returns the Password field value +func (o *CreateDremioUserPayload) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *CreateDremioUserPayload) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *CreateDremioUserPayload) SetPassword(v string) { + o.Password = v +} + +func (o CreateDremioUserPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateDremioUserPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["email"] = o.Email + toSerialize["firstName"] = o.FirstName + toSerialize["lastName"] = o.LastName + toSerialize["name"] = o.Name + toSerialize["password"] = o.Password + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateDremioUserPayload) 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{ + "email", + "firstName", + "lastName", + "name", + "password", + } + + 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) + } + } + + varCreateDremioUserPayload := _CreateDremioUserPayload{} + + err = json.Unmarshal(data, &varCreateDremioUserPayload) + + if err != nil { + return err + } + + *o = CreateDremioUserPayload(varCreateDremioUserPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "email") + delete(additionalProperties, "firstName") + delete(additionalProperties, "lastName") + delete(additionalProperties, "name") + delete(additionalProperties, "password") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateDremioUserPayload struct { + value *CreateDremioUserPayload + isSet bool +} + +func (v NullableCreateDremioUserPayload) Get() *CreateDremioUserPayload { + return v.value +} + +func (v *NullableCreateDremioUserPayload) Set(val *CreateDremioUserPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDremioUserPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDremioUserPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDremioUserPayload(val *CreateDremioUserPayload) *NullableCreateDremioUserPayload { + return &NullableCreateDremioUserPayload{value: val, isSet: true} +} + +func (v NullableCreateDremioUserPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDremioUserPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_dremio_response.go b/services/dremio/v1alphaapi/model_dremio_response.go new file mode 100644 index 000000000..6ddcbddb8 --- /dev/null +++ b/services/dremio/v1alphaapi/model_dremio_response.go @@ -0,0 +1,392 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the DremioResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DremioResponse{} + +// DremioResponse struct for DremioResponse +type DremioResponse struct { + Authentication Authentication `json:"authentication"` + // The point in time the resource was created. + CreateTime time.Time `json:"create_time"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9 ]*$"` + Endpoints Endpoints `json:"endpoints"` + // A message describing an actionable error the user can resolve. This field is empty if no such error exists. + ErrorMessage *string `json:"errorMessage,omitempty"` + // A auto generated unique id which identifies the resource. + Id string `json:"id"` + // The current state of the resource. + State string `json:"state"` + AdditionalProperties map[string]interface{} +} + +type _DremioResponse DremioResponse + +// NewDremioResponse instantiates a new DremioResponse 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 NewDremioResponse(authentication Authentication, createTime time.Time, displayName string, endpoints Endpoints, id string, state string) *DremioResponse { + this := DremioResponse{} + this.Authentication = authentication + this.CreateTime = createTime + this.DisplayName = displayName + this.Endpoints = endpoints + this.Id = id + this.State = state + return &this +} + +// NewDremioResponseWithDefaults instantiates a new DremioResponse 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 NewDremioResponseWithDefaults() *DremioResponse { + this := DremioResponse{} + return &this +} + +// GetAuthentication returns the Authentication field value +func (o *DremioResponse) GetAuthentication() Authentication { + if o == nil { + var ret Authentication + return ret + } + + return o.Authentication +} + +// GetAuthenticationOk returns a tuple with the Authentication field value +// and a boolean to check if the value has been set. +func (o *DremioResponse) GetAuthenticationOk() (*Authentication, bool) { + if o == nil { + return nil, false + } + return &o.Authentication, true +} + +// SetAuthentication sets field value +func (o *DremioResponse) SetAuthentication(v Authentication) { + o.Authentication = v +} + +// GetCreateTime returns the CreateTime field value +func (o *DremioResponse) 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 *DremioResponse) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *DremioResponse) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DremioResponse) 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 *DremioResponse) 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 *DremioResponse) 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 *DremioResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *DremioResponse) 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 *DremioResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *DremioResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetEndpoints returns the Endpoints field value +func (o *DremioResponse) GetEndpoints() Endpoints { + if o == nil { + var ret Endpoints + return ret + } + + return o.Endpoints +} + +// GetEndpointsOk returns a tuple with the Endpoints field value +// and a boolean to check if the value has been set. +func (o *DremioResponse) GetEndpointsOk() (*Endpoints, bool) { + if o == nil { + return nil, false + } + return &o.Endpoints, true +} + +// SetEndpoints sets field value +func (o *DremioResponse) SetEndpoints(v Endpoints) { + o.Endpoints = v +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *DremioResponse) GetErrorMessage() string { + if o == nil || IsNil(o.ErrorMessage) { + var ret string + return ret + } + return *o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DremioResponse) GetErrorMessageOk() (*string, bool) { + if o == nil || IsNil(o.ErrorMessage) { + return nil, false + } + return o.ErrorMessage, true +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *DremioResponse) HasErrorMessage() bool { + if o != nil && !IsNil(o.ErrorMessage) { + return true + } + + return false +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *DremioResponse) SetErrorMessage(v string) { + o.ErrorMessage = &v +} + +// GetId returns the Id field value +func (o *DremioResponse) 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 *DremioResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *DremioResponse) SetId(v string) { + o.Id = v +} + +// GetState returns the State field value +func (o *DremioResponse) 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 *DremioResponse) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *DremioResponse) SetState(v string) { + o.State = v +} + +func (o DremioResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DremioResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["authentication"] = o.Authentication + toSerialize["create_time"] = o.CreateTime + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["endpoints"] = o.Endpoints + if !IsNil(o.ErrorMessage) { + toSerialize["errorMessage"] = o.ErrorMessage + } + toSerialize["id"] = o.Id + toSerialize["state"] = o.State + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DremioResponse) 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{ + "authentication", + "create_time", + "displayName", + "endpoints", + "id", + "state", + } + + 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) + } + } + + varDremioResponse := _DremioResponse{} + + err = json.Unmarshal(data, &varDremioResponse) + + if err != nil { + return err + } + + *o = DremioResponse(varDremioResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "authentication") + delete(additionalProperties, "create_time") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "endpoints") + delete(additionalProperties, "errorMessage") + delete(additionalProperties, "id") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDremioResponse struct { + value *DremioResponse + isSet bool +} + +func (v NullableDremioResponse) Get() *DremioResponse { + return v.value +} + +func (v *NullableDremioResponse) Set(val *DremioResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDremioResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDremioResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDremioResponse(val *DremioResponse) *NullableDremioResponse { + return &NullableDremioResponse{value: val, isSet: true} +} + +func (v NullableDremioResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDremioResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_dremio_user_response.go b/services/dremio/v1alphaapi/model_dremio_user_response.go new file mode 100644 index 000000000..5b61e1a11 --- /dev/null +++ b/services/dremio/v1alphaapi/model_dremio_user_response.go @@ -0,0 +1,432 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the DremioUserResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DremioUserResponse{} + +// DremioUserResponse struct for DremioUserResponse +type DremioUserResponse struct { + // The point in time the resource was created. + CreateTime *time.Time `json:"create_time,omitempty"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // This is the admin user's email address. + Email string `json:"email"` + // A message describing an actionable error the user can resolve. This field is empty if no such error exists. + ErrorMessage *string `json:"errorMessage,omitempty"` + // This is the admin user's first name. + FirstName string `json:"firstName"` + // A auto generated unique id which identifies the resource. + Id string `json:"id"` + // This is the admin user's last name. + LastName string `json:"lastName"` + // This is the username used to login the admin user. + Name string `json:"name"` + // The current state of the resource. + State string `json:"state"` + AdditionalProperties map[string]interface{} +} + +type _DremioUserResponse DremioUserResponse + +// NewDremioUserResponse instantiates a new DremioUserResponse 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 NewDremioUserResponse(email string, firstName string, id string, lastName string, name string, state string) *DremioUserResponse { + this := DremioUserResponse{} + this.Email = email + this.FirstName = firstName + this.Id = id + this.LastName = lastName + this.Name = name + this.State = state + return &this +} + +// NewDremioUserResponseWithDefaults instantiates a new DremioUserResponse 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 NewDremioUserResponseWithDefaults() *DremioUserResponse { + this := DremioUserResponse{} + return &this +} + +// GetCreateTime returns the CreateTime field value if set, zero value otherwise. +func (o *DremioUserResponse) GetCreateTime() time.Time { + if o == nil || IsNil(o.CreateTime) { + var ret time.Time + return ret + } + return *o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DremioUserResponse) GetCreateTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreateTime) { + return nil, false + } + return o.CreateTime, true +} + +// HasCreateTime returns a boolean if a field has been set. +func (o *DremioUserResponse) HasCreateTime() bool { + if o != nil && !IsNil(o.CreateTime) { + return true + } + + return false +} + +// SetCreateTime gets a reference to the given time.Time and assigns it to the CreateTime field. +func (o *DremioUserResponse) SetCreateTime(v time.Time) { + o.CreateTime = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DremioUserResponse) 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 *DremioUserResponse) 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 *DremioUserResponse) 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 *DremioUserResponse) SetDescription(v string) { + o.Description = &v +} + +// GetEmail returns the Email field value +func (o *DremioUserResponse) GetEmail() string { + if o == nil { + var ret string + return ret + } + + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *DremioUserResponse) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value +func (o *DremioUserResponse) SetEmail(v string) { + o.Email = v +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *DremioUserResponse) GetErrorMessage() string { + if o == nil || IsNil(o.ErrorMessage) { + var ret string + return ret + } + return *o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DremioUserResponse) GetErrorMessageOk() (*string, bool) { + if o == nil || IsNil(o.ErrorMessage) { + return nil, false + } + return o.ErrorMessage, true +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *DremioUserResponse) HasErrorMessage() bool { + if o != nil && !IsNil(o.ErrorMessage) { + return true + } + + return false +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *DremioUserResponse) SetErrorMessage(v string) { + o.ErrorMessage = &v +} + +// GetFirstName returns the FirstName field value +func (o *DremioUserResponse) GetFirstName() string { + if o == nil { + var ret string + return ret + } + + return o.FirstName +} + +// GetFirstNameOk returns a tuple with the FirstName field value +// and a boolean to check if the value has been set. +func (o *DremioUserResponse) GetFirstNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FirstName, true +} + +// SetFirstName sets field value +func (o *DremioUserResponse) SetFirstName(v string) { + o.FirstName = v +} + +// GetId returns the Id field value +func (o *DremioUserResponse) 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 *DremioUserResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *DremioUserResponse) SetId(v string) { + o.Id = v +} + +// GetLastName returns the LastName field value +func (o *DremioUserResponse) GetLastName() string { + if o == nil { + var ret string + return ret + } + + return o.LastName +} + +// GetLastNameOk returns a tuple with the LastName field value +// and a boolean to check if the value has been set. +func (o *DremioUserResponse) GetLastNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.LastName, true +} + +// SetLastName sets field value +func (o *DremioUserResponse) SetLastName(v string) { + o.LastName = v +} + +// GetName returns the Name field value +func (o *DremioUserResponse) 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 *DremioUserResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *DremioUserResponse) SetName(v string) { + o.Name = v +} + +// GetState returns the State field value +func (o *DremioUserResponse) 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 *DremioUserResponse) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *DremioUserResponse) SetState(v string) { + o.State = v +} + +func (o DremioUserResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DremioUserResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreateTime) { + toSerialize["create_time"] = o.CreateTime + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["email"] = o.Email + if !IsNil(o.ErrorMessage) { + toSerialize["errorMessage"] = o.ErrorMessage + } + toSerialize["firstName"] = o.FirstName + toSerialize["id"] = o.Id + toSerialize["lastName"] = o.LastName + toSerialize["name"] = o.Name + toSerialize["state"] = o.State + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DremioUserResponse) 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{ + "email", + "firstName", + "id", + "lastName", + "name", + "state", + } + + 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) + } + } + + varDremioUserResponse := _DremioUserResponse{} + + err = json.Unmarshal(data, &varDremioUserResponse) + + if err != nil { + return err + } + + *o = DremioUserResponse(varDremioUserResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "create_time") + delete(additionalProperties, "description") + delete(additionalProperties, "email") + delete(additionalProperties, "errorMessage") + delete(additionalProperties, "firstName") + delete(additionalProperties, "id") + delete(additionalProperties, "lastName") + delete(additionalProperties, "name") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDremioUserResponse struct { + value *DremioUserResponse + isSet bool +} + +func (v NullableDremioUserResponse) Get() *DremioUserResponse { + return v.value +} + +func (v *NullableDremioUserResponse) Set(val *DremioUserResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDremioUserResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDremioUserResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDremioUserResponse(val *DremioUserResponse) *NullableDremioUserResponse { + return &NullableDremioUserResponse{value: val, isSet: true} +} + +func (v NullableDremioUserResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDremioUserResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_endpoints.go b/services/dremio/v1alphaapi/model_endpoints.go new file mode 100644 index 000000000..1d2ec56ab --- /dev/null +++ b/services/dremio/v1alphaapi/model_endpoints.go @@ -0,0 +1,227 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Endpoints type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Endpoints{} + +// Endpoints A collection of endpoints offered by the Dremio instance. +type Endpoints struct { + // The URL for the Arrow Flight endpoint of the Dremio instance. + ArrowFlight string `json:"arrowFlight"` + // The URL for the Catalog endpoint of the Dremio instance. + Catalog string `json:"catalog"` + // The URL for the UI of the Dremio instance. + Ui string `json:"ui"` + AdditionalProperties map[string]interface{} +} + +type _Endpoints Endpoints + +// NewEndpoints instantiates a new Endpoints object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEndpoints(arrowFlight string, catalog string, ui string) *Endpoints { + this := Endpoints{} + this.ArrowFlight = arrowFlight + this.Catalog = catalog + this.Ui = ui + return &this +} + +// NewEndpointsWithDefaults instantiates a new Endpoints object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEndpointsWithDefaults() *Endpoints { + this := Endpoints{} + return &this +} + +// GetArrowFlight returns the ArrowFlight field value +func (o *Endpoints) GetArrowFlight() string { + if o == nil { + var ret string + return ret + } + + return o.ArrowFlight +} + +// GetArrowFlightOk returns a tuple with the ArrowFlight field value +// and a boolean to check if the value has been set. +func (o *Endpoints) GetArrowFlightOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ArrowFlight, true +} + +// SetArrowFlight sets field value +func (o *Endpoints) SetArrowFlight(v string) { + o.ArrowFlight = v +} + +// GetCatalog returns the Catalog field value +func (o *Endpoints) GetCatalog() string { + if o == nil { + var ret string + return ret + } + + return o.Catalog +} + +// GetCatalogOk returns a tuple with the Catalog field value +// and a boolean to check if the value has been set. +func (o *Endpoints) GetCatalogOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Catalog, true +} + +// SetCatalog sets field value +func (o *Endpoints) SetCatalog(v string) { + o.Catalog = v +} + +// GetUi returns the Ui field value +func (o *Endpoints) GetUi() string { + if o == nil { + var ret string + return ret + } + + return o.Ui +} + +// GetUiOk returns a tuple with the Ui field value +// and a boolean to check if the value has been set. +func (o *Endpoints) GetUiOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Ui, true +} + +// SetUi sets field value +func (o *Endpoints) SetUi(v string) { + o.Ui = v +} + +func (o Endpoints) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Endpoints) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["arrowFlight"] = o.ArrowFlight + toSerialize["catalog"] = o.Catalog + toSerialize["ui"] = o.Ui + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Endpoints) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "arrowFlight", + "catalog", + "ui", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varEndpoints := _Endpoints{} + + err = json.Unmarshal(data, &varEndpoints) + + if err != nil { + return err + } + + *o = Endpoints(varEndpoints) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "arrowFlight") + delete(additionalProperties, "catalog") + delete(additionalProperties, "ui") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEndpoints struct { + value *Endpoints + isSet bool +} + +func (v NullableEndpoints) Get() *Endpoints { + return v.value +} + +func (v *NullableEndpoints) Set(val *Endpoints) { + v.value = val + v.isSet = true +} + +func (v NullableEndpoints) IsSet() bool { + return v.isSet +} + +func (v *NullableEndpoints) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEndpoints(val *Endpoints) *NullableEndpoints { + return &NullableEndpoints{value: val, isSet: true} +} + +func (v NullableEndpoints) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEndpoints) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_list_dremio_users_response.go b/services/dremio/v1alphaapi/model_list_dremio_users_response.go new file mode 100644 index 000000000..14d194c3c --- /dev/null +++ b/services/dremio/v1alphaapi/model_list_dremio_users_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListDremioUsersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDremioUsersResponse{} + +// ListDremioUsersResponse struct for ListDremioUsersResponse +type ListDremioUsersResponse struct { + DremioUsers []DremioUserResponse `json:"dremioUsers"` + // A token to retrieve the next page of results. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListDremioUsersResponse ListDremioUsersResponse + +// NewListDremioUsersResponse instantiates a new ListDremioUsersResponse 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 NewListDremioUsersResponse(dremioUsers []DremioUserResponse) *ListDremioUsersResponse { + this := ListDremioUsersResponse{} + this.DremioUsers = dremioUsers + return &this +} + +// NewListDremioUsersResponseWithDefaults instantiates a new ListDremioUsersResponse 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 NewListDremioUsersResponseWithDefaults() *ListDremioUsersResponse { + this := ListDremioUsersResponse{} + return &this +} + +// GetDremioUsers returns the DremioUsers field value +func (o *ListDremioUsersResponse) GetDremioUsers() []DremioUserResponse { + if o == nil { + var ret []DremioUserResponse + return ret + } + + return o.DremioUsers +} + +// GetDremioUsersOk returns a tuple with the DremioUsers field value +// and a boolean to check if the value has been set. +func (o *ListDremioUsersResponse) GetDremioUsersOk() ([]DremioUserResponse, bool) { + if o == nil { + return nil, false + } + return o.DremioUsers, true +} + +// SetDremioUsers sets field value +func (o *ListDremioUsersResponse) SetDremioUsers(v []DremioUserResponse) { + o.DremioUsers = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListDremioUsersResponse) 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 *ListDremioUsersResponse) 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 *ListDremioUsersResponse) 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 *ListDremioUsersResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ListDremioUsersResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListDremioUsersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["dremioUsers"] = o.DremioUsers + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListDremioUsersResponse) 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{ + "dremioUsers", + } + + 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) + } + } + + varListDremioUsersResponse := _ListDremioUsersResponse{} + + err = json.Unmarshal(data, &varListDremioUsersResponse) + + if err != nil { + return err + } + + *o = ListDremioUsersResponse(varListDremioUsersResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "dremioUsers") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListDremioUsersResponse struct { + value *ListDremioUsersResponse + isSet bool +} + +func (v NullableListDremioUsersResponse) Get() *ListDremioUsersResponse { + return v.value +} + +func (v *NullableListDremioUsersResponse) Set(val *ListDremioUsersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListDremioUsersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListDremioUsersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDremioUsersResponse(val *ListDremioUsersResponse) *NullableListDremioUsersResponse { + return &NullableListDremioUsersResponse{value: val, isSet: true} +} + +func (v NullableListDremioUsersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDremioUsersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_list_dremios_response.go b/services/dremio/v1alphaapi/model_list_dremios_response.go new file mode 100644 index 000000000..48e00ff4d --- /dev/null +++ b/services/dremio/v1alphaapi/model_list_dremios_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListDremiosResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDremiosResponse{} + +// ListDremiosResponse struct for ListDremiosResponse +type ListDremiosResponse struct { + Dremios []DremioResponse `json:"dremios"` + // A token to retrieve the next page of results. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListDremiosResponse ListDremiosResponse + +// NewListDremiosResponse instantiates a new ListDremiosResponse 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 NewListDremiosResponse(dremios []DremioResponse) *ListDremiosResponse { + this := ListDremiosResponse{} + this.Dremios = dremios + return &this +} + +// NewListDremiosResponseWithDefaults instantiates a new ListDremiosResponse 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 NewListDremiosResponseWithDefaults() *ListDremiosResponse { + this := ListDremiosResponse{} + return &this +} + +// GetDremios returns the Dremios field value +func (o *ListDremiosResponse) GetDremios() []DremioResponse { + if o == nil { + var ret []DremioResponse + return ret + } + + return o.Dremios +} + +// GetDremiosOk returns a tuple with the Dremios field value +// and a boolean to check if the value has been set. +func (o *ListDremiosResponse) GetDremiosOk() ([]DremioResponse, bool) { + if o == nil { + return nil, false + } + return o.Dremios, true +} + +// SetDremios sets field value +func (o *ListDremiosResponse) SetDremios(v []DremioResponse) { + o.Dremios = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListDremiosResponse) 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 *ListDremiosResponse) 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 *ListDremiosResponse) 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 *ListDremiosResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ListDremiosResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListDremiosResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["dremios"] = o.Dremios + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListDremiosResponse) 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{ + "dremios", + } + + 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) + } + } + + varListDremiosResponse := _ListDremiosResponse{} + + err = json.Unmarshal(data, &varListDremiosResponse) + + if err != nil { + return err + } + + *o = ListDremiosResponse(varListDremiosResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "dremios") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListDremiosResponse struct { + value *ListDremiosResponse + isSet bool +} + +func (v NullableListDremiosResponse) Get() *ListDremiosResponse { + return v.value +} + +func (v *NullableListDremiosResponse) Set(val *ListDremiosResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListDremiosResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListDremiosResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDremiosResponse(val *ListDremiosResponse) *NullableListDremiosResponse { + return &NullableListDremiosResponse{value: val, isSet: true} +} + +func (v NullableListDremiosResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDremiosResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_oauth.go b/services/dremio/v1alphaapi/model_oauth.go new file mode 100644 index 000000000..6716a612c --- /dev/null +++ b/services/dremio/v1alphaapi/model_oauth.go @@ -0,0 +1,374 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Oauth type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Oauth{} + +// Oauth OIDC authentication configuration. +type Oauth struct { + // The Issuer location URI, where the OIDC provider configuration can be found. + AuthorityUrl string `json:"authorityUrl"` + // The client ID assigned by the Identity Provider. + ClientId string `json:"clientId"` + // The client secret generated by the Identity Provider. + ClientSecret string `json:"clientSecret"` + JwtClaims OauthJwtClaims `json:"jwtClaims"` + // Any additional parameters the Identity Provider requires. + Parameters []AuthParameters `json:"parameters,omitempty"` + // The URL where Dremio is hosted. The URL must match the redirect URL set in the Identity Provider. + RedirectUrl *string `json:"redirectUrl,omitempty"` + // A list of space-separated scopes. The `openid` scope is always required; other scopes can vary by provider. + Scope *string `json:"scope,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Oauth Oauth + +// NewOauth instantiates a new Oauth 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 NewOauth(authorityUrl string, clientId string, clientSecret string, jwtClaims OauthJwtClaims) *Oauth { + this := Oauth{} + this.AuthorityUrl = authorityUrl + this.ClientId = clientId + this.ClientSecret = clientSecret + this.JwtClaims = jwtClaims + var scope string = "openid profile" + this.Scope = &scope + return &this +} + +// NewOauthWithDefaults instantiates a new Oauth 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 NewOauthWithDefaults() *Oauth { + this := Oauth{} + var scope string = "openid profile" + this.Scope = &scope + return &this +} + +// GetAuthorityUrl returns the AuthorityUrl field value +func (o *Oauth) GetAuthorityUrl() string { + if o == nil { + var ret string + return ret + } + + return o.AuthorityUrl +} + +// GetAuthorityUrlOk returns a tuple with the AuthorityUrl field value +// and a boolean to check if the value has been set. +func (o *Oauth) GetAuthorityUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AuthorityUrl, true +} + +// SetAuthorityUrl sets field value +func (o *Oauth) SetAuthorityUrl(v string) { + o.AuthorityUrl = v +} + +// GetClientId returns the ClientId field value +func (o *Oauth) GetClientId() string { + if o == nil { + var ret string + return ret + } + + return o.ClientId +} + +// GetClientIdOk returns a tuple with the ClientId field value +// and a boolean to check if the value has been set. +func (o *Oauth) GetClientIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientId, true +} + +// SetClientId sets field value +func (o *Oauth) SetClientId(v string) { + o.ClientId = v +} + +// GetClientSecret returns the ClientSecret field value +func (o *Oauth) GetClientSecret() string { + if o == nil { + var ret string + return ret + } + + return o.ClientSecret +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value +// and a boolean to check if the value has been set. +func (o *Oauth) GetClientSecretOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientSecret, true +} + +// SetClientSecret sets field value +func (o *Oauth) SetClientSecret(v string) { + o.ClientSecret = v +} + +// GetJwtClaims returns the JwtClaims field value +func (o *Oauth) GetJwtClaims() OauthJwtClaims { + if o == nil { + var ret OauthJwtClaims + return ret + } + + return o.JwtClaims +} + +// GetJwtClaimsOk returns a tuple with the JwtClaims field value +// and a boolean to check if the value has been set. +func (o *Oauth) GetJwtClaimsOk() (*OauthJwtClaims, bool) { + if o == nil { + return nil, false + } + return &o.JwtClaims, true +} + +// SetJwtClaims sets field value +func (o *Oauth) SetJwtClaims(v OauthJwtClaims) { + o.JwtClaims = v +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *Oauth) GetParameters() []AuthParameters { + if o == nil || IsNil(o.Parameters) { + var ret []AuthParameters + return ret + } + return o.Parameters +} + +// GetParametersOk returns a tuple with the Parameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Oauth) GetParametersOk() ([]AuthParameters, bool) { + if o == nil || IsNil(o.Parameters) { + return nil, false + } + return o.Parameters, true +} + +// HasParameters returns a boolean if a field has been set. +func (o *Oauth) HasParameters() bool { + if o != nil && !IsNil(o.Parameters) { + return true + } + + return false +} + +// SetParameters gets a reference to the given []AuthParameters and assigns it to the Parameters field. +func (o *Oauth) SetParameters(v []AuthParameters) { + o.Parameters = v +} + +// GetRedirectUrl returns the RedirectUrl field value if set, zero value otherwise. +func (o *Oauth) GetRedirectUrl() string { + if o == nil || IsNil(o.RedirectUrl) { + var ret string + return ret + } + return *o.RedirectUrl +} + +// GetRedirectUrlOk returns a tuple with the RedirectUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Oauth) GetRedirectUrlOk() (*string, bool) { + if o == nil || IsNil(o.RedirectUrl) { + return nil, false + } + return o.RedirectUrl, true +} + +// HasRedirectUrl returns a boolean if a field has been set. +func (o *Oauth) HasRedirectUrl() bool { + if o != nil && !IsNil(o.RedirectUrl) { + return true + } + + return false +} + +// SetRedirectUrl gets a reference to the given string and assigns it to the RedirectUrl field. +func (o *Oauth) SetRedirectUrl(v string) { + o.RedirectUrl = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *Oauth) GetScope() string { + if o == nil || IsNil(o.Scope) { + var ret string + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Oauth) GetScopeOk() (*string, bool) { + if o == nil || IsNil(o.Scope) { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *Oauth) HasScope() bool { + if o != nil && !IsNil(o.Scope) { + return true + } + + return false +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *Oauth) SetScope(v string) { + o.Scope = &v +} + +func (o Oauth) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Oauth) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["authorityUrl"] = o.AuthorityUrl + toSerialize["clientId"] = o.ClientId + toSerialize["clientSecret"] = o.ClientSecret + toSerialize["jwtClaims"] = o.JwtClaims + if !IsNil(o.Parameters) { + toSerialize["parameters"] = o.Parameters + } + if !IsNil(o.RedirectUrl) { + toSerialize["redirectUrl"] = o.RedirectUrl + } + if !IsNil(o.Scope) { + toSerialize["scope"] = o.Scope + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Oauth) 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{ + "authorityUrl", + "clientId", + "clientSecret", + "jwtClaims", + } + + 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) + } + } + + varOauth := _Oauth{} + + err = json.Unmarshal(data, &varOauth) + + if err != nil { + return err + } + + *o = Oauth(varOauth) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "authorityUrl") + delete(additionalProperties, "clientId") + delete(additionalProperties, "clientSecret") + delete(additionalProperties, "jwtClaims") + delete(additionalProperties, "parameters") + delete(additionalProperties, "redirectUrl") + delete(additionalProperties, "scope") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOauth struct { + value *Oauth + isSet bool +} + +func (v NullableOauth) Get() *Oauth { + return v.value +} + +func (v *NullableOauth) Set(val *Oauth) { + v.value = val + v.isSet = true +} + +func (v NullableOauth) IsSet() bool { + return v.isSet +} + +func (v *NullableOauth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOauth(val *Oauth) *NullableOauth { + return &NullableOauth{value: val, isSet: true} +} + +func (v NullableOauth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOauth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_oauth_jwt_claims.go b/services/dremio/v1alphaapi/model_oauth_jwt_claims.go new file mode 100644 index 000000000..4d0577f10 --- /dev/null +++ b/services/dremio/v1alphaapi/model_oauth_jwt_claims.go @@ -0,0 +1,166 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the OauthJwtClaims type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OauthJwtClaims{} + +// OauthJwtClaims Maps fields from the JWT token to fields Dremio requires. +type OauthJwtClaims struct { + UserName string `json:"userName"` + AdditionalProperties map[string]interface{} +} + +type _OauthJwtClaims OauthJwtClaims + +// NewOauthJwtClaims instantiates a new OauthJwtClaims 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 NewOauthJwtClaims(userName string) *OauthJwtClaims { + this := OauthJwtClaims{} + this.UserName = userName + return &this +} + +// NewOauthJwtClaimsWithDefaults instantiates a new OauthJwtClaims 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 NewOauthJwtClaimsWithDefaults() *OauthJwtClaims { + this := OauthJwtClaims{} + return &this +} + +// GetUserName returns the UserName field value +func (o *OauthJwtClaims) GetUserName() string { + if o == nil { + var ret string + return ret + } + + return o.UserName +} + +// GetUserNameOk returns a tuple with the UserName field value +// and a boolean to check if the value has been set. +func (o *OauthJwtClaims) GetUserNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UserName, true +} + +// SetUserName sets field value +func (o *OauthJwtClaims) SetUserName(v string) { + o.UserName = v +} + +func (o OauthJwtClaims) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OauthJwtClaims) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["userName"] = o.UserName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *OauthJwtClaims) 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{ + "userName", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varOauthJwtClaims := _OauthJwtClaims{} + + err = json.Unmarshal(data, &varOauthJwtClaims) + + if err != nil { + return err + } + + *o = OauthJwtClaims(varOauthJwtClaims) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "userName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableOauthJwtClaims struct { + value *OauthJwtClaims + isSet bool +} + +func (v NullableOauthJwtClaims) Get() *OauthJwtClaims { + return v.value +} + +func (v *NullableOauthJwtClaims) Set(val *OauthJwtClaims) { + v.value = val + v.isSet = true +} + +func (v NullableOauthJwtClaims) IsSet() bool { + return v.isSet +} + +func (v *NullableOauthJwtClaims) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOauthJwtClaims(val *OauthJwtClaims) *NullableOauthJwtClaims { + return &NullableOauthJwtClaims{value: val, isSet: true} +} + +func (v NullableOauthJwtClaims) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOauthJwtClaims) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/model_update_dremio_payload.go b/services/dremio/v1alphaapi/model_update_dremio_payload.go new file mode 100644 index 000000000..fca641055 --- /dev/null +++ b/services/dremio/v1alphaapi/model_update_dremio_payload.go @@ -0,0 +1,229 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the UpdateDremioPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDremioPayload{} + +// UpdateDremioPayload struct for UpdateDremioPayload +type UpdateDremioPayload struct { + Authentication *Authentication `json:"authentication,omitempty"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z0-9 ]*$"` + AdditionalProperties map[string]interface{} +} + +type _UpdateDremioPayload UpdateDremioPayload + +// NewUpdateDremioPayload instantiates a new UpdateDremioPayload 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 NewUpdateDremioPayload() *UpdateDremioPayload { + this := UpdateDremioPayload{} + return &this +} + +// NewUpdateDremioPayloadWithDefaults instantiates a new UpdateDremioPayload 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 NewUpdateDremioPayloadWithDefaults() *UpdateDremioPayload { + this := UpdateDremioPayload{} + return &this +} + +// GetAuthentication returns the Authentication field value if set, zero value otherwise. +func (o *UpdateDremioPayload) GetAuthentication() Authentication { + if o == nil || IsNil(o.Authentication) { + var ret Authentication + return ret + } + return *o.Authentication +} + +// GetAuthenticationOk returns a tuple with the Authentication field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateDremioPayload) GetAuthenticationOk() (*Authentication, bool) { + if o == nil || IsNil(o.Authentication) { + return nil, false + } + return o.Authentication, true +} + +// HasAuthentication returns a boolean if a field has been set. +func (o *UpdateDremioPayload) HasAuthentication() bool { + if o != nil && !IsNil(o.Authentication) { + return true + } + + return false +} + +// SetAuthentication gets a reference to the given Authentication and assigns it to the Authentication field. +func (o *UpdateDremioPayload) SetAuthentication(v Authentication) { + o.Authentication = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateDremioPayload) 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 *UpdateDremioPayload) 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 *UpdateDremioPayload) 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 *UpdateDremioPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateDremioPayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateDremioPayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateDremioPayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateDremioPayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +func (o UpdateDremioPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDremioPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Authentication) { + toSerialize["authentication"] = o.Authentication + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateDremioPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateDremioPayload := _UpdateDremioPayload{} + + err = json.Unmarshal(data, &varUpdateDremioPayload) + + if err != nil { + return err + } + + *o = UpdateDremioPayload(varUpdateDremioPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "authentication") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateDremioPayload struct { + value *UpdateDremioPayload + isSet bool +} + +func (v NullableUpdateDremioPayload) Get() *UpdateDremioPayload { + return v.value +} + +func (v *NullableUpdateDremioPayload) Set(val *UpdateDremioPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDremioPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDremioPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDremioPayload(val *UpdateDremioPayload) *NullableUpdateDremioPayload { + return &NullableUpdateDremioPayload{value: val, isSet: true} +} + +func (v NullableUpdateDremioPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDremioPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dremio/v1alphaapi/response.go b/services/dremio/v1alphaapi/response.go new file mode 100644 index 000000000..cb8ceb8e7 --- /dev/null +++ b/services/dremio/v1alphaapi/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/dremio/v1alphaapi/utils.go b/services/dremio/v1alphaapi/utils.go new file mode 100644 index 000000000..3ab2e78a0 --- /dev/null +++ b/services/dremio/v1alphaapi/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Dremio API + +This API provides endpoints for managing Dremios. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +}