From ca1f599a560c346dc1dc56309b8ac547d2aa1e0b Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 4 May 2026 14:51:28 +0000 Subject: [PATCH] Generate git --- services/git/api_default.go | 1416 ++++++++++++++--- services/git/model_authentication.go | 197 ++- services/git/model_authentication_test.go | 68 + services/git/model_create_user_payload.go | 373 +++++ .../git/model_create_user_payload_test.go | 11 + services/git/model_feature_toggle.go | 108 +- services/git/model_list_users.go | 149 ++ services/git/model_list_users_test.go | 11 + services/git/model_patch_user_payload.go | 270 ++++ services/git/model_patch_user_payload_test.go | 11 + services/git/model_pipelines.go | 241 +++ services/git/model_pipelines_test.go | 11 + services/git/model_user.go | 317 ++++ services/git/model_user_test.go | 11 + services/git/oas_commit | 2 +- services/git/v1betaapi/api_default.go | 1098 +++++++++++-- services/git/v1betaapi/api_default_mock.go | 106 ++ .../git/v1betaapi/model_authentication.go | 40 +- .../v1betaapi/model_create_user_payload.go | 300 ++++ .../git/v1betaapi/model_feature_toggle.go | 86 +- services/git/v1betaapi/model_list_users.go | 167 ++ .../git/v1betaapi/model_patch_user_payload.go | 231 +++ services/git/v1betaapi/model_pipelines.go | 215 +++ services/git/v1betaapi/model_user.go | 266 ++++ 24 files changed, 5269 insertions(+), 436 deletions(-) create mode 100644 services/git/model_create_user_payload.go create mode 100644 services/git/model_create_user_payload_test.go create mode 100644 services/git/model_list_users.go create mode 100644 services/git/model_list_users_test.go create mode 100644 services/git/model_patch_user_payload.go create mode 100644 services/git/model_patch_user_payload_test.go create mode 100644 services/git/model_pipelines.go create mode 100644 services/git/model_pipelines_test.go create mode 100644 services/git/model_user.go create mode 100644 services/git/model_user_test.go create mode 100644 services/git/v1betaapi/model_create_user_payload.go create mode 100644 services/git/v1betaapi/model_list_users.go create mode 100644 services/git/v1betaapi/model_patch_user_payload.go create mode 100644 services/git/v1betaapi/model_pipelines.go create mode 100644 services/git/v1betaapi/model_user.go diff --git a/services/git/api_default.go b/services/git/api_default.go index 21e1022e9..e0f487796 100644 --- a/services/git/api_default.go +++ b/services/git/api_default.go @@ -96,6 +96,30 @@ type DefaultApi interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ CreateRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) + /* + CreateUser Create an Instance Local/Technical User. + Creates a new STACKIT Git instance Local/Technical User. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiCreateUserRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + CreateUser(ctx context.Context, projectId string, instanceId string) ApiCreateUserRequest + /* + CreateUserExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return User + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + CreateUserExecute(ctx context.Context, projectId string, instanceId string) (*User, error) /* DeleteAuthentication Delete Authentication Source Deletes the authentication source associated to this STACKIT Git instance. @@ -154,6 +178,26 @@ type DefaultApi interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ DeleteRunnerExecute(ctx context.Context, projectId string, instanceId string) error + /* + DeleteUser Delete Instance User. + Deletes a STACKIT Git instance User and destroys all associated data. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiDeleteUserRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + DeleteUser(ctx context.Context, projectId string, instanceId string, username string) ApiDeleteUserRequest + /* + DeleteUserExecute executes the request + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + DeleteUserExecute(ctx context.Context, projectId string, instanceId string, username string) error /* GetAuthentication Get authentication provider Get authentication provider @@ -226,6 +270,49 @@ type DefaultApi interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) + /* + GetUser Get Instance User information. + Retrieves information about a STACKIT Git instance User. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiGetUserRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetUser(ctx context.Context, projectId string, instanceId string, username string) ApiGetUserRequest + /* + GetUserExecute executes the request + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetUserExecute(ctx context.Context, projectId string, instanceId string, username string) error + /* + GetUsers Get instance Users. + Lists all STACKIT Git Users within an instances. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetUsersRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetUsers(ctx context.Context, projectId string, instanceId string) ApiGetUsersRequest + /* + GetUsersExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ListUsers + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetUsersExecute(ctx context.Context, projectId string, instanceId string) (*ListUsers, error) /* ListAuthentication List authentication sources Lists all authentication sources belonging to a specific instance @@ -365,6 +452,32 @@ type DefaultApi interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ PatchInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) + /* + PatchUser Patch Instance User. + Patches the Instance User. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiPatchUserRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + PatchUser(ctx context.Context, projectId string, instanceId string, username string) ApiPatchUserRequest + /* + PatchUserExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return User + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + PatchUserExecute(ctx context.Context, projectId string, instanceId string, username string) (*User, error) } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @@ -394,6 +507,15 @@ type ApiCreateRunnerRequest interface { Execute() (*Runner, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiCreateUserRequest interface { + // Instance User details options. + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CreateUserPayload(createUserPayload CreateUserPayload) ApiCreateUserRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*User, error) +} + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiDeleteAuthenticationRequest interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @@ -412,6 +534,12 @@ type ApiDeleteRunnerRequest interface { Execute() error } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiDeleteUserRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() error +} + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiGetAuthenticationRequest interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @@ -430,6 +558,18 @@ type ApiGetRunnerRequest interface { Execute() (*Runner, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiGetUserRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() error +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiGetUsersRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*ListUsers, error) +} + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiListAuthenticationRequest interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @@ -471,6 +611,14 @@ type ApiPatchInstanceRequest interface { Execute() (*Instance, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiPatchUserRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + PatchUserPayload(patchUserPayload PatchUserPayload) ApiPatchUserRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*User, error) +} + // DefaultApiService DefaultApi service // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApiService service @@ -1045,60 +1193,64 @@ func (a *APIClient) CreateRunnerExecute(ctx context.Context, projectId string, i } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type DeleteAuthenticationRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - instanceId string - authenticationId string +type CreateUserRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + createUserPayload *CreateUserPayload } +// Instance User details options. // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r DeleteAuthenticationRequest) Execute() error { +func (r CreateUserRequest) CreateUserPayload(createUserPayload CreateUserPayload) ApiCreateUserRequest { + r.createUserPayload = &createUserPayload + return r +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r CreateUserRequest) Execute() (*User, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User ) a := r.apiService client, ok := a.client.(*APIClient) if !ok { - return fmt.Errorf("could not parse client to type APIClient") + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAuthentication") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateUser") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(r.authenticationId, "authenticationId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return fmt.Errorf("projectId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return fmt.Errorf("projectId must have less than 36 elements") + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.instanceId) < 36 { - return fmt.Errorf("instanceId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") } if strlen(r.instanceId) > 36 { - return fmt.Errorf("instanceId must have less than 36 elements") - } - if strlen(r.authenticationId) < 36 { - return fmt.Errorf("authenticationId must have at least 36 elements") + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") } - if strlen(r.authenticationId) > 36 { - return fmt.Errorf("authenticationId must have less than 36 elements") + if r.createUserPayload == nil { + return localVarReturnValue, fmt.Errorf("createUserPayload is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1114,9 +1266,11 @@ func (r DeleteAuthenticationRequest) Execute() error { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createUserPayload req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return err + return localVarReturnValue, err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -1130,14 +1284,14 @@ func (r DeleteAuthenticationRequest) Execute() error { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return err + return localVarReturnValue, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return err + return localVarReturnValue, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1151,104 +1305,90 @@ func (r DeleteAuthenticationRequest) Execute() error { err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedErrorResponse - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v GenericErrorResponse - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 409 { var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr + return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return newErr + return localVarReturnValue, newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return newErr + return localVarReturnValue, newErr } - return nil + err = 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 } /* -DeleteAuthentication: Delete Authentication Source +CreateUser: Create an Instance Local/Technical User. Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. @param instanceId Instance identifier. - @param authenticationId Authentication Source identifier. - @return ApiDeleteAuthenticationRequest + @return ApiCreateUserRequest */ -func (a *APIClient) DeleteAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiDeleteAuthenticationRequest { - return DeleteAuthenticationRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - instanceId: instanceId, - authenticationId: authenticationId, +func (a *APIClient) CreateUser(ctx context.Context, projectId string, instanceId string) ApiCreateUserRequest { + return CreateUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, } } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (a *APIClient) DeleteAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) error { - r := DeleteAuthenticationRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - instanceId: instanceId, - authenticationId: authenticationId, +func (a *APIClient) CreateUserExecute(ctx context.Context, projectId string, instanceId string) (*User, error) { + r := CreateUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, } return r.Execute() } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type DeleteInstanceRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - instanceId string +type DeleteAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + authenticationId string } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r DeleteInstanceRequest) Execute() error { +func (r DeleteAuthenticationRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} @@ -1259,14 +1399,15 @@ func (r DeleteInstanceRequest) Execute() error { if !ok { return fmt.Errorf("could not parse client to type APIClient") } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteInstance") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAuthentication") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(r.authenticationId, "authenticationId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1283,6 +1424,12 @@ func (r DeleteInstanceRequest) Execute() error { if strlen(r.instanceId) > 36 { return fmt.Errorf("instanceId must have less than 36 elements") } + if strlen(r.authenticationId) < 36 { + return fmt.Errorf("authenticationId must have at least 36 elements") + } + if strlen(r.authenticationId) > 36 { + return fmt.Errorf("authenticationId must have less than 36 elements") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1344,6 +1491,17 @@ func (r DeleteInstanceRequest) Execute() error { newErr.Model = v return newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } if localVarHTTPResponse.StatusCode == 404 { var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1383,15 +1541,191 @@ func (r DeleteInstanceRequest) Execute() error { } /* -DeleteInstance: Delete Instance. +DeleteAuthentication: Delete Authentication Source Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. @param instanceId Instance identifier. - @return ApiDeleteInstanceRequest -*/ + @param authenticationId Authentication Source identifier. + @return ApiDeleteAuthenticationRequest +*/ +func (a *APIClient) DeleteAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiDeleteAuthenticationRequest { + return DeleteAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) DeleteAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) error { + r := DeleteAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DeleteInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r DeleteInstanceRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteInstance") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return fmt.Errorf("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := 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 := 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{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = 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 +} + +/* +DeleteInstance: Delete Instance. + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiDeleteInstanceRequest +*/ func (a *APIClient) DeleteInstance(ctx context.Context, projectId string, instanceId string) ApiDeleteInstanceRequest { return DeleteInstanceRequest{ apiService: a.defaultApi, @@ -1564,57 +1898,50 @@ func (a *APIClient) DeleteRunnerExecute(ctx context.Context, projectId string, i } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type GetAuthenticationRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - instanceId string - authenticationId string +type DeleteUserRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + username string } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r GetAuthenticationRequest) Execute() (*Authentication, error) { +func (r DeleteUserRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Authentication + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService client, ok := a.client.(*APIClient) if !ok { - return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + return fmt.Errorf("could not parse client to type APIClient") } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAuthentication") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteUser") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users/{username}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(r.authenticationId, "authenticationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.instanceId) < 36 { - return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + return fmt.Errorf("instanceId must have at least 36 elements") } if strlen(r.instanceId) > 36 { - return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") - } - if strlen(r.authenticationId) < 36 { - return localVarReturnValue, fmt.Errorf("authenticationId must have at least 36 elements") - } - if strlen(r.authenticationId) > 36 { - return localVarReturnValue, fmt.Errorf("authenticationId must have less than 36 elements") + return fmt.Errorf("instanceId must have less than 36 elements") } // to determine the Content-Type header @@ -1636,7 +1963,7 @@ func (r GetAuthenticationRequest) Execute() (*Authentication, error) { } req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -1650,14 +1977,14 @@ func (r GetAuthenticationRequest) Execute() (*Authentication, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1667,48 +1994,211 @@ func (r GetAuthenticationRequest) Execute() (*Authentication, error) { ErrorMessage: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v BadErrorResponse - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedErrorResponse + var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { - var v InternalServerErrorResponse + var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return localVarReturnValue, newErr - } - - err = 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 newErr + } + + return nil +} + +/* +DeleteUser: Delete Instance User. + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiDeleteUserRequest +*/ +func (a *APIClient) DeleteUser(ctx context.Context, projectId string, instanceId string, username string) ApiDeleteUserRequest { + return DeleteUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) DeleteUserExecute(ctx context.Context, projectId string, instanceId string, username string) error { + r := DeleteUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type GetAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + authenticationId string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r GetAuthenticationRequest) Execute() (*Authentication, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Authentication + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAuthentication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(r.authenticationId, "authenticationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + if strlen(r.authenticationId) < 36 { + return localVarReturnValue, fmt.Errorf("authenticationId must have at least 36 elements") + } + if strlen(r.authenticationId) > 36 { + return localVarReturnValue, fmt.Errorf("authenticationId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := 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 := 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{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v InternalServerErrorResponse + err = 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 = 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 @@ -1725,72 +2215,408 @@ Deprecated: Will be removed after 2026-09-30. Move to the packages generated for @param authenticationId Authentication Source identifier. @return ApiGetAuthenticationRequest */ -func (a *APIClient) GetAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiGetAuthenticationRequest { - return GetAuthenticationRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - instanceId: instanceId, - authenticationId: authenticationId, +func (a *APIClient) GetAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiGetAuthenticationRequest { + return GetAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) GetAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) { + r := GetAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type GetInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r GetInstanceRequest) Execute() (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := 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 := 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{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = 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 = 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 +} + +/* +GetInstance: Get Instance information. + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetInstanceRequest +*/ +func (a *APIClient) GetInstance(ctx context.Context, projectId string, instanceId string) ApiGetInstanceRequest { + return GetInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) GetInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) { + r := GetInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type GetRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r GetRunnerRequest) Execute() (*Runner, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Runner + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRunner") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := 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 := 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{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = 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 = 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 +} + +/* +GetRunner: Get Runner information. + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetRunnerRequest +*/ +func (a *APIClient) GetRunner(ctx context.Context, projectId string, instanceId string) ApiGetRunnerRequest { + return GetRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, } } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (a *APIClient) GetAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) { - r := GetAuthenticationRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - instanceId: instanceId, - authenticationId: authenticationId, +func (a *APIClient) GetRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) { + r := GetRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, } return r.Execute() } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type GetInstanceRequest struct { +type GetUserRequest struct { ctx context.Context apiService *DefaultApiService projectId string instanceId string + username string } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r GetInstanceRequest) Execute() (*Instance, error) { +func (r GetUserRequest) Execute() error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Instance + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile ) a := r.apiService client, ok := a.client.(*APIClient) if !ok { - return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + return fmt.Errorf("could not parse client to type APIClient") } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstance") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetUser") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users/{username}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + return fmt.Errorf("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + return fmt.Errorf("projectId must have less than 36 elements") } if strlen(r.instanceId) < 36 { - return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + return fmt.Errorf("instanceId must have at least 36 elements") } if strlen(r.instanceId) > 36 { - return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + return fmt.Errorf("instanceId must have less than 36 elements") } // to determine the Content-Type header @@ -1812,7 +2638,7 @@ func (r GetInstanceRequest) Execute() (*Instance, error) { } req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -1826,14 +2652,14 @@ func (r GetInstanceRequest) Execute() (*Instance, error) { *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1842,86 +2668,79 @@ func (r GetInstanceRequest) Execute() (*Instance, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v GenericErrorResponse + if localVarHTTPResponse.StatusCode == 302 { + var v User err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 400 { var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v } - return localVarReturnValue, newErr - } - - err = 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 newErr } - return localVarReturnValue, nil + return nil } /* -GetInstance: Get Instance information. +GetUser: Get Instance User information. Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. @param instanceId Instance identifier. - @return ApiGetInstanceRequest + @param username Instance User identifier. + @return ApiGetUserRequest */ -func (a *APIClient) GetInstance(ctx context.Context, projectId string, instanceId string) ApiGetInstanceRequest { - return GetInstanceRequest{ +func (a *APIClient) GetUser(ctx context.Context, projectId string, instanceId string, username string) ApiGetUserRequest { + return GetUserRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, instanceId: instanceId, + username: username, } } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (a *APIClient) GetInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) { - r := GetInstanceRequest{ +func (a *APIClient) GetUserExecute(ctx context.Context, projectId string, instanceId string, username string) error { + r := GetUserRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, instanceId: instanceId, + username: username, } return r.Execute() } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type GetRunnerRequest struct { +type GetUsersRequest struct { ctx context.Context apiService *DefaultApiService projectId string @@ -1929,24 +2748,24 @@ type GetRunnerRequest struct { } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r GetRunnerRequest) Execute() (*Runner, error) { +func (r GetUsersRequest) Execute() (*ListUsers, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Runner + localVarReturnValue *ListUsers ) a := r.apiService client, ok := a.client.(*APIClient) if !ok { return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRunner") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetUsers") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) @@ -2053,17 +2872,17 @@ func (r GetRunnerRequest) Execute() (*Runner, error) { } /* -GetRunner: Get Runner information. +GetUsers: Get instance Users. Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. @param instanceId Instance identifier. - @return ApiGetRunnerRequest + @return ApiGetUsersRequest */ -func (a *APIClient) GetRunner(ctx context.Context, projectId string, instanceId string) ApiGetRunnerRequest { - return GetRunnerRequest{ +func (a *APIClient) GetUsers(ctx context.Context, projectId string, instanceId string) ApiGetUsersRequest { + return GetUsersRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -2072,8 +2891,8 @@ func (a *APIClient) GetRunner(ctx context.Context, projectId string, instanceId } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (a *APIClient) GetRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) { - r := GetRunnerRequest{ +func (a *APIClient) GetUsersExecute(ctx context.Context, projectId string, instanceId string) (*ListUsers, error) { + r := GetUsersRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -3100,3 +3919,182 @@ func (a *APIClient) PatchInstanceExecute(ctx context.Context, projectId string, } return r.Execute() } + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + username string + patchUserPayload *PatchUserPayload +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r PatchUserRequest) PatchUserPayload(patchUserPayload PatchUserPayload) ApiPatchUserRequest { + r.patchUserPayload = &patchUserPayload + return r +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r PatchUserRequest) Execute() (*User, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PatchUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + if r.patchUserPayload == nil { + return localVarReturnValue, fmt.Errorf("patchUserPayload 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.patchUserPayload + req, err := 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 := 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{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = 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 = 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 +} + +/* +PatchUser: Patch Instance User. + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiPatchUserRequest +*/ +func (a *APIClient) PatchUser(ctx context.Context, projectId string, instanceId string, username string) ApiPatchUserRequest { + return PatchUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) PatchUserExecute(ctx context.Context, projectId string, instanceId string, username string) (*User, error) { + r := PatchUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, + } + return r.Execute() +} diff --git a/services/git/model_authentication.go b/services/git/model_authentication.go index 5291ed29d..6d2b847c0 100644 --- a/services/git/model_authentication.go +++ b/services/git/model_authentication.go @@ -13,6 +13,7 @@ package git import ( "encoding/json" + "fmt" "time" ) @@ -239,9 +240,144 @@ type AuthenticationGetScopesRetType = string types and functions for status */ -// isNotNullableString +// isEnum + +// AuthenticationStatus The current status of the authentication definition. +// value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AuthenticationStatus string + +// List of Status +const ( + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + AUTHENTICATIONSTATUS_CREATING AuthenticationStatus = "Creating" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + AUTHENTICATIONSTATUS_UPDATING AuthenticationStatus = "Updating" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + AUTHENTICATIONSTATUS_DELETING AuthenticationStatus = "Deleting" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + AUTHENTICATIONSTATUS_READY AuthenticationStatus = "Ready" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + AUTHENTICATIONSTATUS_ERROR AuthenticationStatus = "Error" +) + +// All allowed values of Authentication enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +var AllowedAuthenticationStatusEnumValues = []AuthenticationStatus{ + "Creating", + "Updating", + "Deleting", + "Ready", + "Error", +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *AuthenticationStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson AuthenticationStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := AuthenticationStatus(value) + for _, existing := range AllowedAuthenticationStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Authentication", value) +} + +// NewAuthenticationStatusFromValue returns a pointer to a valid AuthenticationStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewAuthenticationStatusFromValue(v AuthenticationStatus) (*AuthenticationStatus, error) { + ev := AuthenticationStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AuthenticationStatus: valid values are %v", v, AllowedAuthenticationStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v AuthenticationStatus) IsValid() bool { + for _, existing := range AllowedAuthenticationStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v AuthenticationStatus) Ptr() *AuthenticationStatus { + return &v +} + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type AuthenticationGetStatusAttributeType = *string +type NullableAuthenticationStatus struct { + value *AuthenticationStatus + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAuthenticationStatus) Get() *AuthenticationStatus { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAuthenticationStatus) Set(val *AuthenticationStatus) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAuthenticationStatus) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAuthenticationStatus) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableAuthenticationStatus(val *AuthenticationStatus) *NullableAuthenticationStatus { + return &NullableAuthenticationStatus{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAuthenticationStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAuthenticationStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AuthenticationGetStatusAttributeType = *AuthenticationStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AuthenticationGetStatusArgType = AuthenticationStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AuthenticationGetStatusRetType = AuthenticationStatus // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAuthenticationGetStatusAttributeTypeOk(arg AuthenticationGetStatusAttributeType) (ret AuthenticationGetStatusRetType, ok bool) { @@ -256,11 +392,32 @@ func setAuthenticationGetStatusAttributeType(arg *AuthenticationGetStatusAttribu *arg = &val } +/* + types and functions for status_message +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AuthenticationGetStatusMessageAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getAuthenticationGetStatusMessageAttributeTypeOk(arg AuthenticationGetStatusMessageAttributeType) (ret AuthenticationGetStatusMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setAuthenticationGetStatusMessageAttributeType(arg *AuthenticationGetStatusMessageAttributeType, val AuthenticationGetStatusMessageRetType) { + *arg = &val +} + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type AuthenticationGetStatusArgType = string +type AuthenticationGetStatusMessageArgType = string // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type AuthenticationGetStatusRetType = string +type AuthenticationGetStatusMessageRetType = string // Authentication Describes an authentication definition associated to a STACKIT Git instance. The provider type will be an openidConnect type. // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @@ -292,6 +449,8 @@ type Authentication struct { // The current status of the authentication definition. // REQUIRED Status AuthenticationGetStatusAttributeType `json:"status" required:"true"` + // Provides additional information or error details when the status is 'Error'. + StatusMessage AuthenticationGetStatusMessageAttributeType `json:"status_message,omitempty"` } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @@ -505,6 +664,33 @@ func (o *Authentication) SetStatus(v AuthenticationGetStatusRetType) { setAuthenticationGetStatusAttributeType(&o.Status, v) } +// GetStatusMessage returns the StatusMessage field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Authentication) GetStatusMessage() (res AuthenticationGetStatusMessageRetType) { + res, _ = o.GetStatusMessageOk() + return +} + +// GetStatusMessageOk returns a tuple with the StatusMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Authentication) GetStatusMessageOk() (ret AuthenticationGetStatusMessageRetType, ok bool) { + return getAuthenticationGetStatusMessageAttributeTypeOk(o.StatusMessage) +} + +// HasStatusMessage returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Authentication) HasStatusMessage() bool { + _, ok := o.GetStatusMessageOk() + return ok +} + +// SetStatusMessage gets a reference to the given string and assigns it to the StatusMessage field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Authentication) SetStatusMessage(v AuthenticationGetStatusMessageRetType) { + setAuthenticationGetStatusMessageAttributeType(&o.StatusMessage, v) +} + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o Authentication) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} @@ -535,6 +721,9 @@ func (o Authentication) ToMap() (map[string]interface{}, error) { if val, ok := getAuthenticationGetStatusAttributeTypeOk(o.Status); ok { toSerialize["Status"] = val } + if val, ok := getAuthenticationGetStatusMessageAttributeTypeOk(o.StatusMessage); ok { + toSerialize["StatusMessage"] = val + } return toSerialize, nil } diff --git a/services/git/model_authentication_test.go b/services/git/model_authentication_test.go index e39c866ed..2c98ac16e 100644 --- a/services/git/model_authentication_test.go +++ b/services/git/model_authentication_test.go @@ -9,3 +9,71 @@ API version: 1beta.0.4 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package git + +import ( + "testing" +) + +// isEnum + +func TestAuthenticationStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"Creating"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"Updating"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"Deleting"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"Ready"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"Error"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := AuthenticationStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/services/git/model_create_user_payload.go b/services/git/model_create_user_payload.go new file mode 100644 index 000000000..00ae1fada --- /dev/null +++ b/services/git/model_create_user_payload.go @@ -0,0 +1,373 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package git + +import ( + "encoding/json" +) + +// checks if the CreateUserPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateUserPayload{} + +/* + types and functions for email +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetEmailAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateUserPayloadGetEmailAttributeTypeOk(arg CreateUserPayloadGetEmailAttributeType) (ret CreateUserPayloadGetEmailRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateUserPayloadGetEmailAttributeType(arg *CreateUserPayloadGetEmailAttributeType, val CreateUserPayloadGetEmailRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetEmailArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetEmailRetType = string + +/* + types and functions for force_send_reset_password +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadgetForceSendResetPasswordAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadgetForceSendResetPasswordArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadgetForceSendResetPasswordRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateUserPayloadgetForceSendResetPasswordAttributeTypeOk(arg CreateUserPayloadgetForceSendResetPasswordAttributeType) (ret CreateUserPayloadgetForceSendResetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateUserPayloadgetForceSendResetPasswordAttributeType(arg *CreateUserPayloadgetForceSendResetPasswordAttributeType, val CreateUserPayloadgetForceSendResetPasswordRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateUserPayloadGetNameAttributeTypeOk(arg CreateUserPayloadGetNameAttributeType) (ret CreateUserPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateUserPayloadGetNameAttributeType(arg *CreateUserPayloadGetNameAttributeType, val CreateUserPayloadGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetNameRetType = string + +/* + types and functions for password +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetPasswordAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateUserPayloadGetPasswordAttributeTypeOk(arg CreateUserPayloadGetPasswordAttributeType) (ret CreateUserPayloadGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateUserPayloadGetPasswordAttributeType(arg *CreateUserPayloadGetPasswordAttributeType, val CreateUserPayloadGetPasswordRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetPasswordArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetPasswordRetType = string + +/* + types and functions for username +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetUsernameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateUserPayloadGetUsernameAttributeTypeOk(arg CreateUserPayloadGetUsernameAttributeType) (ret CreateUserPayloadGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateUserPayloadGetUsernameAttributeType(arg *CreateUserPayloadGetUsernameAttributeType, val CreateUserPayloadGetUsernameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetUsernameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayloadGetUsernameRetType = string + +// CreateUserPayload Request a STACKIT Git instance User to be created with these properties. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateUserPayload struct { + // A user chosen email to distinguish multiple STACKIT Git instance Users. + // REQUIRED + Email CreateUserPayloadGetEmailAttributeType `json:"email" required:"true"` + // Whether to force sending a reset password email. + ForceSendResetPassword CreateUserPayloadgetForceSendResetPasswordAttributeType `json:"force_send_reset_password,omitempty"` + // Name of the user. + // REQUIRED + Name CreateUserPayloadGetNameAttributeType `json:"name" required:"true"` + // A user password to allow user/pass instance login. + // REQUIRED + Password CreateUserPayloadGetPasswordAttributeType `json:"password" required:"true"` + // A user chosen username to distinguish multiple STACKIT Git instance Users. + // REQUIRED + Username CreateUserPayloadGetUsernameAttributeType `json:"username" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _CreateUserPayload CreateUserPayload + +// NewCreateUserPayload instantiates a new CreateUserPayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCreateUserPayload(email CreateUserPayloadGetEmailArgType, name CreateUserPayloadGetNameArgType, password CreateUserPayloadGetPasswordArgType, username CreateUserPayloadGetUsernameArgType) *CreateUserPayload { + this := CreateUserPayload{} + setCreateUserPayloadGetEmailAttributeType(&this.Email, email) + setCreateUserPayloadGetNameAttributeType(&this.Name, name) + setCreateUserPayloadGetPasswordAttributeType(&this.Password, password) + setCreateUserPayloadGetUsernameAttributeType(&this.Username, username) + return &this +} + +// NewCreateUserPayloadWithDefaults instantiates a new CreateUserPayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCreateUserPayloadWithDefaults() *CreateUserPayload { + this := CreateUserPayload{} + var forceSendResetPassword bool = false + this.ForceSendResetPassword = &forceSendResetPassword + return &this +} + +// GetEmail returns the Email field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetEmail() (ret CreateUserPayloadGetEmailRetType) { + ret, _ = o.GetEmailOk() + return ret +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetEmailOk() (ret CreateUserPayloadGetEmailRetType, ok bool) { + return getCreateUserPayloadGetEmailAttributeTypeOk(o.Email) +} + +// SetEmail sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) SetEmail(v CreateUserPayloadGetEmailRetType) { + setCreateUserPayloadGetEmailAttributeType(&o.Email, v) +} + +// GetForceSendResetPassword returns the ForceSendResetPassword field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetForceSendResetPassword() (res CreateUserPayloadgetForceSendResetPasswordRetType) { + res, _ = o.GetForceSendResetPasswordOk() + return +} + +// GetForceSendResetPasswordOk returns a tuple with the ForceSendResetPassword field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetForceSendResetPasswordOk() (ret CreateUserPayloadgetForceSendResetPasswordRetType, ok bool) { + return getCreateUserPayloadgetForceSendResetPasswordAttributeTypeOk(o.ForceSendResetPassword) +} + +// HasForceSendResetPassword returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) HasForceSendResetPassword() bool { + _, ok := o.GetForceSendResetPasswordOk() + return ok +} + +// SetForceSendResetPassword gets a reference to the given bool and assigns it to the ForceSendResetPassword field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) SetForceSendResetPassword(v CreateUserPayloadgetForceSendResetPasswordRetType) { + setCreateUserPayloadgetForceSendResetPasswordAttributeType(&o.ForceSendResetPassword, v) +} + +// GetName returns the Name field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetName() (ret CreateUserPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetNameOk() (ret CreateUserPayloadGetNameRetType, ok bool) { + return getCreateUserPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) SetName(v CreateUserPayloadGetNameRetType) { + setCreateUserPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPassword returns the Password field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetPassword() (ret CreateUserPayloadGetPasswordRetType) { + ret, _ = o.GetPasswordOk() + return ret +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetPasswordOk() (ret CreateUserPayloadGetPasswordRetType, ok bool) { + return getCreateUserPayloadGetPasswordAttributeTypeOk(o.Password) +} + +// SetPassword sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) SetPassword(v CreateUserPayloadGetPasswordRetType) { + setCreateUserPayloadGetPasswordAttributeType(&o.Password, v) +} + +// GetUsername returns the Username field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetUsername() (ret CreateUserPayloadGetUsernameRetType) { + ret, _ = o.GetUsernameOk() + return ret +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) GetUsernameOk() (ret CreateUserPayloadGetUsernameRetType, ok bool) { + return getCreateUserPayloadGetUsernameAttributeTypeOk(o.Username) +} + +// SetUsername sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateUserPayload) SetUsername(v CreateUserPayloadGetUsernameRetType) { + setCreateUserPayloadGetUsernameAttributeType(&o.Username, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o CreateUserPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateUserPayloadGetEmailAttributeTypeOk(o.Email); ok { + toSerialize["Email"] = val + } + if val, ok := getCreateUserPayloadgetForceSendResetPasswordAttributeTypeOk(o.ForceSendResetPassword); ok { + toSerialize["ForceSendResetPassword"] = val + } + if val, ok := getCreateUserPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateUserPayloadGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + if val, ok := getCreateUserPayloadGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableCreateUserPayload struct { + value *CreateUserPayload + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateUserPayload) Get() *CreateUserPayload { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateUserPayload) Set(val *CreateUserPayload) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateUserPayload) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateUserPayload) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableCreateUserPayload(val *CreateUserPayload) *NullableCreateUserPayload { + return &NullableCreateUserPayload{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateUserPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateUserPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_create_user_payload_test.go b/services/git/model_create_user_payload_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_create_user_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package git diff --git a/services/git/model_feature_toggle.go b/services/git/model_feature_toggle.go index b2255d409..837eb793e 100644 --- a/services/git/model_feature_toggle.go +++ b/services/git/model_feature_toggle.go @@ -173,21 +173,21 @@ func setFeatureToggleGetDefaultEmailNotificationsAttributeType(arg *FeatureToggl } /* - types and functions for enable_commit_signatures + types and functions for enable_local_login */ // isBoolean // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type FeatureTogglegetEnableCommitSignaturesAttributeType = *bool +type FeatureTogglegetEnableLocalLoginAttributeType = *bool // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type FeatureTogglegetEnableCommitSignaturesArgType = *bool +type FeatureTogglegetEnableLocalLoginArgType = *bool // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type FeatureTogglegetEnableCommitSignaturesRetType = *bool +type FeatureTogglegetEnableLocalLoginRetType = *bool // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(arg FeatureTogglegetEnableCommitSignaturesAttributeType) (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) { +func getFeatureTogglegetEnableLocalLoginAttributeTypeOk(arg FeatureTogglegetEnableLocalLoginAttributeType) (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) { if arg == nil { return nil, false } @@ -195,35 +195,35 @@ func getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(arg FeatureToggleg } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func setFeatureTogglegetEnableCommitSignaturesAttributeType(arg *FeatureTogglegetEnableCommitSignaturesAttributeType, val FeatureTogglegetEnableCommitSignaturesRetType) { +func setFeatureTogglegetEnableLocalLoginAttributeType(arg *FeatureTogglegetEnableLocalLoginAttributeType, val FeatureTogglegetEnableLocalLoginRetType) { *arg = val } /* - types and functions for enable_local_login + types and functions for pipelines */ -// isBoolean +// isModel // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type FeatureTogglegetEnableLocalLoginAttributeType = *bool +type FeatureToggleGetPipelinesAttributeType = *Pipelines // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type FeatureTogglegetEnableLocalLoginArgType = *bool +type FeatureToggleGetPipelinesArgType = Pipelines // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type FeatureTogglegetEnableLocalLoginRetType = *bool +type FeatureToggleGetPipelinesRetType = Pipelines // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func getFeatureTogglegetEnableLocalLoginAttributeTypeOk(arg FeatureTogglegetEnableLocalLoginAttributeType) (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) { +func getFeatureToggleGetPipelinesAttributeTypeOk(arg FeatureToggleGetPipelinesAttributeType) (ret FeatureToggleGetPipelinesRetType, ok bool) { if arg == nil { - return nil, false + return ret, false } - return arg, true + return *arg, true } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func setFeatureTogglegetEnableLocalLoginAttributeType(arg *FeatureTogglegetEnableLocalLoginAttributeType, val FeatureTogglegetEnableLocalLoginRetType) { - *arg = val +func setFeatureToggleGetPipelinesAttributeType(arg *FeatureToggleGetPipelinesAttributeType, val FeatureToggleGetPipelinesRetType) { + *arg = &val } // FeatureToggle Feature toggles for the instance. @@ -231,10 +231,9 @@ func setFeatureTogglegetEnableLocalLoginAttributeType(arg *FeatureTogglegetEnabl type FeatureToggle struct { // Default email notifications. DefaultEmailNotifications FeatureToggleGetDefaultEmailNotificationsAttributeType `json:"default_email_notifications,omitempty"` - // Enable commit signatures. - EnableCommitSignatures FeatureTogglegetEnableCommitSignaturesAttributeType `json:"enable_commit_signatures,omitempty"` // Enable local login. EnableLocalLogin FeatureTogglegetEnableLocalLoginAttributeType `json:"enable_local_login,omitempty"` + Pipelines FeatureToggleGetPipelinesAttributeType `json:"pipelines,omitempty"` } // NewFeatureToggle instantiates a new FeatureToggle object @@ -296,46 +295,6 @@ func (o *FeatureToggle) UnsetDefaultEmailNotifications() { o.DefaultEmailNotifications = nil } -// GetEnableCommitSignatures returns the EnableCommitSignatures field value if set, zero value otherwise (both if not set or set to explicit null). -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (o *FeatureToggle) GetEnableCommitSignatures() (res FeatureTogglegetEnableCommitSignaturesRetType) { - res, _ = o.GetEnableCommitSignaturesOk() - return -} - -// GetEnableCommitSignaturesOk returns a tuple with the EnableCommitSignatures field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (o *FeatureToggle) GetEnableCommitSignaturesOk() (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) { - return getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures) -} - -// HasEnableCommitSignatures returns a boolean if a field has been set. -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (o *FeatureToggle) HasEnableCommitSignatures() bool { - _, ok := o.GetEnableCommitSignaturesOk() - return ok -} - -// SetEnableCommitSignatures gets a reference to the given bool and assigns it to the EnableCommitSignatures field. -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (o *FeatureToggle) SetEnableCommitSignatures(v FeatureTogglegetEnableCommitSignaturesRetType) { - setFeatureTogglegetEnableCommitSignaturesAttributeType(&o.EnableCommitSignatures, v) -} - -// SetEnableCommitSignaturesNil sets the value for EnableCommitSignatures to be an explicit nil -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (o *FeatureToggle) SetEnableCommitSignaturesNil() { - o.EnableCommitSignatures = nil -} - -// UnsetEnableCommitSignatures ensures that no value is present for EnableCommitSignatures, not even an explicit nil -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (o *FeatureToggle) UnsetEnableCommitSignatures() { - o.EnableCommitSignatures = nil -} - // GetEnableLocalLogin returns the EnableLocalLogin field value if set, zero value otherwise (both if not set or set to explicit null). // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *FeatureToggle) GetEnableLocalLogin() (res FeatureTogglegetEnableLocalLoginRetType) { @@ -376,18 +335,45 @@ func (o *FeatureToggle) UnsetEnableLocalLogin() { o.EnableLocalLogin = nil } +// GetPipelines returns the Pipelines field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *FeatureToggle) GetPipelines() (res FeatureToggleGetPipelinesRetType) { + res, _ = o.GetPipelinesOk() + return +} + +// GetPipelinesOk returns a tuple with the Pipelines field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *FeatureToggle) GetPipelinesOk() (ret FeatureToggleGetPipelinesRetType, ok bool) { + return getFeatureToggleGetPipelinesAttributeTypeOk(o.Pipelines) +} + +// HasPipelines returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *FeatureToggle) HasPipelines() bool { + _, ok := o.GetPipelinesOk() + return ok +} + +// SetPipelines gets a reference to the given Pipelines and assigns it to the Pipelines field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *FeatureToggle) SetPipelines(v FeatureToggleGetPipelinesRetType) { + setFeatureToggleGetPipelinesAttributeType(&o.Pipelines, v) +} + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o FeatureToggle) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(o.DefaultEmailNotifications); ok { toSerialize["DefaultEmailNotifications"] = val } - if val, ok := getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures); ok { - toSerialize["EnableCommitSignatures"] = val - } if val, ok := getFeatureTogglegetEnableLocalLoginAttributeTypeOk(o.EnableLocalLogin); ok { toSerialize["EnableLocalLogin"] = val } + if val, ok := getFeatureToggleGetPipelinesAttributeTypeOk(o.Pipelines); ok { + toSerialize["Pipelines"] = val + } return toSerialize, nil } diff --git a/services/git/model_list_users.go b/services/git/model_list_users.go new file mode 100644 index 000000000..399fc8fe1 --- /dev/null +++ b/services/git/model_list_users.go @@ -0,0 +1,149 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package git + +import ( + "encoding/json" +) + +// checks if the ListUsers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListUsers{} + +/* + types and functions for users +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListUsersGetUsersAttributeType = *[]User + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListUsersGetUsersArgType = []User + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListUsersGetUsersRetType = []User + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getListUsersGetUsersAttributeTypeOk(arg ListUsersGetUsersAttributeType) (ret ListUsersGetUsersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setListUsersGetUsersAttributeType(arg *ListUsersGetUsersAttributeType, val ListUsersGetUsersRetType) { + *arg = &val +} + +// ListUsers A list of STACKIT Git instance Users. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListUsers struct { + // REQUIRED + Users ListUsersGetUsersAttributeType `json:"users" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _ListUsers ListUsers + +// NewListUsers instantiates a new ListUsers 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewListUsers(users ListUsersGetUsersArgType) *ListUsers { + this := ListUsers{} + setListUsersGetUsersAttributeType(&this.Users, users) + return &this +} + +// NewListUsersWithDefaults instantiates a new ListUsers 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewListUsersWithDefaults() *ListUsers { + this := ListUsers{} + return &this +} + +// GetUsers returns the Users field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ListUsers) GetUsers() (ret ListUsersGetUsersRetType) { + ret, _ = o.GetUsersOk() + return ret +} + +// GetUsersOk returns a tuple with the Users field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ListUsers) GetUsersOk() (ret ListUsersGetUsersRetType, ok bool) { + return getListUsersGetUsersAttributeTypeOk(o.Users) +} + +// SetUsers sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ListUsers) SetUsers(v ListUsersGetUsersRetType) { + setListUsersGetUsersAttributeType(&o.Users, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o ListUsers) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListUsersGetUsersAttributeTypeOk(o.Users); ok { + toSerialize["Users"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableListUsers struct { + value *ListUsers + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableListUsers) Get() *ListUsers { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableListUsers) Set(val *ListUsers) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableListUsers) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableListUsers) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableListUsers(val *ListUsers) *NullableListUsers { + return &NullableListUsers{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableListUsers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableListUsers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_list_users_test.go b/services/git/model_list_users_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_list_users_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package git diff --git a/services/git/model_patch_user_payload.go b/services/git/model_patch_user_payload.go new file mode 100644 index 000000000..26e636536 --- /dev/null +++ b/services/git/model_patch_user_payload.go @@ -0,0 +1,270 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package git + +import ( + "encoding/json" +) + +// checks if the PatchUserPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchUserPayload{} + +/* + types and functions for email +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetEmailAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getPatchUserPayloadGetEmailAttributeTypeOk(arg PatchUserPayloadGetEmailAttributeType) (ret PatchUserPayloadGetEmailRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setPatchUserPayloadGetEmailAttributeType(arg *PatchUserPayloadGetEmailAttributeType, val PatchUserPayloadGetEmailRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetEmailArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetEmailRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getPatchUserPayloadGetNameAttributeTypeOk(arg PatchUserPayloadGetNameAttributeType) (ret PatchUserPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setPatchUserPayloadGetNameAttributeType(arg *PatchUserPayloadGetNameAttributeType, val PatchUserPayloadGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetNameRetType = string + +/* + types and functions for password +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetPasswordAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getPatchUserPayloadGetPasswordAttributeTypeOk(arg PatchUserPayloadGetPasswordAttributeType) (ret PatchUserPayloadGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setPatchUserPayloadGetPasswordAttributeType(arg *PatchUserPayloadGetPasswordAttributeType, val PatchUserPayloadGetPasswordRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetPasswordArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayloadGetPasswordRetType = string + +// PatchUserPayload Properties to patch a Instance User. All fields are optional. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PatchUserPayload struct { + // A user chosen email to distinguish multiple STACKIT Git instance Users. + Email PatchUserPayloadGetEmailAttributeType `json:"email,omitempty"` + // Name of the user. + Name PatchUserPayloadGetNameAttributeType `json:"name,omitempty"` + // A user password to allow user/pass instance login. + Password PatchUserPayloadGetPasswordAttributeType `json:"password,omitempty"` +} + +// NewPatchUserPayload instantiates a new PatchUserPayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewPatchUserPayload() *PatchUserPayload { + this := PatchUserPayload{} + return &this +} + +// NewPatchUserPayloadWithDefaults instantiates a new PatchUserPayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewPatchUserPayloadWithDefaults() *PatchUserPayload { + this := PatchUserPayload{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) GetEmail() (res PatchUserPayloadGetEmailRetType) { + res, _ = o.GetEmailOk() + return +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) GetEmailOk() (ret PatchUserPayloadGetEmailRetType, ok bool) { + return getPatchUserPayloadGetEmailAttributeTypeOk(o.Email) +} + +// HasEmail returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) HasEmail() bool { + _, ok := o.GetEmailOk() + return ok +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) SetEmail(v PatchUserPayloadGetEmailRetType) { + setPatchUserPayloadGetEmailAttributeType(&o.Email, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) GetName() (res PatchUserPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) GetNameOk() (ret PatchUserPayloadGetNameRetType, ok bool) { + return getPatchUserPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) SetName(v PatchUserPayloadGetNameRetType) { + setPatchUserPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPassword returns the Password field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) GetPassword() (res PatchUserPayloadGetPasswordRetType) { + res, _ = o.GetPasswordOk() + return +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) GetPasswordOk() (ret PatchUserPayloadGetPasswordRetType, ok bool) { + return getPatchUserPayloadGetPasswordAttributeTypeOk(o.Password) +} + +// HasPassword returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) HasPassword() bool { + _, ok := o.GetPasswordOk() + return ok +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *PatchUserPayload) SetPassword(v PatchUserPayloadGetPasswordRetType) { + setPatchUserPayloadGetPasswordAttributeType(&o.Password, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o PatchUserPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPatchUserPayloadGetEmailAttributeTypeOk(o.Email); ok { + toSerialize["Email"] = val + } + if val, ok := getPatchUserPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getPatchUserPayloadGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullablePatchUserPayload struct { + value *PatchUserPayload + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullablePatchUserPayload) Get() *PatchUserPayload { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullablePatchUserPayload) Set(val *PatchUserPayload) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullablePatchUserPayload) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullablePatchUserPayload) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullablePatchUserPayload(val *PatchUserPayload) *NullablePatchUserPayload { + return &NullablePatchUserPayload{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullablePatchUserPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullablePatchUserPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_patch_user_payload_test.go b/services/git/model_patch_user_payload_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_patch_user_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package git diff --git a/services/git/model_pipelines.go b/services/git/model_pipelines.go new file mode 100644 index 000000000..550ef3298 --- /dev/null +++ b/services/git/model_pipelines.go @@ -0,0 +1,241 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package git + +import ( + "encoding/json" +) + +// checks if the Pipelines type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Pipelines{} + +/* + types and functions for action_url +*/ + +// isNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PipelinesGetActionUrlAttributeType = *NullableString + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getPipelinesGetActionUrlAttributeTypeOk(arg PipelinesGetActionUrlAttributeType) (ret PipelinesGetActionUrlRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setPipelinesGetActionUrlAttributeType(arg *PipelinesGetActionUrlAttributeType, val PipelinesGetActionUrlRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PipelinesGetActionUrlArgType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PipelinesGetActionUrlRetType = *string + +/* + types and functions for enabled +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PipelinesgetEnabledAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PipelinesgetEnabledArgType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type PipelinesgetEnabledRetType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getPipelinesgetEnabledAttributeTypeOk(arg PipelinesgetEnabledAttributeType) (ret PipelinesgetEnabledRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setPipelinesgetEnabledAttributeType(arg *PipelinesgetEnabledAttributeType, val PipelinesgetEnabledRetType) { + *arg = val +} + +// Pipelines Feature toggles for instance pipelines +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Pipelines struct { + // The action URL for the pipelines + ActionUrl PipelinesGetActionUrlAttributeType `json:"action_url,omitempty"` + // Enable pipelines for this instance + Enabled PipelinesgetEnabledAttributeType `json:"enabled,omitempty"` +} + +// NewPipelines instantiates a new Pipelines 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewPipelines() *Pipelines { + this := Pipelines{} + return &this +} + +// NewPipelinesWithDefaults instantiates a new Pipelines 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewPipelinesWithDefaults() *Pipelines { + this := Pipelines{} + return &this +} + +// GetActionUrl returns the ActionUrl field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) GetActionUrl() (res PipelinesGetActionUrlRetType) { + res, _ = o.GetActionUrlOk() + return +} + +// GetActionUrlOk returns a tuple with the ActionUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) GetActionUrlOk() (ret PipelinesGetActionUrlRetType, ok bool) { + return getPipelinesGetActionUrlAttributeTypeOk(o.ActionUrl) +} + +// HasActionUrl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) HasActionUrl() bool { + _, ok := o.GetActionUrlOk() + return ok +} + +// SetActionUrl gets a reference to the given string and assigns it to the ActionUrl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) SetActionUrl(v PipelinesGetActionUrlRetType) { + setPipelinesGetActionUrlAttributeType(&o.ActionUrl, v) +} + +// SetActionUrlNil sets the value for ActionUrl to be an explicit nil +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) SetActionUrlNil() { + o.ActionUrl = nil +} + +// UnsetActionUrl ensures that no value is present for ActionUrl, not even an explicit nil +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) UnsetActionUrl() { + o.ActionUrl = nil +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) GetEnabled() (res PipelinesgetEnabledRetType) { + res, _ = o.GetEnabledOk() + return +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) GetEnabledOk() (ret PipelinesgetEnabledRetType, ok bool) { + return getPipelinesgetEnabledAttributeTypeOk(o.Enabled) +} + +// HasEnabled returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) HasEnabled() bool { + _, ok := o.GetEnabledOk() + return ok +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) SetEnabled(v PipelinesgetEnabledRetType) { + setPipelinesgetEnabledAttributeType(&o.Enabled, v) +} + +// SetEnabledNil sets the value for Enabled to be an explicit nil +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) SetEnabledNil() { + o.Enabled = nil +} + +// UnsetEnabled ensures that no value is present for Enabled, not even an explicit nil +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Pipelines) UnsetEnabled() { + o.Enabled = nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Pipelines) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPipelinesGetActionUrlAttributeTypeOk(o.ActionUrl); ok { + toSerialize["ActionUrl"] = val + } + if val, ok := getPipelinesgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullablePipelines struct { + value *Pipelines + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullablePipelines) Get() *Pipelines { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullablePipelines) Set(val *Pipelines) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullablePipelines) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullablePipelines) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullablePipelines(val *Pipelines) *NullablePipelines { + return &NullablePipelines{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullablePipelines) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullablePipelines) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_pipelines_test.go b/services/git/model_pipelines_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_pipelines_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package git diff --git a/services/git/model_user.go b/services/git/model_user.go new file mode 100644 index 000000000..98cdf503b --- /dev/null +++ b/services/git/model_user.go @@ -0,0 +1,317 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package git + +import ( + "encoding/json" +) + +// checks if the User type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &User{} + +/* + types and functions for email +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetEmailAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getUserGetEmailAttributeTypeOk(arg UserGetEmailAttributeType) (ret UserGetEmailRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setUserGetEmailAttributeType(arg *UserGetEmailAttributeType, val UserGetEmailRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetEmailArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetEmailRetType = string + +/* + types and functions for id +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetIdAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetIdArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetIdRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getUserGetIdAttributeTypeOk(arg UserGetIdAttributeType) (ret UserGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setUserGetIdAttributeType(arg *UserGetIdAttributeType, val UserGetIdRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getUserGetNameAttributeTypeOk(arg UserGetNameAttributeType) (ret UserGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setUserGetNameAttributeType(arg *UserGetNameAttributeType, val UserGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetNameRetType = string + +/* + types and functions for username +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetUsernameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getUserGetUsernameAttributeTypeOk(arg UserGetUsernameAttributeType) (ret UserGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setUserGetUsernameAttributeType(arg *UserGetUsernameAttributeType, val UserGetUsernameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetUsernameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type UserGetUsernameRetType = string + +// User Describes a STACKIT Git instance User. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type User struct { + // A user chosen email to distinguish multiple STACKIT Git instance Users. + // REQUIRED + Email UserGetEmailAttributeType `json:"email" required:"true"` + // A auto generated unique id which identifies the STACKIT Git instances. + Id UserGetIdAttributeType `json:"id,omitempty"` + // Name of the user. + // REQUIRED + Name UserGetNameAttributeType `json:"name" required:"true"` + // A user chosen username to distinguish multiple STACKIT Git instance Users. + // REQUIRED + Username UserGetUsernameAttributeType `json:"username" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _User User + +// NewUser instantiates a new User 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewUser(email UserGetEmailArgType, name UserGetNameArgType, username UserGetUsernameArgType) *User { + this := User{} + setUserGetEmailAttributeType(&this.Email, email) + setUserGetNameAttributeType(&this.Name, name) + setUserGetUsernameAttributeType(&this.Username, username) + return &this +} + +// NewUserWithDefaults instantiates a new User 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetEmail returns the Email field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) GetEmail() (ret UserGetEmailRetType) { + ret, _ = o.GetEmailOk() + return ret +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) GetEmailOk() (ret UserGetEmailRetType, ok bool) { + return getUserGetEmailAttributeTypeOk(o.Email) +} + +// SetEmail sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) SetEmail(v UserGetEmailRetType) { + setUserGetEmailAttributeType(&o.Email, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) GetId() (res UserGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) GetIdOk() (ret UserGetIdRetType, ok bool) { + return getUserGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) SetId(v UserGetIdRetType) { + setUserGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) GetName() (ret UserGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) GetNameOk() (ret UserGetNameRetType, ok bool) { + return getUserGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) SetName(v UserGetNameRetType) { + setUserGetNameAttributeType(&o.Name, v) +} + +// GetUsername returns the Username field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) GetUsername() (ret UserGetUsernameRetType) { + ret, _ = o.GetUsernameOk() + return ret +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) GetUsernameOk() (ret UserGetUsernameRetType, ok bool) { + return getUserGetUsernameAttributeTypeOk(o.Username) +} + +// SetUsername sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *User) SetUsername(v UserGetUsernameRetType) { + setUserGetUsernameAttributeType(&o.Username, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o User) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUserGetEmailAttributeTypeOk(o.Email); ok { + toSerialize["Email"] = val + } + if val, ok := getUserGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getUserGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUserGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableUser struct { + value *User + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableUser) Get() *User { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableUser) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_user_test.go b/services/git/model_user_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_user_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package git diff --git a/services/git/oas_commit b/services/git/oas_commit index c08a6770d..e9709bac1 100644 --- a/services/git/oas_commit +++ b/services/git/oas_commit @@ -1 +1 @@ -4407196dbbef4e53e6798809e856725cbc84ae05 +ab1981b26da8ccd28bb0fb761ce81584235a2ff4 diff --git a/services/git/v1betaapi/api_default.go b/services/git/v1betaapi/api_default.go index cbb5762dd..f941a7855 100644 --- a/services/git/v1betaapi/api_default.go +++ b/services/git/v1betaapi/api_default.go @@ -74,6 +74,23 @@ type DefaultAPI interface { // @return Runner CreateRunnerExecute(r ApiCreateRunnerRequest) (*Runner, error) + /* + CreateUser Create an Instance Local/Technical User. + + Creates a new STACKIT Git instance Local/Technical User. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiCreateUserRequest + */ + CreateUser(ctx context.Context, projectId string, instanceId string) ApiCreateUserRequest + + // CreateUserExecute executes the request + // @return User + CreateUserExecute(r ApiCreateUserRequest) (*User, error) + /* DeleteAuthentication Delete Authentication Source @@ -123,6 +140,23 @@ type DefaultAPI interface { // DeleteRunnerExecute executes the request DeleteRunnerExecute(r ApiDeleteRunnerRequest) error + /* + DeleteUser Delete Instance User. + + Deletes a STACKIT Git instance User and destroys all associated data. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiDeleteUserRequest + */ + DeleteUser(ctx context.Context, projectId string, instanceId string, username string) ApiDeleteUserRequest + + // DeleteUserExecute executes the request + DeleteUserExecute(r ApiDeleteUserRequest) error + /* GetAuthentication Get authentication provider @@ -173,6 +207,39 @@ type DefaultAPI interface { // @return Runner GetRunnerExecute(r ApiGetRunnerRequest) (*Runner, error) + /* + GetUser Get Instance User information. + + Retrieves information about a STACKIT Git instance User. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiGetUserRequest + */ + GetUser(ctx context.Context, projectId string, instanceId string, username string) ApiGetUserRequest + + // GetUserExecute executes the request + GetUserExecute(r ApiGetUserRequest) error + + /* + GetUsers Get instance Users. + + Lists all STACKIT Git Users within an instances. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetUsersRequest + */ + GetUsers(ctx context.Context, projectId string, instanceId string) ApiGetUsersRequest + + // GetUsersExecute executes the request + // @return ListUsers + GetUsersExecute(r ApiGetUsersRequest) (*ListUsers, error) + /* ListAuthentication List authentication sources @@ -271,6 +338,24 @@ type DefaultAPI interface { // PatchInstanceExecute executes the request // @return Instance PatchInstanceExecute(r ApiPatchInstanceRequest) (*Instance, error) + + /* + PatchUser Patch Instance User. + + Patches the Instance User. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiPatchUserRequest + */ + PatchUser(ctx context.Context, projectId string, instanceId string, username string) ApiPatchUserRequest + + // PatchUserExecute executes the request + // @return User + PatchUserExecute(r ApiPatchUserRequest) (*User, error) } // DefaultAPIService DefaultAPI service @@ -813,6 +898,181 @@ func (a *DefaultAPIService) CreateRunnerExecute(r ApiCreateRunnerRequest) (*Runn return localVarReturnValue, nil } +type ApiCreateUserRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + instanceId string + createUserPayload *CreateUserPayload +} + +// Instance User details options. +func (r ApiCreateUserRequest) CreateUserPayload(createUserPayload CreateUserPayload) ApiCreateUserRequest { + r.createUserPayload = &createUserPayload + return r +} + +func (r ApiCreateUserRequest) Execute() (*User, error) { + return r.ApiService.CreateUserExecute(r) +} + +/* +CreateUser Create an Instance Local/Technical User. + +Creates a new STACKIT Git instance Local/Technical User. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiCreateUserRequest +*/ +func (a *DefaultAPIService) CreateUser(ctx context.Context, projectId string, instanceId string) ApiCreateUserRequest { + return ApiCreateUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return User +func (a *DefaultAPIService) CreateUserExecute(r ApiCreateUserRequest) (*User, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, reportError("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, reportError("instanceId must have less than 36 elements") + } + if r.createUserPayload == nil { + return localVarReturnValue, reportError("createUserPayload 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.createUserPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + type ApiDeleteAuthenticationRequest struct { ctx context.Context ApiService DefaultAPI @@ -1295,80 +1555,549 @@ func (a *DefaultAPIService) DeleteRunnerExecute(r ApiDeleteRunnerRequest) error return nil } -type ApiGetAuthenticationRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - instanceId string - authenticationId string +type ApiDeleteUserRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + instanceId string + username string } -func (r ApiGetAuthenticationRequest) Execute() (*Authentication, error) { - return r.ApiService.GetAuthenticationExecute(r) +func (r ApiDeleteUserRequest) Execute() error { + return r.ApiService.DeleteUserExecute(r) } /* -GetAuthentication Get authentication provider +DeleteUser Delete Instance User. -# Get authentication provider +Deletes a STACKIT Git instance User and destroys all associated data. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. @param instanceId Instance identifier. - @param authenticationId Authentication Source identifier. - @return ApiGetAuthenticationRequest + @param username Instance User identifier. + @return ApiDeleteUserRequest */ -func (a *DefaultAPIService) GetAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiGetAuthenticationRequest { - return ApiGetAuthenticationRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - instanceId: instanceId, - authenticationId: authenticationId, +func (a *DefaultAPIService) DeleteUser(ctx context.Context, projectId string, instanceId string, username string) ApiDeleteUserRequest { + return ApiDeleteUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, } } // Execute executes the request -// -// @return Authentication -func (a *DefaultAPIService) GetAuthenticationExecute(r ApiGetAuthenticationRequest) (*Authentication, error) { +func (a *DefaultAPIService) DeleteUserExecute(r ApiDeleteUserRequest) error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Authentication + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetAuthentication") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteUser") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users/{username}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(parameterValueToString(r.authenticationId, "authenticationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, reportError("projectId must have at least 36 elements") + return reportError("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, reportError("projectId must have less than 36 elements") + return reportError("projectId must have less than 36 elements") } if strlen(r.instanceId) < 36 { - return localVarReturnValue, reportError("instanceId must have at least 36 elements") + return reportError("instanceId must have at least 36 elements") } if strlen(r.instanceId) > 36 { - return localVarReturnValue, reportError("instanceId must have less than 36 elements") - } - if strlen(r.authenticationId) < 36 { - return localVarReturnValue, reportError("authenticationId must have at least 36 elements") - } - if strlen(r.authenticationId) > 36 { - return localVarReturnValue, reportError("authenticationId must have less than 36 elements") + return reportError("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiGetAuthenticationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + instanceId string + authenticationId string +} + +func (r ApiGetAuthenticationRequest) Execute() (*Authentication, error) { + return r.ApiService.GetAuthenticationExecute(r) +} + +/* +GetAuthentication Get authentication provider + +# Get authentication provider + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiGetAuthenticationRequest +*/ +func (a *DefaultAPIService) GetAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiGetAuthenticationRequest { + return ApiGetAuthenticationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } +} + +// Execute executes the request +// +// @return Authentication +func (a *DefaultAPIService) GetAuthenticationExecute(r ApiGetAuthenticationRequest) (*Authentication, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Authentication + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetAuthentication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(parameterValueToString(r.authenticationId, "authenticationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, reportError("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, reportError("instanceId must have less than 36 elements") + } + if strlen(r.authenticationId) < 36 { + return localVarReturnValue, reportError("authenticationId must have at least 36 elements") + } + if strlen(r.authenticationId) > 36 { + return localVarReturnValue, reportError("authenticationId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v InternalServerErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + instanceId string +} + +func (r ApiGetInstanceRequest) Execute() (*Instance, error) { + return r.ApiService.GetInstanceExecute(r) +} + +/* +GetInstance Get Instance information. + +Retrieves information about a STACKIT Git instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetInstanceRequest +*/ +func (a *DefaultAPIService) GetInstance(ctx context.Context, projectId string, instanceId string) ApiGetInstanceRequest { + return ApiGetInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return Instance +func (a *DefaultAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, reportError("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, reportError("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetRunnerRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + instanceId string +} + +func (r ApiGetRunnerRequest) Execute() (*Runner, error) { + return r.ApiService.GetRunnerExecute(r) +} + +/* +GetRunner Get Runner information. + +Retrieves information about a runner in a STACKIT Git instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetRunnerRequest +*/ +func (a *DefaultAPIService) GetRunner(ctx context.Context, projectId string, instanceId string) ApiGetRunnerRequest { + return ApiGetRunnerRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return Runner +func (a *DefaultAPIService) GetRunnerExecute(r ApiGetRunnerRequest) (*Runner, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Runner + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetRunner") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, reportError("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, reportError("instanceId must have less than 36 elements") } // to determine the Content-Type header @@ -1421,18 +2150,7 @@ func (a *DefaultAPIService) GetAuthenticationExecute(r ApiGetAuthenticationReque StatusCode: localVarHTTPResponse.StatusCode, } if localVarHTTPResponse.StatusCode == 400 { - var v BadErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedErrorResponse + var v GenericErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -1443,7 +2161,7 @@ func (a *DefaultAPIService) GetAuthenticationExecute(r ApiGetAuthenticationReque return localVarReturnValue, newErr } if localVarHTTPResponse.StatusCode == 500 { - var v InternalServerErrorResponse + var v GenericErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -1468,70 +2186,71 @@ func (a *DefaultAPIService) GetAuthenticationExecute(r ApiGetAuthenticationReque return localVarReturnValue, nil } -type ApiGetInstanceRequest struct { +type ApiGetUserRequest struct { ctx context.Context ApiService DefaultAPI projectId string instanceId string + username string } -func (r ApiGetInstanceRequest) Execute() (*Instance, error) { - return r.ApiService.GetInstanceExecute(r) +func (r ApiGetUserRequest) Execute() error { + return r.ApiService.GetUserExecute(r) } /* -GetInstance Get Instance information. +GetUser Get Instance User information. -Retrieves information about a STACKIT Git instance. +Retrieves information about a STACKIT Git instance User. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. @param instanceId Instance identifier. - @return ApiGetInstanceRequest + @param username Instance User identifier. + @return ApiGetUserRequest */ -func (a *DefaultAPIService) GetInstance(ctx context.Context, projectId string, instanceId string) ApiGetInstanceRequest { - return ApiGetInstanceRequest{ +func (a *DefaultAPIService) GetUser(ctx context.Context, projectId string, instanceId string, username string) ApiGetUserRequest { + return ApiGetUserRequest{ ApiService: a, ctx: ctx, projectId: projectId, instanceId: instanceId, + username: username, } } // Execute executes the request -// -// @return Instance -func (a *DefaultAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*Instance, error) { +func (a *DefaultAPIService) GetUserExecute(r ApiGetUserRequest) error { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Instance + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetInstance") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetUser") if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users/{username}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if strlen(r.projectId) < 36 { - return localVarReturnValue, reportError("projectId must have at least 36 elements") + return reportError("projectId must have at least 36 elements") } if strlen(r.projectId) > 36 { - return localVarReturnValue, reportError("projectId must have less than 36 elements") + return reportError("projectId must have less than 36 elements") } if strlen(r.instanceId) < 36 { - return localVarReturnValue, reportError("instanceId must have at least 36 elements") + return reportError("instanceId must have at least 36 elements") } if strlen(r.instanceId) > 36 { - return localVarReturnValue, reportError("instanceId must have less than 36 elements") + return reportError("instanceId must have less than 36 elements") } // to determine the Content-Type header @@ -1553,7 +2272,7 @@ func (a *DefaultAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*Instan } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, err + return err } contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) @@ -1567,14 +2286,14 @@ func (a *DefaultAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*Instan *contextHTTPResponse = localVarHTTPResponse } if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err + return err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, err + return err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1583,77 +2302,67 @@ func (a *DefaultAPIService) GetInstanceExecute(r ApiGetInstanceRequest) (*Instan ErrorMessage: localVarHTTPResponse.Status, StatusCode: localVarHTTPResponse.StatusCode, } - if localVarHTTPResponse.StatusCode == 400 { - var v GenericErrorResponse + if localVarHTTPResponse.StatusCode == 302 { + var v User err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 400 { var v GenericErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return newErr } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr + return newErr } if localVarHTTPResponse.StatusCode == 500 { var v GenericErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr + return 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 newErr } - return localVarReturnValue, nil + return nil } -type ApiGetRunnerRequest struct { +type ApiGetUsersRequest struct { ctx context.Context ApiService DefaultAPI projectId string instanceId string } -func (r ApiGetRunnerRequest) Execute() (*Runner, error) { - return r.ApiService.GetRunnerExecute(r) +func (r ApiGetUsersRequest) Execute() (*ListUsers, error) { + return r.ApiService.GetUsersExecute(r) } /* -GetRunner Get Runner information. +GetUsers Get instance Users. -Retrieves information about a runner in a STACKIT Git instance. +Lists all STACKIT Git Users within an instances. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. @param instanceId Instance identifier. - @return ApiGetRunnerRequest + @return ApiGetUsersRequest */ -func (a *DefaultAPIService) GetRunner(ctx context.Context, projectId string, instanceId string) ApiGetRunnerRequest { - return ApiGetRunnerRequest{ +func (a *DefaultAPIService) GetUsers(ctx context.Context, projectId string, instanceId string) ApiGetUsersRequest { + return ApiGetUsersRequest{ ApiService: a, ctx: ctx, projectId: projectId, @@ -1663,21 +2372,21 @@ func (a *DefaultAPIService) GetRunner(ctx context.Context, projectId string, ins // Execute executes the request // -// @return Runner -func (a *DefaultAPIService) GetRunnerExecute(r ApiGetRunnerRequest) (*Runner, error) { +// @return ListUsers +func (a *DefaultAPIService) GetUsersExecute(r ApiGetUsersRequest) (*ListUsers, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Runner + localVarReturnValue *ListUsers ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetRunner") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetUsers") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) @@ -2741,3 +3450,170 @@ func (a *DefaultAPIService) PatchInstanceExecute(r ApiPatchInstanceRequest) (*In return localVarReturnValue, nil } + +type ApiPatchUserRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + instanceId string + username string + patchUserPayload *PatchUserPayload +} + +func (r ApiPatchUserRequest) PatchUserPayload(patchUserPayload PatchUserPayload) ApiPatchUserRequest { + r.patchUserPayload = &patchUserPayload + return r +} + +func (r ApiPatchUserRequest) Execute() (*User, error) { + return r.ApiService.PatchUserExecute(r) +} + +/* +PatchUser Patch Instance User. + +Patches the Instance User. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param username Instance User identifier. + @return ApiPatchUserRequest +*/ +func (a *DefaultAPIService) PatchUser(ctx context.Context, projectId string, instanceId string, username string) ApiPatchUserRequest { + return ApiPatchUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, + } +} + +// Execute executes the request +// +// @return User +func (a *DefaultAPIService) PatchUserExecute(r ApiPatchUserRequest) (*User, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.PatchUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/users/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterValueToString(r.username, "username")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, reportError("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, reportError("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, reportError("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, reportError("instanceId must have less than 36 elements") + } + if r.patchUserPayload == nil { + return localVarReturnValue, reportError("patchUserPayload 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.patchUserPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} diff --git a/services/git/v1betaapi/api_default_mock.go b/services/git/v1betaapi/api_default_mock.go index 8bfd62212..ca18df10c 100644 --- a/services/git/v1betaapi/api_default_mock.go +++ b/services/git/v1betaapi/api_default_mock.go @@ -27,18 +27,26 @@ type DefaultAPIServiceMock struct { CreateInstanceExecuteMock *func(r ApiCreateInstanceRequest) (*Instance, error) // CreateRunnerExecuteMock can be populated to implement the behavior of the CreateRunnerExecute function of this mock CreateRunnerExecuteMock *func(r ApiCreateRunnerRequest) (*Runner, error) + // CreateUserExecuteMock can be populated to implement the behavior of the CreateUserExecute function of this mock + CreateUserExecuteMock *func(r ApiCreateUserRequest) (*User, error) // DeleteAuthenticationExecuteMock can be populated to implement the behavior of the DeleteAuthenticationExecute function of this mock DeleteAuthenticationExecuteMock *func(r ApiDeleteAuthenticationRequest) error // DeleteInstanceExecuteMock can be populated to implement the behavior of the DeleteInstanceExecute function of this mock DeleteInstanceExecuteMock *func(r ApiDeleteInstanceRequest) error // DeleteRunnerExecuteMock can be populated to implement the behavior of the DeleteRunnerExecute function of this mock DeleteRunnerExecuteMock *func(r ApiDeleteRunnerRequest) error + // DeleteUserExecuteMock can be populated to implement the behavior of the DeleteUserExecute function of this mock + DeleteUserExecuteMock *func(r ApiDeleteUserRequest) error // GetAuthenticationExecuteMock can be populated to implement the behavior of the GetAuthenticationExecute function of this mock GetAuthenticationExecuteMock *func(r ApiGetAuthenticationRequest) (*Authentication, error) // GetInstanceExecuteMock can be populated to implement the behavior of the GetInstanceExecute function of this mock GetInstanceExecuteMock *func(r ApiGetInstanceRequest) (*Instance, error) // GetRunnerExecuteMock can be populated to implement the behavior of the GetRunnerExecute function of this mock GetRunnerExecuteMock *func(r ApiGetRunnerRequest) (*Runner, error) + // GetUserExecuteMock can be populated to implement the behavior of the GetUserExecute function of this mock + GetUserExecuteMock *func(r ApiGetUserRequest) error + // GetUsersExecuteMock can be populated to implement the behavior of the GetUsersExecute function of this mock + GetUsersExecuteMock *func(r ApiGetUsersRequest) (*ListUsers, error) // ListAuthenticationExecuteMock can be populated to implement the behavior of the ListAuthenticationExecute function of this mock ListAuthenticationExecuteMock *func(r ApiListAuthenticationRequest) (*AuthenticationList, error) // ListFlavorsExecuteMock can be populated to implement the behavior of the ListFlavorsExecute function of this mock @@ -51,6 +59,8 @@ type DefaultAPIServiceMock struct { PatchAuthenticationExecuteMock *func(r ApiPatchAuthenticationRequest) (*Authentication, error) // PatchInstanceExecuteMock can be populated to implement the behavior of the PatchInstanceExecute function of this mock PatchInstanceExecuteMock *func(r ApiPatchInstanceRequest) (*Instance, error) + // PatchUserExecuteMock can be populated to implement the behavior of the PatchUserExecute function of this mock + PatchUserExecuteMock *func(r ApiPatchUserRequest) (*User, error) } func (a DefaultAPIServiceMock) CreateAuthentication(ctx context.Context, projectId string, instanceId string) ApiCreateAuthenticationRequest { @@ -109,6 +119,25 @@ func (a DefaultAPIServiceMock) CreateRunnerExecute(r ApiCreateRunnerRequest) (*R return (*a.CreateRunnerExecuteMock)(r) } +func (a DefaultAPIServiceMock) CreateUser(ctx context.Context, projectId string, instanceId string) ApiCreateUserRequest { + return ApiCreateUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +// CreateUserExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateUserExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateUserExecute(r ApiCreateUserRequest) (*User, error) { + if a.CreateUserExecuteMock == nil { + var localVarReturnValue *User + return localVarReturnValue, nil + } + + return (*a.CreateUserExecuteMock)(r) +} + func (a DefaultAPIServiceMock) DeleteAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiDeleteAuthenticationRequest { return ApiDeleteAuthenticationRequest{ ApiService: a, @@ -164,6 +193,25 @@ func (a DefaultAPIServiceMock) DeleteRunnerExecute(r ApiDeleteRunnerRequest) err return (*a.DeleteRunnerExecuteMock)(r) } +func (a DefaultAPIServiceMock) DeleteUser(ctx context.Context, projectId string, instanceId string, username string) ApiDeleteUserRequest { + return ApiDeleteUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, + } +} + +// DeleteUserExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteUserExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteUserExecute(r ApiDeleteUserRequest) error { + if a.DeleteUserExecuteMock == nil { + return nil + } + + return (*a.DeleteUserExecuteMock)(r) +} + func (a DefaultAPIServiceMock) GetAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiGetAuthenticationRequest { return ApiGetAuthenticationRequest{ ApiService: a, @@ -222,6 +270,44 @@ func (a DefaultAPIServiceMock) GetRunnerExecute(r ApiGetRunnerRequest) (*Runner, return (*a.GetRunnerExecuteMock)(r) } +func (a DefaultAPIServiceMock) GetUser(ctx context.Context, projectId string, instanceId string, username string) ApiGetUserRequest { + return ApiGetUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, + } +} + +// 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) error { + if a.GetUserExecuteMock == nil { + return nil + } + + return (*a.GetUserExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetUsers(ctx context.Context, projectId string, instanceId string) ApiGetUsersRequest { + return ApiGetUsersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +// GetUsersExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetUsersExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetUsersExecute(r ApiGetUsersRequest) (*ListUsers, error) { + if a.GetUsersExecuteMock == nil { + var localVarReturnValue *ListUsers + return localVarReturnValue, nil + } + + return (*a.GetUsersExecuteMock)(r) +} + func (a DefaultAPIServiceMock) ListAuthentication(ctx context.Context, projectId string, instanceId string) ApiListAuthenticationRequest { return ApiListAuthenticationRequest{ ApiService: a, @@ -333,3 +419,23 @@ func (a DefaultAPIServiceMock) PatchInstanceExecute(r ApiPatchInstanceRequest) ( return (*a.PatchInstanceExecuteMock)(r) } + +func (a DefaultAPIServiceMock) PatchUser(ctx context.Context, projectId string, instanceId string, username string) ApiPatchUserRequest { + return ApiPatchUserRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + username: username, + } +} + +// PatchUserExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the PatchUserExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) PatchUserExecute(r ApiPatchUserRequest) (*User, error) { + if a.PatchUserExecuteMock == nil { + var localVarReturnValue *User + return localVarReturnValue, nil + } + + return (*a.PatchUserExecuteMock)(r) +} diff --git a/services/git/v1betaapi/model_authentication.go b/services/git/v1betaapi/model_authentication.go index c741fae71..8af5089be 100644 --- a/services/git/v1betaapi/model_authentication.go +++ b/services/git/v1betaapi/model_authentication.go @@ -39,7 +39,9 @@ type Authentication struct { // Scopes defines the OIDC scopes to request. Scopes string `json:"scopes"` // The current status of the authentication definition. - Status string `json:"status"` + Status string `json:"status"` + // Provides additional information or error details when the status is 'Error'. + StatusMessage *string `json:"status_message,omitempty"` AdditionalProperties map[string]interface{} } @@ -287,6 +289,38 @@ func (o *Authentication) SetStatus(v string) { o.Status = v } +// GetStatusMessage returns the StatusMessage field value if set, zero value otherwise. +func (o *Authentication) GetStatusMessage() string { + if o == nil || IsNil(o.StatusMessage) { + var ret string + return ret + } + return *o.StatusMessage +} + +// GetStatusMessageOk returns a tuple with the StatusMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Authentication) GetStatusMessageOk() (*string, bool) { + if o == nil || IsNil(o.StatusMessage) { + return nil, false + } + return o.StatusMessage, true +} + +// HasStatusMessage returns a boolean if a field has been set. +func (o *Authentication) HasStatusMessage() bool { + if o != nil && !IsNil(o.StatusMessage) { + return true + } + + return false +} + +// SetStatusMessage gets a reference to the given string and assigns it to the StatusMessage field. +func (o *Authentication) SetStatusMessage(v string) { + o.StatusMessage = &v +} + func (o Authentication) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -306,6 +340,9 @@ func (o Authentication) ToMap() (map[string]interface{}, error) { toSerialize["provider"] = o.Provider toSerialize["scopes"] = o.Scopes toSerialize["status"] = o.Status + if !IsNil(o.StatusMessage) { + toSerialize["status_message"] = o.StatusMessage + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -366,6 +403,7 @@ func (o *Authentication) UnmarshalJSON(data []byte) (err error) { delete(additionalProperties, "provider") delete(additionalProperties, "scopes") delete(additionalProperties, "status") + delete(additionalProperties, "status_message") o.AdditionalProperties = additionalProperties } diff --git a/services/git/v1betaapi/model_create_user_payload.go b/services/git/v1betaapi/model_create_user_payload.go new file mode 100644 index 000000000..5244259c2 --- /dev/null +++ b/services/git/v1betaapi/model_create_user_payload.go @@ -0,0 +1,300 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +Contact: git@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateUserPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateUserPayload{} + +// CreateUserPayload Request a STACKIT Git instance User to be created with these properties. +type CreateUserPayload struct { + // A user chosen email to distinguish multiple STACKIT Git instance Users. + Email string `json:"email"` + // Whether to force sending a reset password email. + ForceSendResetPassword *bool `json:"force_send_reset_password,omitempty"` + // Name of the user. + Name string `json:"name"` + // A user password to allow user/pass instance login. + Password string `json:"password"` + // A user chosen username to distinguish multiple STACKIT Git instance Users. + Username string `json:"username"` + AdditionalProperties map[string]interface{} +} + +type _CreateUserPayload CreateUserPayload + +// NewCreateUserPayload instantiates a new CreateUserPayload 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 NewCreateUserPayload(email string, name string, password string, username string) *CreateUserPayload { + this := CreateUserPayload{} + this.Email = email + var forceSendResetPassword bool = false + this.ForceSendResetPassword = &forceSendResetPassword + this.Name = name + this.Password = password + this.Username = username + return &this +} + +// NewCreateUserPayloadWithDefaults instantiates a new CreateUserPayload 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 NewCreateUserPayloadWithDefaults() *CreateUserPayload { + this := CreateUserPayload{} + var forceSendResetPassword bool = false + this.ForceSendResetPassword = &forceSendResetPassword + return &this +} + +// GetEmail returns the Email field value +func (o *CreateUserPayload) GetEmail() string { + if o == nil { + var ret string + return ret + } + + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *CreateUserPayload) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value +func (o *CreateUserPayload) SetEmail(v string) { + o.Email = v +} + +// GetForceSendResetPassword returns the ForceSendResetPassword field value if set, zero value otherwise. +func (o *CreateUserPayload) GetForceSendResetPassword() bool { + if o == nil || IsNil(o.ForceSendResetPassword) { + var ret bool + return ret + } + return *o.ForceSendResetPassword +} + +// GetForceSendResetPasswordOk returns a tuple with the ForceSendResetPassword field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateUserPayload) GetForceSendResetPasswordOk() (*bool, bool) { + if o == nil || IsNil(o.ForceSendResetPassword) { + return nil, false + } + return o.ForceSendResetPassword, true +} + +// HasForceSendResetPassword returns a boolean if a field has been set. +func (o *CreateUserPayload) HasForceSendResetPassword() bool { + if o != nil && !IsNil(o.ForceSendResetPassword) { + return true + } + + return false +} + +// SetForceSendResetPassword gets a reference to the given bool and assigns it to the ForceSendResetPassword field. +func (o *CreateUserPayload) SetForceSendResetPassword(v bool) { + o.ForceSendResetPassword = &v +} + +// GetName returns the Name field value +func (o *CreateUserPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateUserPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateUserPayload) SetName(v string) { + o.Name = v +} + +// GetPassword returns the Password field value +func (o *CreateUserPayload) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *CreateUserPayload) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *CreateUserPayload) SetPassword(v string) { + o.Password = v +} + +// GetUsername returns the Username field value +func (o *CreateUserPayload) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *CreateUserPayload) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *CreateUserPayload) SetUsername(v string) { + o.Username = v +} + +func (o CreateUserPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateUserPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["email"] = o.Email + if !IsNil(o.ForceSendResetPassword) { + toSerialize["force_send_reset_password"] = o.ForceSendResetPassword + } + toSerialize["name"] = o.Name + toSerialize["password"] = o.Password + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateUserPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "email", + "name", + "password", + "username", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateUserPayload := _CreateUserPayload{} + + err = json.Unmarshal(data, &varCreateUserPayload) + + if err != nil { + return err + } + + *o = CreateUserPayload(varCreateUserPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "email") + delete(additionalProperties, "force_send_reset_password") + delete(additionalProperties, "name") + delete(additionalProperties, "password") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateUserPayload struct { + value *CreateUserPayload + isSet bool +} + +func (v NullableCreateUserPayload) Get() *CreateUserPayload { + return v.value +} + +func (v *NullableCreateUserPayload) Set(val *CreateUserPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateUserPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateUserPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateUserPayload(val *CreateUserPayload) *NullableCreateUserPayload { + return &NullableCreateUserPayload{value: val, isSet: true} +} + +func (v NullableCreateUserPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateUserPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/v1betaapi/model_feature_toggle.go b/services/git/v1betaapi/model_feature_toggle.go index c233e5617..7d25de6e6 100644 --- a/services/git/v1betaapi/model_feature_toggle.go +++ b/services/git/v1betaapi/model_feature_toggle.go @@ -22,10 +22,9 @@ var _ MappedNullable = &FeatureToggle{} type FeatureToggle struct { // Default email notifications. DefaultEmailNotifications NullableString `json:"default_email_notifications,omitempty"` - // Enable commit signatures. - EnableCommitSignatures NullableBool `json:"enable_commit_signatures,omitempty"` // Enable local login. EnableLocalLogin NullableBool `json:"enable_local_login,omitempty"` + Pipelines *Pipelines `json:"pipelines,omitempty"` AdditionalProperties map[string]interface{} } @@ -91,49 +90,6 @@ func (o *FeatureToggle) UnsetDefaultEmailNotifications() { o.DefaultEmailNotifications.Unset() } -// GetEnableCommitSignatures returns the EnableCommitSignatures field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *FeatureToggle) GetEnableCommitSignatures() bool { - if o == nil || IsNil(o.EnableCommitSignatures.Get()) { - var ret bool - return ret - } - return *o.EnableCommitSignatures.Get() -} - -// GetEnableCommitSignaturesOk returns a tuple with the EnableCommitSignatures field value if set, nil otherwise -// and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *FeatureToggle) GetEnableCommitSignaturesOk() (*bool, bool) { - if o == nil { - return nil, false - } - return o.EnableCommitSignatures.Get(), o.EnableCommitSignatures.IsSet() -} - -// HasEnableCommitSignatures returns a boolean if a field has been set. -func (o *FeatureToggle) HasEnableCommitSignatures() bool { - if o != nil && o.EnableCommitSignatures.IsSet() { - return true - } - - return false -} - -// SetEnableCommitSignatures gets a reference to the given NullableBool and assigns it to the EnableCommitSignatures field. -func (o *FeatureToggle) SetEnableCommitSignatures(v bool) { - o.EnableCommitSignatures.Set(&v) -} - -// SetEnableCommitSignaturesNil sets the value for EnableCommitSignatures to be an explicit nil -func (o *FeatureToggle) SetEnableCommitSignaturesNil() { - o.EnableCommitSignatures.Set(nil) -} - -// UnsetEnableCommitSignatures ensures that no value is present for EnableCommitSignatures, not even an explicit nil -func (o *FeatureToggle) UnsetEnableCommitSignatures() { - o.EnableCommitSignatures.Unset() -} - // GetEnableLocalLogin returns the EnableLocalLogin field value if set, zero value otherwise (both if not set or set to explicit null). func (o *FeatureToggle) GetEnableLocalLogin() bool { if o == nil || IsNil(o.EnableLocalLogin.Get()) { @@ -177,6 +133,38 @@ func (o *FeatureToggle) UnsetEnableLocalLogin() { o.EnableLocalLogin.Unset() } +// GetPipelines returns the Pipelines field value if set, zero value otherwise. +func (o *FeatureToggle) GetPipelines() Pipelines { + if o == nil || IsNil(o.Pipelines) { + var ret Pipelines + return ret + } + return *o.Pipelines +} + +// GetPipelinesOk returns a tuple with the Pipelines field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FeatureToggle) GetPipelinesOk() (*Pipelines, bool) { + if o == nil || IsNil(o.Pipelines) { + return nil, false + } + return o.Pipelines, true +} + +// HasPipelines returns a boolean if a field has been set. +func (o *FeatureToggle) HasPipelines() bool { + if o != nil && !IsNil(o.Pipelines) { + return true + } + + return false +} + +// SetPipelines gets a reference to the given Pipelines and assigns it to the Pipelines field. +func (o *FeatureToggle) SetPipelines(v Pipelines) { + o.Pipelines = &v +} + func (o FeatureToggle) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -190,12 +178,12 @@ func (o FeatureToggle) ToMap() (map[string]interface{}, error) { if o.DefaultEmailNotifications.IsSet() { toSerialize["default_email_notifications"] = o.DefaultEmailNotifications.Get() } - if o.EnableCommitSignatures.IsSet() { - toSerialize["enable_commit_signatures"] = o.EnableCommitSignatures.Get() - } if o.EnableLocalLogin.IsSet() { toSerialize["enable_local_login"] = o.EnableLocalLogin.Get() } + if !IsNil(o.Pipelines) { + toSerialize["pipelines"] = o.Pipelines + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -219,8 +207,8 @@ func (o *FeatureToggle) UnmarshalJSON(data []byte) (err error) { if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "default_email_notifications") - delete(additionalProperties, "enable_commit_signatures") delete(additionalProperties, "enable_local_login") + delete(additionalProperties, "pipelines") o.AdditionalProperties = additionalProperties } diff --git a/services/git/v1betaapi/model_list_users.go b/services/git/v1betaapi/model_list_users.go new file mode 100644 index 000000000..7e641b91a --- /dev/null +++ b/services/git/v1betaapi/model_list_users.go @@ -0,0 +1,167 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +Contact: git@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListUsers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListUsers{} + +// ListUsers A list of STACKIT Git instance Users. +type ListUsers struct { + Users []User `json:"users"` + AdditionalProperties map[string]interface{} +} + +type _ListUsers ListUsers + +// NewListUsers instantiates a new ListUsers 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 NewListUsers(users []User) *ListUsers { + this := ListUsers{} + this.Users = users + return &this +} + +// NewListUsersWithDefaults instantiates a new ListUsers 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 NewListUsersWithDefaults() *ListUsers { + this := ListUsers{} + return &this +} + +// GetUsers returns the Users field value +func (o *ListUsers) GetUsers() []User { + if o == nil { + var ret []User + return ret + } + + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value +// and a boolean to check if the value has been set. +func (o *ListUsers) GetUsersOk() ([]User, bool) { + if o == nil { + return nil, false + } + return o.Users, true +} + +// SetUsers sets field value +func (o *ListUsers) SetUsers(v []User) { + o.Users = v +} + +func (o ListUsers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListUsers) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["users"] = o.Users + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListUsers) 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{ + "users", + } + + 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) + } + } + + varListUsers := _ListUsers{} + + err = json.Unmarshal(data, &varListUsers) + + if err != nil { + return err + } + + *o = ListUsers(varListUsers) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "users") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListUsers struct { + value *ListUsers + isSet bool +} + +func (v NullableListUsers) Get() *ListUsers { + return v.value +} + +func (v *NullableListUsers) Set(val *ListUsers) { + v.value = val + v.isSet = true +} + +func (v NullableListUsers) IsSet() bool { + return v.isSet +} + +func (v *NullableListUsers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListUsers(val *ListUsers) *NullableListUsers { + return &NullableListUsers{value: val, isSet: true} +} + +func (v NullableListUsers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListUsers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/v1betaapi/model_patch_user_payload.go b/services/git/v1betaapi/model_patch_user_payload.go new file mode 100644 index 000000000..f5ccb1984 --- /dev/null +++ b/services/git/v1betaapi/model_patch_user_payload.go @@ -0,0 +1,231 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +Contact: git@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the PatchUserPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchUserPayload{} + +// PatchUserPayload Properties to patch a Instance User. All fields are optional. +type PatchUserPayload struct { + // A user chosen email to distinguish multiple STACKIT Git instance Users. + Email *string `json:"email,omitempty"` + // Name of the user. + Name *string `json:"name,omitempty"` + // A user password to allow user/pass instance login. + Password *string `json:"password,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PatchUserPayload PatchUserPayload + +// NewPatchUserPayload instantiates a new PatchUserPayload 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 NewPatchUserPayload() *PatchUserPayload { + this := PatchUserPayload{} + return &this +} + +// NewPatchUserPayloadWithDefaults instantiates a new PatchUserPayload 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 NewPatchUserPayloadWithDefaults() *PatchUserPayload { + this := PatchUserPayload{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *PatchUserPayload) 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 *PatchUserPayload) 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 *PatchUserPayload) 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 *PatchUserPayload) SetEmail(v string) { + o.Email = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PatchUserPayload) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchUserPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *PatchUserPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PatchUserPayload) SetName(v string) { + o.Name = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *PatchUserPayload) GetPassword() string { + if o == nil || IsNil(o.Password) { + var ret string + return ret + } + return *o.Password +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchUserPayload) GetPasswordOk() (*string, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *PatchUserPayload) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *PatchUserPayload) SetPassword(v string) { + o.Password = &v +} + +func (o PatchUserPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PatchUserPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Email) { + toSerialize["email"] = o.Email + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Password) { + toSerialize["password"] = o.Password + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PatchUserPayload) UnmarshalJSON(data []byte) (err error) { + varPatchUserPayload := _PatchUserPayload{} + + err = json.Unmarshal(data, &varPatchUserPayload) + + if err != nil { + return err + } + + *o = PatchUserPayload(varPatchUserPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "email") + delete(additionalProperties, "name") + delete(additionalProperties, "password") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePatchUserPayload struct { + value *PatchUserPayload + isSet bool +} + +func (v NullablePatchUserPayload) Get() *PatchUserPayload { + return v.value +} + +func (v *NullablePatchUserPayload) Set(val *PatchUserPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePatchUserPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchUserPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchUserPayload(val *PatchUserPayload) *NullablePatchUserPayload { + return &NullablePatchUserPayload{value: val, isSet: true} +} + +func (v NullablePatchUserPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchUserPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/v1betaapi/model_pipelines.go b/services/git/v1betaapi/model_pipelines.go new file mode 100644 index 000000000..ba2e4e0df --- /dev/null +++ b/services/git/v1betaapi/model_pipelines.go @@ -0,0 +1,215 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +Contact: git@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the Pipelines type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Pipelines{} + +// Pipelines Feature toggles for instance pipelines +type Pipelines struct { + // The action URL for the pipelines + ActionUrl NullableString `json:"action_url,omitempty"` + // Enable pipelines for this instance + Enabled NullableBool `json:"enabled,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Pipelines Pipelines + +// NewPipelines instantiates a new Pipelines 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 NewPipelines() *Pipelines { + this := Pipelines{} + return &this +} + +// NewPipelinesWithDefaults instantiates a new Pipelines 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 NewPipelinesWithDefaults() *Pipelines { + this := Pipelines{} + return &this +} + +// GetActionUrl returns the ActionUrl field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Pipelines) GetActionUrl() string { + if o == nil || IsNil(o.ActionUrl.Get()) { + var ret string + return ret + } + return *o.ActionUrl.Get() +} + +// GetActionUrlOk returns a tuple with the ActionUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Pipelines) GetActionUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ActionUrl.Get(), o.ActionUrl.IsSet() +} + +// HasActionUrl returns a boolean if a field has been set. +func (o *Pipelines) HasActionUrl() bool { + if o != nil && o.ActionUrl.IsSet() { + return true + } + + return false +} + +// SetActionUrl gets a reference to the given NullableString and assigns it to the ActionUrl field. +func (o *Pipelines) SetActionUrl(v string) { + o.ActionUrl.Set(&v) +} + +// SetActionUrlNil sets the value for ActionUrl to be an explicit nil +func (o *Pipelines) SetActionUrlNil() { + o.ActionUrl.Set(nil) +} + +// UnsetActionUrl ensures that no value is present for ActionUrl, not even an explicit nil +func (o *Pipelines) UnsetActionUrl() { + o.ActionUrl.Unset() +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Pipelines) GetEnabled() bool { + if o == nil || IsNil(o.Enabled.Get()) { + var ret bool + return ret + } + return *o.Enabled.Get() +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Pipelines) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Enabled.Get(), o.Enabled.IsSet() +} + +// HasEnabled returns a boolean if a field has been set. +func (o *Pipelines) HasEnabled() bool { + if o != nil && o.Enabled.IsSet() { + return true + } + + return false +} + +// SetEnabled gets a reference to the given NullableBool and assigns it to the Enabled field. +func (o *Pipelines) SetEnabled(v bool) { + o.Enabled.Set(&v) +} + +// SetEnabledNil sets the value for Enabled to be an explicit nil +func (o *Pipelines) SetEnabledNil() { + o.Enabled.Set(nil) +} + +// UnsetEnabled ensures that no value is present for Enabled, not even an explicit nil +func (o *Pipelines) UnsetEnabled() { + o.Enabled.Unset() +} + +func (o Pipelines) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Pipelines) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.ActionUrl.IsSet() { + toSerialize["action_url"] = o.ActionUrl.Get() + } + if o.Enabled.IsSet() { + toSerialize["enabled"] = o.Enabled.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Pipelines) UnmarshalJSON(data []byte) (err error) { + varPipelines := _Pipelines{} + + err = json.Unmarshal(data, &varPipelines) + + if err != nil { + return err + } + + *o = Pipelines(varPipelines) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "action_url") + delete(additionalProperties, "enabled") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePipelines struct { + value *Pipelines + isSet bool +} + +func (v NullablePipelines) Get() *Pipelines { + return v.value +} + +func (v *NullablePipelines) Set(val *Pipelines) { + v.value = val + v.isSet = true +} + +func (v NullablePipelines) IsSet() bool { + return v.isSet +} + +func (v *NullablePipelines) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePipelines(val *Pipelines) *NullablePipelines { + return &NullablePipelines{value: val, isSet: true} +} + +func (v NullablePipelines) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePipelines) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/v1betaapi/model_user.go b/services/git/v1betaapi/model_user.go new file mode 100644 index 000000000..b6868fe2f --- /dev/null +++ b/services/git/v1betaapi/model_user.go @@ -0,0 +1,266 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +Contact: git@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the User type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &User{} + +// User Describes a STACKIT Git instance User. +type User struct { + // A user chosen email to distinguish multiple STACKIT Git instance Users. + Email string `json:"email"` + // A auto generated unique id which identifies the STACKIT Git instances. + Id *int32 `json:"id,omitempty"` + // Name of the user. + Name string `json:"name"` + // A user chosen username to distinguish multiple STACKIT Git instance Users. + Username string `json:"username"` + AdditionalProperties map[string]interface{} +} + +type _User User + +// NewUser instantiates a new User 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 NewUser(email string, name string, username string) *User { + this := User{} + this.Email = email + this.Name = name + this.Username = username + return &this +} + +// NewUserWithDefaults instantiates a new User 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 NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetEmail returns the Email field value +func (o *User) GetEmail() string { + if o == nil { + var ret string + return ret + } + + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *User) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value +func (o *User) SetEmail(v string) { + o.Email = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *User) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + 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 *User) GetIdOk() (*int32, 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 *User) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *User) SetId(v int32) { + o.Id = &v +} + +// GetName returns the Name field value +func (o *User) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *User) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *User) SetName(v string) { + o.Name = v +} + +// GetUsername returns the Username field value +func (o *User) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *User) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *User) SetUsername(v string) { + o.Username = v +} + +func (o User) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o User) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["email"] = o.Email + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + toSerialize["name"] = o.Name + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *User) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "email", + "name", + "username", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUser := _User{} + + err = json.Unmarshal(data, &varUser) + + if err != nil { + return err + } + + *o = User(varUser) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "email") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}