From 02350a1a66edc880dba2e86a3ed8c4ccb2a1f534 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 12 Feb 2026 09:01:37 +0000 Subject: [PATCH] Generate sqlserverflex --- services/sqlserverflex/api_default_test.go | 1633 -------------------- services/sqlserverflex/oas_commit | 2 +- 2 files changed, 1 insertion(+), 1634 deletions(-) delete mode 100644 services/sqlserverflex/api_default_test.go diff --git a/services/sqlserverflex/api_default_test.go b/services/sqlserverflex/api_default_test.go deleted file mode 100644 index 0babfe365..000000000 --- a/services/sqlserverflex/api_default_test.go +++ /dev/null @@ -1,1633 +0,0 @@ -/* -STACKIT MSSQL Service API - -Testing DefaultApiService - -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); - -package sqlserverflex - -import ( - "context" - "encoding/json" - "net/http" - "net/http/httptest" - "net/url" - "strings" - "testing" - - "github.com/stackitcloud/stackit-sdk-go/core/config" -) - -func Test_sqlserverflex_DefaultApiService(t *testing.T) { - - 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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := CreateDatabaseResponse{} - 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 sqlserverflex_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 - region := regionValue - createDatabasePayload := CreateDatabasePayload{} - - resp, reqErr := apiClient.CreateDatabase(context.Background(), projectId, instanceId, region).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 sqlserverflex_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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := 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 sqlserverflex_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 - region := regionValue - createUserPayload := CreateUserPayload{} - - resp, reqErr := apiClient.CreateUser(context.Background(), projectId, instanceId, region).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/{databaseName}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - databaseNameValue := "databaseName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName")), -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) { - }) - 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 sqlserverflex_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 - databaseName := databaseNameValue - region := regionValue - - reqErr := apiClient.DeleteDatabase(context.Background(), projectId, instanceId, databaseName, region).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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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) { - }) - 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 sqlserverflex_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 - region := regionValue - - reqErr := apiClient.DeleteInstance(context.Background(), projectId, instanceId, region).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) - 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) - 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) { - }) - 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 sqlserverflex_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 - userId := userIdValue - region := regionValue - - reqErr := apiClient.DeleteUser(context.Background(), projectId, instanceId, userId, region).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) - 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) - 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 := 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 sqlserverflex_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 - backupId := backupIdValue - region := regionValue - - resp, reqErr := apiClient.GetBackup(context.Background(), projectId, instanceId, backupId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService GetDatabase", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseName}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - databaseNameValue := "databaseName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName")), -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 := GetDatabaseResponse{} - 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 sqlserverflex_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 - databaseName := databaseNameValue - region := regionValue - - resp, reqErr := apiClient.GetDatabase(context.Background(), projectId, instanceId, databaseName, region).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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := GetInstanceResponse{} - 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 sqlserverflex_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 - region := regionValue - - resp, reqErr := apiClient.GetInstance(context.Background(), projectId, instanceId, region).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) - 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) - 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 := 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 sqlserverflex_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 - userId := userIdValue - region := regionValue - - resp, reqErr := apiClient.GetUser(context.Background(), projectId, instanceId, userId, region).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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := 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 sqlserverflex_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 - region := regionValue - - resp, reqErr := apiClient.ListBackups(context.Background(), projectId, instanceId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListCollations", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/collation" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := ListCollationsResponse{} - 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 sqlserverflex_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 - region := regionValue - - resp, reqErr := apiClient.ListCollations(context.Background(), projectId, instanceId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListCompatibility", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/compatibility" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := ListCompatibilityResponse{} - 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 sqlserverflex_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 - region := regionValue - - resp, reqErr := apiClient.ListCompatibility(context.Background(), projectId, instanceId, region).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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := ListDatabasesResponse{} - 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 sqlserverflex_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 - region := regionValue - - resp, reqErr := apiClient.ListDatabases(context.Background(), projectId, instanceId, region).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 sqlserverflex_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 sqlserverflex_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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -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 := ListMetricsResponse{} - 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 sqlserverflex_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 - region := regionValue - metric := metricValue - var granularity string - - resp, reqErr := apiClient.ListMetrics(context.Background(), projectId, instanceId, region, 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 ListRestoreJobs", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/restores" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := ListRestoreJobsResponse{} - 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 sqlserverflex_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 - region := regionValue - - resp, reqErr := apiClient.ListRestoreJobs(context.Background(), projectId, instanceId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListRoles", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/roles" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := ListRolesResponse{} - 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 sqlserverflex_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 - region := regionValue - - resp, reqErr := apiClient.ListRoles(context.Background(), projectId, instanceId, region).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) - flavorIdValue := "flavorId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"flavorId"+"}", url.PathEscape(ParameterValueToString(flavorIdValue, "flavorId")), -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 := 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 sqlserverflex_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 - flavorId := flavorIdValue - region := regionValue - - resp, reqErr := apiClient.ListStorages(context.Background(), projectId, flavorId, region).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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := 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 sqlserverflex_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 - region := regionValue - - resp, reqErr := apiClient.ListUsers(context.Background(), projectId, instanceId, region).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 sqlserverflex_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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := UpdateInstanceResponse{} - 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 sqlserverflex_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 - region := regionValue - partialUpdateInstancePayload := PartialUpdateInstancePayload{} - - resp, reqErr := apiClient.PartialUpdateInstance(context.Background(), projectId, instanceId, region).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 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) - 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) - 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 := 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 sqlserverflex_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 - userId := userIdValue - region := regionValue - - resp, reqErr := apiClient.ResetUser(context.Background(), projectId, instanceId, userId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService TerminateProject", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}" - 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) { - }) - 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 sqlserverflex_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 - - reqErr := apiClient.TerminateProject(context.Background(), projectId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService TriggerDatabaseBackup", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/databases/{databaseName}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - databaseNameValue := "databaseName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName")), -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) { - }) - 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 sqlserverflex_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 - databaseName := databaseNameValue - region := regionValue - - reqErr := apiClient.TriggerDatabaseBackup(context.Background(), projectId, instanceId, databaseName, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - - t.Run("Test DefaultApiService TriggerDatabaseRestore", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/databases/{databaseName}/restores" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - databaseNameValue := "databaseName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName")), -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) { - }) - 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 sqlserverflex_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 - databaseName := databaseNameValue - region := regionValue - triggerDatabaseRestorePayload := TriggerDatabaseRestorePayload{} - - reqErr := apiClient.TriggerDatabaseRestore(context.Background(), projectId, instanceId, databaseName, region).TriggerDatabaseRestorePayload(triggerDatabaseRestorePayload).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) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -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 := UpdateInstanceResponse{} - 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 sqlserverflex_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 - region := regionValue - updateInstancePayload := UpdateInstancePayload{} - - resp, reqErr := apiClient.UpdateInstance(context.Background(), projectId, instanceId, region).UpdateInstancePayload(updateInstancePayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - -} diff --git a/services/sqlserverflex/oas_commit b/services/sqlserverflex/oas_commit index 1c4304d8a..47b49289a 100644 --- a/services/sqlserverflex/oas_commit +++ b/services/sqlserverflex/oas_commit @@ -1 +1 @@ -4ba9d6ffcf1ec61aff0807a261f8c0ca25d266f8 +d7a7113a1117f58b72d89fb9f7ecc3cc9e94c8ad