diff --git a/go.work b/go.work index bc06de4004..4842bd1dc4 100644 --- a/go.work +++ b/go.work @@ -9,6 +9,7 @@ use ( ./examples/experimental ./examples/middleware ./examples/retries + ./examples/runtime ./examples/services ./examples/waiter ./services/alb @@ -24,6 +25,7 @@ use ( ./services/functions ./services/git ./services/iaas + ./services/identity ./services/intake ./services/kms ./services/lbiplists diff --git a/services/identity/LICENSE.md b/services/identity/LICENSE.md new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/services/identity/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/identity/go.mod b/services/identity/go.mod new file mode 100644 index 0000000000..3142d608c1 --- /dev/null +++ b/services/identity/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/identity + +go 1.25 + +require github.com/stackitcloud/stackit-sdk-go/core v0.27.1 + +require ( + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/identity/go.sum b/services/identity/go.sum new file mode 100644 index 0000000000..5bae1d1250 --- /dev/null +++ b/services/identity/go.sum @@ -0,0 +1,8 @@ +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/stackitcloud/stackit-sdk-go/core v0.27.1 h1:k7SrqqMoHjkvHbx6n6nV3Lt51itp8nNplht6vGHkPhw= +github.com/stackitcloud/stackit-sdk-go/core v0.27.1/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/identity/oas_commit b/services/identity/oas_commit new file mode 100644 index 0000000000..63a33b7991 --- /dev/null +++ b/services/identity/oas_commit @@ -0,0 +1 @@ +692f43a036e54bd79e6c93ffe2a5dade91548731 diff --git a/services/identity/package.go b/services/identity/package.go new file mode 100644 index 0000000000..cca56a06ae --- /dev/null +++ b/services/identity/package.go @@ -0,0 +1 @@ +package identity diff --git a/services/identity/v1api/api_default.go b/services/identity/v1api/api_default.go new file mode 100644 index 0000000000..ad76cf2431 --- /dev/null +++ b/services/identity/v1api/api_default.go @@ -0,0 +1,1854 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + CreateGroup Create a group + + Creates a new group for a specific organization using the provided display name and description + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @return ApiCreateGroupRequest + */ + CreateGroup(ctx context.Context, organizationId string) ApiCreateGroupRequest + + // CreateGroupExecute executes the request + // @return CreateGroupResponse + CreateGroupExecute(r ApiCreateGroupRequest) (*CreateGroupResponse, error) + + /* + DeleteGroup Delete a group + + Deletes a specific group. If removeAssignments=true, it automatically detaches all associated members and roles. If removeAssignments=false, the request fails with a 409 Conflict if any assignments exist. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiDeleteGroupRequest + */ + DeleteGroup(ctx context.Context, organizationId string, groupId string) ApiDeleteGroupRequest + + // DeleteGroupExecute executes the request + DeleteGroupExecute(r ApiDeleteGroupRequest) error + + /* + GetGroup Get a specific group + + Retrieves a specific group by its ID within an organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiGetGroupRequest + */ + GetGroup(ctx context.Context, organizationId string, groupId string) ApiGetGroupRequest + + // GetGroupExecute executes the request + // @return GetGroupResponse + GetGroupExecute(r ApiGetGroupRequest) (*GetGroupResponse, error) + + /* + GetUser Get a user + + Retrieves a specific user by their ID within an organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param userId User ID (UUID) + @return ApiGetUserRequest + */ + GetUser(ctx context.Context, organizationId string, userId string) ApiGetUserRequest + + // GetUserExecute executes the request + // @return GetUserResponse + GetUserExecute(r ApiGetUserRequest) (*GetUserResponse, error) + + /* + ListGroupMembers List the members of a group + + Lists the members of an existing group by its ID within a specific organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiListGroupMembersRequest + */ + ListGroupMembers(ctx context.Context, organizationId string, groupId string) ApiListGroupMembersRequest + + // ListGroupMembersExecute executes the request + // @return MembersResponse + ListGroupMembersExecute(r ApiListGroupMembersRequest) (*MembersResponse, error) + + /* + ListGroups List groups + + Retrieves a list of groups for a specific organization with optional filtering and pagination + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @return ApiListGroupsRequest + */ + ListGroups(ctx context.Context, organizationId string) ApiListGroupsRequest + + // ListGroupsExecute executes the request + // @return ListGroupResponse + ListGroupsExecute(r ApiListGroupsRequest) (*ListGroupResponse, error) + + /* + ListUsers List users + + Retrieves a list of users for a specific organization with optional filtering and pagination + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @return ApiListUsersRequest + */ + ListUsers(ctx context.Context, organizationId string) ApiListUsersRequest + + // ListUsersExecute executes the request + // @return ListUserResponse + ListUsersExecute(r ApiListUsersRequest) (*ListUserResponse, error) + + /* + UpdateGroup Update a specific group + + Updates the details of an existing group by its ID within a specific organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiUpdateGroupRequest + */ + UpdateGroup(ctx context.Context, organizationId string, groupId string) ApiUpdateGroupRequest + + // UpdateGroupExecute executes the request + // @return UpdateGroupResponse + UpdateGroupExecute(r ApiUpdateGroupRequest) (*UpdateGroupResponse, error) + + /* + UpdateGroupMembers Update the members of a group + + Updates the members of an existing group by its ID within a specific organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiUpdateGroupMembersRequest + */ + UpdateGroupMembers(ctx context.Context, organizationId string, groupId string) ApiUpdateGroupMembersRequest + + // UpdateGroupMembersExecute executes the request + // @return MembersResponse + UpdateGroupMembersExecute(r ApiUpdateGroupMembersRequest) (*MembersResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateGroupRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + createGroupPayload *CreateGroupPayload +} + +// Group creation payload +func (r ApiCreateGroupRequest) CreateGroupPayload(createGroupPayload CreateGroupPayload) ApiCreateGroupRequest { + r.createGroupPayload = &createGroupPayload + return r +} + +func (r ApiCreateGroupRequest) Execute() (*CreateGroupResponse, error) { + return r.ApiService.CreateGroupExecute(r) +} + +/* +CreateGroup Create a group + +Creates a new group for a specific organization using the provided display name and description + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @return ApiCreateGroupRequest +*/ +func (a *DefaultAPIService) CreateGroup(ctx context.Context, organizationId string) ApiCreateGroupRequest { + return ApiCreateGroupRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + } +} + +// Execute executes the request +// +// @return CreateGroupResponse +func (a *DefaultAPIService) CreateGroupExecute(r ApiCreateGroupRequest) (*CreateGroupResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateGroupResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/groups" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createGroupPayload == nil { + return localVarReturnValue, reportError("createGroupPayload 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.createGroupPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiDeleteGroupRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + groupId string + removeAssignments *bool +} + +// Automatically detach all relations before deleting +func (r ApiDeleteGroupRequest) RemoveAssignments(removeAssignments bool) ApiDeleteGroupRequest { + r.removeAssignments = &removeAssignments + return r +} + +func (r ApiDeleteGroupRequest) Execute() error { + return r.ApiService.DeleteGroupExecute(r) +} + +/* +DeleteGroup Delete a group + +Deletes a specific group. If removeAssignments=true, it automatically detaches all associated members and roles. If removeAssignments=false, the request fails with a 409 Conflict if any assignments exist. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiDeleteGroupRequest +*/ +func (a *DefaultAPIService) DeleteGroup(ctx context.Context, organizationId string, groupId string) ApiDeleteGroupRequest { + return ApiDeleteGroupRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteGroupExecute(r ApiDeleteGroupRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/groups/{groupId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.removeAssignments != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "removeAssignments", r.removeAssignments, "form", "") + } else { + var defaultValue bool = false + parameterAddToHeaderOrQuery(localVarQueryParams, "removeAssignments", defaultValue, "form", "") + r.removeAssignments = &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{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiGetGroupRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + groupId string +} + +func (r ApiGetGroupRequest) Execute() (*GetGroupResponse, error) { + return r.ApiService.GetGroupExecute(r) +} + +/* +GetGroup Get a specific group + +Retrieves a specific group by its ID within an organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiGetGroupRequest +*/ +func (a *DefaultAPIService) GetGroup(ctx context.Context, organizationId string, groupId string) ApiGetGroupRequest { + return ApiGetGroupRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// Execute executes the request +// +// @return GetGroupResponse +func (a *DefaultAPIService) GetGroupExecute(r ApiGetGroupRequest) (*GetGroupResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetGroupResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/groups/{groupId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetUserRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + userId string +} + +func (r ApiGetUserRequest) Execute() (*GetUserResponse, error) { + return r.ApiService.GetUserExecute(r) +} + +/* +GetUser Get a user + +Retrieves a specific user by their ID within an organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param userId User ID (UUID) + @return ApiGetUserRequest +*/ +func (a *DefaultAPIService) GetUser(ctx context.Context, organizationId string, userId string) ApiGetUserRequest { + return ApiGetUserRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + userId: userId, + } +} + +// Execute executes the request +// +// @return GetUserResponse +func (a *DefaultAPIService) GetUserExecute(r ApiGetUserRequest) (*GetUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetUserResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListGroupMembersRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + groupId string +} + +func (r ApiListGroupMembersRequest) Execute() (*MembersResponse, error) { + return r.ApiService.ListGroupMembersExecute(r) +} + +/* +ListGroupMembers List the members of a group + +Lists the members of an existing group by its ID within a specific organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiListGroupMembersRequest +*/ +func (a *DefaultAPIService) ListGroupMembers(ctx context.Context, organizationId string, groupId string) ApiListGroupMembersRequest { + return ApiListGroupMembersRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// Execute executes the request +// +// @return MembersResponse +func (a *DefaultAPIService) ListGroupMembersExecute(r ApiListGroupMembersRequest) (*MembersResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MembersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGroupMembers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/groups/{groupId}/members" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListGroupsRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + displayName *string + order *ListGroupsOrderParameter + page *int32 + pageSize *int32 + sortBy *string +} + +func (r ApiListGroupsRequest) DisplayName(displayName string) ApiListGroupsRequest { + r.displayName = &displayName + return r +} + +func (r ApiListGroupsRequest) Order(order ListGroupsOrderParameter) ApiListGroupsRequest { + r.order = &order + return r +} + +func (r ApiListGroupsRequest) Page(page int32) ApiListGroupsRequest { + r.page = &page + return r +} + +func (r ApiListGroupsRequest) PageSize(pageSize int32) ApiListGroupsRequest { + r.pageSize = &pageSize + return r +} + +func (r ApiListGroupsRequest) SortBy(sortBy string) ApiListGroupsRequest { + r.sortBy = &sortBy + return r +} + +func (r ApiListGroupsRequest) Execute() (*ListGroupResponse, error) { + return r.ApiService.ListGroupsExecute(r) +} + +/* +ListGroups List groups + +Retrieves a list of groups for a specific organization with optional filtering and pagination + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @return ApiListGroupsRequest +*/ +func (a *DefaultAPIService) ListGroups(ctx context.Context, organizationId string) ApiListGroupsRequest { + return ApiListGroupsRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + } +} + +// Execute executes the request +// +// @return ListGroupResponse +func (a *DefaultAPIService) ListGroupsExecute(r ApiListGroupsRequest) (*ListGroupResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListGroupResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListGroups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/groups" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.displayName != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "displayName", r.displayName, "form", "") + } + if r.order != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "form", "") + } else { + var defaultValue ListGroupsOrderParameter = "asc" + parameterAddToHeaderOrQuery(localVarQueryParams, "order", defaultValue, "form", "") + r.order = &defaultValue + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + parameterAddToHeaderOrQuery(localVarQueryParams, "page", defaultValue, "form", "") + r.page = &defaultValue + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 30 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + if r.sortBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListUsersRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + displayName *string + order *ListUsersOrderParameter + page *int32 + pageSize *int32 + sortBy *ListUsersSortByParameter +} + +func (r ApiListUsersRequest) DisplayName(displayName string) ApiListUsersRequest { + r.displayName = &displayName + return r +} + +func (r ApiListUsersRequest) Order(order ListUsersOrderParameter) ApiListUsersRequest { + r.order = &order + return r +} + +func (r ApiListUsersRequest) Page(page int32) ApiListUsersRequest { + r.page = &page + return r +} + +func (r ApiListUsersRequest) PageSize(pageSize int32) ApiListUsersRequest { + r.pageSize = &pageSize + return r +} + +func (r ApiListUsersRequest) SortBy(sortBy ListUsersSortByParameter) ApiListUsersRequest { + r.sortBy = &sortBy + return r +} + +func (r ApiListUsersRequest) Execute() (*ListUserResponse, error) { + return r.ApiService.ListUsersExecute(r) +} + +/* +ListUsers List users + +Retrieves a list of users for a specific organization with optional filtering and pagination + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @return ApiListUsersRequest +*/ +func (a *DefaultAPIService) ListUsers(ctx context.Context, organizationId string) ApiListUsersRequest { + return ApiListUsersRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + } +} + +// Execute executes the request +// +// @return ListUserResponse +func (a *DefaultAPIService) ListUsersExecute(r ApiListUsersRequest) (*ListUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListUserResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListUsers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.displayName != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "displayName", r.displayName, "form", "") + } + if r.order != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "form", "") + } else { + var defaultValue ListUsersOrderParameter = "asc" + parameterAddToHeaderOrQuery(localVarQueryParams, "order", defaultValue, "form", "") + r.order = &defaultValue + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + parameterAddToHeaderOrQuery(localVarQueryParams, "page", defaultValue, "form", "") + r.page = &defaultValue + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 30 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + if r.sortBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiUpdateGroupRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + groupId string + updateGroupPayload *UpdateGroupPayload +} + +// Update request payload +func (r ApiUpdateGroupRequest) UpdateGroupPayload(updateGroupPayload UpdateGroupPayload) ApiUpdateGroupRequest { + r.updateGroupPayload = &updateGroupPayload + return r +} + +func (r ApiUpdateGroupRequest) Execute() (*UpdateGroupResponse, error) { + return r.ApiService.UpdateGroupExecute(r) +} + +/* +UpdateGroup Update a specific group + +Updates the details of an existing group by its ID within a specific organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiUpdateGroupRequest +*/ +func (a *DefaultAPIService) UpdateGroup(ctx context.Context, organizationId string, groupId string) ApiUpdateGroupRequest { + return ApiUpdateGroupRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// Execute executes the request +// +// @return UpdateGroupResponse +func (a *DefaultAPIService) UpdateGroupExecute(r ApiUpdateGroupRequest) (*UpdateGroupResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateGroupResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/groups/{groupId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateGroupPayload == nil { + return localVarReturnValue, reportError("updateGroupPayload 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.updateGroupPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiUpdateGroupMembersRequest struct { + ctx context.Context + ApiService DefaultAPI + organizationId string + groupId string + updateGroupMembersPayload *UpdateGroupMembersPayload +} + +// Update request payload +func (r ApiUpdateGroupMembersRequest) UpdateGroupMembersPayload(updateGroupMembersPayload UpdateGroupMembersPayload) ApiUpdateGroupMembersRequest { + r.updateGroupMembersPayload = &updateGroupMembersPayload + return r +} + +func (r ApiUpdateGroupMembersRequest) Execute() (*MembersResponse, error) { + return r.ApiService.UpdateGroupMembersExecute(r) +} + +/* +UpdateGroupMembers Update the members of a group + +Updates the members of an existing group by its ID within a specific organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId Organization ID (UUID) + @param groupId Group ID (UUID) + @return ApiUpdateGroupMembersRequest +*/ +func (a *DefaultAPIService) UpdateGroupMembers(ctx context.Context, organizationId string, groupId string) ApiUpdateGroupMembersRequest { + return ApiUpdateGroupMembersRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// Execute executes the request +// +// @return MembersResponse +func (a *DefaultAPIService) UpdateGroupMembersExecute(r ApiUpdateGroupMembersRequest) (*MembersResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MembersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateGroupMembers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/organizations/{organizationId}/groups/{groupId}/members" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(parameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateGroupMembersPayload == nil { + return localVarReturnValue, reportError("updateGroupMembersPayload 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.updateGroupMembersPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v StandardError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} diff --git a/services/identity/v1api/api_default_mock.go b/services/identity/v1api/api_default_mock.go new file mode 100644 index 0000000000..75fd627ba9 --- /dev/null +++ b/services/identity/v1api/api_default_mock.go @@ -0,0 +1,209 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "context" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateGroupExecuteMock can be populated to implement the behavior of the CreateGroupExecute function of this mock + CreateGroupExecuteMock *func(r ApiCreateGroupRequest) (*CreateGroupResponse, error) + // DeleteGroupExecuteMock can be populated to implement the behavior of the DeleteGroupExecute function of this mock + DeleteGroupExecuteMock *func(r ApiDeleteGroupRequest) error + // GetGroupExecuteMock can be populated to implement the behavior of the GetGroupExecute function of this mock + GetGroupExecuteMock *func(r ApiGetGroupRequest) (*GetGroupResponse, error) + // GetUserExecuteMock can be populated to implement the behavior of the GetUserExecute function of this mock + GetUserExecuteMock *func(r ApiGetUserRequest) (*GetUserResponse, error) + // ListGroupMembersExecuteMock can be populated to implement the behavior of the ListGroupMembersExecute function of this mock + ListGroupMembersExecuteMock *func(r ApiListGroupMembersRequest) (*MembersResponse, error) + // ListGroupsExecuteMock can be populated to implement the behavior of the ListGroupsExecute function of this mock + ListGroupsExecuteMock *func(r ApiListGroupsRequest) (*ListGroupResponse, error) + // ListUsersExecuteMock can be populated to implement the behavior of the ListUsersExecute function of this mock + ListUsersExecuteMock *func(r ApiListUsersRequest) (*ListUserResponse, error) + // UpdateGroupExecuteMock can be populated to implement the behavior of the UpdateGroupExecute function of this mock + UpdateGroupExecuteMock *func(r ApiUpdateGroupRequest) (*UpdateGroupResponse, error) + // UpdateGroupMembersExecuteMock can be populated to implement the behavior of the UpdateGroupMembersExecute function of this mock + UpdateGroupMembersExecuteMock *func(r ApiUpdateGroupMembersRequest) (*MembersResponse, error) +} + +func (a DefaultAPIServiceMock) CreateGroup(ctx context.Context, organizationId string) ApiCreateGroupRequest { + return ApiCreateGroupRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + } +} + +// CreateGroupExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateGroupExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateGroupExecute(r ApiCreateGroupRequest) (*CreateGroupResponse, error) { + if a.CreateGroupExecuteMock == nil { + var localVarReturnValue *CreateGroupResponse + return localVarReturnValue, nil + } + + return (*a.CreateGroupExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteGroup(ctx context.Context, organizationId string, groupId string) ApiDeleteGroupRequest { + return ApiDeleteGroupRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// DeleteGroupExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteGroupExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteGroupExecute(r ApiDeleteGroupRequest) error { + if a.DeleteGroupExecuteMock == nil { + return nil + } + + return (*a.DeleteGroupExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetGroup(ctx context.Context, organizationId string, groupId string) ApiGetGroupRequest { + return ApiGetGroupRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// GetGroupExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetGroupExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetGroupExecute(r ApiGetGroupRequest) (*GetGroupResponse, error) { + if a.GetGroupExecuteMock == nil { + var localVarReturnValue *GetGroupResponse + return localVarReturnValue, nil + } + + return (*a.GetGroupExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetUser(ctx context.Context, organizationId string, userId string) ApiGetUserRequest { + return ApiGetUserRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + userId: userId, + } +} + +// GetUserExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetUserExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetUserExecute(r ApiGetUserRequest) (*GetUserResponse, error) { + if a.GetUserExecuteMock == nil { + var localVarReturnValue *GetUserResponse + return localVarReturnValue, nil + } + + return (*a.GetUserExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListGroupMembers(ctx context.Context, organizationId string, groupId string) ApiListGroupMembersRequest { + return ApiListGroupMembersRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// ListGroupMembersExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListGroupMembersExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListGroupMembersExecute(r ApiListGroupMembersRequest) (*MembersResponse, error) { + if a.ListGroupMembersExecuteMock == nil { + var localVarReturnValue *MembersResponse + return localVarReturnValue, nil + } + + return (*a.ListGroupMembersExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListGroups(ctx context.Context, organizationId string) ApiListGroupsRequest { + return ApiListGroupsRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + } +} + +// ListGroupsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListGroupsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListGroupsExecute(r ApiListGroupsRequest) (*ListGroupResponse, error) { + if a.ListGroupsExecuteMock == nil { + var localVarReturnValue *ListGroupResponse + return localVarReturnValue, nil + } + + return (*a.ListGroupsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListUsers(ctx context.Context, organizationId string) ApiListUsersRequest { + return ApiListUsersRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + } +} + +// ListUsersExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListUsersExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListUsersExecute(r ApiListUsersRequest) (*ListUserResponse, error) { + if a.ListUsersExecuteMock == nil { + var localVarReturnValue *ListUserResponse + return localVarReturnValue, nil + } + + return (*a.ListUsersExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateGroup(ctx context.Context, organizationId string, groupId string) ApiUpdateGroupRequest { + return ApiUpdateGroupRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// UpdateGroupExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateGroupExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateGroupExecute(r ApiUpdateGroupRequest) (*UpdateGroupResponse, error) { + if a.UpdateGroupExecuteMock == nil { + var localVarReturnValue *UpdateGroupResponse + return localVarReturnValue, nil + } + + return (*a.UpdateGroupExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateGroupMembers(ctx context.Context, organizationId string, groupId string) ApiUpdateGroupMembersRequest { + return ApiUpdateGroupMembersRequest{ + ApiService: a, + ctx: ctx, + organizationId: organizationId, + groupId: groupId, + } +} + +// UpdateGroupMembersExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateGroupMembersExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateGroupMembersExecute(r ApiUpdateGroupMembersRequest) (*MembersResponse, error) { + if a.UpdateGroupMembersExecuteMock == nil { + var localVarReturnValue *MembersResponse + return localVarReturnValue, nil + } + + return (*a.UpdateGroupMembersExecuteMock)(r) +} diff --git a/services/identity/v1api/client.go b/services/identity/v1api/client.go new file mode 100644 index 0000000000..16c8513c4c --- /dev/null +++ b/services/identity/v1api/client.go @@ -0,0 +1,668 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Identity API API v1.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if r, ok := v.(*io.Reader); ok { + *r = bytes.NewReader(b) + return nil + } + // Must stay before the JSON branch: json.Unmarshal would base64-decode into *[]byte. + if p, ok := v.(*[]byte); ok { + *p = b + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/identity/v1api/configuration.go b/services/identity/v1api/configuration.go new file mode 100644 index 0000000000..2b7d7a430b --- /dev/null +++ b/services/identity/v1api/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/identity", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://identity.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/identity/v1api/model_create_group_payload.go b/services/identity/v1api/model_create_group_payload.go new file mode 100644 index 0000000000..48aadd502e --- /dev/null +++ b/services/identity/v1api/model_create_group_payload.go @@ -0,0 +1,206 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateGroupPayload{} + +// CreateGroupPayload struct for CreateGroupPayload +type CreateGroupPayload struct { + // A description of the group's purpose. + Description *string `json:"description,omitempty"` + // The display name of the group. Must start and end with a lowercase letter, German umlaut (ä, ü, ö, ß), or number, and can only contain lowercase letters, umlauts, numbers, hyphens, and underscores. + DisplayName string `json:"displayName"` + AdditionalProperties map[string]interface{} +} + +type _CreateGroupPayload CreateGroupPayload + +// NewCreateGroupPayload instantiates a new CreateGroupPayload 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 NewCreateGroupPayload(displayName string) *CreateGroupPayload { + this := CreateGroupPayload{} + this.DisplayName = displayName + return &this +} + +// NewCreateGroupPayloadWithDefaults instantiates a new CreateGroupPayload 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 NewCreateGroupPayloadWithDefaults() *CreateGroupPayload { + this := CreateGroupPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateGroupPayload) 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 *CreateGroupPayload) 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 *CreateGroupPayload) 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 *CreateGroupPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateGroupPayload) 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 *CreateGroupPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateGroupPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +func (o CreateGroupPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + 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 *CreateGroupPayload) 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) + } + } + + varCreateGroupPayload := _CreateGroupPayload{} + + err = json.Unmarshal(data, &varCreateGroupPayload) + + if err != nil { + return err + } + + *o = CreateGroupPayload(varCreateGroupPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateGroupPayload struct { + value *CreateGroupPayload + isSet bool +} + +func (v NullableCreateGroupPayload) Get() *CreateGroupPayload { + return v.value +} + +func (v *NullableCreateGroupPayload) Set(val *CreateGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGroupPayload(val *CreateGroupPayload) *NullableCreateGroupPayload { + return &NullableCreateGroupPayload{value: val, isSet: true} +} + +func (v NullableCreateGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_create_group_response.go b/services/identity/v1api/model_create_group_response.go new file mode 100644 index 0000000000..ae311a8022 --- /dev/null +++ b/services/identity/v1api/model_create_group_response.go @@ -0,0 +1,302 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the CreateGroupResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateGroupResponse{} + +// CreateGroupResponse Response object for group creation. +type CreateGroupResponse struct { + CreatedAt *string `json:"createdAt,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Id *string `json:"id,omitempty"` + Origin *Origin `json:"origin,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateGroupResponse CreateGroupResponse + +// NewCreateGroupResponse instantiates a new CreateGroupResponse 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 NewCreateGroupResponse() *CreateGroupResponse { + this := CreateGroupResponse{} + return &this +} + +// NewCreateGroupResponseWithDefaults instantiates a new CreateGroupResponse 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 NewCreateGroupResponseWithDefaults() *CreateGroupResponse { + this := CreateGroupResponse{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateGroupResponse) GetCreatedAt() string { + if o == nil || IsNil(o.CreatedAt) { + var ret string + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGroupResponse) GetCreatedAtOk() (*string, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateGroupResponse) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +func (o *CreateGroupResponse) SetCreatedAt(v string) { + o.CreatedAt = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateGroupResponse) 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 *CreateGroupResponse) 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 *CreateGroupResponse) 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 *CreateGroupResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *CreateGroupResponse) 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 *CreateGroupResponse) 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 *CreateGroupResponse) 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 *CreateGroupResponse) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateGroupResponse) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGroupResponse) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateGroupResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateGroupResponse) SetId(v string) { + o.Id = &v +} + +// GetOrigin returns the Origin field value if set, zero value otherwise. +func (o *CreateGroupResponse) GetOrigin() Origin { + if o == nil || IsNil(o.Origin) { + var ret Origin + return ret + } + return *o.Origin +} + +// GetOriginOk returns a tuple with the Origin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGroupResponse) GetOriginOk() (*Origin, bool) { + if o == nil || IsNil(o.Origin) { + return nil, false + } + return o.Origin, true +} + +// HasOrigin returns a boolean if a field has been set. +func (o *CreateGroupResponse) HasOrigin() bool { + if o != nil && !IsNil(o.Origin) { + return true + } + + return false +} + +// SetOrigin gets a reference to the given Origin and assigns it to the Origin field. +func (o *CreateGroupResponse) SetOrigin(v Origin) { + o.Origin = &v +} + +func (o CreateGroupResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateGroupResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Origin) { + toSerialize["origin"] = o.Origin + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateGroupResponse) UnmarshalJSON(data []byte) (err error) { + varCreateGroupResponse := _CreateGroupResponse{} + + err = json.Unmarshal(data, &varCreateGroupResponse) + + if err != nil { + return err + } + + *o = CreateGroupResponse(varCreateGroupResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createdAt") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + delete(additionalProperties, "origin") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateGroupResponse struct { + value *CreateGroupResponse + isSet bool +} + +func (v NullableCreateGroupResponse) Get() *CreateGroupResponse { + return v.value +} + +func (v *NullableCreateGroupResponse) Set(val *CreateGroupResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGroupResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGroupResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGroupResponse(val *CreateGroupResponse) *NullableCreateGroupResponse { + return &NullableCreateGroupResponse{value: val, isSet: true} +} + +func (v NullableCreateGroupResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGroupResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_get_group_response.go b/services/identity/v1api/model_get_group_response.go new file mode 100644 index 0000000000..1e8e0dc532 --- /dev/null +++ b/services/identity/v1api/model_get_group_response.go @@ -0,0 +1,339 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the GetGroupResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetGroupResponse{} + +// GetGroupResponse struct for GetGroupResponse +type GetGroupResponse struct { + CreatedAt *string `json:"createdAt,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Id *string `json:"id,omitempty"` + IsTopLevel *bool `json:"isTopLevel,omitempty"` + Origin *Origin `json:"origin,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GetGroupResponse GetGroupResponse + +// NewGetGroupResponse instantiates a new GetGroupResponse 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 NewGetGroupResponse() *GetGroupResponse { + this := GetGroupResponse{} + return &this +} + +// NewGetGroupResponseWithDefaults instantiates a new GetGroupResponse 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 NewGetGroupResponseWithDefaults() *GetGroupResponse { + this := GetGroupResponse{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *GetGroupResponse) GetCreatedAt() string { + if o == nil || IsNil(o.CreatedAt) { + var ret string + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetGroupResponse) GetCreatedAtOk() (*string, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *GetGroupResponse) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +func (o *GetGroupResponse) SetCreatedAt(v string) { + o.CreatedAt = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *GetGroupResponse) 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 *GetGroupResponse) 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 *GetGroupResponse) 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 *GetGroupResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *GetGroupResponse) 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 *GetGroupResponse) 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 *GetGroupResponse) 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 *GetGroupResponse) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetGroupResponse) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetGroupResponse) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *GetGroupResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GetGroupResponse) SetId(v string) { + o.Id = &v +} + +// GetIsTopLevel returns the IsTopLevel field value if set, zero value otherwise. +func (o *GetGroupResponse) GetIsTopLevel() bool { + if o == nil || IsNil(o.IsTopLevel) { + var ret bool + return ret + } + return *o.IsTopLevel +} + +// GetIsTopLevelOk returns a tuple with the IsTopLevel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetGroupResponse) GetIsTopLevelOk() (*bool, bool) { + if o == nil || IsNil(o.IsTopLevel) { + return nil, false + } + return o.IsTopLevel, true +} + +// HasIsTopLevel returns a boolean if a field has been set. +func (o *GetGroupResponse) HasIsTopLevel() bool { + if o != nil && !IsNil(o.IsTopLevel) { + return true + } + + return false +} + +// SetIsTopLevel gets a reference to the given bool and assigns it to the IsTopLevel field. +func (o *GetGroupResponse) SetIsTopLevel(v bool) { + o.IsTopLevel = &v +} + +// GetOrigin returns the Origin field value if set, zero value otherwise. +func (o *GetGroupResponse) GetOrigin() Origin { + if o == nil || IsNil(o.Origin) { + var ret Origin + return ret + } + return *o.Origin +} + +// GetOriginOk returns a tuple with the Origin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetGroupResponse) GetOriginOk() (*Origin, bool) { + if o == nil || IsNil(o.Origin) { + return nil, false + } + return o.Origin, true +} + +// HasOrigin returns a boolean if a field has been set. +func (o *GetGroupResponse) HasOrigin() bool { + if o != nil && !IsNil(o.Origin) { + return true + } + + return false +} + +// SetOrigin gets a reference to the given Origin and assigns it to the Origin field. +func (o *GetGroupResponse) SetOrigin(v Origin) { + o.Origin = &v +} + +func (o GetGroupResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetGroupResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.IsTopLevel) { + toSerialize["isTopLevel"] = o.IsTopLevel + } + if !IsNil(o.Origin) { + toSerialize["origin"] = o.Origin + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetGroupResponse) UnmarshalJSON(data []byte) (err error) { + varGetGroupResponse := _GetGroupResponse{} + + err = json.Unmarshal(data, &varGetGroupResponse) + + if err != nil { + return err + } + + *o = GetGroupResponse(varGetGroupResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createdAt") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + delete(additionalProperties, "isTopLevel") + delete(additionalProperties, "origin") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetGroupResponse struct { + value *GetGroupResponse + isSet bool +} + +func (v NullableGetGroupResponse) Get() *GetGroupResponse { + return v.value +} + +func (v *NullableGetGroupResponse) Set(val *GetGroupResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetGroupResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetGroupResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetGroupResponse(val *GetGroupResponse) *NullableGetGroupResponse { + return &NullableGetGroupResponse{value: val, isSet: true} +} + +func (v NullableGetGroupResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetGroupResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_get_user_response.go b/services/identity/v1api/model_get_user_response.go new file mode 100644 index 0000000000..5ab562c07c --- /dev/null +++ b/services/identity/v1api/model_get_user_response.go @@ -0,0 +1,302 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the GetUserResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetUserResponse{} + +// GetUserResponse struct for GetUserResponse +type GetUserResponse struct { + CreatedAt *string `json:"createdAt,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Email *string `json:"email,omitempty"` + Id *string `json:"id,omitempty"` + Origin *Origin `json:"origin,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GetUserResponse GetUserResponse + +// NewGetUserResponse instantiates a new GetUserResponse 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 NewGetUserResponse() *GetUserResponse { + this := GetUserResponse{} + return &this +} + +// NewGetUserResponseWithDefaults instantiates a new GetUserResponse 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 NewGetUserResponseWithDefaults() *GetUserResponse { + this := GetUserResponse{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *GetUserResponse) GetCreatedAt() string { + if o == nil || IsNil(o.CreatedAt) { + var ret string + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetUserResponse) GetCreatedAtOk() (*string, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *GetUserResponse) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +func (o *GetUserResponse) SetCreatedAt(v string) { + o.CreatedAt = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *GetUserResponse) 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 *GetUserResponse) 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 *GetUserResponse) 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 *GetUserResponse) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *GetUserResponse) GetEmail() string { + if o == nil || IsNil(o.Email) { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetUserResponse) GetEmailOk() (*string, bool) { + if o == nil || IsNil(o.Email) { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *GetUserResponse) HasEmail() bool { + if o != nil && !IsNil(o.Email) { + return true + } + + return false +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *GetUserResponse) SetEmail(v string) { + o.Email = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetUserResponse) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetUserResponse) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *GetUserResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GetUserResponse) SetId(v string) { + o.Id = &v +} + +// GetOrigin returns the Origin field value if set, zero value otherwise. +func (o *GetUserResponse) GetOrigin() Origin { + if o == nil || IsNil(o.Origin) { + var ret Origin + return ret + } + return *o.Origin +} + +// GetOriginOk returns a tuple with the Origin field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetUserResponse) GetOriginOk() (*Origin, bool) { + if o == nil || IsNil(o.Origin) { + return nil, false + } + return o.Origin, true +} + +// HasOrigin returns a boolean if a field has been set. +func (o *GetUserResponse) HasOrigin() bool { + if o != nil && !IsNil(o.Origin) { + return true + } + + return false +} + +// SetOrigin gets a reference to the given Origin and assigns it to the Origin field. +func (o *GetUserResponse) SetOrigin(v Origin) { + o.Origin = &v +} + +func (o GetUserResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetUserResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Origin) { + toSerialize["origin"] = o.Origin + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetUserResponse) UnmarshalJSON(data []byte) (err error) { + varGetUserResponse := _GetUserResponse{} + + err = json.Unmarshal(data, &varGetUserResponse) + + if err != nil { + return err + } + + *o = GetUserResponse(varGetUserResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createdAt") + delete(additionalProperties, "displayName") + delete(additionalProperties, "email") + delete(additionalProperties, "id") + delete(additionalProperties, "origin") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetUserResponse struct { + value *GetUserResponse + isSet bool +} + +func (v NullableGetUserResponse) Get() *GetUserResponse { + return v.value +} + +func (v *NullableGetUserResponse) Set(val *GetUserResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetUserResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetUserResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetUserResponse(val *GetUserResponse) *NullableGetUserResponse { + return &NullableGetUserResponse{value: val, isSet: true} +} + +func (v NullableGetUserResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetUserResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_list_group_response.go b/services/identity/v1api/model_list_group_response.go new file mode 100644 index 0000000000..d827a15c71 --- /dev/null +++ b/services/identity/v1api/model_list_group_response.go @@ -0,0 +1,191 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the ListGroupResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListGroupResponse{} + +// ListGroupResponse struct for ListGroupResponse +type ListGroupResponse struct { + Groups []GetGroupResponse `json:"groups,omitempty"` + Total *int32 `json:"total,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListGroupResponse ListGroupResponse + +// NewListGroupResponse instantiates a new ListGroupResponse 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 NewListGroupResponse() *ListGroupResponse { + this := ListGroupResponse{} + return &this +} + +// NewListGroupResponseWithDefaults instantiates a new ListGroupResponse 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 NewListGroupResponseWithDefaults() *ListGroupResponse { + this := ListGroupResponse{} + return &this +} + +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *ListGroupResponse) GetGroups() []GetGroupResponse { + if o == nil || IsNil(o.Groups) { + var ret []GetGroupResponse + return ret + } + return o.Groups +} + +// GetGroupsOk returns a tuple with the Groups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListGroupResponse) GetGroupsOk() ([]GetGroupResponse, bool) { + if o == nil || IsNil(o.Groups) { + return nil, false + } + return o.Groups, true +} + +// HasGroups returns a boolean if a field has been set. +func (o *ListGroupResponse) HasGroups() bool { + if o != nil && !IsNil(o.Groups) { + return true + } + + return false +} + +// SetGroups gets a reference to the given []GetGroupResponse and assigns it to the Groups field. +func (o *ListGroupResponse) SetGroups(v []GetGroupResponse) { + o.Groups = v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *ListGroupResponse) GetTotal() int32 { + if o == nil || IsNil(o.Total) { + var ret int32 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListGroupResponse) GetTotalOk() (*int32, bool) { + if o == nil || IsNil(o.Total) { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *ListGroupResponse) HasTotal() bool { + if o != nil && !IsNil(o.Total) { + return true + } + + return false +} + +// SetTotal gets a reference to the given int32 and assigns it to the Total field. +func (o *ListGroupResponse) SetTotal(v int32) { + o.Total = &v +} + +func (o ListGroupResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListGroupResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Groups) { + toSerialize["groups"] = o.Groups + } + if !IsNil(o.Total) { + toSerialize["total"] = o.Total + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListGroupResponse) UnmarshalJSON(data []byte) (err error) { + varListGroupResponse := _ListGroupResponse{} + + err = json.Unmarshal(data, &varListGroupResponse) + + if err != nil { + return err + } + + *o = ListGroupResponse(varListGroupResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "groups") + delete(additionalProperties, "total") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListGroupResponse struct { + value *ListGroupResponse + isSet bool +} + +func (v NullableListGroupResponse) Get() *ListGroupResponse { + return v.value +} + +func (v *NullableListGroupResponse) Set(val *ListGroupResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListGroupResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListGroupResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListGroupResponse(val *ListGroupResponse) *NullableListGroupResponse { + return &NullableListGroupResponse{value: val, isSet: true} +} + +func (v NullableListGroupResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListGroupResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_list_groups_order_parameter.go b/services/identity/v1api/model_list_groups_order_parameter.go new file mode 100644 index 0000000000..8b2b49943f --- /dev/null +++ b/services/identity/v1api/model_list_groups_order_parameter.go @@ -0,0 +1,114 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// ListGroupsOrderParameter the model 'ListGroupsOrderParameter' +type ListGroupsOrderParameter string + +// List of ListGroups_order_parameter +const ( + LISTGROUPSORDERPARAMETER_ASC ListGroupsOrderParameter = "asc" + LISTGROUPSORDERPARAMETER_DESC ListGroupsOrderParameter = "desc" + LISTGROUPSORDERPARAMETER_UNKNOWN_DEFAULT_OPEN_API ListGroupsOrderParameter = "unknown_default_open_api" +) + +// All allowed values of ListGroupsOrderParameter enum +var AllowedListGroupsOrderParameterEnumValues = []ListGroupsOrderParameter{ + "asc", + "desc", + "unknown_default_open_api", +} + +func (v *ListGroupsOrderParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ListGroupsOrderParameter(value) + for _, existing := range AllowedListGroupsOrderParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = LISTGROUPSORDERPARAMETER_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewListGroupsOrderParameterFromValue returns a pointer to a valid ListGroupsOrderParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewListGroupsOrderParameterFromValue(v string) (*ListGroupsOrderParameter, error) { + ev := ListGroupsOrderParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ListGroupsOrderParameter: valid values are %v", v, AllowedListGroupsOrderParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ListGroupsOrderParameter) IsValid() bool { + for _, existing := range AllowedListGroupsOrderParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ListGroups_order_parameter value +func (v ListGroupsOrderParameter) Ptr() *ListGroupsOrderParameter { + return &v +} + +type NullableListGroupsOrderParameter struct { + value *ListGroupsOrderParameter + isSet bool +} + +func (v NullableListGroupsOrderParameter) Get() *ListGroupsOrderParameter { + return v.value +} + +func (v *NullableListGroupsOrderParameter) Set(val *ListGroupsOrderParameter) { + v.value = val + v.isSet = true +} + +func (v NullableListGroupsOrderParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableListGroupsOrderParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListGroupsOrderParameter(val *ListGroupsOrderParameter) *NullableListGroupsOrderParameter { + return &NullableListGroupsOrderParameter{value: val, isSet: true} +} + +func (v NullableListGroupsOrderParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListGroupsOrderParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_list_user_response.go b/services/identity/v1api/model_list_user_response.go new file mode 100644 index 0000000000..4b6e2bff47 --- /dev/null +++ b/services/identity/v1api/model_list_user_response.go @@ -0,0 +1,191 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the ListUserResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListUserResponse{} + +// ListUserResponse struct for ListUserResponse +type ListUserResponse struct { + Total *int32 `json:"total,omitempty"` + Users []GetUserResponse `json:"users,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListUserResponse ListUserResponse + +// NewListUserResponse instantiates a new ListUserResponse 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 NewListUserResponse() *ListUserResponse { + this := ListUserResponse{} + return &this +} + +// NewListUserResponseWithDefaults instantiates a new ListUserResponse 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 NewListUserResponseWithDefaults() *ListUserResponse { + this := ListUserResponse{} + return &this +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *ListUserResponse) GetTotal() int32 { + if o == nil || IsNil(o.Total) { + var ret int32 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListUserResponse) GetTotalOk() (*int32, bool) { + if o == nil || IsNil(o.Total) { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *ListUserResponse) HasTotal() bool { + if o != nil && !IsNil(o.Total) { + return true + } + + return false +} + +// SetTotal gets a reference to the given int32 and assigns it to the Total field. +func (o *ListUserResponse) SetTotal(v int32) { + o.Total = &v +} + +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *ListUserResponse) GetUsers() []GetUserResponse { + if o == nil || IsNil(o.Users) { + var ret []GetUserResponse + return ret + } + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListUserResponse) GetUsersOk() ([]GetUserResponse, bool) { + if o == nil || IsNil(o.Users) { + return nil, false + } + return o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *ListUserResponse) HasUsers() bool { + if o != nil && !IsNil(o.Users) { + return true + } + + return false +} + +// SetUsers gets a reference to the given []GetUserResponse and assigns it to the Users field. +func (o *ListUserResponse) SetUsers(v []GetUserResponse) { + o.Users = v +} + +func (o ListUserResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListUserResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Total) { + toSerialize["total"] = o.Total + } + if !IsNil(o.Users) { + toSerialize["users"] = o.Users + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListUserResponse) UnmarshalJSON(data []byte) (err error) { + varListUserResponse := _ListUserResponse{} + + err = json.Unmarshal(data, &varListUserResponse) + + if err != nil { + return err + } + + *o = ListUserResponse(varListUserResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "total") + delete(additionalProperties, "users") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListUserResponse struct { + value *ListUserResponse + isSet bool +} + +func (v NullableListUserResponse) Get() *ListUserResponse { + return v.value +} + +func (v *NullableListUserResponse) Set(val *ListUserResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListUserResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListUserResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListUserResponse(val *ListUserResponse) *NullableListUserResponse { + return &NullableListUserResponse{value: val, isSet: true} +} + +func (v NullableListUserResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListUserResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_list_users_order_parameter.go b/services/identity/v1api/model_list_users_order_parameter.go new file mode 100644 index 0000000000..d43180cff0 --- /dev/null +++ b/services/identity/v1api/model_list_users_order_parameter.go @@ -0,0 +1,114 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// ListUsersOrderParameter the model 'ListUsersOrderParameter' +type ListUsersOrderParameter string + +// List of ListUsers_order_parameter +const ( + LISTUSERSORDERPARAMETER_ASC ListUsersOrderParameter = "asc" + LISTUSERSORDERPARAMETER_DESC ListUsersOrderParameter = "desc" + LISTUSERSORDERPARAMETER_UNKNOWN_DEFAULT_OPEN_API ListUsersOrderParameter = "unknown_default_open_api" +) + +// All allowed values of ListUsersOrderParameter enum +var AllowedListUsersOrderParameterEnumValues = []ListUsersOrderParameter{ + "asc", + "desc", + "unknown_default_open_api", +} + +func (v *ListUsersOrderParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ListUsersOrderParameter(value) + for _, existing := range AllowedListUsersOrderParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = LISTUSERSORDERPARAMETER_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewListUsersOrderParameterFromValue returns a pointer to a valid ListUsersOrderParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewListUsersOrderParameterFromValue(v string) (*ListUsersOrderParameter, error) { + ev := ListUsersOrderParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ListUsersOrderParameter: valid values are %v", v, AllowedListUsersOrderParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ListUsersOrderParameter) IsValid() bool { + for _, existing := range AllowedListUsersOrderParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ListUsers_order_parameter value +func (v ListUsersOrderParameter) Ptr() *ListUsersOrderParameter { + return &v +} + +type NullableListUsersOrderParameter struct { + value *ListUsersOrderParameter + isSet bool +} + +func (v NullableListUsersOrderParameter) Get() *ListUsersOrderParameter { + return v.value +} + +func (v *NullableListUsersOrderParameter) Set(val *ListUsersOrderParameter) { + v.value = val + v.isSet = true +} + +func (v NullableListUsersOrderParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableListUsersOrderParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListUsersOrderParameter(val *ListUsersOrderParameter) *NullableListUsersOrderParameter { + return &NullableListUsersOrderParameter{value: val, isSet: true} +} + +func (v NullableListUsersOrderParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListUsersOrderParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_list_users_sort_by_parameter.go b/services/identity/v1api/model_list_users_sort_by_parameter.go new file mode 100644 index 0000000000..5e3665a976 --- /dev/null +++ b/services/identity/v1api/model_list_users_sort_by_parameter.go @@ -0,0 +1,112 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// ListUsersSortByParameter the model 'ListUsersSortByParameter' +type ListUsersSortByParameter string + +// List of ListUsers_sortBy_parameter +const ( + LISTUSERSSORTBYPARAMETER_DISPLAY_NAME ListUsersSortByParameter = "displayName" + LISTUSERSSORTBYPARAMETER_UNKNOWN_DEFAULT_OPEN_API ListUsersSortByParameter = "unknown_default_open_api" +) + +// All allowed values of ListUsersSortByParameter enum +var AllowedListUsersSortByParameterEnumValues = []ListUsersSortByParameter{ + "displayName", + "unknown_default_open_api", +} + +func (v *ListUsersSortByParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ListUsersSortByParameter(value) + for _, existing := range AllowedListUsersSortByParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = LISTUSERSSORTBYPARAMETER_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewListUsersSortByParameterFromValue returns a pointer to a valid ListUsersSortByParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewListUsersSortByParameterFromValue(v string) (*ListUsersSortByParameter, error) { + ev := ListUsersSortByParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ListUsersSortByParameter: valid values are %v", v, AllowedListUsersSortByParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ListUsersSortByParameter) IsValid() bool { + for _, existing := range AllowedListUsersSortByParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ListUsers_sortBy_parameter value +func (v ListUsersSortByParameter) Ptr() *ListUsersSortByParameter { + return &v +} + +type NullableListUsersSortByParameter struct { + value *ListUsersSortByParameter + isSet bool +} + +func (v NullableListUsersSortByParameter) Get() *ListUsersSortByParameter { + return v.value +} + +func (v *NullableListUsersSortByParameter) Set(val *ListUsersSortByParameter) { + v.value = val + v.isSet = true +} + +func (v NullableListUsersSortByParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableListUsersSortByParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListUsersSortByParameter(val *ListUsersSortByParameter) *NullableListUsersSortByParameter { + return &NullableListUsersSortByParameter{value: val, isSet: true} +} + +func (v NullableListUsersSortByParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListUsersSortByParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_member_response.go b/services/identity/v1api/model_member_response.go new file mode 100644 index 0000000000..09a71183a0 --- /dev/null +++ b/services/identity/v1api/model_member_response.go @@ -0,0 +1,191 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the MemberResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MemberResponse{} + +// MemberResponse struct for MemberResponse +type MemberResponse struct { + Id *string `json:"id,omitempty"` + Type *MemberType `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MemberResponse MemberResponse + +// NewMemberResponse instantiates a new MemberResponse 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 NewMemberResponse() *MemberResponse { + this := MemberResponse{} + return &this +} + +// NewMemberResponseWithDefaults instantiates a new MemberResponse 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 NewMemberResponseWithDefaults() *MemberResponse { + this := MemberResponse{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MemberResponse) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemberResponse) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MemberResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MemberResponse) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MemberResponse) GetType() MemberType { + if o == nil || IsNil(o.Type) { + var ret MemberType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemberResponse) GetTypeOk() (*MemberType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MemberResponse) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given MemberType and assigns it to the Type field. +func (o *MemberResponse) SetType(v MemberType) { + o.Type = &v +} + +func (o MemberResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MemberResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MemberResponse) UnmarshalJSON(data []byte) (err error) { + varMemberResponse := _MemberResponse{} + + err = json.Unmarshal(data, &varMemberResponse) + + if err != nil { + return err + } + + *o = MemberResponse(varMemberResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMemberResponse struct { + value *MemberResponse + isSet bool +} + +func (v NullableMemberResponse) Get() *MemberResponse { + return v.value +} + +func (v *NullableMemberResponse) Set(val *MemberResponse) { + v.value = val + v.isSet = true +} + +func (v NullableMemberResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableMemberResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMemberResponse(val *MemberResponse) *NullableMemberResponse { + return &NullableMemberResponse{value: val, isSet: true} +} + +func (v NullableMemberResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMemberResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_member_type.go b/services/identity/v1api/model_member_type.go new file mode 100644 index 0000000000..8213281b47 --- /dev/null +++ b/services/identity/v1api/model_member_type.go @@ -0,0 +1,116 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// MemberType the model 'MemberType' +type MemberType string + +// List of MemberType +const ( + MEMBERTYPE_USER MemberType = "user" + MEMBERTYPE_GROUP MemberType = "group" + MEMBERTYPE_SERVICE_ACCOUNT MemberType = "service_account" + MEMBERTYPE_UNKNOWN_DEFAULT_OPEN_API MemberType = "unknown_default_open_api" +) + +// All allowed values of MemberType enum +var AllowedMemberTypeEnumValues = []MemberType{ + "user", + "group", + "service_account", + "unknown_default_open_api", +} + +func (v *MemberType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := MemberType(value) + for _, existing := range AllowedMemberTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = MEMBERTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewMemberTypeFromValue returns a pointer to a valid MemberType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewMemberTypeFromValue(v string) (*MemberType, error) { + ev := MemberType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for MemberType: valid values are %v", v, AllowedMemberTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v MemberType) IsValid() bool { + for _, existing := range AllowedMemberTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MemberType value +func (v MemberType) Ptr() *MemberType { + return &v +} + +type NullableMemberType struct { + value *MemberType + isSet bool +} + +func (v NullableMemberType) Get() *MemberType { + return v.value +} + +func (v *NullableMemberType) Set(val *MemberType) { + v.value = val + v.isSet = true +} + +func (v NullableMemberType) IsSet() bool { + return v.isSet +} + +func (v *NullableMemberType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMemberType(val *MemberType) *NullableMemberType { + return &NullableMemberType{value: val, isSet: true} +} + +func (v NullableMemberType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMemberType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_members_response.go b/services/identity/v1api/model_members_response.go new file mode 100644 index 0000000000..0d778d455c --- /dev/null +++ b/services/identity/v1api/model_members_response.go @@ -0,0 +1,191 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the MembersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MembersResponse{} + +// MembersResponse Response object for group updates. +type MembersResponse struct { + Id *string `json:"id,omitempty"` + Members []MemberResponse `json:"members,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MembersResponse MembersResponse + +// NewMembersResponse instantiates a new MembersResponse 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 NewMembersResponse() *MembersResponse { + this := MembersResponse{} + return &this +} + +// NewMembersResponseWithDefaults instantiates a new MembersResponse 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 NewMembersResponseWithDefaults() *MembersResponse { + this := MembersResponse{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MembersResponse) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MembersResponse) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MembersResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MembersResponse) SetId(v string) { + o.Id = &v +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *MembersResponse) GetMembers() []MemberResponse { + if o == nil || IsNil(o.Members) { + var ret []MemberResponse + return ret + } + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MembersResponse) GetMembersOk() ([]MemberResponse, bool) { + if o == nil || IsNil(o.Members) { + return nil, false + } + return o.Members, true +} + +// HasMembers returns a boolean if a field has been set. +func (o *MembersResponse) HasMembers() bool { + if o != nil && !IsNil(o.Members) { + return true + } + + return false +} + +// SetMembers gets a reference to the given []MemberResponse and assigns it to the Members field. +func (o *MembersResponse) SetMembers(v []MemberResponse) { + o.Members = v +} + +func (o MembersResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MembersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Members) { + toSerialize["members"] = o.Members + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MembersResponse) UnmarshalJSON(data []byte) (err error) { + varMembersResponse := _MembersResponse{} + + err = json.Unmarshal(data, &varMembersResponse) + + if err != nil { + return err + } + + *o = MembersResponse(varMembersResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "members") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMembersResponse struct { + value *MembersResponse + isSet bool +} + +func (v NullableMembersResponse) Get() *MembersResponse { + return v.value +} + +func (v *NullableMembersResponse) Set(val *MembersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableMembersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableMembersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMembersResponse(val *MembersResponse) *NullableMembersResponse { + return &NullableMembersResponse{value: val, isSet: true} +} + +func (v NullableMembersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMembersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_origin.go b/services/identity/v1api/model_origin.go new file mode 100644 index 0000000000..5828f2588d --- /dev/null +++ b/services/identity/v1api/model_origin.go @@ -0,0 +1,114 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// Origin The system of origin for the resource. +type Origin string + +// List of Origin +const ( + ORIGIN_STACKIT Origin = "STACKIT" + ORIGIN_SCIM Origin = "SCIM" + ORIGIN_UNKNOWN_DEFAULT_OPEN_API Origin = "unknown_default_open_api" +) + +// All allowed values of Origin enum +var AllowedOriginEnumValues = []Origin{ + "STACKIT", + "SCIM", + "unknown_default_open_api", +} + +func (v *Origin) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Origin(value) + for _, existing := range AllowedOriginEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = ORIGIN_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewOriginFromValue returns a pointer to a valid Origin +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewOriginFromValue(v string) (*Origin, error) { + ev := Origin(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Origin: valid values are %v", v, AllowedOriginEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Origin) IsValid() bool { + for _, existing := range AllowedOriginEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Origin value +func (v Origin) Ptr() *Origin { + return &v +} + +type NullableOrigin struct { + value *Origin + isSet bool +} + +func (v NullableOrigin) Get() *Origin { + return v.value +} + +func (v *NullableOrigin) Set(val *Origin) { + v.value = val + v.isSet = true +} + +func (v NullableOrigin) IsSet() bool { + return v.isSet +} + +func (v *NullableOrigin) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOrigin(val *Origin) *NullableOrigin { + return &NullableOrigin{value: val, isSet: true} +} + +func (v NullableOrigin) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOrigin) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_standard_error.go b/services/identity/v1api/model_standard_error.go new file mode 100644 index 0000000000..d9e311d791 --- /dev/null +++ b/services/identity/v1api/model_standard_error.go @@ -0,0 +1,302 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the StandardError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StandardError{} + +// StandardError struct for StandardError +type StandardError struct { + Error *string `json:"error,omitempty"` + Message *string `json:"message,omitempty"` + Path *string `json:"path,omitempty"` + Status *int32 `json:"status,omitempty"` + TimeStamp *string `json:"timeStamp,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _StandardError StandardError + +// NewStandardError instantiates a new StandardError 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 NewStandardError() *StandardError { + this := StandardError{} + return &this +} + +// NewStandardErrorWithDefaults instantiates a new StandardError 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 NewStandardErrorWithDefaults() *StandardError { + this := StandardError{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *StandardError) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StandardError) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *StandardError) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *StandardError) SetError(v string) { + o.Error = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *StandardError) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StandardError) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *StandardError) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *StandardError) SetMessage(v string) { + o.Message = &v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *StandardError) GetPath() string { + if o == nil || IsNil(o.Path) { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StandardError) GetPathOk() (*string, bool) { + if o == nil || IsNil(o.Path) { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *StandardError) HasPath() bool { + if o != nil && !IsNil(o.Path) { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *StandardError) SetPath(v string) { + o.Path = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *StandardError) GetStatus() int32 { + if o == nil || IsNil(o.Status) { + var ret int32 + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StandardError) GetStatusOk() (*int32, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *StandardError) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given int32 and assigns it to the Status field. +func (o *StandardError) SetStatus(v int32) { + o.Status = &v +} + +// GetTimeStamp returns the TimeStamp field value if set, zero value otherwise. +func (o *StandardError) GetTimeStamp() string { + if o == nil || IsNil(o.TimeStamp) { + var ret string + return ret + } + return *o.TimeStamp +} + +// GetTimeStampOk returns a tuple with the TimeStamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StandardError) GetTimeStampOk() (*string, bool) { + if o == nil || IsNil(o.TimeStamp) { + return nil, false + } + return o.TimeStamp, true +} + +// HasTimeStamp returns a boolean if a field has been set. +func (o *StandardError) HasTimeStamp() bool { + if o != nil && !IsNil(o.TimeStamp) { + return true + } + + return false +} + +// SetTimeStamp gets a reference to the given string and assigns it to the TimeStamp field. +func (o *StandardError) SetTimeStamp(v string) { + o.TimeStamp = &v +} + +func (o StandardError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o StandardError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + if !IsNil(o.Path) { + toSerialize["path"] = o.Path + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + if !IsNil(o.TimeStamp) { + toSerialize["timeStamp"] = o.TimeStamp + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *StandardError) UnmarshalJSON(data []byte) (err error) { + varStandardError := _StandardError{} + + err = json.Unmarshal(data, &varStandardError) + + if err != nil { + return err + } + + *o = StandardError(varStandardError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "message") + delete(additionalProperties, "path") + delete(additionalProperties, "status") + delete(additionalProperties, "timeStamp") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableStandardError struct { + value *StandardError + isSet bool +} + +func (v NullableStandardError) Get() *StandardError { + return v.value +} + +func (v *NullableStandardError) Set(val *StandardError) { + v.value = val + v.isSet = true +} + +func (v NullableStandardError) IsSet() bool { + return v.isSet +} + +func (v *NullableStandardError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStandardError(val *StandardError) *NullableStandardError { + return &NullableStandardError{value: val, isSet: true} +} + +func (v NullableStandardError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStandardError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_update_group_members_payload.go b/services/identity/v1api/model_update_group_members_payload.go new file mode 100644 index 0000000000..81fca7e2b7 --- /dev/null +++ b/services/identity/v1api/model_update_group_members_payload.go @@ -0,0 +1,167 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateGroupMembersPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGroupMembersPayload{} + +// UpdateGroupMembersPayload struct for UpdateGroupMembersPayload +type UpdateGroupMembersPayload struct { + Members []UpdateMemberRequest `json:"members"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGroupMembersPayload UpdateGroupMembersPayload + +// NewUpdateGroupMembersPayload instantiates a new UpdateGroupMembersPayload 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 NewUpdateGroupMembersPayload(members []UpdateMemberRequest) *UpdateGroupMembersPayload { + this := UpdateGroupMembersPayload{} + this.Members = members + return &this +} + +// NewUpdateGroupMembersPayloadWithDefaults instantiates a new UpdateGroupMembersPayload 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 NewUpdateGroupMembersPayloadWithDefaults() *UpdateGroupMembersPayload { + this := UpdateGroupMembersPayload{} + return &this +} + +// GetMembers returns the Members field value +func (o *UpdateGroupMembersPayload) GetMembers() []UpdateMemberRequest { + if o == nil { + var ret []UpdateMemberRequest + return ret + } + + return o.Members +} + +// GetMembersOk returns a tuple with the Members field value +// and a boolean to check if the value has been set. +func (o *UpdateGroupMembersPayload) GetMembersOk() ([]UpdateMemberRequest, bool) { + if o == nil { + return nil, false + } + return o.Members, true +} + +// SetMembers sets field value +func (o *UpdateGroupMembersPayload) SetMembers(v []UpdateMemberRequest) { + o.Members = v +} + +func (o UpdateGroupMembersPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGroupMembersPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["members"] = o.Members + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGroupMembersPayload) 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{ + "members", + } + + 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) + } + } + + varUpdateGroupMembersPayload := _UpdateGroupMembersPayload{} + + err = json.Unmarshal(data, &varUpdateGroupMembersPayload) + + if err != nil { + return err + } + + *o = UpdateGroupMembersPayload(varUpdateGroupMembersPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "members") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGroupMembersPayload struct { + value *UpdateGroupMembersPayload + isSet bool +} + +func (v NullableUpdateGroupMembersPayload) Get() *UpdateGroupMembersPayload { + return v.value +} + +func (v *NullableUpdateGroupMembersPayload) Set(val *UpdateGroupMembersPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGroupMembersPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGroupMembersPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGroupMembersPayload(val *UpdateGroupMembersPayload) *NullableUpdateGroupMembersPayload { + return &NullableUpdateGroupMembersPayload{value: val, isSet: true} +} + +func (v NullableUpdateGroupMembersPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGroupMembersPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_update_group_payload.go b/services/identity/v1api/model_update_group_payload.go new file mode 100644 index 0000000000..4983c2fbbf --- /dev/null +++ b/services/identity/v1api/model_update_group_payload.go @@ -0,0 +1,196 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGroupPayload{} + +// UpdateGroupPayload struct for UpdateGroupPayload +type UpdateGroupPayload struct { + Description string `json:"description"` + DisplayName string `json:"displayName"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGroupPayload UpdateGroupPayload + +// NewUpdateGroupPayload instantiates a new UpdateGroupPayload 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 NewUpdateGroupPayload(description string, displayName string) *UpdateGroupPayload { + this := UpdateGroupPayload{} + this.Description = description + this.DisplayName = displayName + return &this +} + +// NewUpdateGroupPayloadWithDefaults instantiates a new UpdateGroupPayload 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 NewUpdateGroupPayloadWithDefaults() *UpdateGroupPayload { + this := UpdateGroupPayload{} + return &this +} + +// GetDescription returns the Description field value +func (o *UpdateGroupPayload) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *UpdateGroupPayload) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *UpdateGroupPayload) SetDescription(v string) { + o.Description = v +} + +// GetDisplayName returns the DisplayName field value +func (o *UpdateGroupPayload) 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 *UpdateGroupPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *UpdateGroupPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +func (o UpdateGroupPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["description"] = o.Description + toSerialize["displayName"] = o.DisplayName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGroupPayload) 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{ + "description", + "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) + } + } + + varUpdateGroupPayload := _UpdateGroupPayload{} + + err = json.Unmarshal(data, &varUpdateGroupPayload) + + if err != nil { + return err + } + + *o = UpdateGroupPayload(varUpdateGroupPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGroupPayload struct { + value *UpdateGroupPayload + isSet bool +} + +func (v NullableUpdateGroupPayload) Get() *UpdateGroupPayload { + return v.value +} + +func (v *NullableUpdateGroupPayload) Set(val *UpdateGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGroupPayload(val *UpdateGroupPayload) *NullableUpdateGroupPayload { + return &NullableUpdateGroupPayload{value: val, isSet: true} +} + +func (v NullableUpdateGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_update_group_response.go b/services/identity/v1api/model_update_group_response.go new file mode 100644 index 0000000000..d1c766c29b --- /dev/null +++ b/services/identity/v1api/model_update_group_response.go @@ -0,0 +1,302 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the UpdateGroupResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGroupResponse{} + +// UpdateGroupResponse Response object for group updates. +type UpdateGroupResponse struct { + CreatedAt *string `json:"createdAt,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Id *string `json:"id,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateGroupResponse UpdateGroupResponse + +// NewUpdateGroupResponse instantiates a new UpdateGroupResponse 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 NewUpdateGroupResponse() *UpdateGroupResponse { + this := UpdateGroupResponse{} + return &this +} + +// NewUpdateGroupResponseWithDefaults instantiates a new UpdateGroupResponse 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 NewUpdateGroupResponseWithDefaults() *UpdateGroupResponse { + this := UpdateGroupResponse{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UpdateGroupResponse) GetCreatedAt() string { + if o == nil || IsNil(o.CreatedAt) { + var ret string + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGroupResponse) GetCreatedAtOk() (*string, bool) { + if o == nil || IsNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UpdateGroupResponse) HasCreatedAt() bool { + if o != nil && !IsNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +func (o *UpdateGroupResponse) SetCreatedAt(v string) { + o.CreatedAt = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateGroupResponse) 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 *UpdateGroupResponse) 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 *UpdateGroupResponse) 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 *UpdateGroupResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateGroupResponse) 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 *UpdateGroupResponse) 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 *UpdateGroupResponse) 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 *UpdateGroupResponse) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateGroupResponse) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGroupResponse) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateGroupResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateGroupResponse) SetId(v string) { + o.Id = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *UpdateGroupResponse) GetUpdatedAt() string { + if o == nil || IsNil(o.UpdatedAt) { + var ret string + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGroupResponse) GetUpdatedAtOk() (*string, bool) { + if o == nil || IsNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *UpdateGroupResponse) HasUpdatedAt() bool { + if o != nil && !IsNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field. +func (o *UpdateGroupResponse) SetUpdatedAt(v string) { + o.UpdatedAt = &v +} + +func (o UpdateGroupResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateGroupResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateGroupResponse) UnmarshalJSON(data []byte) (err error) { + varUpdateGroupResponse := _UpdateGroupResponse{} + + err = json.Unmarshal(data, &varUpdateGroupResponse) + + if err != nil { + return err + } + + *o = UpdateGroupResponse(varUpdateGroupResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createdAt") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + delete(additionalProperties, "updatedAt") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateGroupResponse struct { + value *UpdateGroupResponse + isSet bool +} + +func (v NullableUpdateGroupResponse) Get() *UpdateGroupResponse { + return v.value +} + +func (v *NullableUpdateGroupResponse) Set(val *UpdateGroupResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGroupResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGroupResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGroupResponse(val *UpdateGroupResponse) *NullableUpdateGroupResponse { + return &NullableUpdateGroupResponse{value: val, isSet: true} +} + +func (v NullableUpdateGroupResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGroupResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_update_member_request.go b/services/identity/v1api/model_update_member_request.go new file mode 100644 index 0000000000..a6d5c3482d --- /dev/null +++ b/services/identity/v1api/model_update_member_request.go @@ -0,0 +1,196 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateMemberRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateMemberRequest{} + +// UpdateMemberRequest struct for UpdateMemberRequest +type UpdateMemberRequest struct { + Id string `json:"id"` + Type UpdateMemberRequestType `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _UpdateMemberRequest UpdateMemberRequest + +// NewUpdateMemberRequest instantiates a new UpdateMemberRequest 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 NewUpdateMemberRequest(id string, types UpdateMemberRequestType) *UpdateMemberRequest { + this := UpdateMemberRequest{} + this.Id = id + this.Type = types + return &this +} + +// NewUpdateMemberRequestWithDefaults instantiates a new UpdateMemberRequest 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 NewUpdateMemberRequestWithDefaults() *UpdateMemberRequest { + this := UpdateMemberRequest{} + return &this +} + +// GetId returns the Id field value +func (o *UpdateMemberRequest) 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 *UpdateMemberRequest) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *UpdateMemberRequest) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value +func (o *UpdateMemberRequest) GetType() UpdateMemberRequestType { + if o == nil { + var ret UpdateMemberRequestType + 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 *UpdateMemberRequest) GetTypeOk() (*UpdateMemberRequestType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *UpdateMemberRequest) SetType(v UpdateMemberRequestType) { + o.Type = v +} + +func (o UpdateMemberRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateMemberRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateMemberRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "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) + } + } + + varUpdateMemberRequest := _UpdateMemberRequest{} + + err = json.Unmarshal(data, &varUpdateMemberRequest) + + if err != nil { + return err + } + + *o = UpdateMemberRequest(varUpdateMemberRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateMemberRequest struct { + value *UpdateMemberRequest + isSet bool +} + +func (v NullableUpdateMemberRequest) Get() *UpdateMemberRequest { + return v.value +} + +func (v *NullableUpdateMemberRequest) Set(val *UpdateMemberRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateMemberRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateMemberRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateMemberRequest(val *UpdateMemberRequest) *NullableUpdateMemberRequest { + return &NullableUpdateMemberRequest{value: val, isSet: true} +} + +func (v NullableUpdateMemberRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateMemberRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/model_update_member_request_type.go b/services/identity/v1api/model_update_member_request_type.go new file mode 100644 index 0000000000..e2772f5609 --- /dev/null +++ b/services/identity/v1api/model_update_member_request_type.go @@ -0,0 +1,116 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// UpdateMemberRequestType the model 'UpdateMemberRequestType' +type UpdateMemberRequestType string + +// List of UpdateMemberRequest_type +const ( + UPDATEMEMBERREQUESTTYPE_USER UpdateMemberRequestType = "user" + UPDATEMEMBERREQUESTTYPE_GROUP UpdateMemberRequestType = "group" + UPDATEMEMBERREQUESTTYPE_SERVICE_ACCOUNT UpdateMemberRequestType = "service_account" + UPDATEMEMBERREQUESTTYPE_UNKNOWN_DEFAULT_OPEN_API UpdateMemberRequestType = "unknown_default_open_api" +) + +// All allowed values of UpdateMemberRequestType enum +var AllowedUpdateMemberRequestTypeEnumValues = []UpdateMemberRequestType{ + "user", + "group", + "service_account", + "unknown_default_open_api", +} + +func (v *UpdateMemberRequestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := UpdateMemberRequestType(value) + for _, existing := range AllowedUpdateMemberRequestTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = UPDATEMEMBERREQUESTTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewUpdateMemberRequestTypeFromValue returns a pointer to a valid UpdateMemberRequestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateMemberRequestTypeFromValue(v string) (*UpdateMemberRequestType, error) { + ev := UpdateMemberRequestType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateMemberRequestType: valid values are %v", v, AllowedUpdateMemberRequestTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateMemberRequestType) IsValid() bool { + for _, existing := range AllowedUpdateMemberRequestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UpdateMemberRequest_type value +func (v UpdateMemberRequestType) Ptr() *UpdateMemberRequestType { + return &v +} + +type NullableUpdateMemberRequestType struct { + value *UpdateMemberRequestType + isSet bool +} + +func (v NullableUpdateMemberRequestType) Get() *UpdateMemberRequestType { + return v.value +} + +func (v *NullableUpdateMemberRequestType) Set(val *UpdateMemberRequestType) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateMemberRequestType) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateMemberRequestType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateMemberRequestType(val *UpdateMemberRequestType) *NullableUpdateMemberRequestType { + return &NullableUpdateMemberRequestType{value: val, isSet: true} +} + +func (v NullableUpdateMemberRequestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateMemberRequestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/identity/v1api/response.go b/services/identity/v1api/response.go new file mode 100644 index 0000000000..3c6c9b0547 --- /dev/null +++ b/services/identity/v1api/response.go @@ -0,0 +1,48 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/identity/v1api/utils.go b/services/identity/v1api/utils.go new file mode 100644 index 0000000000..56b05f4d0e --- /dev/null +++ b/services/identity/v1api/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT Identity API + +API endpoints of Identity on STACKIT. + +API version: 1.0 +Contact: info@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +}