From 6fa6c9897b01a8a2cf5dbd7a52eb71659d8953d3 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 12 Feb 2026 09:00:52 +0000 Subject: [PATCH] Generate postgresflex --- services/postgresflex/api_default_test.go | 1512 --------------------- services/postgresflex/oas_commit | 1 + 2 files changed, 1 insertion(+), 1512 deletions(-) delete mode 100644 services/postgresflex/api_default_test.go create mode 100644 services/postgresflex/oas_commit diff --git a/services/postgresflex/api_default_test.go b/services/postgresflex/api_default_test.go deleted file mode 100644 index fa66a0eb2..000000000 --- a/services/postgresflex/api_default_test.go +++ /dev/null @@ -1,1512 +0,0 @@ -/* -STACKIT PostgreSQL Flex API - -Testing DefaultApiService - -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); - -package postgresflex - -import ( - "context" - "encoding/json" - "net/http" - "net/http/httptest" - "net/url" - "strings" - "testing" - - "github.com/stackitcloud/stackit-sdk-go/core/config" -) - -func Test_postgresflex_DefaultApiService(t *testing.T) { - - t.Run("Test DefaultApiService CloneInstance", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/clone" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := CloneInstanceResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - cloneInstancePayload := CloneInstancePayload{} - - resp, reqErr := apiClient.CloneInstance(context.Background(), projectId, region, instanceId).CloneInstancePayload(cloneInstancePayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService CreateDatabase", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := InstanceCreateDatabaseResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - createDatabasePayload := CreateDatabasePayload{} - - resp, reqErr := apiClient.CreateDatabase(context.Background(), projectId, region, instanceId).CreateDatabasePayload(createDatabasePayload).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 := "/v2/projects/{projectId}/regions/{region}/instances" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := CreateInstanceResponse{} - 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 postgresflex_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 - region := regionValue - createInstancePayload := CreateInstancePayload{} - - resp, reqErr := apiClient.CreateInstance(context.Background(), projectId, region).CreateInstancePayload(createInstancePayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService CreateUser", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := CreateUserResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - createUserPayload := CreateUserPayload{} - - resp, reqErr := apiClient.CreateUser(context.Background(), projectId, region, instanceId).CreateUserPayload(createUserPayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService DeleteDatabase", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - databaseIdValue := "databaseId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseId"+"}", url.PathEscape(ParameterValueToString(databaseIdValue, "databaseId")), -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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - databaseId := databaseIdValue - - reqErr := apiClient.DeleteDatabase(context.Background(), projectId, region, instanceId, databaseId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - - reqErr := apiClient.DeleteInstance(context.Background(), projectId, region, instanceId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService DeleteUser", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - userId := userIdValue - - reqErr := apiClient.DeleteUser(context.Background(), projectId, region, instanceId, userId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService ForceDeleteInstance", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/force" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - - reqErr := apiClient.ForceDeleteInstance(context.Background(), projectId, region, instanceId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService GetBackup", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - backupIdValue := "backupId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetBackupResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - backupId := backupIdValue - - resp, reqErr := apiClient.GetBackup(context.Background(), projectId, region, instanceId, backupId).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 := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := InstanceResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - - resp, reqErr := apiClient.GetInstance(context.Background(), projectId, region, instanceId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService GetUser", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetUserResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - userId := userIdValue - - resp, reqErr := apiClient.GetUser(context.Background(), projectId, region, instanceId, userId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/backups" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := ListBackupsResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - - resp, reqErr := apiClient.ListBackups(context.Background(), projectId, region, instanceId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListDatabaseParameters", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/parameter" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := PostgresDatabaseParameterResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - - resp, reqErr := apiClient.ListDatabaseParameters(context.Background(), projectId, region, instanceId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListDatabases", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := InstanceListDatabasesResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - - resp, reqErr := apiClient.ListDatabases(context.Background(), projectId, region, 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 := "/v2/projects/{projectId}/regions/{region}/flavors" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListFlavorsResponse{} - 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 postgresflex_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 - region := regionValue - - resp, reqErr := apiClient.ListFlavors(context.Background(), projectId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListInstancesResponse{} - 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 postgresflex_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 - region := regionValue - - resp, reqErr := apiClient.ListInstances(context.Background(), projectId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListMetrics", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/metrics/{metric}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - metricValue := "metric-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"metric"+"}", url.PathEscape(ParameterValueToString(metricValue, "metric")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := InstanceMetricsResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - metric := metricValue - var granularity string - - resp, reqErr := apiClient.ListMetrics(context.Background(), projectId, region, instanceId, metric).Granularity(granularity).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListStorages", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/storages/{flavorId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - flavorIdValue := "flavorId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"flavorId"+"}", url.PathEscape(ParameterValueToString(flavorIdValue, "flavorId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListStoragesResponse{} - 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 postgresflex_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 - region := regionValue - flavorId := flavorIdValue - - resp, reqErr := apiClient.ListStorages(context.Background(), projectId, region, flavorId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListUsers", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := ListUsersResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - - resp, reqErr := apiClient.ListUsers(context.Background(), projectId, region, instanceId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListVersions", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/versions" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListVersionsResponse{} - 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 postgresflex_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 - region := regionValue - - resp, reqErr := apiClient.ListVersions(context.Background(), projectId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService PartialUpdateInstance", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := PartialUpdateInstanceResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - partialUpdateInstancePayload := PartialUpdateInstancePayload{} - - resp, reqErr := apiClient.PartialUpdateInstance(context.Background(), projectId, region, instanceId).PartialUpdateInstancePayload(partialUpdateInstancePayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService PartialUpdateUser", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - userId := userIdValue - - reqErr := apiClient.PartialUpdateUser(context.Background(), projectId, region, instanceId, userId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService ResetUser", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}/reset" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ResetUserResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - userId := userIdValue - - resp, reqErr := apiClient.ResetUser(context.Background(), projectId, region, instanceId, userId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService UpdateBackupSchedule", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/backups" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - updateBackupSchedulePayload := UpdateBackupSchedulePayload{} - - reqErr := apiClient.UpdateBackupSchedule(context.Background(), projectId, region, instanceId).UpdateBackupSchedulePayload(updateBackupSchedulePayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService UpdateInstance", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _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 := PartialUpdateInstanceResponse{} - 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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - updateInstancePayload := UpdateInstancePayload{} - - resp, reqErr := apiClient.UpdateInstance(context.Background(), projectId, region, instanceId).UpdateInstancePayload(updateInstancePayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService UpdateUser", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -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 postgresflex_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 - region := regionValue - instanceId := instanceIdValue - userId := userIdValue - - reqErr := apiClient.UpdateUser(context.Background(), projectId, region, instanceId, userId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - -} diff --git a/services/postgresflex/oas_commit b/services/postgresflex/oas_commit new file mode 100644 index 000000000..47b49289a --- /dev/null +++ b/services/postgresflex/oas_commit @@ -0,0 +1 @@ +d7a7113a1117f58b72d89fb9f7ecc3cc9e94c8ad