From e648bacfb06442d2180474ea062332f230599be4 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 20 Jan 2026 16:00:45 +0000 Subject: [PATCH] Generate git --- services/git/api_default.go | 1972 +++++++++++++++-- services/git/api_default_test.go | 458 +++- services/git/model_authentication.go | 486 ++++ services/git/model_authentication_list.go | 125 ++ ...t.go => model_authentication_list_test.go} | 0 ...s_test.go => model_authentication_test.go} | 0 .../model_create_authentication_payload.go | 413 ++++ ...del_create_authentication_payload_test.go} | 0 services/git/model_create_instance_payload.go | 115 +- .../git/model_create_instance_payload_test.go | 47 + services/git/model_create_runner_payload.go | 125 ++ ...go => model_create_runner_payload_test.go} | 0 services/git/model_feature_toggle.go | 366 +++ services/git/model_feature_toggle_test.go | 72 + services/git/model_flavors_list.go | 125 ++ ...bel_test.go => model_flavors_list_test.go} | 0 services/git/model_instance.go | 42 +- services/git/model_instance_flavor.go | 115 - services/git/model_instance_list.go | 125 ++ ...se_test.go => model_instance_list_test.go} | 0 services/git/model_list_flavors.go | 125 -- services/git/model_list_instances.go | 125 -- services/git/model_list_runner_labels.go | 125 -- .../git/model_patch_authentication_payload.go | 374 ++++ ...model_patch_authentication_payload_test.go | 11 + services/git/model_patch_instance_payload.go | 49 +- services/git/model_runner.go | 258 +++ services/git/model_runner_label.go | 217 -- services/git/model_runner_runtime.go | 307 +++ services/git/model_runner_runtime_list.go | 125 ++ .../git/model_runner_runtime_list_test.go | 11 + services/git/model_runner_runtime_test.go | 11 + services/git/model_runner_test.go | 11 + services/git/model_unauthorized_response.go | 128 -- 34 files changed, 5383 insertions(+), 1080 deletions(-) create mode 100644 services/git/model_authentication.go create mode 100644 services/git/model_authentication_list.go rename services/git/{model_instance_flavor_test.go => model_authentication_list_test.go} (100%) rename services/git/{model_list_flavors_test.go => model_authentication_test.go} (100%) create mode 100644 services/git/model_create_authentication_payload.go rename services/git/{model_list_instances_test.go => model_create_authentication_payload_test.go} (100%) create mode 100644 services/git/model_create_runner_payload.go rename services/git/{model_list_runner_labels_test.go => model_create_runner_payload_test.go} (100%) create mode 100644 services/git/model_feature_toggle.go create mode 100644 services/git/model_feature_toggle_test.go create mode 100644 services/git/model_flavors_list.go rename services/git/{model_runner_label_test.go => model_flavors_list_test.go} (100%) delete mode 100644 services/git/model_instance_flavor.go create mode 100644 services/git/model_instance_list.go rename services/git/{model_unauthorized_response_test.go => model_instance_list_test.go} (100%) delete mode 100644 services/git/model_list_flavors.go delete mode 100644 services/git/model_list_instances.go delete mode 100644 services/git/model_list_runner_labels.go create mode 100644 services/git/model_patch_authentication_payload.go create mode 100644 services/git/model_patch_authentication_payload_test.go create mode 100644 services/git/model_runner.go delete mode 100644 services/git/model_runner_label.go create mode 100644 services/git/model_runner_runtime.go create mode 100644 services/git/model_runner_runtime_list.go create mode 100644 services/git/model_runner_runtime_list_test.go create mode 100644 services/git/model_runner_runtime_test.go create mode 100644 services/git/model_runner_test.go delete mode 100644 services/git/model_unauthorized_response.go diff --git a/services/git/api_default.go b/services/git/api_default.go index 3e7fae492..f46d8b74b 100644 --- a/services/git/api_default.go +++ b/services/git/api_default.go @@ -24,6 +24,27 @@ import ( ) type DefaultApi interface { + /* + CreateAuthentication Creates an authentication source + Creates an authentication source for the corresponding 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 ApiCreateAuthenticationRequest + */ + CreateAuthentication(ctx context.Context, projectId string, instanceId string) ApiCreateAuthenticationRequest + /* + CreateAuthenticationExecute 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 Authentication + + */ + CreateAuthenticationExecute(ctx context.Context, projectId string, instanceId string) (*Authentication, error) /* CreateInstance Create an Instance. Creates a new STACKIT Git instance as a project resource. @@ -43,6 +64,44 @@ type DefaultApi interface { */ CreateInstanceExecute(ctx context.Context, projectId string) (*Instance, error) + /* + CreateRunner Create the runner associated to this instance. + Creates the runner associated to this 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 ApiCreateRunnerRequest + */ + CreateRunner(ctx context.Context, projectId string, instanceId string) ApiCreateRunnerRequest + /* + CreateRunnerExecute 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 Runner + + */ + CreateRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) + /* + DeleteAuthentication Delete Authentication Source + Deletes the authentication source associated to this 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. + @param authenticationId Authentication Source identifier. + @return ApiDeleteAuthenticationRequest + */ + DeleteAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiDeleteAuthenticationRequest + /* + DeleteAuthenticationExecute executes the request + + */ + DeleteAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) error /* DeleteInstance Delete Instance. Deletes a STACKIT Git instance and destroys all associated data. @@ -59,6 +118,45 @@ type DefaultApi interface { */ DeleteInstanceExecute(ctx context.Context, projectId string, instanceId string) error + /* + DeleteRunner Delete Runner. + Deletes the runner associated to this STACKIT Git instance 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. + @return ApiDeleteRunnerRequest + */ + DeleteRunner(ctx context.Context, projectId string, instanceId string) ApiDeleteRunnerRequest + /* + DeleteRunnerExecute executes the request + + */ + DeleteRunnerExecute(ctx context.Context, projectId string, instanceId string) error + /* + 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 + */ + GetAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiGetAuthenticationRequest + /* + GetAuthenticationExecute 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 authenticationId Authentication Source identifier. + @return Authentication + + */ + GetAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) /* GetInstance Get Instance information. Retrieves information about a STACKIT Git instance. @@ -79,6 +177,66 @@ type DefaultApi interface { */ GetInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) + /* + GetInstances List Instances. + Lists all STACKIT Git instances within a project. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiGetInstancesRequest + */ + GetInstances(ctx context.Context, projectId string) ApiGetInstancesRequest + /* + GetInstancesExecute 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. + @return InstanceList + + */ + GetInstancesExecute(ctx context.Context, projectId string) (*InstanceList, error) + /* + 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 + */ + GetRunner(ctx context.Context, projectId string, instanceId string) ApiGetRunnerRequest + /* + GetRunnerExecute 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 Runner + + */ + GetRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) + /* + ListAuthentication List authentication sources + Lists all authentication sources belonging to a specific 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 ApiListAuthenticationRequest + */ + ListAuthentication(ctx context.Context, projectId string, instanceId string) ApiListAuthenticationRequest + /* + ListAuthenticationExecute 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 AuthenticationList + + */ + ListAuthenticationExecute(ctx context.Context, projectId string, instanceId string) (*AuthenticationList, error) /* ListFlavors Returns the details for the given STACKIT Git flavors. Provides detailed information about possible Git Flavors. @@ -94,48 +252,51 @@ type DefaultApi interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. - @return ListFlavors + @return FlavorsList */ - ListFlavorsExecute(ctx context.Context, projectId string) (*ListFlavors, error) + ListFlavorsExecute(ctx context.Context, projectId string) (*FlavorsList, error) /* - ListInstances List Instances. - Lists all STACKIT Git instances within a project. - + ListRunnerRuntimes Method for ListRunnerRuntimes + A list of runner runtimes that are available to be enabled for the project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. - @return ApiListInstancesRequest + @return ApiListRunnerRuntimesRequest */ - ListInstances(ctx context.Context, projectId string) ApiListInstancesRequest + ListRunnerRuntimes(ctx context.Context, projectId string) ApiListRunnerRuntimesRequest /* - ListInstancesExecute executes the request + ListRunnerRuntimesExecute 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. - @return ListInstances + @return RunnerRuntimeList */ - ListInstancesExecute(ctx context.Context, projectId string) (*ListInstances, error) + ListRunnerRuntimesExecute(ctx context.Context, projectId string) (*RunnerRuntimeList, error) /* - ListRunnerLabels Returns the details for the given STACKIT Git RunnerLabels. - Type of runners we can use for running jobs. + PatchAuthentication Patch Authentication. + Patches the Authentication Provider. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. - @return ApiListRunnerLabelsRequest + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiPatchAuthenticationRequest */ - ListRunnerLabels(ctx context.Context, projectId string) ApiListRunnerLabelsRequest + PatchAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiPatchAuthenticationRequest /* - ListRunnerLabelsExecute executes the request + PatchAuthenticationExecute 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. - @return ListRunnerLabels + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return Authentication */ - ListRunnerLabelsExecute(ctx context.Context, projectId string) (*ListRunnerLabels, error) + PatchAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) /* PatchInstance Patch Instance. Patches the Instance. @@ -159,67 +320,1485 @@ type DefaultApi interface { PatchInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) } +type ApiCreateAuthenticationRequest interface { + // Authentication Definition configuration data. + CreateAuthenticationPayload(createAuthenticationPayload CreateAuthenticationPayload) ApiCreateAuthenticationRequest + Execute() (*Authentication, error) +} + type ApiCreateInstanceRequest interface { // Instance configuration options. CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest Execute() (*Instance, error) } +type ApiCreateRunnerRequest interface { + // Runner configuration options. + CreateRunnerPayload(createRunnerPayload CreateRunnerPayload) ApiCreateRunnerRequest + Execute() (*Runner, error) +} + +type ApiDeleteAuthenticationRequest interface { + Execute() error +} + type ApiDeleteInstanceRequest interface { Execute() error } -type ApiGetInstanceRequest interface { - Execute() (*Instance, error) -} +type ApiDeleteRunnerRequest interface { + Execute() error +} + +type ApiGetAuthenticationRequest interface { + Execute() (*Authentication, error) +} + +type ApiGetInstanceRequest interface { + Execute() (*Instance, error) +} + +type ApiGetInstancesRequest interface { + Execute() (*InstanceList, error) +} + +type ApiGetRunnerRequest interface { + Execute() (*Runner, error) +} + +type ApiListAuthenticationRequest interface { + Execute() (*AuthenticationList, error) +} + +type ApiListFlavorsRequest interface { + Execute() (*FlavorsList, error) +} + +type ApiListRunnerRuntimesRequest interface { + Execute() (*RunnerRuntimeList, error) +} + +type ApiPatchAuthenticationRequest interface { + // Authentication Definition configuration data. + PatchAuthenticationPayload(patchAuthenticationPayload PatchAuthenticationPayload) ApiPatchAuthenticationRequest + Execute() (*Authentication, error) +} + +type ApiPatchInstanceRequest interface { + PatchInstancePayload(patchInstancePayload PatchInstancePayload) ApiPatchInstanceRequest + Execute() (*Instance, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + createAuthenticationPayload *CreateAuthenticationPayload +} + +// Authentication Definition configuration data. + +func (r CreateAuthenticationRequest) CreateAuthenticationPayload(createAuthenticationPayload CreateAuthenticationPayload) ApiCreateAuthenticationRequest { + r.createAuthenticationPayload = &createAuthenticationPayload + return r +} + +func (r CreateAuthenticationRequest) Execute() (*Authentication, error) { + var ( + localVarHTTPMethod = http.MethodPost + 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.CreateAuthentication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications" + 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") + } + if r.createAuthenticationPayload == nil { + return localVarReturnValue, fmt.Errorf("createAuthenticationPayload 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.createAuthenticationPayload + 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 == 409 { + 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 +} + +/* +CreateAuthentication: Creates an authentication source + +# Creates an authentication source for the corresponding 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 ApiCreateAuthenticationRequest +*/ +func (a *APIClient) CreateAuthentication(ctx context.Context, projectId string, instanceId string) ApiCreateAuthenticationRequest { + return CreateAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) CreateAuthenticationExecute(ctx context.Context, projectId string, instanceId string) (*Authentication, error) { + r := CreateAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type CreateInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createInstancePayload *CreateInstancePayload +} + +// Instance configuration options. + +func (r CreateInstanceRequest) CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest { + r.createInstancePayload = &createInstancePayload + return r +} + +func (r CreateInstanceRequest) Execute() (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPost + 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.CreateInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -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 r.createInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("createInstancePayload 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.createInstancePayload + 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 == 409 { + 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 +} + +/* +CreateInstance: Create an Instance. + +Creates a new STACKIT Git instance as a project resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiCreateInstanceRequest +*/ +func (a *APIClient) CreateInstance(ctx context.Context, projectId string) ApiCreateInstanceRequest { + return CreateInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateInstanceExecute(ctx context.Context, projectId string) (*Instance, error) { + r := CreateInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type CreateRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + createRunnerPayload *CreateRunnerPayload +} + +// Runner configuration options. + +func (r CreateRunnerRequest) CreateRunnerPayload(createRunnerPayload CreateRunnerPayload) ApiCreateRunnerRequest { + r.createRunnerPayload = &createRunnerPayload + return r +} + +func (r CreateRunnerRequest) Execute() (*Runner, error) { + var ( + localVarHTTPMethod = http.MethodPost + 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.CreateRunner") + 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") + } + if r.createRunnerPayload == nil { + return localVarReturnValue, fmt.Errorf("createRunnerPayload 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.createRunnerPayload + 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 == 409 { + 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 +} + +/* +CreateRunner: Create the runner associated to this instance. + +Creates the runner associated to this 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 ApiCreateRunnerRequest +*/ +func (a *APIClient) CreateRunner(ctx context.Context, projectId string, instanceId string) ApiCreateRunnerRequest { + return CreateRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) CreateRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) { + r := CreateRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + authenticationId string +} + +func (r DeleteAuthenticationRequest) 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.DeleteAuthentication") + if err != nil { + return &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 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") + } + 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{} + + // 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 +} + +/* +DeleteAuthentication: Delete Authentication Source + +Deletes the authentication source associated to this 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. + @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, + } +} + +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() +} + +type DeleteInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +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. + +Deletes a STACKIT Git instance 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. + @return ApiDeleteInstanceRequest +*/ +func (a *APIClient) DeleteInstance(ctx context.Context, projectId string, instanceId string) ApiDeleteInstanceRequest { + return DeleteInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteInstanceExecute(ctx context.Context, projectId string, instanceId string) error { + r := DeleteInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +func (r DeleteRunnerRequest) 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.DeleteRunner") + if err != nil { + return &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 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 == 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 +} + +/* +DeleteRunner: Delete Runner. + +Deletes the runner associated to this STACKIT Git instance 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. + @return ApiDeleteRunnerRequest +*/ +func (a *APIClient) DeleteRunner(ctx context.Context, projectId string, instanceId string) ApiDeleteRunnerRequest { + return DeleteRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteRunnerExecute(ctx context.Context, projectId string, instanceId string) error { + r := DeleteRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type GetAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + authenticationId string +} + +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 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 +} + +/* +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 *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) 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() +} + +type GetInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +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 + } -type ApiListFlavorsRequest interface { - Execute() (*ListFlavors, error) + return localVarReturnValue, nil } -type ApiListInstancesRequest interface { - Execute() (*ListInstances, error) -} +/* +GetInstance: Get Instance information. -type ApiListRunnerLabelsRequest interface { - Execute() (*ListRunnerLabels, error) -} +Retrieves information about a STACKIT Git instance. -type ApiPatchInstanceRequest interface { - PatchInstancePayload(patchInstancePayload PatchInstancePayload) ApiPatchInstanceRequest - Execute() (*Instance, error) + @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, + } } -// DefaultApiService DefaultApi service -type DefaultApiService service - -type CreateInstanceRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createInstancePayload *CreateInstancePayload +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() } -// Instance configuration options. - -func (r CreateInstanceRequest) CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest { - r.createInstancePayload = &createInstancePayload - return r +type GetInstancesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string } -func (r CreateInstanceRequest) Execute() (*Instance, error) { +func (r GetInstancesRequest) Execute() (*InstanceList, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Instance + localVarReturnValue *InstanceList ) 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.CreateInstance") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstances") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } @@ -236,12 +1815,9 @@ func (r CreateInstanceRequest) Execute() (*Instance, error) { if strlen(r.projectId) > 36 { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } - if r.createInstancePayload == nil { - return localVarReturnValue, fmt.Errorf("createInstancePayload is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -257,8 +1833,6 @@ func (r CreateInstanceRequest) Execute() (*Instance, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.createInstancePayload req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -302,28 +1876,6 @@ func (r CreateInstanceRequest) Execute() (*Instance, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedResponse - 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 == 409 { - 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")) @@ -351,24 +1903,24 @@ func (r CreateInstanceRequest) Execute() (*Instance, error) { } /* -CreateInstance: Create an Instance. +GetInstances: List Instances. -Creates a new STACKIT Git instance as a project resource. +Lists all STACKIT Git instances within a project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. - @return ApiCreateInstanceRequest + @return ApiGetInstancesRequest */ -func (a *APIClient) CreateInstance(ctx context.Context, projectId string) ApiCreateInstanceRequest { - return CreateInstanceRequest{ +func (a *APIClient) GetInstances(ctx context.Context, projectId string) ApiGetInstancesRequest { + return GetInstancesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) CreateInstanceExecute(ctx context.Context, projectId string) (*Instance, error) { - r := CreateInstanceRequest{ +func (a *APIClient) GetInstancesExecute(ctx context.Context, projectId string) (*InstanceList, error) { + r := GetInstancesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -376,30 +1928,31 @@ func (a *APIClient) CreateInstanceExecute(ctx context.Context, projectId string) return r.Execute() } -type DeleteInstanceRequest struct { +type GetRunnerRequest struct { ctx context.Context apiService *DefaultApiService projectId string instanceId string } -func (r DeleteInstanceRequest) Execute() error { +func (r GetRunnerRequest) Execute() (*Runner, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Runner ) 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.DeleteInstance") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRunner") if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + 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) @@ -407,16 +1960,16 @@ func (r DeleteInstanceRequest) Execute() error { 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") + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") } // to determine the Content-Type header @@ -438,7 +1991,7 @@ func (r DeleteInstanceRequest) Execute() error { } 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) @@ -452,14 +2005,14 @@ func (r DeleteInstanceRequest) 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 { @@ -473,51 +2026,50 @@ func (r DeleteInstanceRequest) 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 UnauthorizedResponse - 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 } /* -DeleteInstance: Delete Instance. +GetRunner: Get Runner information. -Deletes a STACKIT Git instance and destroys all associated data. +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 ApiDeleteInstanceRequest + @return ApiGetRunnerRequest */ -func (a *APIClient) DeleteInstance(ctx context.Context, projectId string, instanceId string) ApiDeleteInstanceRequest { - return DeleteInstanceRequest{ +func (a *APIClient) GetRunner(ctx context.Context, projectId string, instanceId string) ApiGetRunnerRequest { + return GetRunnerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -525,8 +2077,8 @@ func (a *APIClient) DeleteInstance(ctx context.Context, projectId string, instan } } -func (a *APIClient) DeleteInstanceExecute(ctx context.Context, projectId string, instanceId string) error { - r := DeleteInstanceRequest{ +func (a *APIClient) GetRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) { + r := GetRunnerRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -535,31 +2087,31 @@ func (a *APIClient) DeleteInstanceExecute(ctx context.Context, projectId string, return r.Execute() } -type GetInstanceRequest struct { +type ListAuthenticationRequest struct { ctx context.Context apiService *DefaultApiService projectId string instanceId string } -func (r GetInstanceRequest) Execute() (*Instance, error) { +func (r ListAuthenticationRequest) Execute() (*AuthenticationList, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Instance + localVarReturnValue *AuthenticationList ) 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") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAuthentication") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) @@ -639,17 +2191,6 @@ func (r GetInstanceRequest) Execute() (*Instance, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedResponse - 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")) @@ -677,17 +2218,17 @@ func (r GetInstanceRequest) Execute() (*Instance, error) { } /* -GetInstance: Get Instance information. +ListAuthentication: List authentication sources -Retrieves information about a STACKIT Git instance. +# Lists all authentication sources belonging to a specific 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 + @return ApiListAuthenticationRequest */ -func (a *APIClient) GetInstance(ctx context.Context, projectId string, instanceId string) ApiGetInstanceRequest { - return GetInstanceRequest{ +func (a *APIClient) ListAuthentication(ctx context.Context, projectId string, instanceId string) ApiListAuthenticationRequest { + return ListAuthenticationRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -695,8 +2236,8 @@ func (a *APIClient) GetInstance(ctx context.Context, projectId string, instanceI } } -func (a *APIClient) GetInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) { - r := GetInstanceRequest{ +func (a *APIClient) ListAuthenticationExecute(ctx context.Context, projectId string, instanceId string) (*AuthenticationList, error) { + r := ListAuthenticationRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -711,12 +2252,12 @@ type ListFlavorsRequest struct { projectId string } -func (r ListFlavorsRequest) Execute() (*ListFlavors, error) { +func (r ListFlavorsRequest) Execute() (*FlavorsList, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListFlavors + localVarReturnValue *FlavorsList ) a := r.apiService client, ok := a.client.(*APIClient) @@ -801,17 +2342,6 @@ func (r ListFlavorsRequest) Execute() (*ListFlavors, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedResponse - 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")) @@ -855,7 +2385,7 @@ func (a *APIClient) ListFlavors(ctx context.Context, projectId string) ApiListFl } } -func (a *APIClient) ListFlavorsExecute(ctx context.Context, projectId string) (*ListFlavors, error) { +func (a *APIClient) ListFlavorsExecute(ctx context.Context, projectId string) (*FlavorsList, error) { r := ListFlavorsRequest{ apiService: a.defaultApi, ctx: ctx, @@ -864,30 +2394,30 @@ func (a *APIClient) ListFlavorsExecute(ctx context.Context, projectId string) (* return r.Execute() } -type ListInstancesRequest struct { +type ListRunnerRuntimesRequest struct { ctx context.Context apiService *DefaultApiService projectId string } -func (r ListInstancesRequest) Execute() (*ListInstances, error) { +func (r ListRunnerRuntimesRequest) Execute() (*RunnerRuntimeList, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListInstances + localVarReturnValue *RunnerRuntimeList ) 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.ListInstances") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRunnerRuntimes") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances" + localVarPath := localBasePath + "/v1beta/projects/{projectId}/runner-runtimes" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -960,8 +2490,8 @@ func (r ListInstancesRequest) Execute() (*ListInstances, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedResponse + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -998,24 +2528,24 @@ func (r ListInstancesRequest) Execute() (*ListInstances, error) { } /* -ListInstances: List Instances. +ListRunnerRuntimes: Method for ListRunnerRuntimes -Lists all STACKIT Git instances within a project. +A list of runner runtimes that are available to be enabled for the project. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. - @return ApiListInstancesRequest + @return ApiListRunnerRuntimesRequest */ -func (a *APIClient) ListInstances(ctx context.Context, projectId string) ApiListInstancesRequest { - return ListInstancesRequest{ +func (a *APIClient) ListRunnerRuntimes(ctx context.Context, projectId string) ApiListRunnerRuntimesRequest { + return ListRunnerRuntimesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, } } -func (a *APIClient) ListInstancesExecute(ctx context.Context, projectId string) (*ListInstances, error) { - r := ListInstancesRequest{ +func (a *APIClient) ListRunnerRuntimesExecute(ctx context.Context, projectId string) (*RunnerRuntimeList, error) { + r := ListRunnerRuntimesRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -1023,31 +2553,43 @@ func (a *APIClient) ListInstancesExecute(ctx context.Context, projectId string) return r.Execute() } -type ListRunnerLabelsRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string +type PatchAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + authenticationId string + patchAuthenticationPayload *PatchAuthenticationPayload +} + +// Authentication Definition configuration data. + +func (r PatchAuthenticationRequest) PatchAuthenticationPayload(patchAuthenticationPayload PatchAuthenticationPayload) ApiPatchAuthenticationRequest { + r.patchAuthenticationPayload = &patchAuthenticationPayload + return r } -func (r ListRunnerLabelsRequest) Execute() (*ListRunnerLabels, error) { +func (r PatchAuthenticationRequest) Execute() (*Authentication, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListRunnerLabels + 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.ListRunnerLabels") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PatchAuthentication") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1beta/projects/{projectId}/runner-labels" + 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{} @@ -1058,9 +2600,24 @@ func (r ListRunnerLabelsRequest) Execute() (*ListRunnerLabels, error) { 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") + } + if r.patchAuthenticationPayload == nil { + return localVarReturnValue, fmt.Errorf("patchAuthenticationPayload 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) @@ -1076,6 +2633,8 @@ func (r ListRunnerLabelsRequest) Execute() (*ListRunnerLabels, error) { if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.patchAuthenticationPayload req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -1119,8 +2678,8 @@ func (r ListRunnerLabelsRequest) Execute() (*ListRunnerLabels, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedResponse + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -1157,27 +2716,33 @@ func (r ListRunnerLabelsRequest) Execute() (*ListRunnerLabels, error) { } /* -ListRunnerLabels: Returns the details for the given STACKIT Git RunnerLabels. +PatchAuthentication: Patch Authentication. -Type of runners we can use for running jobs. +Patches the Authentication Provider. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId Project identifier. - @return ApiListRunnerLabelsRequest + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiPatchAuthenticationRequest */ -func (a *APIClient) ListRunnerLabels(ctx context.Context, projectId string) ApiListRunnerLabelsRequest { - return ListRunnerLabelsRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) PatchAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiPatchAuthenticationRequest { + return PatchAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, } } -func (a *APIClient) ListRunnerLabelsExecute(ctx context.Context, projectId string) (*ListRunnerLabels, error) { - r := ListRunnerLabelsRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) PatchAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) { + r := PatchAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, } return r.Execute() } @@ -1297,17 +2862,6 @@ func (r PatchInstanceRequest) Execute() (*Instance, error) { newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 401 { - var v UnauthorizedResponse - 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")) diff --git a/services/git/api_default_test.go b/services/git/api_default_test.go index d4077721d..3736d3f6b 100644 --- a/services/git/api_default_test.go +++ b/services/git/api_default_test.go @@ -23,6 +23,62 @@ import ( func Test_git_DefaultApiService(t *testing.T) { + t.Run("Test DefaultApiService CreateAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Authentication{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for git_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + createAuthenticationPayload := CreateAuthenticationPayload{} + + resp, reqErr := apiClient.CreateAuthentication(context.Background(), projectId, instanceId).CreateAuthenticationPayload(createAuthenticationPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/instances" projectIdValue := randString(36) @@ -76,6 +132,114 @@ func Test_git_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService CreateRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Runner{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for git_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + createRunnerPayload := CreateRunnerPayload{} + + resp, reqErr := apiClient.CreateRunner(context.Background(), projectId, instanceId).CreateRunnerPayload(createRunnerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + authenticationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for git_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + authenticationId := authenticationIdValue + + reqErr := apiClient.DeleteAuthentication(context.Background(), projectId, instanceId, authenticationId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}" projectIdValue := randString(36) @@ -125,6 +289,113 @@ func Test_git_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService DeleteRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for git_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + + reqErr := apiClient.DeleteRunner(context.Background(), projectId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + authenticationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Authentication{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for git_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + authenticationId := authenticationIdValue + + resp, reqErr := apiClient.GetAuthentication(context.Background(), projectId, instanceId, authenticationId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}" projectIdValue := randString(36) @@ -180,6 +451,168 @@ func Test_git_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService GetInstances", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := InstanceList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for git_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.GetInstances(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Runner{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for git_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.GetRunner(context.Background(), projectId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AuthenticationList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for git_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.ListAuthentication(context.Background(), projectId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService ListFlavors", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/flavors" projectIdValue := randString(36) @@ -187,7 +620,7 @@ func Test_git_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListFlavors{} + data := FlavorsList{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -232,14 +665,14 @@ func Test_git_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { - _apiUrlPath := "/v1beta/projects/{projectId}/instances" + t.Run("Test DefaultApiService ListRunnerRuntimes", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/runner-runtimes" projectIdValue := randString(36) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListInstances{} + data := RunnerRuntimeList{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -274,7 +707,7 @@ func Test_git_DefaultApiService(t *testing.T) { projectId := projectIdValue - resp, reqErr := apiClient.ListInstances(context.Background(), projectId).Execute() + resp, reqErr := apiClient.ListRunnerRuntimes(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -284,14 +717,18 @@ func Test_git_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListRunnerLabels", func(t *testing.T) { - _apiUrlPath := "/v1beta/projects/{projectId}/runner-labels" + t.Run("Test DefaultApiService PatchAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" projectIdValue := randString(36) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + authenticationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListRunnerLabels{} + data := Authentication{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -325,8 +762,11 @@ func Test_git_DefaultApiService(t *testing.T) { } projectId := projectIdValue + instanceId := instanceIdValue + authenticationId := authenticationIdValue + patchAuthenticationPayload := PatchAuthenticationPayload{} - resp, reqErr := apiClient.ListRunnerLabels(context.Background(), projectId).Execute() + resp, reqErr := apiClient.PatchAuthentication(context.Background(), projectId, instanceId, authenticationId).PatchAuthenticationPayload(patchAuthenticationPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) diff --git a/services/git/model_authentication.go b/services/git/model_authentication.go new file mode 100644 index 000000000..46157063e --- /dev/null +++ b/services/git/model_authentication.go @@ -0,0 +1,486 @@ +/* +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 + +import ( + "encoding/json" + "time" +) + +// checks if the Authentication type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Authentication{} + +/* + types and functions for auto_discover_url +*/ + +// isNotNullableString +type AuthenticationGetAutoDiscoverUrlAttributeType = *string + +func getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(arg AuthenticationGetAutoDiscoverUrlAttributeType) (ret AuthenticationGetAutoDiscoverUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetAutoDiscoverUrlAttributeType(arg *AuthenticationGetAutoDiscoverUrlAttributeType, val AuthenticationGetAutoDiscoverUrlRetType) { + *arg = &val +} + +type AuthenticationGetAutoDiscoverUrlArgType = string +type AuthenticationGetAutoDiscoverUrlRetType = string + +/* + types and functions for client_id +*/ + +// isNotNullableString +type AuthenticationGetClientIdAttributeType = *string + +func getAuthenticationGetClientIdAttributeTypeOk(arg AuthenticationGetClientIdAttributeType) (ret AuthenticationGetClientIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetClientIdAttributeType(arg *AuthenticationGetClientIdAttributeType, val AuthenticationGetClientIdRetType) { + *arg = &val +} + +type AuthenticationGetClientIdArgType = string +type AuthenticationGetClientIdRetType = string + +/* + types and functions for created_at +*/ + +// isDateTime +type AuthenticationGetCreatedAtAttributeType = *time.Time +type AuthenticationGetCreatedAtArgType = time.Time +type AuthenticationGetCreatedAtRetType = time.Time + +func getAuthenticationGetCreatedAtAttributeTypeOk(arg AuthenticationGetCreatedAtAttributeType) (ret AuthenticationGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetCreatedAtAttributeType(arg *AuthenticationGetCreatedAtAttributeType, val AuthenticationGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for icon_url +*/ + +// isNotNullableString +type AuthenticationGetIconUrlAttributeType = *string + +func getAuthenticationGetIconUrlAttributeTypeOk(arg AuthenticationGetIconUrlAttributeType) (ret AuthenticationGetIconUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetIconUrlAttributeType(arg *AuthenticationGetIconUrlAttributeType, val AuthenticationGetIconUrlRetType) { + *arg = &val +} + +type AuthenticationGetIconUrlArgType = string +type AuthenticationGetIconUrlRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type AuthenticationGetIdAttributeType = *string + +func getAuthenticationGetIdAttributeTypeOk(arg AuthenticationGetIdAttributeType) (ret AuthenticationGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetIdAttributeType(arg *AuthenticationGetIdAttributeType, val AuthenticationGetIdRetType) { + *arg = &val +} + +type AuthenticationGetIdArgType = string +type AuthenticationGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type AuthenticationGetNameAttributeType = *string + +func getAuthenticationGetNameAttributeTypeOk(arg AuthenticationGetNameAttributeType) (ret AuthenticationGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetNameAttributeType(arg *AuthenticationGetNameAttributeType, val AuthenticationGetNameRetType) { + *arg = &val +} + +type AuthenticationGetNameArgType = string +type AuthenticationGetNameRetType = string + +/* + types and functions for provider +*/ + +// isNotNullableString +type AuthenticationGetProviderAttributeType = *string + +func getAuthenticationGetProviderAttributeTypeOk(arg AuthenticationGetProviderAttributeType) (ret AuthenticationGetProviderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetProviderAttributeType(arg *AuthenticationGetProviderAttributeType, val AuthenticationGetProviderRetType) { + *arg = &val +} + +type AuthenticationGetProviderArgType = string +type AuthenticationGetProviderRetType = string + +/* + types and functions for scopes +*/ + +// isNotNullableString +type AuthenticationGetScopesAttributeType = *string + +func getAuthenticationGetScopesAttributeTypeOk(arg AuthenticationGetScopesAttributeType) (ret AuthenticationGetScopesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetScopesAttributeType(arg *AuthenticationGetScopesAttributeType, val AuthenticationGetScopesRetType) { + *arg = &val +} + +type AuthenticationGetScopesArgType = string +type AuthenticationGetScopesRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type AuthenticationGetStatusAttributeType = *string + +func getAuthenticationGetStatusAttributeTypeOk(arg AuthenticationGetStatusAttributeType) (ret AuthenticationGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetStatusAttributeType(arg *AuthenticationGetStatusAttributeType, val AuthenticationGetStatusRetType) { + *arg = &val +} + +type AuthenticationGetStatusArgType = string +type AuthenticationGetStatusRetType = string + +// Authentication Describes an authentication definition associated to a STACKIT Git instance. The provider type will be an openidConnect type. +type Authentication struct { + // The well-known configuration url to use for this authentication definition. + // REQUIRED + AutoDiscoverUrl AuthenticationGetAutoDiscoverUrlAttributeType `json:"auto_discover_url" required:"true"` + // The IDP client id to use. + // REQUIRED + ClientId AuthenticationGetClientIdAttributeType `json:"client_id" required:"true"` + // REQUIRED + CreatedAt AuthenticationGetCreatedAtAttributeType `json:"created_at" required:"true"` + // The url of the icon to use for this authentication definition. + // REQUIRED + IconUrl AuthenticationGetIconUrlAttributeType `json:"icon_url" required:"true"` + // An auto generated unique uuid which identifies the authentication definition in STACKIT Git instances. + // REQUIRED + Id AuthenticationGetIdAttributeType `json:"id" required:"true"` + // The name to identify an authentication definition associated with a STACKIT Git instance. + // REQUIRED + Name AuthenticationGetNameAttributeType `json:"name" required:"true"` + // The Oauth2 provider to use. + // REQUIRED + Provider AuthenticationGetProviderAttributeType `json:"provider" required:"true"` + // Scopes defines the OIDC scopes to request. + // REQUIRED + Scopes AuthenticationGetScopesAttributeType `json:"scopes" required:"true"` + // The current status of the authentication definition. + // REQUIRED + Status AuthenticationGetStatusAttributeType `json:"status" required:"true"` +} + +type _Authentication Authentication + +// NewAuthentication instantiates a new Authentication object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAuthentication(autoDiscoverUrl AuthenticationGetAutoDiscoverUrlArgType, clientId AuthenticationGetClientIdArgType, createdAt AuthenticationGetCreatedAtArgType, iconUrl AuthenticationGetIconUrlArgType, id AuthenticationGetIdArgType, name AuthenticationGetNameArgType, provider AuthenticationGetProviderArgType, scopes AuthenticationGetScopesArgType, status AuthenticationGetStatusArgType) *Authentication { + this := Authentication{} + setAuthenticationGetAutoDiscoverUrlAttributeType(&this.AutoDiscoverUrl, autoDiscoverUrl) + setAuthenticationGetClientIdAttributeType(&this.ClientId, clientId) + setAuthenticationGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setAuthenticationGetIconUrlAttributeType(&this.IconUrl, iconUrl) + setAuthenticationGetIdAttributeType(&this.Id, id) + setAuthenticationGetNameAttributeType(&this.Name, name) + setAuthenticationGetProviderAttributeType(&this.Provider, provider) + setAuthenticationGetScopesAttributeType(&this.Scopes, scopes) + setAuthenticationGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewAuthenticationWithDefaults instantiates a new Authentication object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAuthenticationWithDefaults() *Authentication { + this := Authentication{} + return &this +} + +// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value +func (o *Authentication) GetAutoDiscoverUrl() (ret AuthenticationGetAutoDiscoverUrlRetType) { + ret, _ = o.GetAutoDiscoverUrlOk() + return ret +} + +// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetAutoDiscoverUrlOk() (ret AuthenticationGetAutoDiscoverUrlRetType, ok bool) { + return getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl) +} + +// SetAutoDiscoverUrl sets field value +func (o *Authentication) SetAutoDiscoverUrl(v AuthenticationGetAutoDiscoverUrlRetType) { + setAuthenticationGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v) +} + +// GetClientId returns the ClientId field value +func (o *Authentication) GetClientId() (ret AuthenticationGetClientIdRetType) { + ret, _ = o.GetClientIdOk() + return ret +} + +// GetClientIdOk returns a tuple with the ClientId field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetClientIdOk() (ret AuthenticationGetClientIdRetType, ok bool) { + return getAuthenticationGetClientIdAttributeTypeOk(o.ClientId) +} + +// SetClientId sets field value +func (o *Authentication) SetClientId(v AuthenticationGetClientIdRetType) { + setAuthenticationGetClientIdAttributeType(&o.ClientId, v) +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Authentication) GetCreatedAt() (ret AuthenticationGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetCreatedAtOk() (ret AuthenticationGetCreatedAtRetType, ok bool) { + return getAuthenticationGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *Authentication) SetCreatedAt(v AuthenticationGetCreatedAtRetType) { + setAuthenticationGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetIconUrl returns the IconUrl field value +func (o *Authentication) GetIconUrl() (ret AuthenticationGetIconUrlRetType) { + ret, _ = o.GetIconUrlOk() + return ret +} + +// GetIconUrlOk returns a tuple with the IconUrl field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetIconUrlOk() (ret AuthenticationGetIconUrlRetType, ok bool) { + return getAuthenticationGetIconUrlAttributeTypeOk(o.IconUrl) +} + +// SetIconUrl sets field value +func (o *Authentication) SetIconUrl(v AuthenticationGetIconUrlRetType) { + setAuthenticationGetIconUrlAttributeType(&o.IconUrl, v) +} + +// GetId returns the Id field value +func (o *Authentication) GetId() (ret AuthenticationGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetIdOk() (ret AuthenticationGetIdRetType, ok bool) { + return getAuthenticationGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Authentication) SetId(v AuthenticationGetIdRetType) { + setAuthenticationGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value +func (o *Authentication) GetName() (ret AuthenticationGetNameRetType) { + 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. +func (o *Authentication) GetNameOk() (ret AuthenticationGetNameRetType, ok bool) { + return getAuthenticationGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Authentication) SetName(v AuthenticationGetNameRetType) { + setAuthenticationGetNameAttributeType(&o.Name, v) +} + +// GetProvider returns the Provider field value +func (o *Authentication) GetProvider() (ret AuthenticationGetProviderRetType) { + ret, _ = o.GetProviderOk() + return ret +} + +// GetProviderOk returns a tuple with the Provider field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetProviderOk() (ret AuthenticationGetProviderRetType, ok bool) { + return getAuthenticationGetProviderAttributeTypeOk(o.Provider) +} + +// SetProvider sets field value +func (o *Authentication) SetProvider(v AuthenticationGetProviderRetType) { + setAuthenticationGetProviderAttributeType(&o.Provider, v) +} + +// GetScopes returns the Scopes field value +func (o *Authentication) GetScopes() (ret AuthenticationGetScopesRetType) { + ret, _ = o.GetScopesOk() + return ret +} + +// GetScopesOk returns a tuple with the Scopes field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetScopesOk() (ret AuthenticationGetScopesRetType, ok bool) { + return getAuthenticationGetScopesAttributeTypeOk(o.Scopes) +} + +// SetScopes sets field value +func (o *Authentication) SetScopes(v AuthenticationGetScopesRetType) { + setAuthenticationGetScopesAttributeType(&o.Scopes, v) +} + +// GetStatus returns the Status field value +func (o *Authentication) GetStatus() (ret AuthenticationGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetStatusOk() (ret AuthenticationGetStatusRetType, ok bool) { + return getAuthenticationGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Authentication) SetStatus(v AuthenticationGetStatusRetType) { + setAuthenticationGetStatusAttributeType(&o.Status, v) +} + +func (o Authentication) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok { + toSerialize["AutoDiscoverUrl"] = val + } + if val, ok := getAuthenticationGetClientIdAttributeTypeOk(o.ClientId); ok { + toSerialize["ClientId"] = val + } + if val, ok := getAuthenticationGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getAuthenticationGetIconUrlAttributeTypeOk(o.IconUrl); ok { + toSerialize["IconUrl"] = val + } + if val, ok := getAuthenticationGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAuthenticationGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getAuthenticationGetProviderAttributeTypeOk(o.Provider); ok { + toSerialize["Provider"] = val + } + if val, ok := getAuthenticationGetScopesAttributeTypeOk(o.Scopes); ok { + toSerialize["Scopes"] = val + } + if val, ok := getAuthenticationGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableAuthentication struct { + value *Authentication + isSet bool +} + +func (v NullableAuthentication) Get() *Authentication { + return v.value +} + +func (v *NullableAuthentication) Set(val *Authentication) { + v.value = val + v.isSet = true +} + +func (v NullableAuthentication) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthentication) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthentication(val *Authentication) *NullableAuthentication { + return &NullableAuthentication{value: val, isSet: true} +} + +func (v NullableAuthentication) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthentication) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_authentication_list.go b/services/git/model_authentication_list.go new file mode 100644 index 000000000..43a57aaa9 --- /dev/null +++ b/services/git/model_authentication_list.go @@ -0,0 +1,125 @@ +/* +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 + +import ( + "encoding/json" +) + +// checks if the AuthenticationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthenticationList{} + +/* + types and functions for authentication +*/ + +// isArray +type AuthenticationListGetAuthenticationAttributeType = *[]Authentication +type AuthenticationListGetAuthenticationArgType = []Authentication +type AuthenticationListGetAuthenticationRetType = []Authentication + +func getAuthenticationListGetAuthenticationAttributeTypeOk(arg AuthenticationListGetAuthenticationAttributeType) (ret AuthenticationListGetAuthenticationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationListGetAuthenticationAttributeType(arg *AuthenticationListGetAuthenticationAttributeType, val AuthenticationListGetAuthenticationRetType) { + *arg = &val +} + +// AuthenticationList A list of authentications belonging to an Instance. +type AuthenticationList struct { + // REQUIRED + Authentication AuthenticationListGetAuthenticationAttributeType `json:"authentication" required:"true"` +} + +type _AuthenticationList AuthenticationList + +// NewAuthenticationList instantiates a new AuthenticationList 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 NewAuthenticationList(authentication AuthenticationListGetAuthenticationArgType) *AuthenticationList { + this := AuthenticationList{} + setAuthenticationListGetAuthenticationAttributeType(&this.Authentication, authentication) + return &this +} + +// NewAuthenticationListWithDefaults instantiates a new AuthenticationList 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 NewAuthenticationListWithDefaults() *AuthenticationList { + this := AuthenticationList{} + return &this +} + +// GetAuthentication returns the Authentication field value +func (o *AuthenticationList) GetAuthentication() (ret AuthenticationListGetAuthenticationRetType) { + ret, _ = o.GetAuthenticationOk() + return ret +} + +// GetAuthenticationOk returns a tuple with the Authentication field value +// and a boolean to check if the value has been set. +func (o *AuthenticationList) GetAuthenticationOk() (ret AuthenticationListGetAuthenticationRetType, ok bool) { + return getAuthenticationListGetAuthenticationAttributeTypeOk(o.Authentication) +} + +// SetAuthentication sets field value +func (o *AuthenticationList) SetAuthentication(v AuthenticationListGetAuthenticationRetType) { + setAuthenticationListGetAuthenticationAttributeType(&o.Authentication, v) +} + +func (o AuthenticationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuthenticationListGetAuthenticationAttributeTypeOk(o.Authentication); ok { + toSerialize["Authentication"] = val + } + return toSerialize, nil +} + +type NullableAuthenticationList struct { + value *AuthenticationList + isSet bool +} + +func (v NullableAuthenticationList) Get() *AuthenticationList { + return v.value +} + +func (v *NullableAuthenticationList) Set(val *AuthenticationList) { + v.value = val + v.isSet = true +} + +func (v NullableAuthenticationList) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthenticationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthenticationList(val *AuthenticationList) *NullableAuthenticationList { + return &NullableAuthenticationList{value: val, isSet: true} +} + +func (v NullableAuthenticationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthenticationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_instance_flavor_test.go b/services/git/model_authentication_list_test.go similarity index 100% rename from services/git/model_instance_flavor_test.go rename to services/git/model_authentication_list_test.go diff --git a/services/git/model_list_flavors_test.go b/services/git/model_authentication_test.go similarity index 100% rename from services/git/model_list_flavors_test.go rename to services/git/model_authentication_test.go diff --git a/services/git/model_create_authentication_payload.go b/services/git/model_create_authentication_payload.go new file mode 100644 index 000000000..8e0bf16d4 --- /dev/null +++ b/services/git/model_create_authentication_payload.go @@ -0,0 +1,413 @@ +/* +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 + +import ( + "encoding/json" +) + +// checks if the CreateAuthenticationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAuthenticationPayload{} + +/* + types and functions for auto_discover_url +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType = *string + +func getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(arg CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType) (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(arg *CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType, val CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetAutoDiscoverUrlArgType = string +type CreateAuthenticationPayloadGetAutoDiscoverUrlRetType = string + +/* + types and functions for client_id +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetClientIdAttributeType = *string + +func getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(arg CreateAuthenticationPayloadGetClientIdAttributeType) (ret CreateAuthenticationPayloadGetClientIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetClientIdAttributeType(arg *CreateAuthenticationPayloadGetClientIdAttributeType, val CreateAuthenticationPayloadGetClientIdRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetClientIdArgType = string +type CreateAuthenticationPayloadGetClientIdRetType = string + +/* + types and functions for client_secret +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetClientSecretAttributeType = *string + +func getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(arg CreateAuthenticationPayloadGetClientSecretAttributeType) (ret CreateAuthenticationPayloadGetClientSecretRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetClientSecretAttributeType(arg *CreateAuthenticationPayloadGetClientSecretAttributeType, val CreateAuthenticationPayloadGetClientSecretRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetClientSecretArgType = string +type CreateAuthenticationPayloadGetClientSecretRetType = string + +/* + types and functions for icon_url +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetIconUrlAttributeType = *string + +func getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(arg CreateAuthenticationPayloadGetIconUrlAttributeType) (ret CreateAuthenticationPayloadGetIconUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetIconUrlAttributeType(arg *CreateAuthenticationPayloadGetIconUrlAttributeType, val CreateAuthenticationPayloadGetIconUrlRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetIconUrlArgType = string +type CreateAuthenticationPayloadGetIconUrlRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetNameAttributeType = *string + +func getCreateAuthenticationPayloadGetNameAttributeTypeOk(arg CreateAuthenticationPayloadGetNameAttributeType) (ret CreateAuthenticationPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetNameAttributeType(arg *CreateAuthenticationPayloadGetNameAttributeType, val CreateAuthenticationPayloadGetNameRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetNameArgType = string +type CreateAuthenticationPayloadGetNameRetType = string + +/* + types and functions for provider +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetProviderAttributeType = *string + +func getCreateAuthenticationPayloadGetProviderAttributeTypeOk(arg CreateAuthenticationPayloadGetProviderAttributeType) (ret CreateAuthenticationPayloadGetProviderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetProviderAttributeType(arg *CreateAuthenticationPayloadGetProviderAttributeType, val CreateAuthenticationPayloadGetProviderRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetProviderArgType = string +type CreateAuthenticationPayloadGetProviderRetType = string + +/* + types and functions for scopes +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetScopesAttributeType = *string + +func getCreateAuthenticationPayloadGetScopesAttributeTypeOk(arg CreateAuthenticationPayloadGetScopesAttributeType) (ret CreateAuthenticationPayloadGetScopesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetScopesAttributeType(arg *CreateAuthenticationPayloadGetScopesAttributeType, val CreateAuthenticationPayloadGetScopesRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetScopesArgType = string +type CreateAuthenticationPayloadGetScopesRetType = string + +// CreateAuthenticationPayload Properties to patch on an authentication. All fields are optional. +type CreateAuthenticationPayload struct { + // The well-known configuration url to use for this authentication definition. + // REQUIRED + AutoDiscoverUrl CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType `json:"auto_discover_url" required:"true"` + // The IDP client id to use. + // REQUIRED + ClientId CreateAuthenticationPayloadGetClientIdAttributeType `json:"client_id" required:"true"` + // The IDP client secret to use. + // REQUIRED + ClientSecret CreateAuthenticationPayloadGetClientSecretAttributeType `json:"client_secret" required:"true"` + // The url of the icon to use for this authentication definition. + IconUrl CreateAuthenticationPayloadGetIconUrlAttributeType `json:"icon_url,omitempty"` + // The name to identify an authentication definition associated with a STACKIT Git instance. + // REQUIRED + Name CreateAuthenticationPayloadGetNameAttributeType `json:"name" required:"true"` + // The Oauth2 provider to use. + Provider CreateAuthenticationPayloadGetProviderAttributeType `json:"provider,omitempty"` + // Scopes defines the OIDC scopes to request. + Scopes CreateAuthenticationPayloadGetScopesAttributeType `json:"scopes,omitempty"` +} + +type _CreateAuthenticationPayload CreateAuthenticationPayload + +// NewCreateAuthenticationPayload instantiates a new CreateAuthenticationPayload 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 NewCreateAuthenticationPayload(autoDiscoverUrl CreateAuthenticationPayloadGetAutoDiscoverUrlArgType, clientId CreateAuthenticationPayloadGetClientIdArgType, clientSecret CreateAuthenticationPayloadGetClientSecretArgType, name CreateAuthenticationPayloadGetNameArgType) *CreateAuthenticationPayload { + this := CreateAuthenticationPayload{} + setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&this.AutoDiscoverUrl, autoDiscoverUrl) + setCreateAuthenticationPayloadGetClientIdAttributeType(&this.ClientId, clientId) + setCreateAuthenticationPayloadGetClientSecretAttributeType(&this.ClientSecret, clientSecret) + setCreateAuthenticationPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateAuthenticationPayloadWithDefaults instantiates a new CreateAuthenticationPayload 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 NewCreateAuthenticationPayloadWithDefaults() *CreateAuthenticationPayload { + this := CreateAuthenticationPayload{} + var provider string = "openidConnect" + this.Provider = &provider + var scopes string = "openid profile email" + this.Scopes = &scopes + return &this +} + +// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value +func (o *CreateAuthenticationPayload) GetAutoDiscoverUrl() (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) { + ret, _ = o.GetAutoDiscoverUrlOk() + return ret +} + +// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetAutoDiscoverUrlOk() (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) { + return getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl) +} + +// SetAutoDiscoverUrl sets field value +func (o *CreateAuthenticationPayload) SetAutoDiscoverUrl(v CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) { + setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v) +} + +// GetClientId returns the ClientId field value +func (o *CreateAuthenticationPayload) GetClientId() (ret CreateAuthenticationPayloadGetClientIdRetType) { + ret, _ = o.GetClientIdOk() + return ret +} + +// GetClientIdOk returns a tuple with the ClientId field value +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetClientIdOk() (ret CreateAuthenticationPayloadGetClientIdRetType, ok bool) { + return getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId) +} + +// SetClientId sets field value +func (o *CreateAuthenticationPayload) SetClientId(v CreateAuthenticationPayloadGetClientIdRetType) { + setCreateAuthenticationPayloadGetClientIdAttributeType(&o.ClientId, v) +} + +// GetClientSecret returns the ClientSecret field value +func (o *CreateAuthenticationPayload) GetClientSecret() (ret CreateAuthenticationPayloadGetClientSecretRetType) { + ret, _ = o.GetClientSecretOk() + return ret +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetClientSecretOk() (ret CreateAuthenticationPayloadGetClientSecretRetType, ok bool) { + return getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret) +} + +// SetClientSecret sets field value +func (o *CreateAuthenticationPayload) SetClientSecret(v CreateAuthenticationPayloadGetClientSecretRetType) { + setCreateAuthenticationPayloadGetClientSecretAttributeType(&o.ClientSecret, v) +} + +// GetIconUrl returns the IconUrl field value if set, zero value otherwise. +func (o *CreateAuthenticationPayload) GetIconUrl() (res CreateAuthenticationPayloadGetIconUrlRetType) { + res, _ = o.GetIconUrlOk() + return +} + +// GetIconUrlOk returns a tuple with the IconUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetIconUrlOk() (ret CreateAuthenticationPayloadGetIconUrlRetType, ok bool) { + return getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl) +} + +// HasIconUrl returns a boolean if a field has been set. +func (o *CreateAuthenticationPayload) HasIconUrl() bool { + _, ok := o.GetIconUrlOk() + return ok +} + +// SetIconUrl gets a reference to the given string and assigns it to the IconUrl field. +func (o *CreateAuthenticationPayload) SetIconUrl(v CreateAuthenticationPayloadGetIconUrlRetType) { + setCreateAuthenticationPayloadGetIconUrlAttributeType(&o.IconUrl, v) +} + +// GetName returns the Name field value +func (o *CreateAuthenticationPayload) GetName() (ret CreateAuthenticationPayloadGetNameRetType) { + 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. +func (o *CreateAuthenticationPayload) GetNameOk() (ret CreateAuthenticationPayloadGetNameRetType, ok bool) { + return getCreateAuthenticationPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateAuthenticationPayload) SetName(v CreateAuthenticationPayloadGetNameRetType) { + setCreateAuthenticationPayloadGetNameAttributeType(&o.Name, v) +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *CreateAuthenticationPayload) GetProvider() (res CreateAuthenticationPayloadGetProviderRetType) { + res, _ = o.GetProviderOk() + return +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetProviderOk() (ret CreateAuthenticationPayloadGetProviderRetType, ok bool) { + return getCreateAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider) +} + +// HasProvider returns a boolean if a field has been set. +func (o *CreateAuthenticationPayload) HasProvider() bool { + _, ok := o.GetProviderOk() + return ok +} + +// SetProvider gets a reference to the given string and assigns it to the Provider field. +func (o *CreateAuthenticationPayload) SetProvider(v CreateAuthenticationPayloadGetProviderRetType) { + setCreateAuthenticationPayloadGetProviderAttributeType(&o.Provider, v) +} + +// GetScopes returns the Scopes field value if set, zero value otherwise. +func (o *CreateAuthenticationPayload) GetScopes() (res CreateAuthenticationPayloadGetScopesRetType) { + res, _ = o.GetScopesOk() + return +} + +// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetScopesOk() (ret CreateAuthenticationPayloadGetScopesRetType, ok bool) { + return getCreateAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes) +} + +// HasScopes returns a boolean if a field has been set. +func (o *CreateAuthenticationPayload) HasScopes() bool { + _, ok := o.GetScopesOk() + return ok +} + +// SetScopes gets a reference to the given string and assigns it to the Scopes field. +func (o *CreateAuthenticationPayload) SetScopes(v CreateAuthenticationPayloadGetScopesRetType) { + setCreateAuthenticationPayloadGetScopesAttributeType(&o.Scopes, v) +} + +func (o CreateAuthenticationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok { + toSerialize["AutoDiscoverUrl"] = val + } + if val, ok := getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId); ok { + toSerialize["ClientId"] = val + } + if val, ok := getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret); ok { + toSerialize["ClientSecret"] = val + } + if val, ok := getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl); ok { + toSerialize["IconUrl"] = val + } + if val, ok := getCreateAuthenticationPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider); ok { + toSerialize["Provider"] = val + } + if val, ok := getCreateAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes); ok { + toSerialize["Scopes"] = val + } + return toSerialize, nil +} + +type NullableCreateAuthenticationPayload struct { + value *CreateAuthenticationPayload + isSet bool +} + +func (v NullableCreateAuthenticationPayload) Get() *CreateAuthenticationPayload { + return v.value +} + +func (v *NullableCreateAuthenticationPayload) Set(val *CreateAuthenticationPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAuthenticationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAuthenticationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAuthenticationPayload(val *CreateAuthenticationPayload) *NullableCreateAuthenticationPayload { + return &NullableCreateAuthenticationPayload{value: val, isSet: true} +} + +func (v NullableCreateAuthenticationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAuthenticationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_list_instances_test.go b/services/git/model_create_authentication_payload_test.go similarity index 100% rename from services/git/model_list_instances_test.go rename to services/git/model_create_authentication_payload_test.go diff --git a/services/git/model_create_instance_payload.go b/services/git/model_create_instance_payload.go index 408be85f5..6417ded34 100644 --- a/services/git/model_create_instance_payload.go +++ b/services/git/model_create_instance_payload.go @@ -12,6 +12,7 @@ package git import ( "encoding/json" + "fmt" ) // checks if the CreateInstancePayload type satisfies the MappedNullable interface at compile time @@ -41,10 +42,114 @@ func setCreateInstancePayloadGetAclAttributeType(arg *CreateInstancePayloadGetAc types and functions for flavor */ -// isEnumRef -type CreateInstancePayloadGetFlavorAttributeType = *InstanceFlavor -type CreateInstancePayloadGetFlavorArgType = InstanceFlavor -type CreateInstancePayloadGetFlavorRetType = InstanceFlavor +// isEnum + +// CreateInstancePayloadFlavor the model 'CreateInstancePayload' +// value type for enums +type CreateInstancePayloadFlavor string + +// List of Flavor +const ( + CREATEINSTANCEPAYLOADFLAVOR__10 CreateInstancePayloadFlavor = "git-10" + CREATEINSTANCEPAYLOADFLAVOR__100 CreateInstancePayloadFlavor = "git-100" +) + +// All allowed values of CreateInstancePayload enum +var AllowedCreateInstancePayloadFlavorEnumValues = []CreateInstancePayloadFlavor{ + "git-10", + "git-100", +} + +func (v *CreateInstancePayloadFlavor) 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 CreateInstancePayloadFlavor + 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 := CreateInstancePayloadFlavor(value) + for _, existing := range AllowedCreateInstancePayloadFlavorEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateInstancePayload", value) +} + +// NewCreateInstancePayloadFlavorFromValue returns a pointer to a valid CreateInstancePayloadFlavor +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateInstancePayloadFlavorFromValue(v CreateInstancePayloadFlavor) (*CreateInstancePayloadFlavor, error) { + ev := CreateInstancePayloadFlavor(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateInstancePayloadFlavor: valid values are %v", v, AllowedCreateInstancePayloadFlavorEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateInstancePayloadFlavor) IsValid() bool { + for _, existing := range AllowedCreateInstancePayloadFlavorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FlavorFlavor value +func (v CreateInstancePayloadFlavor) Ptr() *CreateInstancePayloadFlavor { + return &v +} + +type NullableCreateInstancePayloadFlavor struct { + value *CreateInstancePayloadFlavor + isSet bool +} + +func (v NullableCreateInstancePayloadFlavor) Get() *CreateInstancePayloadFlavor { + return v.value +} + +func (v *NullableCreateInstancePayloadFlavor) Set(val *CreateInstancePayloadFlavor) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstancePayloadFlavor) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstancePayloadFlavor) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstancePayloadFlavor(val *CreateInstancePayloadFlavor) *NullableCreateInstancePayloadFlavor { + return &NullableCreateInstancePayloadFlavor{value: val, isSet: true} +} + +func (v NullableCreateInstancePayloadFlavor) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstancePayloadFlavor) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateInstancePayloadGetFlavorAttributeType = *CreateInstancePayloadFlavor +type CreateInstancePayloadGetFlavorArgType = CreateInstancePayloadFlavor +type CreateInstancePayloadGetFlavorRetType = CreateInstancePayloadFlavor func getCreateInstancePayloadGetFlavorAttributeTypeOk(arg CreateInstancePayloadGetFlavorAttributeType) (ret CreateInstancePayloadGetFlavorRetType, ok bool) { if arg == nil { @@ -149,7 +254,7 @@ func (o *CreateInstancePayload) HasFlavor() bool { return ok } -// SetFlavor gets a reference to the given InstanceFlavor and assigns it to the Flavor field. +// SetFlavor gets a reference to the given string and assigns it to the Flavor field. func (o *CreateInstancePayload) SetFlavor(v CreateInstancePayloadGetFlavorRetType) { setCreateInstancePayloadGetFlavorAttributeType(&o.Flavor, v) } diff --git a/services/git/model_create_instance_payload_test.go b/services/git/model_create_instance_payload_test.go index e39c866ed..f0259f88f 100644 --- a/services/git/model_create_instance_payload_test.go +++ b/services/git/model_create_instance_payload_test.go @@ -9,3 +9,50 @@ API version: 1beta.0.4 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package git + +import ( + "testing" +) + +// isEnum + +func TestCreateInstancePayloadFlavor_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(`"git-10"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"git-100"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := CreateInstancePayloadFlavor("") + 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_runner_payload.go b/services/git/model_create_runner_payload.go new file mode 100644 index 000000000..6c03e31ae --- /dev/null +++ b/services/git/model_create_runner_payload.go @@ -0,0 +1,125 @@ +/* +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 + +import ( + "encoding/json" +) + +// checks if the CreateRunnerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRunnerPayload{} + +/* + types and functions for labels +*/ + +// isArray +type CreateRunnerPayloadGetLabelsAttributeType = *[]string +type CreateRunnerPayloadGetLabelsArgType = []string +type CreateRunnerPayloadGetLabelsRetType = []string + +func getCreateRunnerPayloadGetLabelsAttributeTypeOk(arg CreateRunnerPayloadGetLabelsAttributeType) (ret CreateRunnerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRunnerPayloadGetLabelsAttributeType(arg *CreateRunnerPayloadGetLabelsAttributeType, val CreateRunnerPayloadGetLabelsRetType) { + *arg = &val +} + +// CreateRunnerPayload Request a runner to be created supporting the requested list of runtime labels. +type CreateRunnerPayload struct { + // REQUIRED + Labels CreateRunnerPayloadGetLabelsAttributeType `json:"labels" required:"true"` +} + +type _CreateRunnerPayload CreateRunnerPayload + +// NewCreateRunnerPayload instantiates a new CreateRunnerPayload 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 NewCreateRunnerPayload(labels CreateRunnerPayloadGetLabelsArgType) *CreateRunnerPayload { + this := CreateRunnerPayload{} + setCreateRunnerPayloadGetLabelsAttributeType(&this.Labels, labels) + return &this +} + +// NewCreateRunnerPayloadWithDefaults instantiates a new CreateRunnerPayload 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 NewCreateRunnerPayloadWithDefaults() *CreateRunnerPayload { + this := CreateRunnerPayload{} + return &this +} + +// GetLabels returns the Labels field value +func (o *CreateRunnerPayload) GetLabels() (ret CreateRunnerPayloadGetLabelsRetType) { + ret, _ = o.GetLabelsOk() + return ret +} + +// GetLabelsOk returns a tuple with the Labels field value +// and a boolean to check if the value has been set. +func (o *CreateRunnerPayload) GetLabelsOk() (ret CreateRunnerPayloadGetLabelsRetType, ok bool) { + return getCreateRunnerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// SetLabels sets field value +func (o *CreateRunnerPayload) SetLabels(v CreateRunnerPayloadGetLabelsRetType) { + setCreateRunnerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o CreateRunnerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateRunnerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableCreateRunnerPayload struct { + value *CreateRunnerPayload + isSet bool +} + +func (v NullableCreateRunnerPayload) Get() *CreateRunnerPayload { + return v.value +} + +func (v *NullableCreateRunnerPayload) Set(val *CreateRunnerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateRunnerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateRunnerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateRunnerPayload(val *CreateRunnerPayload) *NullableCreateRunnerPayload { + return &NullableCreateRunnerPayload{value: val, isSet: true} +} + +func (v NullableCreateRunnerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateRunnerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_list_runner_labels_test.go b/services/git/model_create_runner_payload_test.go similarity index 100% rename from services/git/model_list_runner_labels_test.go rename to services/git/model_create_runner_payload_test.go diff --git a/services/git/model_feature_toggle.go b/services/git/model_feature_toggle.go new file mode 100644 index 000000000..4e3234f45 --- /dev/null +++ b/services/git/model_feature_toggle.go @@ -0,0 +1,366 @@ +/* +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 + +import ( + "encoding/json" + "fmt" +) + +// checks if the FeatureToggle type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FeatureToggle{} + +/* + types and functions for default_email_notifications +*/ + +// isEnum + +// FeatureToggleDefaultEmailNotifications Default email notifications. +// value type for enums +type FeatureToggleDefaultEmailNotifications string + +// List of DefaultEmailNotifications +const ( + FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ENABLED FeatureToggleDefaultEmailNotifications = "enabled" + FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_DISABLED FeatureToggleDefaultEmailNotifications = "disabled" + FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ONMENTION FeatureToggleDefaultEmailNotifications = "onmention" + FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ANDYOUROWN FeatureToggleDefaultEmailNotifications = "andyourown" +) + +// All allowed values of FeatureToggle enum +var AllowedFeatureToggleDefaultEmailNotificationsEnumValues = []FeatureToggleDefaultEmailNotifications{ + "enabled", + "disabled", + "onmention", + "andyourown", +} + +func (v *FeatureToggleDefaultEmailNotifications) 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 FeatureToggleDefaultEmailNotifications + 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 := FeatureToggleDefaultEmailNotifications(value) + for _, existing := range AllowedFeatureToggleDefaultEmailNotificationsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FeatureToggle", value) +} + +// NewFeatureToggleDefaultEmailNotificationsFromValue returns a pointer to a valid FeatureToggleDefaultEmailNotifications +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFeatureToggleDefaultEmailNotificationsFromValue(v FeatureToggleDefaultEmailNotifications) (*FeatureToggleDefaultEmailNotifications, error) { + ev := FeatureToggleDefaultEmailNotifications(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FeatureToggleDefaultEmailNotifications: valid values are %v", v, AllowedFeatureToggleDefaultEmailNotificationsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FeatureToggleDefaultEmailNotifications) IsValid() bool { + for _, existing := range AllowedFeatureToggleDefaultEmailNotificationsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DefaultEmailNotificationsDefaultEmailNotifications value +func (v FeatureToggleDefaultEmailNotifications) Ptr() *FeatureToggleDefaultEmailNotifications { + return &v +} + +type NullableFeatureToggleDefaultEmailNotifications struct { + value *FeatureToggleDefaultEmailNotifications + isSet bool +} + +func (v NullableFeatureToggleDefaultEmailNotifications) Get() *FeatureToggleDefaultEmailNotifications { + return v.value +} + +func (v *NullableFeatureToggleDefaultEmailNotifications) Set(val *FeatureToggleDefaultEmailNotifications) { + v.value = val + v.isSet = true +} + +func (v NullableFeatureToggleDefaultEmailNotifications) IsSet() bool { + return v.isSet +} + +func (v *NullableFeatureToggleDefaultEmailNotifications) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFeatureToggleDefaultEmailNotifications(val *FeatureToggleDefaultEmailNotifications) *NullableFeatureToggleDefaultEmailNotifications { + return &NullableFeatureToggleDefaultEmailNotifications{value: val, isSet: true} +} + +func (v NullableFeatureToggleDefaultEmailNotifications) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFeatureToggleDefaultEmailNotifications) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type FeatureToggleGetDefaultEmailNotificationsAttributeType = *FeatureToggleDefaultEmailNotifications +type FeatureToggleGetDefaultEmailNotificationsArgType = *FeatureToggleDefaultEmailNotifications +type FeatureToggleGetDefaultEmailNotificationsRetType = *FeatureToggleDefaultEmailNotifications + +func getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(arg FeatureToggleGetDefaultEmailNotificationsAttributeType) (ret FeatureToggleGetDefaultEmailNotificationsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setFeatureToggleGetDefaultEmailNotificationsAttributeType(arg *FeatureToggleGetDefaultEmailNotificationsAttributeType, val FeatureToggleGetDefaultEmailNotificationsRetType) { + *arg = val +} + +/* + types and functions for enable_commit_signatures +*/ + +// isBoolean +type FeatureTogglegetEnableCommitSignaturesAttributeType = *bool +type FeatureTogglegetEnableCommitSignaturesArgType = *bool +type FeatureTogglegetEnableCommitSignaturesRetType = *bool + +func getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(arg FeatureTogglegetEnableCommitSignaturesAttributeType) (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setFeatureTogglegetEnableCommitSignaturesAttributeType(arg *FeatureTogglegetEnableCommitSignaturesAttributeType, val FeatureTogglegetEnableCommitSignaturesRetType) { + *arg = val +} + +/* + types and functions for enable_local_login +*/ + +// isBoolean +type FeatureTogglegetEnableLocalLoginAttributeType = *bool +type FeatureTogglegetEnableLocalLoginArgType = *bool +type FeatureTogglegetEnableLocalLoginRetType = *bool + +func getFeatureTogglegetEnableLocalLoginAttributeTypeOk(arg FeatureTogglegetEnableLocalLoginAttributeType) (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setFeatureTogglegetEnableLocalLoginAttributeType(arg *FeatureTogglegetEnableLocalLoginAttributeType, val FeatureTogglegetEnableLocalLoginRetType) { + *arg = val +} + +// FeatureToggle Feature toggles for the instance. +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"` +} + +// NewFeatureToggle instantiates a new FeatureToggle 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 NewFeatureToggle() *FeatureToggle { + this := FeatureToggle{} + return &this +} + +// NewFeatureToggleWithDefaults instantiates a new FeatureToggle 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 NewFeatureToggleWithDefaults() *FeatureToggle { + this := FeatureToggle{} + return &this +} + +// GetDefaultEmailNotifications returns the DefaultEmailNotifications field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FeatureToggle) GetDefaultEmailNotifications() (res FeatureToggleGetDefaultEmailNotificationsRetType) { + res, _ = o.GetDefaultEmailNotificationsOk() + return +} + +// GetDefaultEmailNotificationsOk returns a tuple with the DefaultEmailNotifications 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) GetDefaultEmailNotificationsOk() (ret FeatureToggleGetDefaultEmailNotificationsRetType, ok bool) { + return getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(o.DefaultEmailNotifications) +} + +// HasDefaultEmailNotifications returns a boolean if a field has been set. +func (o *FeatureToggle) HasDefaultEmailNotifications() bool { + _, ok := o.GetDefaultEmailNotificationsOk() + return ok +} + +// SetDefaultEmailNotifications gets a reference to the given string and assigns it to the DefaultEmailNotifications field. +func (o *FeatureToggle) SetDefaultEmailNotifications(v FeatureToggleGetDefaultEmailNotificationsRetType) { + setFeatureToggleGetDefaultEmailNotificationsAttributeType(&o.DefaultEmailNotifications, v) +} + +// SetDefaultEmailNotificationsNil sets the value for DefaultEmailNotifications to be an explicit nil +func (o *FeatureToggle) SetDefaultEmailNotificationsNil() { + o.DefaultEmailNotifications = nil +} + +// UnsetDefaultEmailNotifications ensures that no value is present for DefaultEmailNotifications, not even an explicit nil +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). +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 +func (o *FeatureToggle) GetEnableCommitSignaturesOk() (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) { + return getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures) +} + +// HasEnableCommitSignatures returns a boolean if a field has been set. +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. +func (o *FeatureToggle) SetEnableCommitSignatures(v FeatureTogglegetEnableCommitSignaturesRetType) { + setFeatureTogglegetEnableCommitSignaturesAttributeType(&o.EnableCommitSignatures, v) +} + +// SetEnableCommitSignaturesNil sets the value for EnableCommitSignatures to be an explicit nil +func (o *FeatureToggle) SetEnableCommitSignaturesNil() { + o.EnableCommitSignatures = nil +} + +// UnsetEnableCommitSignatures ensures that no value is present for EnableCommitSignatures, not even an explicit nil +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). +func (o *FeatureToggle) GetEnableLocalLogin() (res FeatureTogglegetEnableLocalLoginRetType) { + res, _ = o.GetEnableLocalLoginOk() + return +} + +// GetEnableLocalLoginOk returns a tuple with the EnableLocalLogin 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) GetEnableLocalLoginOk() (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) { + return getFeatureTogglegetEnableLocalLoginAttributeTypeOk(o.EnableLocalLogin) +} + +// HasEnableLocalLogin returns a boolean if a field has been set. +func (o *FeatureToggle) HasEnableLocalLogin() bool { + _, ok := o.GetEnableLocalLoginOk() + return ok +} + +// SetEnableLocalLogin gets a reference to the given bool and assigns it to the EnableLocalLogin field. +func (o *FeatureToggle) SetEnableLocalLogin(v FeatureTogglegetEnableLocalLoginRetType) { + setFeatureTogglegetEnableLocalLoginAttributeType(&o.EnableLocalLogin, v) +} + +// SetEnableLocalLoginNil sets the value for EnableLocalLogin to be an explicit nil +func (o *FeatureToggle) SetEnableLocalLoginNil() { + o.EnableLocalLogin = nil +} + +// UnsetEnableLocalLogin ensures that no value is present for EnableLocalLogin, not even an explicit nil +func (o *FeatureToggle) UnsetEnableLocalLogin() { + o.EnableLocalLogin = nil +} + +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 + } + return toSerialize, nil +} + +type NullableFeatureToggle struct { + value *FeatureToggle + isSet bool +} + +func (v NullableFeatureToggle) Get() *FeatureToggle { + return v.value +} + +func (v *NullableFeatureToggle) Set(val *FeatureToggle) { + v.value = val + v.isSet = true +} + +func (v NullableFeatureToggle) IsSet() bool { + return v.isSet +} + +func (v *NullableFeatureToggle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFeatureToggle(val *FeatureToggle) *NullableFeatureToggle { + return &NullableFeatureToggle{value: val, isSet: true} +} + +func (v NullableFeatureToggle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFeatureToggle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_feature_toggle_test.go b/services/git/model_feature_toggle_test.go new file mode 100644 index 000000000..db419df58 --- /dev/null +++ b/services/git/model_feature_toggle_test.go @@ -0,0 +1,72 @@ +/* +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 + +import ( + "testing" +) + +// isEnum + +func TestFeatureToggleDefaultEmailNotifications_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(`"enabled"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"disabled"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"onmention"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"andyourown"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := FeatureToggleDefaultEmailNotifications("") + 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_flavors_list.go b/services/git/model_flavors_list.go new file mode 100644 index 000000000..75f5951d7 --- /dev/null +++ b/services/git/model_flavors_list.go @@ -0,0 +1,125 @@ +/* +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 + +import ( + "encoding/json" +) + +// checks if the FlavorsList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlavorsList{} + +/* + types and functions for flavors +*/ + +// isArray +type FlavorsListGetFlavorsAttributeType = *[]Flavor +type FlavorsListGetFlavorsArgType = []Flavor +type FlavorsListGetFlavorsRetType = []Flavor + +func getFlavorsListGetFlavorsAttributeTypeOk(arg FlavorsListGetFlavorsAttributeType) (ret FlavorsListGetFlavorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFlavorsListGetFlavorsAttributeType(arg *FlavorsListGetFlavorsAttributeType, val FlavorsListGetFlavorsRetType) { + *arg = &val +} + +// FlavorsList A list of STACKIT Git Flavors. +type FlavorsList struct { + // REQUIRED + Flavors FlavorsListGetFlavorsAttributeType `json:"flavors" required:"true"` +} + +type _FlavorsList FlavorsList + +// NewFlavorsList instantiates a new FlavorsList 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 NewFlavorsList(flavors FlavorsListGetFlavorsArgType) *FlavorsList { + this := FlavorsList{} + setFlavorsListGetFlavorsAttributeType(&this.Flavors, flavors) + return &this +} + +// NewFlavorsListWithDefaults instantiates a new FlavorsList 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 NewFlavorsListWithDefaults() *FlavorsList { + this := FlavorsList{} + return &this +} + +// GetFlavors returns the Flavors field value +func (o *FlavorsList) GetFlavors() (ret FlavorsListGetFlavorsRetType) { + ret, _ = o.GetFlavorsOk() + return ret +} + +// GetFlavorsOk returns a tuple with the Flavors field value +// and a boolean to check if the value has been set. +func (o *FlavorsList) GetFlavorsOk() (ret FlavorsListGetFlavorsRetType, ok bool) { + return getFlavorsListGetFlavorsAttributeTypeOk(o.Flavors) +} + +// SetFlavors sets field value +func (o *FlavorsList) SetFlavors(v FlavorsListGetFlavorsRetType) { + setFlavorsListGetFlavorsAttributeType(&o.Flavors, v) +} + +func (o FlavorsList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getFlavorsListGetFlavorsAttributeTypeOk(o.Flavors); ok { + toSerialize["Flavors"] = val + } + return toSerialize, nil +} + +type NullableFlavorsList struct { + value *FlavorsList + isSet bool +} + +func (v NullableFlavorsList) Get() *FlavorsList { + return v.value +} + +func (v *NullableFlavorsList) Set(val *FlavorsList) { + v.value = val + v.isSet = true +} + +func (v NullableFlavorsList) IsSet() bool { + return v.isSet +} + +func (v *NullableFlavorsList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlavorsList(val *FlavorsList) *NullableFlavorsList { + return &NullableFlavorsList{value: val, isSet: true} +} + +func (v NullableFlavorsList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlavorsList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_runner_label_test.go b/services/git/model_flavors_list_test.go similarity index 100% rename from services/git/model_runner_label_test.go rename to services/git/model_flavors_list_test.go diff --git a/services/git/model_instance.go b/services/git/model_instance.go index 587308921..c7d5c04c1 100644 --- a/services/git/model_instance.go +++ b/services/git/model_instance.go @@ -82,22 +82,22 @@ type InstanceGetConsumedObjectStorageArgType = string type InstanceGetConsumedObjectStorageRetType = string /* - types and functions for created + types and functions for created_at */ // isDateTime -type InstanceGetCreatedAttributeType = *time.Time -type InstanceGetCreatedArgType = time.Time -type InstanceGetCreatedRetType = time.Time +type InstanceGetCreatedAtAttributeType = *time.Time +type InstanceGetCreatedAtArgType = time.Time +type InstanceGetCreatedAtRetType = time.Time -func getInstanceGetCreatedAttributeTypeOk(arg InstanceGetCreatedAttributeType) (ret InstanceGetCreatedRetType, ok bool) { +func getInstanceGetCreatedAtAttributeTypeOk(arg InstanceGetCreatedAtAttributeType) (ret InstanceGetCreatedAtRetType, ok bool) { if arg == nil { return ret, false } return *arg, true } -func setInstanceGetCreatedAttributeType(arg *InstanceGetCreatedAttributeType, val InstanceGetCreatedRetType) { +func setInstanceGetCreatedAtAttributeType(arg *InstanceGetCreatedAtAttributeType, val InstanceGetCreatedAtRetType) { *arg = &val } @@ -351,8 +351,8 @@ type Instance struct { ConsumedObjectStorage InstanceGetConsumedObjectStorageAttributeType `json:"consumed_object_storage" required:"true"` // The date and time the creation of the STACKIT Git instance was triggered. // REQUIRED - Created InstanceGetCreatedAttributeType `json:"created" required:"true"` - // Desired instance flavor. Must be one of the defined enum values + CreatedAt InstanceGetCreatedAtAttributeType `json:"created_at" required:"true"` + // Instance flavor. // REQUIRED Flavor InstanceGetFlavorAttributeType `json:"flavor" required:"true"` // A auto generated unique id which identifies the STACKIT Git instances. @@ -378,12 +378,12 @@ type _Instance Instance // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewInstance(acl InstanceGetAclArgType, consumedDisk InstanceGetConsumedDiskArgType, consumedObjectStorage InstanceGetConsumedObjectStorageArgType, created InstanceGetCreatedArgType, flavor InstanceGetFlavorArgType, id InstanceGetIdArgType, name InstanceGetNameArgType, state InstanceGetStateArgType, url InstanceGetUrlArgType, version InstanceGetVersionArgType) *Instance { +func NewInstance(acl InstanceGetAclArgType, consumedDisk InstanceGetConsumedDiskArgType, consumedObjectStorage InstanceGetConsumedObjectStorageArgType, createdAt InstanceGetCreatedAtArgType, flavor InstanceGetFlavorArgType, id InstanceGetIdArgType, name InstanceGetNameArgType, state InstanceGetStateArgType, url InstanceGetUrlArgType, version InstanceGetVersionArgType) *Instance { this := Instance{} setInstanceGetAclAttributeType(&this.Acl, acl) setInstanceGetConsumedDiskAttributeType(&this.ConsumedDisk, consumedDisk) setInstanceGetConsumedObjectStorageAttributeType(&this.ConsumedObjectStorage, consumedObjectStorage) - setInstanceGetCreatedAttributeType(&this.Created, created) + setInstanceGetCreatedAtAttributeType(&this.CreatedAt, createdAt) setInstanceGetFlavorAttributeType(&this.Flavor, flavor) setInstanceGetIdAttributeType(&this.Id, id) setInstanceGetNameAttributeType(&this.Name, name) @@ -452,21 +452,21 @@ func (o *Instance) SetConsumedObjectStorage(v InstanceGetConsumedObjectStorageRe setInstanceGetConsumedObjectStorageAttributeType(&o.ConsumedObjectStorage, v) } -// GetCreated returns the Created field value -func (o *Instance) GetCreated() (ret InstanceGetCreatedRetType) { - ret, _ = o.GetCreatedOk() +// GetCreatedAt returns the CreatedAt field value +func (o *Instance) GetCreatedAt() (ret InstanceGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() return ret } -// GetCreatedOk returns a tuple with the Created field value +// GetCreatedAtOk returns a tuple with the CreatedAt field value // and a boolean to check if the value has been set. -func (o *Instance) GetCreatedOk() (ret InstanceGetCreatedRetType, ok bool) { - return getInstanceGetCreatedAttributeTypeOk(o.Created) +func (o *Instance) GetCreatedAtOk() (ret InstanceGetCreatedAtRetType, ok bool) { + return getInstanceGetCreatedAtAttributeTypeOk(o.CreatedAt) } -// SetCreated sets field value -func (o *Instance) SetCreated(v InstanceGetCreatedRetType) { - setInstanceGetCreatedAttributeType(&o.Created, v) +// SetCreatedAt sets field value +func (o *Instance) SetCreatedAt(v InstanceGetCreatedAtRetType) { + setInstanceGetCreatedAtAttributeType(&o.CreatedAt, v) } // GetFlavor returns the Flavor field value @@ -582,8 +582,8 @@ func (o Instance) ToMap() (map[string]interface{}, error) { if val, ok := getInstanceGetConsumedObjectStorageAttributeTypeOk(o.ConsumedObjectStorage); ok { toSerialize["ConsumedObjectStorage"] = val } - if val, ok := getInstanceGetCreatedAttributeTypeOk(o.Created); ok { - toSerialize["Created"] = val + if val, ok := getInstanceGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val } if val, ok := getInstanceGetFlavorAttributeTypeOk(o.Flavor); ok { toSerialize["Flavor"] = val diff --git a/services/git/model_instance_flavor.go b/services/git/model_instance_flavor.go deleted file mode 100644 index 4439a8c76..000000000 --- a/services/git/model_instance_flavor.go +++ /dev/null @@ -1,115 +0,0 @@ -/* -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 - -import ( - "encoding/json" - "fmt" -) - -// InstanceFlavor Desired instance flavor. Must be one of the defined enum values. -type InstanceFlavor string - -// List of InstanceFlavor -const ( - INSTANCEFLAVOR__10 InstanceFlavor = "git-10" - INSTANCEFLAVOR__100 InstanceFlavor = "git-100" -) - -// All allowed values of InstanceFlavor enum -var AllowedInstanceFlavorEnumValues = []InstanceFlavor{ - "git-10", - "git-100", -} - -func (v *InstanceFlavor) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - // Allow unmarshalling zero value for testing purposes - var zeroValue string - if value == zeroValue { - return nil - } - enumTypeValue := InstanceFlavor(value) - for _, existing := range AllowedInstanceFlavorEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid InstanceFlavor", value) -} - -// NewInstanceFlavorFromValue returns a pointer to a valid InstanceFlavor -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewInstanceFlavorFromValue(v string) (*InstanceFlavor, error) { - ev := InstanceFlavor(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for InstanceFlavor: valid values are %v", v, AllowedInstanceFlavorEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v InstanceFlavor) IsValid() bool { - for _, existing := range AllowedInstanceFlavorEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to InstanceFlavor value -func (v InstanceFlavor) Ptr() *InstanceFlavor { - return &v -} - -type NullableInstanceFlavor struct { - value *InstanceFlavor - isSet bool -} - -func (v NullableInstanceFlavor) Get() *InstanceFlavor { - return v.value -} - -func (v *NullableInstanceFlavor) Set(val *InstanceFlavor) { - v.value = val - v.isSet = true -} - -func (v NullableInstanceFlavor) IsSet() bool { - return v.isSet -} - -func (v *NullableInstanceFlavor) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInstanceFlavor(val *InstanceFlavor) *NullableInstanceFlavor { - return &NullableInstanceFlavor{value: val, isSet: true} -} - -func (v NullableInstanceFlavor) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInstanceFlavor) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/git/model_instance_list.go b/services/git/model_instance_list.go new file mode 100644 index 000000000..144db8dd0 --- /dev/null +++ b/services/git/model_instance_list.go @@ -0,0 +1,125 @@ +/* +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 + +import ( + "encoding/json" +) + +// checks if the InstanceList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceList{} + +/* + types and functions for instances +*/ + +// isArray +type InstanceListGetInstancesAttributeType = *[]Instance +type InstanceListGetInstancesArgType = []Instance +type InstanceListGetInstancesRetType = []Instance + +func getInstanceListGetInstancesAttributeTypeOk(arg InstanceListGetInstancesAttributeType) (ret InstanceListGetInstancesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceListGetInstancesAttributeType(arg *InstanceListGetInstancesAttributeType, val InstanceListGetInstancesRetType) { + *arg = &val +} + +// InstanceList A list of STACKIT Git instances. +type InstanceList struct { + // REQUIRED + Instances InstanceListGetInstancesAttributeType `json:"instances" required:"true"` +} + +type _InstanceList InstanceList + +// NewInstanceList instantiates a new InstanceList 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 NewInstanceList(instances InstanceListGetInstancesArgType) *InstanceList { + this := InstanceList{} + setInstanceListGetInstancesAttributeType(&this.Instances, instances) + return &this +} + +// NewInstanceListWithDefaults instantiates a new InstanceList 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 NewInstanceListWithDefaults() *InstanceList { + this := InstanceList{} + return &this +} + +// GetInstances returns the Instances field value +func (o *InstanceList) GetInstances() (ret InstanceListGetInstancesRetType) { + ret, _ = o.GetInstancesOk() + return ret +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *InstanceList) GetInstancesOk() (ret InstanceListGetInstancesRetType, ok bool) { + return getInstanceListGetInstancesAttributeTypeOk(o.Instances) +} + +// SetInstances sets field value +func (o *InstanceList) SetInstances(v InstanceListGetInstancesRetType) { + setInstanceListGetInstancesAttributeType(&o.Instances, v) +} + +func (o InstanceList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getInstanceListGetInstancesAttributeTypeOk(o.Instances); ok { + toSerialize["Instances"] = val + } + return toSerialize, nil +} + +type NullableInstanceList struct { + value *InstanceList + isSet bool +} + +func (v NullableInstanceList) Get() *InstanceList { + return v.value +} + +func (v *NullableInstanceList) Set(val *InstanceList) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceList) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceList(val *InstanceList) *NullableInstanceList { + return &NullableInstanceList{value: val, isSet: true} +} + +func (v NullableInstanceList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_unauthorized_response_test.go b/services/git/model_instance_list_test.go similarity index 100% rename from services/git/model_unauthorized_response_test.go rename to services/git/model_instance_list_test.go diff --git a/services/git/model_list_flavors.go b/services/git/model_list_flavors.go deleted file mode 100644 index e516f42e2..000000000 --- a/services/git/model_list_flavors.go +++ /dev/null @@ -1,125 +0,0 @@ -/* -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 - -import ( - "encoding/json" -) - -// checks if the ListFlavors type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListFlavors{} - -/* - types and functions for flavors -*/ - -// isArray -type ListFlavorsGetFlavorsAttributeType = *[]Flavor -type ListFlavorsGetFlavorsArgType = []Flavor -type ListFlavorsGetFlavorsRetType = []Flavor - -func getListFlavorsGetFlavorsAttributeTypeOk(arg ListFlavorsGetFlavorsAttributeType) (ret ListFlavorsGetFlavorsRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setListFlavorsGetFlavorsAttributeType(arg *ListFlavorsGetFlavorsAttributeType, val ListFlavorsGetFlavorsRetType) { - *arg = &val -} - -// ListFlavors A list of STACKIT Git Flavors. -type ListFlavors struct { - // REQUIRED - Flavors ListFlavorsGetFlavorsAttributeType `json:"flavors" required:"true"` -} - -type _ListFlavors ListFlavors - -// NewListFlavors instantiates a new ListFlavors 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 NewListFlavors(flavors ListFlavorsGetFlavorsArgType) *ListFlavors { - this := ListFlavors{} - setListFlavorsGetFlavorsAttributeType(&this.Flavors, flavors) - return &this -} - -// NewListFlavorsWithDefaults instantiates a new ListFlavors 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 NewListFlavorsWithDefaults() *ListFlavors { - this := ListFlavors{} - return &this -} - -// GetFlavors returns the Flavors field value -func (o *ListFlavors) GetFlavors() (ret ListFlavorsGetFlavorsRetType) { - ret, _ = o.GetFlavorsOk() - return ret -} - -// GetFlavorsOk returns a tuple with the Flavors field value -// and a boolean to check if the value has been set. -func (o *ListFlavors) GetFlavorsOk() (ret ListFlavorsGetFlavorsRetType, ok bool) { - return getListFlavorsGetFlavorsAttributeTypeOk(o.Flavors) -} - -// SetFlavors sets field value -func (o *ListFlavors) SetFlavors(v ListFlavorsGetFlavorsRetType) { - setListFlavorsGetFlavorsAttributeType(&o.Flavors, v) -} - -func (o ListFlavors) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if val, ok := getListFlavorsGetFlavorsAttributeTypeOk(o.Flavors); ok { - toSerialize["Flavors"] = val - } - return toSerialize, nil -} - -type NullableListFlavors struct { - value *ListFlavors - isSet bool -} - -func (v NullableListFlavors) Get() *ListFlavors { - return v.value -} - -func (v *NullableListFlavors) Set(val *ListFlavors) { - v.value = val - v.isSet = true -} - -func (v NullableListFlavors) IsSet() bool { - return v.isSet -} - -func (v *NullableListFlavors) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableListFlavors(val *ListFlavors) *NullableListFlavors { - return &NullableListFlavors{value: val, isSet: true} -} - -func (v NullableListFlavors) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableListFlavors) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/git/model_list_instances.go b/services/git/model_list_instances.go deleted file mode 100644 index 193fb2536..000000000 --- a/services/git/model_list_instances.go +++ /dev/null @@ -1,125 +0,0 @@ -/* -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 - -import ( - "encoding/json" -) - -// checks if the ListInstances type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListInstances{} - -/* - types and functions for instances -*/ - -// isArray -type ListInstancesGetInstancesAttributeType = *[]Instance -type ListInstancesGetInstancesArgType = []Instance -type ListInstancesGetInstancesRetType = []Instance - -func getListInstancesGetInstancesAttributeTypeOk(arg ListInstancesGetInstancesAttributeType) (ret ListInstancesGetInstancesRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setListInstancesGetInstancesAttributeType(arg *ListInstancesGetInstancesAttributeType, val ListInstancesGetInstancesRetType) { - *arg = &val -} - -// ListInstances A list of STACKIT Git instances. -type ListInstances struct { - // REQUIRED - Instances ListInstancesGetInstancesAttributeType `json:"instances" required:"true"` -} - -type _ListInstances ListInstances - -// NewListInstances instantiates a new ListInstances 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 NewListInstances(instances ListInstancesGetInstancesArgType) *ListInstances { - this := ListInstances{} - setListInstancesGetInstancesAttributeType(&this.Instances, instances) - return &this -} - -// NewListInstancesWithDefaults instantiates a new ListInstances 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 NewListInstancesWithDefaults() *ListInstances { - this := ListInstances{} - return &this -} - -// GetInstances returns the Instances field value -func (o *ListInstances) GetInstances() (ret ListInstancesGetInstancesRetType) { - ret, _ = o.GetInstancesOk() - return ret -} - -// GetInstancesOk returns a tuple with the Instances field value -// and a boolean to check if the value has been set. -func (o *ListInstances) GetInstancesOk() (ret ListInstancesGetInstancesRetType, ok bool) { - return getListInstancesGetInstancesAttributeTypeOk(o.Instances) -} - -// SetInstances sets field value -func (o *ListInstances) SetInstances(v ListInstancesGetInstancesRetType) { - setListInstancesGetInstancesAttributeType(&o.Instances, v) -} - -func (o ListInstances) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if val, ok := getListInstancesGetInstancesAttributeTypeOk(o.Instances); ok { - toSerialize["Instances"] = val - } - return toSerialize, nil -} - -type NullableListInstances struct { - value *ListInstances - isSet bool -} - -func (v NullableListInstances) Get() *ListInstances { - return v.value -} - -func (v *NullableListInstances) Set(val *ListInstances) { - v.value = val - v.isSet = true -} - -func (v NullableListInstances) IsSet() bool { - return v.isSet -} - -func (v *NullableListInstances) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableListInstances(val *ListInstances) *NullableListInstances { - return &NullableListInstances{value: val, isSet: true} -} - -func (v NullableListInstances) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableListInstances) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/git/model_list_runner_labels.go b/services/git/model_list_runner_labels.go deleted file mode 100644 index d1643372f..000000000 --- a/services/git/model_list_runner_labels.go +++ /dev/null @@ -1,125 +0,0 @@ -/* -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 - -import ( - "encoding/json" -) - -// checks if the ListRunnerLabels type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListRunnerLabels{} - -/* - types and functions for runner-labels -*/ - -// isArray -type ListRunnerLabelsGetRunnerLabelsAttributeType = *[]RunnerLabel -type ListRunnerLabelsGetRunnerLabelsArgType = []RunnerLabel -type ListRunnerLabelsGetRunnerLabelsRetType = []RunnerLabel - -func getListRunnerLabelsGetRunnerLabelsAttributeTypeOk(arg ListRunnerLabelsGetRunnerLabelsAttributeType) (ret ListRunnerLabelsGetRunnerLabelsRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setListRunnerLabelsGetRunnerLabelsAttributeType(arg *ListRunnerLabelsGetRunnerLabelsAttributeType, val ListRunnerLabelsGetRunnerLabelsRetType) { - *arg = &val -} - -// ListRunnerLabels A list of STACKIT Git RunnerLabels. -type ListRunnerLabels struct { - // REQUIRED - RunnerLabels ListRunnerLabelsGetRunnerLabelsAttributeType `json:"runner-labels" required:"true"` -} - -type _ListRunnerLabels ListRunnerLabels - -// NewListRunnerLabels instantiates a new ListRunnerLabels 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 NewListRunnerLabels(runnerLabels ListRunnerLabelsGetRunnerLabelsArgType) *ListRunnerLabels { - this := ListRunnerLabels{} - setListRunnerLabelsGetRunnerLabelsAttributeType(&this.RunnerLabels, runnerLabels) - return &this -} - -// NewListRunnerLabelsWithDefaults instantiates a new ListRunnerLabels 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 NewListRunnerLabelsWithDefaults() *ListRunnerLabels { - this := ListRunnerLabels{} - return &this -} - -// GetRunnerLabels returns the RunnerLabels field value -func (o *ListRunnerLabels) GetRunnerLabels() (ret ListRunnerLabelsGetRunnerLabelsRetType) { - ret, _ = o.GetRunnerLabelsOk() - return ret -} - -// GetRunnerLabelsOk returns a tuple with the RunnerLabels field value -// and a boolean to check if the value has been set. -func (o *ListRunnerLabels) GetRunnerLabelsOk() (ret ListRunnerLabelsGetRunnerLabelsRetType, ok bool) { - return getListRunnerLabelsGetRunnerLabelsAttributeTypeOk(o.RunnerLabels) -} - -// SetRunnerLabels sets field value -func (o *ListRunnerLabels) SetRunnerLabels(v ListRunnerLabelsGetRunnerLabelsRetType) { - setListRunnerLabelsGetRunnerLabelsAttributeType(&o.RunnerLabels, v) -} - -func (o ListRunnerLabels) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if val, ok := getListRunnerLabelsGetRunnerLabelsAttributeTypeOk(o.RunnerLabels); ok { - toSerialize["RunnerLabels"] = val - } - return toSerialize, nil -} - -type NullableListRunnerLabels struct { - value *ListRunnerLabels - isSet bool -} - -func (v NullableListRunnerLabels) Get() *ListRunnerLabels { - return v.value -} - -func (v *NullableListRunnerLabels) Set(val *ListRunnerLabels) { - v.value = val - v.isSet = true -} - -func (v NullableListRunnerLabels) IsSet() bool { - return v.isSet -} - -func (v *NullableListRunnerLabels) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableListRunnerLabels(val *ListRunnerLabels) *NullableListRunnerLabels { - return &NullableListRunnerLabels{value: val, isSet: true} -} - -func (v NullableListRunnerLabels) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableListRunnerLabels) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/git/model_patch_authentication_payload.go b/services/git/model_patch_authentication_payload.go new file mode 100644 index 000000000..9c263990a --- /dev/null +++ b/services/git/model_patch_authentication_payload.go @@ -0,0 +1,374 @@ +/* +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 + +import ( + "encoding/json" +) + +// checks if the PatchAuthenticationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchAuthenticationPayload{} + +/* + types and functions for auto_discover_url +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType = *string + +func getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(arg PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType) (ret PatchAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType(arg *PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType, val PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetAutoDiscoverUrlArgType = string +type PatchAuthenticationPayloadGetAutoDiscoverUrlRetType = string + +/* + types and functions for client_id +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetClientIdAttributeType = *string + +func getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(arg PatchAuthenticationPayloadGetClientIdAttributeType) (ret PatchAuthenticationPayloadGetClientIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetClientIdAttributeType(arg *PatchAuthenticationPayloadGetClientIdAttributeType, val PatchAuthenticationPayloadGetClientIdRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetClientIdArgType = string +type PatchAuthenticationPayloadGetClientIdRetType = string + +/* + types and functions for client_secret +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetClientSecretAttributeType = *string + +func getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(arg PatchAuthenticationPayloadGetClientSecretAttributeType) (ret PatchAuthenticationPayloadGetClientSecretRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetClientSecretAttributeType(arg *PatchAuthenticationPayloadGetClientSecretAttributeType, val PatchAuthenticationPayloadGetClientSecretRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetClientSecretArgType = string +type PatchAuthenticationPayloadGetClientSecretRetType = string + +/* + types and functions for icon_url +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetIconUrlAttributeType = *string + +func getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(arg PatchAuthenticationPayloadGetIconUrlAttributeType) (ret PatchAuthenticationPayloadGetIconUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetIconUrlAttributeType(arg *PatchAuthenticationPayloadGetIconUrlAttributeType, val PatchAuthenticationPayloadGetIconUrlRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetIconUrlArgType = string +type PatchAuthenticationPayloadGetIconUrlRetType = string + +/* + types and functions for provider +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetProviderAttributeType = *string + +func getPatchAuthenticationPayloadGetProviderAttributeTypeOk(arg PatchAuthenticationPayloadGetProviderAttributeType) (ret PatchAuthenticationPayloadGetProviderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetProviderAttributeType(arg *PatchAuthenticationPayloadGetProviderAttributeType, val PatchAuthenticationPayloadGetProviderRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetProviderArgType = string +type PatchAuthenticationPayloadGetProviderRetType = string + +/* + types and functions for scopes +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetScopesAttributeType = *string + +func getPatchAuthenticationPayloadGetScopesAttributeTypeOk(arg PatchAuthenticationPayloadGetScopesAttributeType) (ret PatchAuthenticationPayloadGetScopesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetScopesAttributeType(arg *PatchAuthenticationPayloadGetScopesAttributeType, val PatchAuthenticationPayloadGetScopesRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetScopesArgType = string +type PatchAuthenticationPayloadGetScopesRetType = string + +// PatchAuthenticationPayload Properties to patch on an authentication. All fields are optional. +type PatchAuthenticationPayload struct { + // The well-known configuration url to use for this authentication definition. + AutoDiscoverUrl PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType `json:"auto_discover_url,omitempty"` + // The IDP client id to use. + ClientId PatchAuthenticationPayloadGetClientIdAttributeType `json:"client_id,omitempty"` + // The IDP client secret to use. + ClientSecret PatchAuthenticationPayloadGetClientSecretAttributeType `json:"client_secret,omitempty"` + // The url of the icon to use for this authentication definition. + IconUrl PatchAuthenticationPayloadGetIconUrlAttributeType `json:"icon_url,omitempty"` + // The Oauth2 provider to use. + Provider PatchAuthenticationPayloadGetProviderAttributeType `json:"provider,omitempty"` + // Scopes defines the OIDC scopes to request. + Scopes PatchAuthenticationPayloadGetScopesAttributeType `json:"scopes,omitempty"` +} + +// NewPatchAuthenticationPayload instantiates a new PatchAuthenticationPayload 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 NewPatchAuthenticationPayload() *PatchAuthenticationPayload { + this := PatchAuthenticationPayload{} + return &this +} + +// NewPatchAuthenticationPayloadWithDefaults instantiates a new PatchAuthenticationPayload 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 NewPatchAuthenticationPayloadWithDefaults() *PatchAuthenticationPayload { + this := PatchAuthenticationPayload{} + return &this +} + +// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetAutoDiscoverUrl() (res PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) { + res, _ = o.GetAutoDiscoverUrlOk() + return +} + +// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetAutoDiscoverUrlOk() (ret PatchAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) { + return getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl) +} + +// HasAutoDiscoverUrl returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasAutoDiscoverUrl() bool { + _, ok := o.GetAutoDiscoverUrlOk() + return ok +} + +// SetAutoDiscoverUrl gets a reference to the given string and assigns it to the AutoDiscoverUrl field. +func (o *PatchAuthenticationPayload) SetAutoDiscoverUrl(v PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) { + setPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v) +} + +// GetClientId returns the ClientId field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetClientId() (res PatchAuthenticationPayloadGetClientIdRetType) { + res, _ = o.GetClientIdOk() + return +} + +// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetClientIdOk() (ret PatchAuthenticationPayloadGetClientIdRetType, ok bool) { + return getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId) +} + +// HasClientId returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasClientId() bool { + _, ok := o.GetClientIdOk() + return ok +} + +// SetClientId gets a reference to the given string and assigns it to the ClientId field. +func (o *PatchAuthenticationPayload) SetClientId(v PatchAuthenticationPayloadGetClientIdRetType) { + setPatchAuthenticationPayloadGetClientIdAttributeType(&o.ClientId, v) +} + +// GetClientSecret returns the ClientSecret field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetClientSecret() (res PatchAuthenticationPayloadGetClientSecretRetType) { + res, _ = o.GetClientSecretOk() + return +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetClientSecretOk() (ret PatchAuthenticationPayloadGetClientSecretRetType, ok bool) { + return getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret) +} + +// HasClientSecret returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasClientSecret() bool { + _, ok := o.GetClientSecretOk() + return ok +} + +// SetClientSecret gets a reference to the given string and assigns it to the ClientSecret field. +func (o *PatchAuthenticationPayload) SetClientSecret(v PatchAuthenticationPayloadGetClientSecretRetType) { + setPatchAuthenticationPayloadGetClientSecretAttributeType(&o.ClientSecret, v) +} + +// GetIconUrl returns the IconUrl field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetIconUrl() (res PatchAuthenticationPayloadGetIconUrlRetType) { + res, _ = o.GetIconUrlOk() + return +} + +// GetIconUrlOk returns a tuple with the IconUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetIconUrlOk() (ret PatchAuthenticationPayloadGetIconUrlRetType, ok bool) { + return getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl) +} + +// HasIconUrl returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasIconUrl() bool { + _, ok := o.GetIconUrlOk() + return ok +} + +// SetIconUrl gets a reference to the given string and assigns it to the IconUrl field. +func (o *PatchAuthenticationPayload) SetIconUrl(v PatchAuthenticationPayloadGetIconUrlRetType) { + setPatchAuthenticationPayloadGetIconUrlAttributeType(&o.IconUrl, v) +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetProvider() (res PatchAuthenticationPayloadGetProviderRetType) { + res, _ = o.GetProviderOk() + return +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetProviderOk() (ret PatchAuthenticationPayloadGetProviderRetType, ok bool) { + return getPatchAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider) +} + +// HasProvider returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasProvider() bool { + _, ok := o.GetProviderOk() + return ok +} + +// SetProvider gets a reference to the given string and assigns it to the Provider field. +func (o *PatchAuthenticationPayload) SetProvider(v PatchAuthenticationPayloadGetProviderRetType) { + setPatchAuthenticationPayloadGetProviderAttributeType(&o.Provider, v) +} + +// GetScopes returns the Scopes field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetScopes() (res PatchAuthenticationPayloadGetScopesRetType) { + res, _ = o.GetScopesOk() + return +} + +// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetScopesOk() (ret PatchAuthenticationPayloadGetScopesRetType, ok bool) { + return getPatchAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes) +} + +// HasScopes returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasScopes() bool { + _, ok := o.GetScopesOk() + return ok +} + +// SetScopes gets a reference to the given string and assigns it to the Scopes field. +func (o *PatchAuthenticationPayload) SetScopes(v PatchAuthenticationPayloadGetScopesRetType) { + setPatchAuthenticationPayloadGetScopesAttributeType(&o.Scopes, v) +} + +func (o PatchAuthenticationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok { + toSerialize["AutoDiscoverUrl"] = val + } + if val, ok := getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId); ok { + toSerialize["ClientId"] = val + } + if val, ok := getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret); ok { + toSerialize["ClientSecret"] = val + } + if val, ok := getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl); ok { + toSerialize["IconUrl"] = val + } + if val, ok := getPatchAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider); ok { + toSerialize["Provider"] = val + } + if val, ok := getPatchAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes); ok { + toSerialize["Scopes"] = val + } + return toSerialize, nil +} + +type NullablePatchAuthenticationPayload struct { + value *PatchAuthenticationPayload + isSet bool +} + +func (v NullablePatchAuthenticationPayload) Get() *PatchAuthenticationPayload { + return v.value +} + +func (v *NullablePatchAuthenticationPayload) Set(val *PatchAuthenticationPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePatchAuthenticationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchAuthenticationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchAuthenticationPayload(val *PatchAuthenticationPayload) *NullablePatchAuthenticationPayload { + return &NullablePatchAuthenticationPayload{value: val, isSet: true} +} + +func (v NullablePatchAuthenticationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchAuthenticationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_patch_authentication_payload_test.go b/services/git/model_patch_authentication_payload_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_patch_authentication_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_patch_instance_payload.go b/services/git/model_patch_instance_payload.go index 87e9c3aa4..44d454ece 100644 --- a/services/git/model_patch_instance_payload.go +++ b/services/git/model_patch_instance_payload.go @@ -37,10 +37,31 @@ func setPatchInstancePayloadGetAclAttributeType(arg *PatchInstancePayloadGetAclA *arg = val } +/* + types and functions for feature_toggle +*/ + +// isModel +type PatchInstancePayloadGetFeatureToggleAttributeType = *FeatureToggle +type PatchInstancePayloadGetFeatureToggleArgType = FeatureToggle +type PatchInstancePayloadGetFeatureToggleRetType = FeatureToggle + +func getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(arg PatchInstancePayloadGetFeatureToggleAttributeType) (ret PatchInstancePayloadGetFeatureToggleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchInstancePayloadGetFeatureToggleAttributeType(arg *PatchInstancePayloadGetFeatureToggleAttributeType, val PatchInstancePayloadGetFeatureToggleRetType) { + *arg = &val +} + // PatchInstancePayload Properties to patch on an instance. All fields are optional. type PatchInstancePayload struct { // A list of CIDR network addresses that are allowed to access the instance. - Acl PatchInstancePayloadGetAclAttributeType `json:"acl,omitempty"` + Acl PatchInstancePayloadGetAclAttributeType `json:"acl,omitempty"` + FeatureToggle PatchInstancePayloadGetFeatureToggleAttributeType `json:"feature_toggle,omitempty"` } // NewPatchInstancePayload instantiates a new PatchInstancePayload object @@ -84,11 +105,37 @@ func (o *PatchInstancePayload) SetAcl(v PatchInstancePayloadGetAclRetType) { setPatchInstancePayloadGetAclAttributeType(&o.Acl, v) } +// GetFeatureToggle returns the FeatureToggle field value if set, zero value otherwise. +func (o *PatchInstancePayload) GetFeatureToggle() (res PatchInstancePayloadGetFeatureToggleRetType) { + res, _ = o.GetFeatureToggleOk() + return +} + +// GetFeatureToggleOk returns a tuple with the FeatureToggle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchInstancePayload) GetFeatureToggleOk() (ret PatchInstancePayloadGetFeatureToggleRetType, ok bool) { + return getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(o.FeatureToggle) +} + +// HasFeatureToggle returns a boolean if a field has been set. +func (o *PatchInstancePayload) HasFeatureToggle() bool { + _, ok := o.GetFeatureToggleOk() + return ok +} + +// SetFeatureToggle gets a reference to the given FeatureToggle and assigns it to the FeatureToggle field. +func (o *PatchInstancePayload) SetFeatureToggle(v PatchInstancePayloadGetFeatureToggleRetType) { + setPatchInstancePayloadGetFeatureToggleAttributeType(&o.FeatureToggle, v) +} + func (o PatchInstancePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getPatchInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { toSerialize["Acl"] = val } + if val, ok := getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(o.FeatureToggle); ok { + toSerialize["FeatureToggle"] = val + } return toSerialize, nil } diff --git a/services/git/model_runner.go b/services/git/model_runner.go new file mode 100644 index 000000000..781fc1090 --- /dev/null +++ b/services/git/model_runner.go @@ -0,0 +1,258 @@ +/* +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 + +import ( + "encoding/json" + "time" +) + +// checks if the Runner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Runner{} + +/* + types and functions for created_at +*/ + +// isDateTime +type RunnerGetCreatedAtAttributeType = *time.Time +type RunnerGetCreatedAtArgType = time.Time +type RunnerGetCreatedAtRetType = time.Time + +func getRunnerGetCreatedAtAttributeTypeOk(arg RunnerGetCreatedAtAttributeType) (ret RunnerGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerGetCreatedAtAttributeType(arg *RunnerGetCreatedAtAttributeType, val RunnerGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type RunnerGetIdAttributeType = *string + +func getRunnerGetIdAttributeTypeOk(arg RunnerGetIdAttributeType) (ret RunnerGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerGetIdAttributeType(arg *RunnerGetIdAttributeType, val RunnerGetIdRetType) { + *arg = &val +} + +type RunnerGetIdArgType = string +type RunnerGetIdRetType = string + +/* + types and functions for labels +*/ + +// isArray +type RunnerGetLabelsAttributeType = *[]string +type RunnerGetLabelsArgType = []string +type RunnerGetLabelsRetType = []string + +func getRunnerGetLabelsAttributeTypeOk(arg RunnerGetLabelsAttributeType) (ret RunnerGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerGetLabelsAttributeType(arg *RunnerGetLabelsAttributeType, val RunnerGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type RunnerGetStatusAttributeType = *string + +func getRunnerGetStatusAttributeTypeOk(arg RunnerGetStatusAttributeType) (ret RunnerGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerGetStatusAttributeType(arg *RunnerGetStatusAttributeType, val RunnerGetStatusRetType) { + *arg = &val +} + +type RunnerGetStatusArgType = string +type RunnerGetStatusRetType = string + +// Runner Describes a runner associated to a STACKIT Git instance. +type Runner struct { + // REQUIRED + CreatedAt RunnerGetCreatedAtAttributeType `json:"created_at" required:"true"` + // REQUIRED + Id RunnerGetIdAttributeType `json:"id" required:"true"` + // REQUIRED + Labels RunnerGetLabelsAttributeType `json:"labels" required:"true"` + // The current status of the runner. + // REQUIRED + Status RunnerGetStatusAttributeType `json:"status" required:"true"` +} + +type _Runner Runner + +// NewRunner instantiates a new Runner 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 NewRunner(createdAt RunnerGetCreatedAtArgType, id RunnerGetIdArgType, labels RunnerGetLabelsArgType, status RunnerGetStatusArgType) *Runner { + this := Runner{} + setRunnerGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setRunnerGetIdAttributeType(&this.Id, id) + setRunnerGetLabelsAttributeType(&this.Labels, labels) + setRunnerGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewRunnerWithDefaults instantiates a new Runner 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 NewRunnerWithDefaults() *Runner { + this := Runner{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Runner) GetCreatedAt() (ret RunnerGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Runner) GetCreatedAtOk() (ret RunnerGetCreatedAtRetType, ok bool) { + return getRunnerGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *Runner) SetCreatedAt(v RunnerGetCreatedAtRetType) { + setRunnerGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value +func (o *Runner) GetId() (ret RunnerGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Runner) GetIdOk() (ret RunnerGetIdRetType, ok bool) { + return getRunnerGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Runner) SetId(v RunnerGetIdRetType) { + setRunnerGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value +func (o *Runner) GetLabels() (ret RunnerGetLabelsRetType) { + ret, _ = o.GetLabelsOk() + return ret +} + +// GetLabelsOk returns a tuple with the Labels field value +// and a boolean to check if the value has been set. +func (o *Runner) GetLabelsOk() (ret RunnerGetLabelsRetType, ok bool) { + return getRunnerGetLabelsAttributeTypeOk(o.Labels) +} + +// SetLabels sets field value +func (o *Runner) SetLabels(v RunnerGetLabelsRetType) { + setRunnerGetLabelsAttributeType(&o.Labels, v) +} + +// GetStatus returns the Status field value +func (o *Runner) GetStatus() (ret RunnerGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Runner) GetStatusOk() (ret RunnerGetStatusRetType, ok bool) { + return getRunnerGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Runner) SetStatus(v RunnerGetStatusRetType) { + setRunnerGetStatusAttributeType(&o.Status, v) +} + +func (o Runner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRunnerGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getRunnerGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRunnerGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getRunnerGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableRunner struct { + value *Runner + isSet bool +} + +func (v NullableRunner) Get() *Runner { + return v.value +} + +func (v *NullableRunner) Set(val *Runner) { + v.value = val + v.isSet = true +} + +func (v NullableRunner) IsSet() bool { + return v.isSet +} + +func (v *NullableRunner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRunner(val *Runner) *NullableRunner { + return &NullableRunner{value: val, isSet: true} +} + +func (v NullableRunner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRunner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_runner_label.go b/services/git/model_runner_label.go deleted file mode 100644 index 79036859c..000000000 --- a/services/git/model_runner_label.go +++ /dev/null @@ -1,217 +0,0 @@ -/* -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 - -import ( - "encoding/json" -) - -// checks if the RunnerLabel type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &RunnerLabel{} - -/* - types and functions for description -*/ - -// isNotNullableString -type RunnerLabelGetDescriptionAttributeType = *string - -func getRunnerLabelGetDescriptionAttributeTypeOk(arg RunnerLabelGetDescriptionAttributeType) (ret RunnerLabelGetDescriptionRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setRunnerLabelGetDescriptionAttributeType(arg *RunnerLabelGetDescriptionAttributeType, val RunnerLabelGetDescriptionRetType) { - *arg = &val -} - -type RunnerLabelGetDescriptionArgType = string -type RunnerLabelGetDescriptionRetType = string - -/* - types and functions for id -*/ - -// isNotNullableString -type RunnerLabelGetIdAttributeType = *string - -func getRunnerLabelGetIdAttributeTypeOk(arg RunnerLabelGetIdAttributeType) (ret RunnerLabelGetIdRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setRunnerLabelGetIdAttributeType(arg *RunnerLabelGetIdAttributeType, val RunnerLabelGetIdRetType) { - *arg = &val -} - -type RunnerLabelGetIdArgType = string -type RunnerLabelGetIdRetType = string - -/* - types and functions for label -*/ - -// isNotNullableString -type RunnerLabelGetLabelAttributeType = *string - -func getRunnerLabelGetLabelAttributeTypeOk(arg RunnerLabelGetLabelAttributeType) (ret RunnerLabelGetLabelRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setRunnerLabelGetLabelAttributeType(arg *RunnerLabelGetLabelAttributeType, val RunnerLabelGetLabelRetType) { - *arg = &val -} - -type RunnerLabelGetLabelArgType = string -type RunnerLabelGetLabelRetType = string - -// RunnerLabel Describes a STACKIT Git RunnerLabel. -type RunnerLabel struct { - // RunnerLabel description. - // REQUIRED - Description RunnerLabelGetDescriptionAttributeType `json:"description" required:"true"` - // RunnerLabel id. - // REQUIRED - Id RunnerLabelGetIdAttributeType `json:"id" required:"true"` - // RunnerLabel label. - // REQUIRED - Label RunnerLabelGetLabelAttributeType `json:"label" required:"true"` -} - -type _RunnerLabel RunnerLabel - -// NewRunnerLabel instantiates a new RunnerLabel 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 NewRunnerLabel(description RunnerLabelGetDescriptionArgType, id RunnerLabelGetIdArgType, label RunnerLabelGetLabelArgType) *RunnerLabel { - this := RunnerLabel{} - setRunnerLabelGetDescriptionAttributeType(&this.Description, description) - setRunnerLabelGetIdAttributeType(&this.Id, id) - setRunnerLabelGetLabelAttributeType(&this.Label, label) - return &this -} - -// NewRunnerLabelWithDefaults instantiates a new RunnerLabel 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 NewRunnerLabelWithDefaults() *RunnerLabel { - this := RunnerLabel{} - return &this -} - -// GetDescription returns the Description field value -func (o *RunnerLabel) GetDescription() (ret RunnerLabelGetDescriptionRetType) { - ret, _ = o.GetDescriptionOk() - return ret -} - -// GetDescriptionOk returns a tuple with the Description field value -// and a boolean to check if the value has been set. -func (o *RunnerLabel) GetDescriptionOk() (ret RunnerLabelGetDescriptionRetType, ok bool) { - return getRunnerLabelGetDescriptionAttributeTypeOk(o.Description) -} - -// SetDescription sets field value -func (o *RunnerLabel) SetDescription(v RunnerLabelGetDescriptionRetType) { - setRunnerLabelGetDescriptionAttributeType(&o.Description, v) -} - -// GetId returns the Id field value -func (o *RunnerLabel) GetId() (ret RunnerLabelGetIdRetType) { - ret, _ = o.GetIdOk() - return ret -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *RunnerLabel) GetIdOk() (ret RunnerLabelGetIdRetType, ok bool) { - return getRunnerLabelGetIdAttributeTypeOk(o.Id) -} - -// SetId sets field value -func (o *RunnerLabel) SetId(v RunnerLabelGetIdRetType) { - setRunnerLabelGetIdAttributeType(&o.Id, v) -} - -// GetLabel returns the Label field value -func (o *RunnerLabel) GetLabel() (ret RunnerLabelGetLabelRetType) { - ret, _ = o.GetLabelOk() - return ret -} - -// GetLabelOk returns a tuple with the Label field value -// and a boolean to check if the value has been set. -func (o *RunnerLabel) GetLabelOk() (ret RunnerLabelGetLabelRetType, ok bool) { - return getRunnerLabelGetLabelAttributeTypeOk(o.Label) -} - -// SetLabel sets field value -func (o *RunnerLabel) SetLabel(v RunnerLabelGetLabelRetType) { - setRunnerLabelGetLabelAttributeType(&o.Label, v) -} - -func (o RunnerLabel) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if val, ok := getRunnerLabelGetDescriptionAttributeTypeOk(o.Description); ok { - toSerialize["Description"] = val - } - if val, ok := getRunnerLabelGetIdAttributeTypeOk(o.Id); ok { - toSerialize["Id"] = val - } - if val, ok := getRunnerLabelGetLabelAttributeTypeOk(o.Label); ok { - toSerialize["Label"] = val - } - return toSerialize, nil -} - -type NullableRunnerLabel struct { - value *RunnerLabel - isSet bool -} - -func (v NullableRunnerLabel) Get() *RunnerLabel { - return v.value -} - -func (v *NullableRunnerLabel) Set(val *RunnerLabel) { - v.value = val - v.isSet = true -} - -func (v NullableRunnerLabel) IsSet() bool { - return v.isSet -} - -func (v *NullableRunnerLabel) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRunnerLabel(val *RunnerLabel) *NullableRunnerLabel { - return &NullableRunnerLabel{value: val, isSet: true} -} - -func (v NullableRunnerLabel) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRunnerLabel) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/git/model_runner_runtime.go b/services/git/model_runner_runtime.go new file mode 100644 index 000000000..d4cc9c963 --- /dev/null +++ b/services/git/model_runner_runtime.go @@ -0,0 +1,307 @@ +/* +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 + +import ( + "encoding/json" +) + +// checks if the RunnerRuntime type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RunnerRuntime{} + +/* + types and functions for availability +*/ + +// isNotNullableString +type RunnerRuntimeGetAvailabilityAttributeType = *string + +func getRunnerRuntimeGetAvailabilityAttributeTypeOk(arg RunnerRuntimeGetAvailabilityAttributeType) (ret RunnerRuntimeGetAvailabilityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetAvailabilityAttributeType(arg *RunnerRuntimeGetAvailabilityAttributeType, val RunnerRuntimeGetAvailabilityRetType) { + *arg = &val +} + +type RunnerRuntimeGetAvailabilityArgType = string +type RunnerRuntimeGetAvailabilityRetType = string + +/* + types and functions for description +*/ + +// isNotNullableString +type RunnerRuntimeGetDescriptionAttributeType = *string + +func getRunnerRuntimeGetDescriptionAttributeTypeOk(arg RunnerRuntimeGetDescriptionAttributeType) (ret RunnerRuntimeGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetDescriptionAttributeType(arg *RunnerRuntimeGetDescriptionAttributeType, val RunnerRuntimeGetDescriptionRetType) { + *arg = &val +} + +type RunnerRuntimeGetDescriptionArgType = string +type RunnerRuntimeGetDescriptionRetType = string + +/* + types and functions for display_name +*/ + +// isNotNullableString +type RunnerRuntimeGetDisplayNameAttributeType = *string + +func getRunnerRuntimeGetDisplayNameAttributeTypeOk(arg RunnerRuntimeGetDisplayNameAttributeType) (ret RunnerRuntimeGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetDisplayNameAttributeType(arg *RunnerRuntimeGetDisplayNameAttributeType, val RunnerRuntimeGetDisplayNameRetType) { + *arg = &val +} + +type RunnerRuntimeGetDisplayNameArgType = string +type RunnerRuntimeGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type RunnerRuntimeGetIdAttributeType = *string + +func getRunnerRuntimeGetIdAttributeTypeOk(arg RunnerRuntimeGetIdAttributeType) (ret RunnerRuntimeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetIdAttributeType(arg *RunnerRuntimeGetIdAttributeType, val RunnerRuntimeGetIdRetType) { + *arg = &val +} + +type RunnerRuntimeGetIdArgType = string +type RunnerRuntimeGetIdRetType = string + +/* + types and functions for label +*/ + +// isNotNullableString +type RunnerRuntimeGetLabelAttributeType = *string + +func getRunnerRuntimeGetLabelAttributeTypeOk(arg RunnerRuntimeGetLabelAttributeType) (ret RunnerRuntimeGetLabelRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetLabelAttributeType(arg *RunnerRuntimeGetLabelAttributeType, val RunnerRuntimeGetLabelRetType) { + *arg = &val +} + +type RunnerRuntimeGetLabelArgType = string +type RunnerRuntimeGetLabelRetType = string + +// RunnerRuntime Describes a STACKIT Git Runner runtime. +type RunnerRuntime struct { + // Indicates the availability of the runner label + // REQUIRED + Availability RunnerRuntimeGetAvailabilityAttributeType `json:"availability" required:"true"` + // Human-friendly description of the runtime and it's capabilities. + // REQUIRED + Description RunnerRuntimeGetDescriptionAttributeType `json:"description" required:"true"` + // Human-friendly name of the runtime. + // REQUIRED + DisplayName RunnerRuntimeGetDisplayNameAttributeType `json:"display_name" required:"true"` + // Runtime identifier. + // REQUIRED + Id RunnerRuntimeGetIdAttributeType `json:"id" required:"true"` + // Runtime label. + // REQUIRED + Label RunnerRuntimeGetLabelAttributeType `json:"label" required:"true"` +} + +type _RunnerRuntime RunnerRuntime + +// NewRunnerRuntime instantiates a new RunnerRuntime 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 NewRunnerRuntime(availability RunnerRuntimeGetAvailabilityArgType, description RunnerRuntimeGetDescriptionArgType, displayName RunnerRuntimeGetDisplayNameArgType, id RunnerRuntimeGetIdArgType, label RunnerRuntimeGetLabelArgType) *RunnerRuntime { + this := RunnerRuntime{} + setRunnerRuntimeGetAvailabilityAttributeType(&this.Availability, availability) + setRunnerRuntimeGetDescriptionAttributeType(&this.Description, description) + setRunnerRuntimeGetDisplayNameAttributeType(&this.DisplayName, displayName) + setRunnerRuntimeGetIdAttributeType(&this.Id, id) + setRunnerRuntimeGetLabelAttributeType(&this.Label, label) + return &this +} + +// NewRunnerRuntimeWithDefaults instantiates a new RunnerRuntime 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 NewRunnerRuntimeWithDefaults() *RunnerRuntime { + this := RunnerRuntime{} + return &this +} + +// GetAvailability returns the Availability field value +func (o *RunnerRuntime) GetAvailability() (ret RunnerRuntimeGetAvailabilityRetType) { + ret, _ = o.GetAvailabilityOk() + return ret +} + +// GetAvailabilityOk returns a tuple with the Availability field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetAvailabilityOk() (ret RunnerRuntimeGetAvailabilityRetType, ok bool) { + return getRunnerRuntimeGetAvailabilityAttributeTypeOk(o.Availability) +} + +// SetAvailability sets field value +func (o *RunnerRuntime) SetAvailability(v RunnerRuntimeGetAvailabilityRetType) { + setRunnerRuntimeGetAvailabilityAttributeType(&o.Availability, v) +} + +// GetDescription returns the Description field value +func (o *RunnerRuntime) GetDescription() (ret RunnerRuntimeGetDescriptionRetType) { + ret, _ = o.GetDescriptionOk() + return ret +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetDescriptionOk() (ret RunnerRuntimeGetDescriptionRetType, ok bool) { + return getRunnerRuntimeGetDescriptionAttributeTypeOk(o.Description) +} + +// SetDescription sets field value +func (o *RunnerRuntime) SetDescription(v RunnerRuntimeGetDescriptionRetType) { + setRunnerRuntimeGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *RunnerRuntime) GetDisplayName() (ret RunnerRuntimeGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetDisplayNameOk() (ret RunnerRuntimeGetDisplayNameRetType, ok bool) { + return getRunnerRuntimeGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *RunnerRuntime) SetDisplayName(v RunnerRuntimeGetDisplayNameRetType) { + setRunnerRuntimeGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *RunnerRuntime) GetId() (ret RunnerRuntimeGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetIdOk() (ret RunnerRuntimeGetIdRetType, ok bool) { + return getRunnerRuntimeGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *RunnerRuntime) SetId(v RunnerRuntimeGetIdRetType) { + setRunnerRuntimeGetIdAttributeType(&o.Id, v) +} + +// GetLabel returns the Label field value +func (o *RunnerRuntime) GetLabel() (ret RunnerRuntimeGetLabelRetType) { + ret, _ = o.GetLabelOk() + return ret +} + +// GetLabelOk returns a tuple with the Label field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetLabelOk() (ret RunnerRuntimeGetLabelRetType, ok bool) { + return getRunnerRuntimeGetLabelAttributeTypeOk(o.Label) +} + +// SetLabel sets field value +func (o *RunnerRuntime) SetLabel(v RunnerRuntimeGetLabelRetType) { + setRunnerRuntimeGetLabelAttributeType(&o.Label, v) +} + +func (o RunnerRuntime) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRunnerRuntimeGetAvailabilityAttributeTypeOk(o.Availability); ok { + toSerialize["Availability"] = val + } + if val, ok := getRunnerRuntimeGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getRunnerRuntimeGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getRunnerRuntimeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRunnerRuntimeGetLabelAttributeTypeOk(o.Label); ok { + toSerialize["Label"] = val + } + return toSerialize, nil +} + +type NullableRunnerRuntime struct { + value *RunnerRuntime + isSet bool +} + +func (v NullableRunnerRuntime) Get() *RunnerRuntime { + return v.value +} + +func (v *NullableRunnerRuntime) Set(val *RunnerRuntime) { + v.value = val + v.isSet = true +} + +func (v NullableRunnerRuntime) IsSet() bool { + return v.isSet +} + +func (v *NullableRunnerRuntime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRunnerRuntime(val *RunnerRuntime) *NullableRunnerRuntime { + return &NullableRunnerRuntime{value: val, isSet: true} +} + +func (v NullableRunnerRuntime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRunnerRuntime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_runner_runtime_list.go b/services/git/model_runner_runtime_list.go new file mode 100644 index 000000000..846f18ed9 --- /dev/null +++ b/services/git/model_runner_runtime_list.go @@ -0,0 +1,125 @@ +/* +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 + +import ( + "encoding/json" +) + +// checks if the RunnerRuntimeList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RunnerRuntimeList{} + +/* + types and functions for items +*/ + +// isArray +type RunnerRuntimeListGetItemsAttributeType = *[]RunnerRuntime +type RunnerRuntimeListGetItemsArgType = []RunnerRuntime +type RunnerRuntimeListGetItemsRetType = []RunnerRuntime + +func getRunnerRuntimeListGetItemsAttributeTypeOk(arg RunnerRuntimeListGetItemsAttributeType) (ret RunnerRuntimeListGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeListGetItemsAttributeType(arg *RunnerRuntimeListGetItemsAttributeType, val RunnerRuntimeListGetItemsRetType) { + *arg = &val +} + +// RunnerRuntimeList A list of STACKIT Git RunnerLabels. +type RunnerRuntimeList struct { + // REQUIRED + Items RunnerRuntimeListGetItemsAttributeType `json:"items" required:"true"` +} + +type _RunnerRuntimeList RunnerRuntimeList + +// NewRunnerRuntimeList instantiates a new RunnerRuntimeList 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 NewRunnerRuntimeList(items RunnerRuntimeListGetItemsArgType) *RunnerRuntimeList { + this := RunnerRuntimeList{} + setRunnerRuntimeListGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewRunnerRuntimeListWithDefaults instantiates a new RunnerRuntimeList 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 NewRunnerRuntimeListWithDefaults() *RunnerRuntimeList { + this := RunnerRuntimeList{} + return &this +} + +// GetItems returns the Items field value +func (o *RunnerRuntimeList) GetItems() (ret RunnerRuntimeListGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntimeList) GetItemsOk() (ret RunnerRuntimeListGetItemsRetType, ok bool) { + return getRunnerRuntimeListGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *RunnerRuntimeList) SetItems(v RunnerRuntimeListGetItemsRetType) { + setRunnerRuntimeListGetItemsAttributeType(&o.Items, v) +} + +func (o RunnerRuntimeList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRunnerRuntimeListGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableRunnerRuntimeList struct { + value *RunnerRuntimeList + isSet bool +} + +func (v NullableRunnerRuntimeList) Get() *RunnerRuntimeList { + return v.value +} + +func (v *NullableRunnerRuntimeList) Set(val *RunnerRuntimeList) { + v.value = val + v.isSet = true +} + +func (v NullableRunnerRuntimeList) IsSet() bool { + return v.isSet +} + +func (v *NullableRunnerRuntimeList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRunnerRuntimeList(val *RunnerRuntimeList) *NullableRunnerRuntimeList { + return &NullableRunnerRuntimeList{value: val, isSet: true} +} + +func (v NullableRunnerRuntimeList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRunnerRuntimeList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/git/model_runner_runtime_list_test.go b/services/git/model_runner_runtime_list_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_runner_runtime_list_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_runner_runtime_test.go b/services/git/model_runner_runtime_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_runner_runtime_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_runner_test.go b/services/git/model_runner_test.go new file mode 100644 index 000000000..e39c866ed --- /dev/null +++ b/services/git/model_runner_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_unauthorized_response.go b/services/git/model_unauthorized_response.go deleted file mode 100644 index 853468a95..000000000 --- a/services/git/model_unauthorized_response.go +++ /dev/null @@ -1,128 +0,0 @@ -/* -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 - -import ( - "encoding/json" -) - -// checks if the UnauthorizedResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &UnauthorizedResponse{} - -/* - types and functions for error -*/ - -// isNotNullableString -type UnauthorizedResponseGetErrorAttributeType = *string - -func getUnauthorizedResponseGetErrorAttributeTypeOk(arg UnauthorizedResponseGetErrorAttributeType) (ret UnauthorizedResponseGetErrorRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setUnauthorizedResponseGetErrorAttributeType(arg *UnauthorizedResponseGetErrorAttributeType, val UnauthorizedResponseGetErrorRetType) { - *arg = &val -} - -type UnauthorizedResponseGetErrorArgType = string -type UnauthorizedResponseGetErrorRetType = string - -// UnauthorizedResponse The request could not be authorized. -type UnauthorizedResponse struct { - Error UnauthorizedResponseGetErrorAttributeType `json:"error,omitempty"` -} - -// NewUnauthorizedResponse instantiates a new UnauthorizedResponse 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 NewUnauthorizedResponse() *UnauthorizedResponse { - this := UnauthorizedResponse{} - return &this -} - -// NewUnauthorizedResponseWithDefaults instantiates a new UnauthorizedResponse 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 NewUnauthorizedResponseWithDefaults() *UnauthorizedResponse { - this := UnauthorizedResponse{} - return &this -} - -// GetError returns the Error field value if set, zero value otherwise. -func (o *UnauthorizedResponse) GetError() (res UnauthorizedResponseGetErrorRetType) { - res, _ = o.GetErrorOk() - return -} - -// GetErrorOk returns a tuple with the Error field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UnauthorizedResponse) GetErrorOk() (ret UnauthorizedResponseGetErrorRetType, ok bool) { - return getUnauthorizedResponseGetErrorAttributeTypeOk(o.Error) -} - -// HasError returns a boolean if a field has been set. -func (o *UnauthorizedResponse) HasError() bool { - _, ok := o.GetErrorOk() - return ok -} - -// SetError gets a reference to the given string and assigns it to the Error field. -func (o *UnauthorizedResponse) SetError(v UnauthorizedResponseGetErrorRetType) { - setUnauthorizedResponseGetErrorAttributeType(&o.Error, v) -} - -func (o UnauthorizedResponse) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if val, ok := getUnauthorizedResponseGetErrorAttributeTypeOk(o.Error); ok { - toSerialize["Error"] = val - } - return toSerialize, nil -} - -type NullableUnauthorizedResponse struct { - value *UnauthorizedResponse - isSet bool -} - -func (v NullableUnauthorizedResponse) Get() *UnauthorizedResponse { - return v.value -} - -func (v *NullableUnauthorizedResponse) Set(val *UnauthorizedResponse) { - v.value = val - v.isSet = true -} - -func (v NullableUnauthorizedResponse) IsSet() bool { - return v.isSet -} - -func (v *NullableUnauthorizedResponse) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableUnauthorizedResponse(val *UnauthorizedResponse) *NullableUnauthorizedResponse { - return &NullableUnauthorizedResponse{value: val, isSet: true} -} - -func (v NullableUnauthorizedResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableUnauthorizedResponse) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -}