## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
7614 lines
276 KiB
Go
7614 lines
276 KiB
Go
/*
|
|
STACKIT IaaS API
|
|
|
|
Testing DefaultApiService
|
|
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
|
|
|
|
package iaasbeta
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"net/url"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
|
)
|
|
|
|
func Test_iaasbeta_DefaultApiService(t *testing.T) {
|
|
|
|
t.Run("Test DefaultApiService AddNetworkToServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
networkId := networkIdValue
|
|
|
|
reqErr := apiClient.AddNetworkToServer(context.Background(), projectId, region, serverId, networkId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService AddNicToServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
nicIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
nicId := nicIdValue
|
|
|
|
reqErr := apiClient.AddNicToServer(context.Background(), projectId, region, serverId, nicId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService AddPublicIpToServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
publicIpIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
publicIpId := publicIpIdValue
|
|
|
|
reqErr := apiClient.AddPublicIpToServer(context.Background(), projectId, region, serverId, publicIpId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService AddRoutesToRoutingTable", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routingTableIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := RouteListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routingTableId := routingTableIdValue
|
|
addRoutesToRoutingTablePayload := AddRoutesToRoutingTablePayload{}
|
|
|
|
resp, reqErr := apiClient.AddRoutesToRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService AddRoutingTableToArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := RoutingTable{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
addRoutingTableToAreaPayload := AddRoutingTableToAreaPayload{}
|
|
|
|
resp, reqErr := apiClient.AddRoutingTableToArea(context.Background(), organizationId, areaId, region).AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService AddSecurityGroupToServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
securityGroupId := securityGroupIdValue
|
|
|
|
reqErr := apiClient.AddSecurityGroupToServer(context.Background(), projectId, region, serverId, securityGroupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService AddServiceAccountToServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
serviceAccountMailValue := randString(255)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ServiceAccountMailListResponse{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
serviceAccountMail := serviceAccountMailValue
|
|
|
|
resp, reqErr := apiClient.AddServiceAccountToServer(context.Background(), projectId, region, serverId, serviceAccountMail).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService AddVolumeToServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
volumeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := VolumeAttachment{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
volumeId := volumeIdValue
|
|
|
|
resp, reqErr := apiClient.AddVolumeToServer(context.Background(), projectId, region, serverId, volumeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateAffinityGroup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups"
|
|
projectIdValue := randString(36)
|
|
_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 := AffinityGroup{}
|
|
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 iaasbeta_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
|
|
createAffinityGroupPayload := CreateAffinityGroupPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateAffinityGroup(context.Background(), projectId, region).CreateAffinityGroupPayload(createAffinityGroupPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups"
|
|
projectIdValue := randString(36)
|
|
_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 := Backup{}
|
|
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 iaasbeta_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
|
|
createBackupPayload := CreateBackupPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateBackup(context.Background(), projectId, region).CreateBackupPayload(createBackupPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateImage", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images"
|
|
projectIdValue := randString(36)
|
|
_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 := ImageCreateResponse{}
|
|
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 iaasbeta_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
|
|
createImagePayload := CreateImagePayload{}
|
|
|
|
resp, reqErr := apiClient.CreateImage(context.Background(), projectId, region).CreateImagePayload(createImagePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateIsolatedNetwork", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/isolated-network"
|
|
projectIdValue := randString(36)
|
|
_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 := Network{}
|
|
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 iaasbeta_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
|
|
createIsolatedNetworkPayload := CreateIsolatedNetworkPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateIsolatedNetwork(context.Background(), projectId, region).CreateIsolatedNetworkPayload(createIsolatedNetworkPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateKeyPair", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/keypairs"
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Keypair{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
createKeyPairPayload := CreateKeyPairPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateKeyPair(context.Background()).CreateKeyPairPayload(createKeyPairPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateNetwork", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks"
|
|
projectIdValue := randString(36)
|
|
_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 := Network{}
|
|
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 iaasbeta_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
|
|
createNetworkPayload := CreateNetworkPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateNetwork(context.Background(), projectId, region).CreateNetworkPayload(createNetworkPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateNetworkArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NetworkArea{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
createNetworkAreaPayload := CreateNetworkAreaPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateNetworkArea(context.Background(), organizationId).CreateNetworkAreaPayload(createNetworkAreaPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateNetworkAreaRange", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := NetworkRangeListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
createNetworkAreaRangePayload := CreateNetworkAreaRangePayload{}
|
|
|
|
resp, reqErr := apiClient.CreateNetworkAreaRange(context.Background(), organizationId, areaId, region).CreateNetworkAreaRangePayload(createNetworkAreaRangePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateNetworkAreaRoute", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := RouteListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
createNetworkAreaRoutePayload := CreateNetworkAreaRoutePayload{}
|
|
|
|
resp, reqErr := apiClient.CreateNetworkAreaRoute(context.Background(), organizationId, areaId, region).CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateNic", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NIC{}
|
|
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 iaasbeta_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
|
|
networkId := networkIdValue
|
|
createNicPayload := CreateNicPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateNic(context.Background(), projectId, region, networkId).CreateNicPayload(createNicPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreatePublicIP", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips"
|
|
projectIdValue := randString(36)
|
|
_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 := PublicIp{}
|
|
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 iaasbeta_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
|
|
createPublicIPPayload := CreatePublicIPPayload{}
|
|
|
|
resp, reqErr := apiClient.CreatePublicIP(context.Background(), projectId, region).CreatePublicIPPayload(createPublicIPPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateSecurityGroup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups"
|
|
projectIdValue := randString(36)
|
|
_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 := SecurityGroup{}
|
|
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 iaasbeta_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
|
|
createSecurityGroupPayload := CreateSecurityGroupPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateSecurityGroup(context.Background(), projectId, region).CreateSecurityGroupPayload(createSecurityGroupPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateSecurityGroupRule", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := SecurityGroupRule{}
|
|
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 iaasbeta_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
|
|
securityGroupId := securityGroupIdValue
|
|
createSecurityGroupRulePayload := CreateSecurityGroupRulePayload{}
|
|
|
|
resp, reqErr := apiClient.CreateSecurityGroupRule(context.Background(), projectId, region, securityGroupId).CreateSecurityGroupRulePayload(createSecurityGroupRulePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers"
|
|
projectIdValue := randString(36)
|
|
_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 := Server{}
|
|
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 iaasbeta_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
|
|
createServerPayload := CreateServerPayload{}
|
|
|
|
resp, reqErr := apiClient.CreateServer(context.Background(), projectId, region).CreateServerPayload(createServerPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService CreateVolume", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes"
|
|
projectIdValue := randString(36)
|
|
_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 := Volume{}
|
|
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 iaasbeta_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
|
|
createVolumePayload := CreateVolumePayload{}
|
|
|
|
resp, reqErr := apiClient.CreateVolume(context.Background(), projectId, region).CreateVolumePayload(createVolumePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeallocateServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/deallocate"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
reqErr := apiClient.DeallocateServer(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteAffinityGroup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
affinityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(affinityGroupIdValue, "affinityGroupId")), -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 iaasbeta_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
|
|
affinityGroupId := affinityGroupIdValue
|
|
|
|
reqErr := apiClient.DeleteAffinityGroup(context.Background(), projectId, region, affinityGroupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteBackup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
backupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -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 iaasbeta_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
|
|
backupId := backupIdValue
|
|
|
|
reqErr := apiClient.DeleteBackup(context.Background(), projectId, region, backupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteImage", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
|
|
reqErr := apiClient.DeleteImage(context.Background(), projectId, region, imageId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteImageShare", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
|
|
reqErr := apiClient.DeleteImageShare(context.Background(), projectId, region, imageId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteImageShareConsumer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1)
|
|
consumerProjectIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(consumerProjectIdValue, "consumerProjectId")), -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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
consumerProjectId := consumerProjectIdValue
|
|
|
|
reqErr := apiClient.DeleteImageShareConsumer(context.Background(), projectId, region, imageId, consumerProjectId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteKeyPair", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/keypairs/{keypairName}"
|
|
keypairNameValue := randString(127)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -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 iaasbeta_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)
|
|
}
|
|
|
|
keypairName := keypairNameValue
|
|
|
|
reqErr := apiClient.DeleteKeyPair(context.Background(), keypairName).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteNetwork", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -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 iaasbeta_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
|
|
networkId := networkIdValue
|
|
|
|
reqErr := apiClient.DeleteNetwork(context.Background(), projectId, region, networkId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteNetworkArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
|
|
reqErr := apiClient.DeleteNetworkArea(context.Background(), organizationId, areaId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteNetworkAreaRange", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
networkRangeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
networkRangeId := networkRangeIdValue
|
|
|
|
reqErr := apiClient.DeleteNetworkAreaRange(context.Background(), organizationId, areaId, region, networkRangeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteNetworkAreaRoute", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routeId := routeIdValue
|
|
|
|
reqErr := apiClient.DeleteNetworkAreaRoute(context.Background(), organizationId, areaId, region, routeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteNic", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1)
|
|
nicIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -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 iaasbeta_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
|
|
networkId := networkIdValue
|
|
nicId := nicIdValue
|
|
|
|
reqErr := apiClient.DeleteNic(context.Background(), projectId, region, networkId, nicId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeletePublicIP", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
publicIpIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -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 iaasbeta_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
|
|
publicIpId := publicIpIdValue
|
|
|
|
reqErr := apiClient.DeletePublicIP(context.Background(), projectId, region, publicIpId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteRouteFromRoutingTable", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routingTableIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
|
|
routeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routingTableId := routingTableIdValue
|
|
routeId := routeIdValue
|
|
|
|
reqErr := apiClient.DeleteRouteFromRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteRoutingTableFromArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routingTableIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routingTableId := routingTableIdValue
|
|
|
|
reqErr := apiClient.DeleteRoutingTableFromArea(context.Background(), organizationId, areaId, region, routingTableId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteSecurityGroup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -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 iaasbeta_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
|
|
securityGroupId := securityGroupIdValue
|
|
|
|
reqErr := apiClient.DeleteSecurityGroup(context.Background(), projectId, region, securityGroupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteSecurityGroupRule", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1)
|
|
securityGroupRuleIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -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 iaasbeta_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
|
|
securityGroupId := securityGroupIdValue
|
|
securityGroupRuleId := securityGroupRuleIdValue
|
|
|
|
reqErr := apiClient.DeleteSecurityGroupRule(context.Background(), projectId, region, securityGroupId, securityGroupRuleId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
reqErr := apiClient.DeleteServer(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService DeleteVolume", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
volumeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -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 iaasbeta_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
|
|
volumeId := volumeIdValue
|
|
|
|
reqErr := apiClient.DeleteVolume(context.Background(), projectId, region, volumeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetAffinityGroup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
affinityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(affinityGroupIdValue, "affinityGroupId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := AffinityGroup{}
|
|
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 iaasbeta_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
|
|
affinityGroupId := affinityGroupIdValue
|
|
|
|
resp, reqErr := apiClient.GetAffinityGroup(context.Background(), projectId, region, affinityGroupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetAttachedVolume", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
volumeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := VolumeAttachment{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
volumeId := volumeIdValue
|
|
|
|
resp, reqErr := apiClient.GetAttachedVolume(context.Background(), projectId, region, serverId, volumeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetBackup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
backupIdValue := randString(36)
|
|
_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 := Backup{}
|
|
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 iaasbeta_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
|
|
backupId := backupIdValue
|
|
|
|
resp, reqErr := apiClient.GetBackup(context.Background(), projectId, region, backupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetImage", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Image{}
|
|
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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
|
|
resp, reqErr := apiClient.GetImage(context.Background(), projectId, region, imageId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetImageShare", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ImageShare{}
|
|
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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
|
|
resp, reqErr := apiClient.GetImageShare(context.Background(), projectId, region, imageId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetImageShareConsumer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1)
|
|
consumerProjectIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(consumerProjectIdValue, "consumerProjectId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ImageShareConsumer{}
|
|
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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
consumerProjectId := consumerProjectIdValue
|
|
|
|
resp, reqErr := apiClient.GetImageShareConsumer(context.Background(), projectId, region, imageId, consumerProjectId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetKeyPair", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/keypairs/{keypairName}"
|
|
keypairNameValue := randString(127)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Keypair{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
keypairName := keypairNameValue
|
|
|
|
resp, reqErr := apiClient.GetKeyPair(context.Background(), keypairName).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetMachineType", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/machine-types/{machineType}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
machineTypeValue := randString(127)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(machineTypeValue, "machineType")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := MachineType{}
|
|
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 iaasbeta_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
|
|
machineType := machineTypeValue
|
|
|
|
resp, reqErr := apiClient.GetMachineType(context.Background(), projectId, region, machineType).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetNetwork", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Network{}
|
|
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 iaasbeta_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
|
|
networkId := networkIdValue
|
|
|
|
resp, reqErr := apiClient.GetNetwork(context.Background(), projectId, region, networkId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetNetworkArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NetworkArea{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
|
|
resp, reqErr := apiClient.GetNetworkArea(context.Background(), organizationId, areaId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetNetworkAreaRange", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
networkRangeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NetworkRange{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
networkRangeId := networkRangeIdValue
|
|
|
|
resp, reqErr := apiClient.GetNetworkAreaRange(context.Background(), organizationId, areaId, region, networkRangeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetNetworkAreaRoute", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Route{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routeId := routeIdValue
|
|
|
|
resp, reqErr := apiClient.GetNetworkAreaRoute(context.Background(), organizationId, areaId, region, routeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetNic", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1)
|
|
nicIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NIC{}
|
|
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 iaasbeta_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
|
|
networkId := networkIdValue
|
|
nicId := nicIdValue
|
|
|
|
resp, reqErr := apiClient.GetNic(context.Background(), projectId, region, networkId, nicId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetOrganizationRequest", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/requests/{requestId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
requestIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Request{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
requestId := requestIdValue
|
|
|
|
resp, reqErr := apiClient.GetOrganizationRequest(context.Background(), organizationId, requestId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetProjectDetails", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}"
|
|
projectIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Project{}
|
|
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 iaasbeta_DefaultApi",
|
|
Variables: map[string]config.ServerVariable{
|
|
"region": {
|
|
DefaultValue: "test_region.",
|
|
EnumValues: []string{
|
|
"test_region.",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
OperationServers: map[string]config.ServerConfigurations{},
|
|
}
|
|
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
|
|
if err != nil {
|
|
t.Fatalf("creating API client: %v", err)
|
|
}
|
|
|
|
projectId := projectIdValue
|
|
|
|
resp, reqErr := apiClient.GetProjectDetails(context.Background(), projectId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetProjectNIC", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/nics/{nicId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
nicIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NIC{}
|
|
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 iaasbeta_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
|
|
nicId := nicIdValue
|
|
|
|
resp, reqErr := apiClient.GetProjectNIC(context.Background(), projectId, region, nicId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetProjectRequest", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/requests/{requestId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
requestIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Request{}
|
|
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 iaasbeta_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
|
|
requestId := requestIdValue
|
|
|
|
resp, reqErr := apiClient.GetProjectRequest(context.Background(), projectId, region, requestId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetPublicIP", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
publicIpIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := PublicIp{}
|
|
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 iaasbeta_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
|
|
publicIpId := publicIpIdValue
|
|
|
|
resp, reqErr := apiClient.GetPublicIP(context.Background(), projectId, region, publicIpId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetRouteOfRoutingTable", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routingTableIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
|
|
routeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Route{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routingTableId := routingTableIdValue
|
|
routeId := routeIdValue
|
|
|
|
resp, reqErr := apiClient.GetRouteOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetRoutingTableOfArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routingTableIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := RoutingTable{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routingTableId := routingTableIdValue
|
|
|
|
resp, reqErr := apiClient.GetRoutingTableOfArea(context.Background(), organizationId, areaId, region, routingTableId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetSecurityGroup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := SecurityGroup{}
|
|
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 iaasbeta_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
|
|
securityGroupId := securityGroupIdValue
|
|
|
|
resp, reqErr := apiClient.GetSecurityGroup(context.Background(), projectId, region, securityGroupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetSecurityGroupRule", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1)
|
|
securityGroupRuleIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := SecurityGroupRule{}
|
|
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 iaasbeta_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
|
|
securityGroupId := securityGroupIdValue
|
|
securityGroupRuleId := securityGroupRuleIdValue
|
|
|
|
resp, reqErr := apiClient.GetSecurityGroupRule(context.Background(), projectId, region, securityGroupId, securityGroupRuleId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Server{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
resp, reqErr := apiClient.GetServer(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetServerConsole", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/console"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ServerConsoleUrl{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
resp, reqErr := apiClient.GetServerConsole(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetServerLog", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/log"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := GetServerLog200Response{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
resp, reqErr := apiClient.GetServerLog(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetVolume", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
volumeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Volume{}
|
|
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 iaasbeta_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
|
|
volumeId := volumeIdValue
|
|
|
|
resp, reqErr := apiClient.GetVolume(context.Background(), projectId, region, volumeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService GetVolumePerformanceClass", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volume-performance-classes/{volumePerformanceClass}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
volumePerformanceClassValue := randString(127)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(volumePerformanceClassValue, "volumePerformanceClass")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := VolumePerformanceClass{}
|
|
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 iaasbeta_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
|
|
volumePerformanceClass := volumePerformanceClassValue
|
|
|
|
resp, reqErr := apiClient.GetVolumePerformanceClass(context.Background(), projectId, region, volumePerformanceClass).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListAffinityGroups", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups"
|
|
projectIdValue := randString(36)
|
|
_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 := AffinityGroupListResponse{}
|
|
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 iaasbeta_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.ListAffinityGroups(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 ListAttachedVolumes", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := VolumeAttachmentListResponse{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
resp, reqErr := apiClient.ListAttachedVolumes(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListAvailabilityZones", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/regions/{region}/availability-zones"
|
|
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 := AvailabilityZoneListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
region := regionValue
|
|
|
|
resp, reqErr := apiClient.ListAvailabilityZones(context.Background(), 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 := "/v2beta1/projects/{projectId}/regions/{region}/backups"
|
|
projectIdValue := randString(36)
|
|
_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 := BackupListResponse{}
|
|
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 iaasbeta_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.ListBackups(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 ListImages", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images"
|
|
projectIdValue := randString(36)
|
|
_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 := ImageListResponse{}
|
|
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 iaasbeta_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.ListImages(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 ListKeyPairs", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/keypairs"
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := KeyPairListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
resp, reqErr := apiClient.ListKeyPairs(context.Background()).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListMachineTypes", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/machine-types"
|
|
projectIdValue := randString(36)
|
|
_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 := MachineTypeListResponse{}
|
|
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 iaasbeta_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.ListMachineTypes(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 ListNetworkAreaProjects", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/projects"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ProjectListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
|
|
resp, reqErr := apiClient.ListNetworkAreaProjects(context.Background(), organizationId, areaId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListNetworkAreaRanges", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := NetworkRangeListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
|
|
resp, reqErr := apiClient.ListNetworkAreaRanges(context.Background(), organizationId, areaId, region).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListNetworkAreaRoutes", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := RouteListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
|
|
resp, reqErr := apiClient.ListNetworkAreaRoutes(context.Background(), organizationId, areaId, region).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListNetworkAreas", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NetworkAreaListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
|
|
resp, reqErr := apiClient.ListNetworkAreas(context.Background(), organizationId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks"
|
|
projectIdValue := randString(36)
|
|
_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 := NetworkListResponse{}
|
|
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 iaasbeta_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.ListNetworks(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 ListNics", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NICListResponse{}
|
|
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 iaasbeta_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
|
|
networkId := networkIdValue
|
|
|
|
resp, reqErr := apiClient.ListNics(context.Background(), projectId, region, networkId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListProjectNICs", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/nics"
|
|
projectIdValue := randString(36)
|
|
_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 := NICListResponse{}
|
|
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 iaasbeta_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.ListProjectNICs(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 ListPublicIPRanges", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/networks/public-ip-ranges"
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := PublicNetworkListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
resp, reqErr := apiClient.ListPublicIPRanges(context.Background()).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListPublicIPs", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips"
|
|
projectIdValue := randString(36)
|
|
_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 := PublicIpListResponse{}
|
|
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 iaasbeta_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.ListPublicIPs(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 ListQuotas", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/quotas"
|
|
projectIdValue := randString(36)
|
|
_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 := QuotaListResponse{}
|
|
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 iaasbeta_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.ListQuotas(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 ListRoutesOfRoutingTable", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routingTableIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := RouteListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routingTableId := routingTableIdValue
|
|
|
|
resp, reqErr := apiClient.ListRoutesOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListRoutingTablesOfArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := RoutingTableListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
|
|
resp, reqErr := apiClient.ListRoutingTablesOfArea(context.Background(), organizationId, areaId, region).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListSecurityGroupRules", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := SecurityGroupRuleListResponse{}
|
|
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 iaasbeta_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
|
|
securityGroupId := securityGroupIdValue
|
|
|
|
resp, reqErr := apiClient.ListSecurityGroupRules(context.Background(), projectId, region, securityGroupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListSecurityGroups", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups"
|
|
projectIdValue := randString(36)
|
|
_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 := SecurityGroupListResponse{}
|
|
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 iaasbeta_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.ListSecurityGroups(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 ListServerNICs", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NICListResponse{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
resp, reqErr := apiClient.ListServerNICs(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListServerServiceAccounts", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ServiceAccountMailListResponse{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
resp, reqErr := apiClient.ListServerServiceAccounts(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ListServers", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers"
|
|
projectIdValue := randString(36)
|
|
_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 := ServerListResponse{}
|
|
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 iaasbeta_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.ListServers(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 ListVolumePerformanceClasses", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volume-performance-classes"
|
|
projectIdValue := randString(36)
|
|
_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 := VolumePerformanceClassListResponse{}
|
|
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 iaasbeta_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.ListVolumePerformanceClasses(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 ListVolumes", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes"
|
|
projectIdValue := randString(36)
|
|
_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 := VolumeListResponse{}
|
|
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 iaasbeta_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.ListVolumes(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 PartialUpdateNetwork", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -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 iaasbeta_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
|
|
networkId := networkIdValue
|
|
partialUpdateNetworkPayload := PartialUpdateNetworkPayload{}
|
|
|
|
reqErr := apiClient.PartialUpdateNetwork(context.Background(), projectId, region, networkId).PartialUpdateNetworkPayload(partialUpdateNetworkPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService PartialUpdateNetworkArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NetworkArea{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
partialUpdateNetworkAreaPayload := PartialUpdateNetworkAreaPayload{}
|
|
|
|
resp, reqErr := apiClient.PartialUpdateNetworkArea(context.Background(), organizationId, areaId).PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RebootServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/reboot"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
reqErr := apiClient.RebootServer(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RemoveNetworkFromServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
networkId := networkIdValue
|
|
|
|
reqErr := apiClient.RemoveNetworkFromServer(context.Background(), projectId, region, serverId, networkId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RemoveNicFromServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
nicIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
nicId := nicIdValue
|
|
|
|
reqErr := apiClient.RemoveNicFromServer(context.Background(), projectId, region, serverId, nicId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RemovePublicIpFromServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
publicIpIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
publicIpId := publicIpIdValue
|
|
|
|
reqErr := apiClient.RemovePublicIpFromServer(context.Background(), projectId, region, serverId, publicIpId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RemoveSecurityGroupFromServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
securityGroupId := securityGroupIdValue
|
|
|
|
reqErr := apiClient.RemoveSecurityGroupFromServer(context.Background(), projectId, region, serverId, securityGroupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RemoveServiceAccountFromServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
serviceAccountMailValue := randString(255)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ServiceAccountMailListResponse{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
serviceAccountMail := serviceAccountMailValue
|
|
|
|
resp, reqErr := apiClient.RemoveServiceAccountFromServer(context.Background(), projectId, region, serverId, serviceAccountMail).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RemoveVolumeFromServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
volumeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
volumeId := volumeIdValue
|
|
|
|
reqErr := apiClient.RemoveVolumeFromServer(context.Background(), projectId, region, serverId, volumeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RescueServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/rescue"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
rescueServerPayload := RescueServerPayload{}
|
|
|
|
reqErr := apiClient.RescueServer(context.Background(), projectId, region, serverId).RescueServerPayload(rescueServerPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ResizeServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/resize"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
resizeServerPayload := ResizeServerPayload{}
|
|
|
|
reqErr := apiClient.ResizeServer(context.Background(), projectId, region, serverId).ResizeServerPayload(resizeServerPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService ResizeVolume", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}/resize"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
volumeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -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 iaasbeta_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
|
|
volumeId := volumeIdValue
|
|
|
|
reqErr := apiClient.ResizeVolume(context.Background(), projectId, region, volumeId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService RestoreBackup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}/restore"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
backupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -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 iaasbeta_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
|
|
backupId := backupIdValue
|
|
|
|
reqErr := apiClient.RestoreBackup(context.Background(), projectId, region, backupId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService SetImageShare", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ImageShare{}
|
|
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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
setImageSharePayload := SetImageSharePayload{}
|
|
|
|
resp, reqErr := apiClient.SetImageShare(context.Background(), projectId, region, imageId).SetImageSharePayload(setImageSharePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService StartServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/start"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
reqErr := apiClient.StartServer(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService StopServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/stop"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
reqErr := apiClient.StopServer(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UnrescueServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/unrescue"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
|
|
reqErr := apiClient.UnrescueServer(context.Background(), projectId, region, serverId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateAttachedVolume", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
volumeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := VolumeAttachment{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
volumeId := volumeIdValue
|
|
updateAttachedVolumePayload := UpdateAttachedVolumePayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateAttachedVolume(context.Background(), projectId, region, serverId, volumeId).UpdateAttachedVolumePayload(updateAttachedVolumePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateImage", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Image{}
|
|
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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
updateImagePayload := UpdateImagePayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateImage(context.Background(), projectId, region, imageId).UpdateImagePayload(updateImagePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateImageShare", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
imageIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := ImageShare{}
|
|
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 iaasbeta_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
|
|
imageId := imageIdValue
|
|
updateImageSharePayload := UpdateImageSharePayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateImageShare(context.Background(), projectId, region, imageId).UpdateImageSharePayload(updateImageSharePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateKeyPair", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/keypairs/{keypairName}"
|
|
keypairNameValue := randString(127)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Keypair{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
keypairName := keypairNameValue
|
|
updateKeyPairPayload := UpdateKeyPairPayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateKeyPair(context.Background(), keypairName).UpdateKeyPairPayload(updateKeyPairPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateNic", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
networkIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1)
|
|
nicIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := NIC{}
|
|
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 iaasbeta_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
|
|
networkId := networkIdValue
|
|
nicId := nicIdValue
|
|
updateNicPayload := UpdateNicPayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateNic(context.Background(), projectId, region, networkId, nicId).UpdateNicPayload(updateNicPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdatePublicIP", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
publicIpIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := PublicIp{}
|
|
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 iaasbeta_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
|
|
publicIpId := publicIpIdValue
|
|
updatePublicIPPayload := UpdatePublicIPPayload{}
|
|
|
|
resp, reqErr := apiClient.UpdatePublicIP(context.Background(), projectId, region, publicIpId).UpdatePublicIPPayload(updatePublicIPPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateRouteOfRoutingTable", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routingTableIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
|
|
routeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Route{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routingTableId := routingTableIdValue
|
|
routeId := routeIdValue
|
|
updateRouteOfRoutingTablePayload := UpdateRouteOfRoutingTablePayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateRouteOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateRoutingTableOfArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routingTableIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := RoutingTable{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routingTableId := routingTableIdValue
|
|
updateRoutingTableOfAreaPayload := UpdateRoutingTableOfAreaPayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateRoutingTableOfArea(context.Background(), organizationId, areaId, region, routingTableId).UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateServer", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
serverIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Server{}
|
|
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 iaasbeta_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
|
|
serverId := serverIdValue
|
|
updateServerPayload := UpdateServerPayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateServer(context.Background(), projectId, region, serverId).UpdateServerPayload(updateServerPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService UpdateVolume", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
volumeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Volume{}
|
|
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 iaasbeta_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
|
|
volumeId := volumeIdValue
|
|
updateVolumePayload := UpdateVolumePayload{}
|
|
|
|
resp, reqErr := apiClient.UpdateVolume(context.Background(), projectId, region, volumeId).UpdateVolumePayload(updateVolumePayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1ConfigureNetworkAreaRegion", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := RegionalArea{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
v2beta1ConfigureNetworkAreaRegionPayload := V2beta1ConfigureNetworkAreaRegionPayload{}
|
|
|
|
resp, reqErr := apiClient.V2beta1ConfigureNetworkAreaRegion(context.Background(), organizationId, areaId, region).V2beta1ConfigureNetworkAreaRegionPayload(v2beta1ConfigureNetworkAreaRegionPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1CreateSnapshot", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots"
|
|
projectIdValue := randString(36)
|
|
_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 := Snapshot{}
|
|
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 iaasbeta_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
|
|
v2beta1CreateSnapshotPayload := V2beta1CreateSnapshotPayload{}
|
|
|
|
resp, reqErr := apiClient.V2beta1CreateSnapshot(context.Background(), projectId, region).V2beta1CreateSnapshotPayload(v2beta1CreateSnapshotPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1DeleteNetworkAreaRegion", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
|
|
reqErr := apiClient.V2beta1DeleteNetworkAreaRegion(context.Background(), organizationId, areaId, region).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1DeleteSnapshot", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
snapshotIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -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 iaasbeta_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
|
|
snapshotId := snapshotIdValue
|
|
|
|
reqErr := apiClient.V2beta1DeleteSnapshot(context.Background(), projectId, region, snapshotId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1GetAreaRegion", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := RegionalArea{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
|
|
resp, reqErr := apiClient.V2beta1GetAreaRegion(context.Background(), organizationId, areaId, region).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1GetSnapshot", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
snapshotIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Snapshot{}
|
|
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 iaasbeta_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
|
|
snapshotId := snapshotIdValue
|
|
|
|
resp, reqErr := apiClient.V2beta1GetSnapshot(context.Background(), projectId, region, snapshotId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1ListAreaRegions", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := RegionalAreaListResponse{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
|
|
resp, reqErr := apiClient.V2beta1ListAreaRegions(context.Background(), organizationId, areaId).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1ListSnapshotsInProject", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots"
|
|
projectIdValue := randString(36)
|
|
_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 := SnapshotListResponse{}
|
|
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 iaasbeta_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.V2beta1ListSnapshotsInProject(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 V2beta1UpdateBackup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
backupIdValue := randString(36)
|
|
_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 := Backup{}
|
|
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 iaasbeta_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
|
|
backupId := backupIdValue
|
|
v2beta1UpdateBackupPayload := V2beta1UpdateBackupPayload{}
|
|
|
|
resp, reqErr := apiClient.V2beta1UpdateBackup(context.Background(), projectId, region, backupId).V2beta1UpdateBackupPayload(v2beta1UpdateBackupPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1UpdateNetworkAreaRegion", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -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 := RegionalArea{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
v2beta1UpdateNetworkAreaRegionPayload := V2beta1UpdateNetworkAreaRegionPayload{}
|
|
|
|
resp, reqErr := apiClient.V2beta1UpdateNetworkAreaRegion(context.Background(), organizationId, areaId, region).V2beta1UpdateNetworkAreaRegionPayload(v2beta1UpdateNetworkAreaRegionPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1UpdateRouteOfArea", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}"
|
|
organizationIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
|
|
areaIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
|
|
regionValue := "region-value"
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
|
routeIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Route{}
|
|
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 iaasbeta_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)
|
|
}
|
|
|
|
organizationId := organizationIdValue
|
|
areaId := areaIdValue
|
|
region := regionValue
|
|
routeId := routeIdValue
|
|
v2beta1UpdateRouteOfAreaPayload := V2beta1UpdateRouteOfAreaPayload{}
|
|
|
|
resp, reqErr := apiClient.V2beta1UpdateRouteOfArea(context.Background(), organizationId, areaId, region, routeId).V2beta1UpdateRouteOfAreaPayload(v2beta1UpdateRouteOfAreaPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1UpdateSecurityGroup", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
securityGroupIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := SecurityGroup{}
|
|
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 iaasbeta_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
|
|
securityGroupId := securityGroupIdValue
|
|
v2beta1UpdateSecurityGroupPayload := V2beta1UpdateSecurityGroupPayload{}
|
|
|
|
resp, reqErr := apiClient.V2beta1UpdateSecurityGroup(context.Background(), projectId, region, securityGroupId).V2beta1UpdateSecurityGroupPayload(v2beta1UpdateSecurityGroupPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
t.Run("Test DefaultApiService V2beta1UpdateSnapshot", func(t *testing.T) {
|
|
_apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}"
|
|
projectIdValue := randString(36)
|
|
_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)
|
|
snapshotIdValue := randString(36)
|
|
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -1)
|
|
|
|
testDefaultApiServeMux := http.NewServeMux()
|
|
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
|
data := Snapshot{}
|
|
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 iaasbeta_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
|
|
snapshotId := snapshotIdValue
|
|
v2beta1UpdateSnapshotPayload := V2beta1UpdateSnapshotPayload{}
|
|
|
|
resp, reqErr := apiClient.V2beta1UpdateSnapshot(context.Background(), projectId, region, snapshotId).V2beta1UpdateSnapshotPayload(v2beta1UpdateSnapshotPayload).Execute()
|
|
|
|
if reqErr != nil {
|
|
t.Fatalf("error in call: %v", reqErr)
|
|
}
|
|
if IsNil(resp) {
|
|
t.Fatalf("response not present")
|
|
}
|
|
})
|
|
|
|
}
|