From 901c72a86a4a1f62435a484fc85c71797b4c69d0 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 16 Jan 2025 16:00:06 +0000 Subject: [PATCH] Generate mongodbflex --- services/mongodbflex/api_default.go | 127 ----------------------- services/mongodbflex/api_default_test.go | 46 -------- 2 files changed, 173 deletions(-) diff --git a/services/mongodbflex/api_default.go b/services/mongodbflex/api_default.go index 955bcd3c2..92a3934f8 100644 --- a/services/mongodbflex/api_default.go +++ b/services/mongodbflex/api_default.go @@ -803,133 +803,6 @@ func (a *APIClient) DeleteUserExecute(ctx context.Context, projectId string, ins return r.Execute() } -type ApiDisableServiceRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string -} - -func (r ApiDisableServiceRequest) Execute() error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DisableService") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"*/*"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := a.client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - } - return newErr - } - - return nil -} - -/* -DisableService: Delete project - -removes all instances inside project - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId project id - @return ApiDisableServiceRequest -*/ -func (a *APIClient) DisableService(ctx context.Context, projectId string) ApiDisableServiceRequest { - return ApiDisableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - } -} - -func (a *APIClient) DisableServiceExecute(ctx context.Context, projectId string) error { - r := ApiDisableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - } - return r.Execute() -} - type ApiGetBackupRequest struct { ctx context.Context apiService *DefaultApiService diff --git a/services/mongodbflex/api_default_test.go b/services/mongodbflex/api_default_test.go index 86e33b101..f84630f35 100644 --- a/services/mongodbflex/api_default_test.go +++ b/services/mongodbflex/api_default_test.go @@ -289,52 +289,6 @@ func Test_mongodbflex_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DisableService", func(t *testing.T) { - path := "/v1/projects/{projectId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, 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 mongodbflex_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 := "projectId" - - reqErr := apiClient.DisableService(context.Background(), projectId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - t.Run("Test DefaultApiService GetBackup", func(t *testing.T) { path := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}" projectIdValue := "projectId"