You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2022/04/12 11:14:11 UTC
[cloudstack-go] 01/01: Decouple tests from autogenerated code
This is an automated email from the ASF dual-hosted git repository.
davidjumani pushed a commit to branch 4161
in repository https://gitbox.apache.org/repos/asf/cloudstack-go.git
commit 80e40eb8cfd7654dac8173510d7f915d738a2066
Author: davidjumani <dj...@gmail.com>
AuthorDate: Tue Apr 12 16:42:31 2022 +0530
Decouple tests from autogenerated code
---
{cloudstack => test}/AccountService_test.go | 8 ++-
{cloudstack => test}/AddressService_test.go | 8 ++-
{cloudstack => test}/AffinityGroupService_test.go | 6 +-
{cloudstack => test}/ApiDiscoveryService_test.go | 6 +-
{cloudstack => test}/AsyncJobService_test.go | 6 +-
{cloudstack => test}/AuthenticationService_test.go | 8 ++-
{cloudstack => test}/CertificateService_test.go | 6 +-
{cloudstack => test}/ClusterService_test.go | 67 ++++------------------
{cloudstack => test}/ConfigurationService_test.go | 10 ++--
{cloudstack => test}/DiskOfferingService_test.go | 10 ++--
{cloudstack => test}/DomainService_test.go | 14 +++--
{cloudstack => test}/FirewallService_test.go | 12 ++--
{cloudstack => test}/HostService_test.go | 18 +++---
{cloudstack => test}/HypervisorService_test.go | 6 +-
{cloudstack => test}/ISOService_test.go | 6 +-
{cloudstack => test}/ImageStoreService_test.go | 10 ++--
{cloudstack => test}/LimitService_test.go | 6 +-
{cloudstack => test}/LoadBalancerService_test.go | 8 ++-
{cloudstack => test}/NetworkACLService_test.go | 6 +-
.../NetworkOfferingService_test.go | 12 ++--
{cloudstack => test}/NetworkService_test.go | 14 +++--
{cloudstack => test}/PoolService_test.go | 10 ++--
{cloudstack => test}/ProjectService_test.go | 14 +++--
{cloudstack => test}/ResourcetagsService_test.go | 8 ++-
{cloudstack => test}/SSHService_test.go | 12 ++--
.../ServiceOfferingService_test.go | 10 ++--
{cloudstack => test}/StoragePoolService_test.go | 8 ++-
{cloudstack => test}/TemplateService_test.go | 10 ++--
{cloudstack => test}/UserService_test.go | 18 +++---
{cloudstack => test}/VLANService_test.go | 6 +-
{cloudstack => test}/VPCService_test.go | 6 +-
{cloudstack => test}/VPNService_test.go | 6 +-
{cloudstack => test}/VirtualMachineService_test.go | 16 +++---
{cloudstack => test}/cloudstack_test.go | 14 +++--
.../testdata/AccountService.json | 0
.../testdata/AddressService.json | 0
.../testdata/AffinityGroupService.json | 0
.../testdata/ApiDiscoveryService.json | 0
.../testdata/AsyncJobService.json | 0
.../testdata/AuthenticationService.json | 0
.../testdata/CertificateService.json | 0
.../testdata/ClusterService.json | 0
.../testdata/ConfigurationService.json | 0
.../testdata/DiskOfferingService.json | 0
.../testdata/DomainService.json | 0
.../testdata/FirewallService.json | 0
.../testdata/HostService.json | 0
.../testdata/HypervisorService.json | 0
.../testdata/ISOService.json | 0
.../testdata/ImageStoreService.json | 0
.../testdata/LimitService.json | 0
.../testdata/LoadBalancerService.json | 0
.../testdata/NetworkACLService.json | 0
.../testdata/NetworkOfferingService.json | 0
.../testdata/NetworkService.json | 0
.../testdata/PoolService.json | 0
.../testdata/ProjectService.json | 0
.../testdata/ResourceTagsService.json | 0
.../testdata/SSHService.json | 0
.../testdata/ServiceOfferingService.json | 0
.../testdata/StoragePoolService.json | 0
.../testdata/TemplateService.json | 0
.../testdata/UserService.json | 0
.../testdata/VLANService.json | 0
.../testdata/VPCService.json | 0
.../testdata/VPNService.json | 0
.../testdata/VirtualMachineService.json | 0
67 files changed, 205 insertions(+), 180 deletions(-)
diff --git a/cloudstack/AccountService_test.go b/test/AccountService_test.go
similarity index 94%
rename from cloudstack/AccountService_test.go
rename to test/AccountService_test.go
index 3e93614..d08e8b1 100644
--- a/cloudstack/AccountService_test.go
+++ b/test/AccountService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestListAccounts(t *testing.T) {
@@ -38,7 +40,7 @@ func TestListAccounts(t *testing.T) {
}))
defer server.Close()
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.Account.NewListAccountsParams()
acc, _ := client.Account.ListAccounts(p)
accounts := acc.Accounts
@@ -75,7 +77,7 @@ func TestCreateAccounts(t *testing.T) {
}))
defer server.Close()
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
email := "user01@example.com"
firstname := "user01"
lastname := "user01"
diff --git a/cloudstack/AddressService_test.go b/test/AddressService_test.go
similarity index 91%
rename from cloudstack/AddressService_test.go
rename to test/AddressService_test.go
index e993488..b676c31 100644
--- a/cloudstack/AddressService_test.go
+++ b/test/AddressService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestAssociateIpAddress(t *testing.T) {
@@ -37,7 +39,7 @@ func TestAssociateIpAddress(t *testing.T) {
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.Address.NewAssociateIpAddressParams()
p.SetZoneid("2e86e486-b472-4f12-a9b2-bb73701241e0")
ip, err := client.Address.AssociateIpAddress(p)
@@ -61,7 +63,7 @@ func TestDisassociateIpAddress(t *testing.T) {
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.Address.NewDisassociateIpAddressParams("a767fbe1-ed7a-4d7c-8221-c7d736ca622d")
address, err := client.Address.DisassociateIpAddress(p)
if err != nil {
diff --git a/cloudstack/AffinityGroupService_test.go b/test/AffinityGroupService_test.go
similarity index 92%
rename from cloudstack/AffinityGroupService_test.go
rename to test/AffinityGroupService_test.go
index 03104f7..288e592 100644
--- a/cloudstack/AffinityGroupService_test.go
+++ b/test/AffinityGroupService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestCreateAffinityGroup(t *testing.T) {
@@ -36,7 +38,7 @@ func TestCreateAffinityGroup(t *testing.T) {
fmt.Fprintln(writer, responses)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.AffinityGroup.NewCreateAffinityGroupParams("testAffinityGroup", "host affinity")
ag, err := client.AffinityGroup.CreateAffinityGroup(p)
if err != nil {
diff --git a/cloudstack/ApiDiscoveryService_test.go b/test/ApiDiscoveryService_test.go
similarity index 97%
rename from cloudstack/ApiDiscoveryService_test.go
rename to test/ApiDiscoveryService_test.go
index 30e63bf..3278ddf 100644
--- a/cloudstack/ApiDiscoveryService_test.go
+++ b/test/ApiDiscoveryService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestListApis_SetName(t *testing.T) {
@@ -169,7 +171,7 @@ func TestListApis_SetName(t *testing.T) {
defer server.Close()
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.APIDiscovery.NewListApisParams()
p.SetName("listSSHKeyPairs")
resp, err := client.APIDiscovery.ListApis(p)
diff --git a/cloudstack/AsyncJobService_test.go b/test/AsyncJobService_test.go
similarity index 91%
rename from cloudstack/AsyncJobService_test.go
rename to test/AsyncJobService_test.go
index 7e55029..5e7f405 100644
--- a/cloudstack/AsyncJobService_test.go
+++ b/test/AsyncJobService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestListAsyncJobs(t *testing.T) {
@@ -38,7 +40,7 @@ func TestListAsyncJobs(t *testing.T) {
defer server.Close()
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.Asyncjob.NewListAsyncJobsParams()
p.SetListall(true)
resp, err := client.Asyncjob.ListAsyncJobs(p)
diff --git a/cloudstack/AuthenticationService_test.go b/test/AuthenticationService_test.go
similarity index 91%
rename from cloudstack/AuthenticationService_test.go
rename to test/AuthenticationService_test.go
index 2295ab5..0e4491e 100644
--- a/cloudstack/AuthenticationService_test.go
+++ b/test/AuthenticationService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestAuthenticationService_Login(t *testing.T) {
@@ -37,7 +39,7 @@ func TestAuthenticationService_Login(t *testing.T) {
}))
defer server.Close()
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
loginParams := client.Authentication.NewLoginParams("admin", "password")
resp, err := client.Authentication.Login(loginParams)
@@ -66,7 +68,7 @@ func TestAuthenticationService_Logout(t *testing.T) {
defer server.Close()
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
logoutParams := client.Authentication.NewLogoutParams()
logoutResp, err := client.Authentication.Logout(logoutParams)
diff --git a/cloudstack/CertificateService_test.go b/test/CertificateService_test.go
similarity index 92%
rename from cloudstack/CertificateService_test.go
rename to test/CertificateService_test.go
index 7402a06..316af49 100644
--- a/cloudstack/CertificateService_test.go
+++ b/test/CertificateService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestUploadCustomCertificate(t *testing.T) {
@@ -37,7 +39,7 @@ func TestUploadCustomCertificate(t *testing.T) {
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Certificate.NewUploadCustomCertificateParams("test", "xyz.com")
resp, err := client.Certificate.UploadCustomCertificate(params)
diff --git a/cloudstack/ClusterService_test.go b/test/ClusterService_test.go
similarity index 79%
rename from cloudstack/ClusterService_test.go
rename to test/ClusterService_test.go
index 68feed2..068de58 100644
--- a/cloudstack/ClusterService_test.go
+++ b/test/ClusterService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
var (
@@ -34,51 +36,6 @@ var (
zoneId = "04ccc336-d730-42fe-8ff6-5ae36e141e81"
)
-//func TestCreateCluster(t *testing.T) {
-// server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
-// response := `{
-// "addclusterresponse": {
-// "count": 1,
-// "cluster": [
-// {
-// "id": "f1f5a259-1b55-431d-ad7e-6d39c28f1b15",
-// "name": "TestCluster",
-// "podid": "6137ef6f-753f-4e7b-a728-8d46a92358d2",
-// "podname": "POD0",
-// "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
-// "zonename": "SimZone1",
-// "hypervisortype": "KVM",
-// "clustertype": "CloudManaged",
-// "allocationstate": "Enabled",
-// "managedstate": "Managed",
-// "cpuovercommitratio": "1.0",
-// "memoryovercommitratio": "1.0",
-// "resourcedetails": {
-// "memoryOvercommitRatio": "1.0",
-// "cpuOvercommitRatio": "1.0"
-// }
-// }
-// ]
-// }
-// }`
-// fmt.Fprintf(writer, response)
-// }))
-// defer server.Close()
-//
-// client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
-// params := client.Cluster.NewAddClusterParams(clusterName, clusterType, hypervisorType, podId, zoneId)
-// resp, err := client.Cluster.AddCluster(params)
-//
-// if err != nil {
-// t.Errorf("Failed to add cluster %s to zone %s, due to: %v", clusterName, zoneId, err)
-// }
-//
-// fmt.Printf("%v", resp)
-// if resp.Name != clusterName {
-// t.Errorf("Failed to add cluster")
-// }
-//}
-
func TestClusterService_ListClusters(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
apiName := "listClusters"
@@ -90,7 +47,7 @@ func TestClusterService_ListClusters(t *testing.T) {
}))
defer server.Close()
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewListClustersParams()
params.SetZoneid(zoneId)
clusterResp, err := client.Cluster.ListClusters(params)
@@ -113,7 +70,7 @@ func TestClusterService_DisableHAForCluster(t *testing.T) {
fmt.Fprintf(writer, responses)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewDisableHAForClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
resp, err := client.Cluster.DisableHAForCluster(params)
if err != nil {
@@ -136,7 +93,7 @@ func TestClusterService_EnableHAForCluster(t *testing.T) {
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewEnableHAForClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
resp, err := client.Cluster.EnableHAForCluster(params)
if err != nil {
@@ -158,7 +115,7 @@ func TestClusterService_DisableOutOfBandManagementForCluster(t *testing.T) {
fmt.Fprintf(writer, responses)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewDisableOutOfBandManagementForClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
resp, err := client.Cluster.DisableOutOfBandManagementForCluster(params)
if err != nil {
@@ -180,7 +137,7 @@ func TestClusterService_EnableOutOfBandManagementForCluster(t *testing.T) {
fmt.Fprintf(writer, responses)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewEnableOutOfBandManagementForClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
resp, err := client.Cluster.EnableOutOfBandManagementForCluster(params)
if err != nil {
@@ -202,7 +159,7 @@ func TestClusterService_DedicateCluster(t *testing.T) {
fmt.Fprintf(writer, responses)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewDedicateClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15", "e4874e10-5fdf-11ea-9a56-1e006800018c")
resp, err := client.Cluster.DedicateCluster(params)
if err != nil {
@@ -224,7 +181,7 @@ func TestClusterService_ReleaseDedicatedCluster(t *testing.T) {
fmt.Fprintf(writer, responses)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewReleaseDedicatedClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
resp, err := client.Cluster.ReleaseDedicatedCluster(params)
if err != nil {
@@ -246,7 +203,7 @@ func TestClusterService_UpdateCluster(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewUpdateClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
params.SetClustername("TestClusterUpdated")
params.SetManagedstate("Unmanaged")
@@ -270,7 +227,7 @@ func TestClusterService_DeleteCluster(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Cluster.NewDeleteClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
resp, err := client.Cluster.DeleteCluster(params)
if err != nil {
diff --git a/cloudstack/ConfigurationService_test.go b/test/ConfigurationService_test.go
similarity index 91%
rename from cloudstack/ConfigurationService_test.go
rename to test/ConfigurationService_test.go
index 00d1053..26c4a3d 100644
--- a/cloudstack/ConfigurationService_test.go
+++ b/test/ConfigurationService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestConfigurationService_ListCapabilities(t *testing.T) {
@@ -37,7 +39,7 @@ func TestConfigurationService_ListCapabilities(t *testing.T) {
}))
defer server.Close()
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.Configuration.NewListCapabilitiesParams()
resp, err := client.Configuration.ListCapabilities(p)
if err != nil {
@@ -58,7 +60,7 @@ func TestConfigurationService_ListConfigurations(t *testing.T) {
}
fmt.Fprintf(w, resp[apiName])
}))
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.Configuration.NewListConfigurationsParams()
p.SetName("allow.user.create.projects")
resp, err := client.Configuration.ListConfigurations(p)
@@ -79,7 +81,7 @@ func TestConfigurationService_UpdateConfigurations(t *testing.T) {
}
fmt.Fprintf(w, resp[apiName])
}))
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.Configuration.NewUpdateConfigurationParams("allow.user.create.projects")
p.SetValue("false")
resp, err := client.Configuration.UpdateConfiguration(p)
diff --git a/cloudstack/DiskOfferingService_test.go b/test/DiskOfferingService_test.go
similarity index 91%
rename from cloudstack/DiskOfferingService_test.go
rename to test/DiskOfferingService_test.go
index 69cbfff..7d2bb0e 100644
--- a/cloudstack/DiskOfferingService_test.go
+++ b/test/DiskOfferingService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestDiskOfferingService_CreateDiskOffering(t *testing.T) {
@@ -35,7 +37,7 @@ func TestDiskOfferingService_CreateDiskOffering(t *testing.T) {
}
fmt.Fprintf(writer, response[apiName])
}))
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.DiskOffering.NewCreateDiskOfferingParams("test", "test")
resp, err := client.DiskOffering.CreateDiskOffering(params)
if err != nil {
@@ -56,7 +58,7 @@ func TestDiskOfferingService_ListDiskOffering(t *testing.T) {
}
fmt.Fprintf(writer, response[apiName])
}))
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.DiskOffering.NewListDiskOfferingsParams()
params.SetId("7662b6ae-f00b-4268-973f-f3f87eaf82c5")
resp, err := client.DiskOffering.ListDiskOfferings(params)
@@ -78,7 +80,7 @@ func TestDiskOfferingService_DeleteDiskOffering(t *testing.T) {
}
fmt.Fprintf(writer, response[apiName])
}))
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.DiskOffering.NewDeleteDiskOfferingParams("7662b6ae-f00b-4268-973f-f3f87eaf82c5")
resp, err := client.DiskOffering.DeleteDiskOffering(params)
if err != nil {
diff --git a/cloudstack/DomainService_test.go b/test/DomainService_test.go
similarity index 91%
rename from cloudstack/DomainService_test.go
rename to test/DomainService_test.go
index 0c34364..8d74ebf 100644
--- a/cloudstack/DomainService_test.go
+++ b/test/DomainService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestDomainService_CreateDomain(t *testing.T) {
@@ -36,7 +38,7 @@ func TestDomainService_CreateDomain(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Domain.NewCreateDomainParams("testDomain")
params.SetParentdomainid("e4874e10-5fdf-11ea-9a56-1e006800018c")
resp, err := client.Domain.CreateDomain(params)
@@ -59,7 +61,7 @@ func TestDomainService_UpdateDomain(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Domain.NewUpdateDomainParams("ee05fd92-7365-4421-a15b-abfa11dfc4f6")
params.SetName("testDomainUpdated")
resp, err := client.Domain.UpdateDomain(params)
@@ -82,7 +84,7 @@ func TestDomainService_ListDomains(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Domain.NewListDomainsParams()
params.SetId("097d3992-7a67-42e1-afb5-b4d2d81e280f")
resp, err := client.Domain.ListDomains(params)
@@ -107,7 +109,7 @@ func TestDomainService_ListDomainChildren(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Domain.NewListDomainChildrenParams()
params.SetId("99becf06-7f0f-4eb4-bdc3-44fecb8cb829")
resp, err := client.Domain.ListDomainChildren(params)
@@ -129,7 +131,7 @@ func TestDomainService_DeleteDomain(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Domain.NewDeleteDomainParams("ee05fd92-7365-4421-a15b-abfa11dfc4f6")
resp, err := client.Domain.DeleteDomain(params)
if err != nil {
diff --git a/cloudstack/FirewallService_test.go b/test/FirewallService_test.go
similarity index 91%
rename from cloudstack/FirewallService_test.go
rename to test/FirewallService_test.go
index abfd1af..8bcc66a 100644
--- a/cloudstack/FirewallService_test.go
+++ b/test/FirewallService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestFirewallService_CreateFirewallRule(t *testing.T) {
@@ -36,7 +38,7 @@ func TestFirewallService_CreateFirewallRule(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Firewall.NewCreateFirewallRuleParams("192.168.2.4", "tcp")
resp, err := client.Firewall.CreateFirewallRule(params)
if err != nil {
@@ -61,7 +63,7 @@ func TestFirewallService_DeleteFirewallRule(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Firewall.NewDeleteFirewallRuleParams("fb4ad2ee-02c8-433e-a769-6f18afddc750")
resp, err := client.Firewall.DeleteFirewallRule(params)
if err != nil {
@@ -82,7 +84,7 @@ func TestFirewallService_CreateEgressFirewallRule(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Firewall.NewCreateEgressFirewallRuleParams("c4a3303c-376d-4d56-b336-1bd91cb130b6", "tcp")
resp, err := client.Firewall.CreateEgressFirewallRule(params)
if err != nil {
@@ -104,7 +106,7 @@ func TestFirewallService_DeleteEgressFirewallRule(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Firewall.NewDeleteEgressFirewallRuleParams("fb4ad2ee-02c8-433e-a769-6f18afddc750")
resp, err := client.Firewall.DeleteEgressFirewallRule(params)
if err != nil {
diff --git a/cloudstack/HostService_test.go b/test/HostService_test.go
similarity index 91%
rename from cloudstack/HostService_test.go
rename to test/HostService_test.go
index 6d4acc2..ca1f604 100644
--- a/cloudstack/HostService_test.go
+++ b/test/HostService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestHostService_AddHost(t *testing.T) {
@@ -37,7 +39,7 @@ func TestHostService_AddHost(t *testing.T) {
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Host.NewAddHostParams("Simulator", "5382edc2-e689-4074-bd67-0e1a236eb2bc", "http://sim/c0/h0",
"d4a81f75-5d92-415e-ab59-e85cc2ce56d9")
resp, err := client.Host.AddHost(params)
@@ -61,7 +63,7 @@ func TestHostService_ListHosts(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Host.NewListHostsParams()
resp, err := client.Host.ListHosts(params)
if err != nil {
@@ -83,7 +85,7 @@ func TestHostService_PrepareHostForMaintenance(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Host.NewPrepareHostForMaintenanceParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
resp, err := client.Host.PrepareHostForMaintenance(params)
if err != nil {
@@ -105,7 +107,7 @@ func TestHostService_CancelHostForMaintenance(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Host.NewCancelHostMaintenanceParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
resp, err := client.Host.CancelHostMaintenance(params)
if err != nil {
@@ -127,7 +129,7 @@ func TestHostService_EnableOutOfBandManagementForHost(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Host.NewEnableOutOfBandManagementForHostParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
resp, err := client.Host.EnableOutOfBandManagementForHost(params)
if err != nil {
@@ -148,7 +150,7 @@ func TestHostService_DisableOutOfBandManagementForHost(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Host.NewDisableOutOfBandManagementForHostParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
resp, err := client.Host.DisableOutOfBandManagementForHost(params)
if err != nil {
@@ -169,7 +171,7 @@ func TestHostService_EnableHAForHost(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Host.NewEnableHAForHostParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
resp, err := client.Host.EnableHAForHost(params)
if err != nil {
diff --git a/cloudstack/HypervisorService_test.go b/test/HypervisorService_test.go
similarity index 92%
rename from cloudstack/HypervisorService_test.go
rename to test/HypervisorService_test.go
index 92ebf9e..e5136f4 100644
--- a/cloudstack/HypervisorService_test.go
+++ b/test/HypervisorService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestHypervisorService_ListSpecificHypervisorCapabilities(t *testing.T) {
@@ -36,7 +38,7 @@ func TestHypervisorService_ListSpecificHypervisorCapabilities(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Hypervisor.NewListHypervisorCapabilitiesParams()
params.SetId("1")
resp, err := client.Hypervisor.ListHypervisorCapabilities(params)
diff --git a/cloudstack/ISOService_test.go b/test/ISOService_test.go
similarity index 92%
rename from cloudstack/ISOService_test.go
rename to test/ISOService_test.go
index 4460b64..3dceac0 100644
--- a/cloudstack/ISOService_test.go
+++ b/test/ISOService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestISOService_RegisterIso(t *testing.T) {
@@ -36,7 +38,7 @@ func TestISOService_RegisterIso(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.ISO.NewRegisterIsoParams("testIso", "testIso",
"http://dl.openvm.eu/cloudstack/iso/TinyCore-8.0.iso", "1d8d87d4-1425-459c-8d81-c6f57dca2bd2")
resp, err := client.ISO.RegisterIso(params)
diff --git a/cloudstack/ImageStoreService_test.go b/test/ImageStoreService_test.go
similarity index 91%
rename from cloudstack/ImageStoreService_test.go
rename to test/ImageStoreService_test.go
index 3c82e5f..cd830b9 100644
--- a/cloudstack/ImageStoreService_test.go
+++ b/test/ImageStoreService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestImageStoreService_AddImageStore(t *testing.T) {
@@ -36,7 +38,7 @@ func TestImageStoreService_AddImageStore(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.ImageStore.NewAddImageStoreParams("NFS")
resp, err := client.ImageStore.AddImageStore(params)
if err != nil {
@@ -59,7 +61,7 @@ func TestImageStoreService_ListImageStores(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.ImageStore.NewListImageStoresParams()
resp, err := client.ImageStore.ListImageStores(params)
if err != nil {
@@ -82,7 +84,7 @@ func TestImageStoreService_DeleteImageStore(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.ImageStore.NewDeleteImageStoreParams("0ac85364-e31a-4840-97a4-a237b4291dfa")
resp, err := client.ImageStore.DeleteImageStore(params)
if err != nil {
diff --git a/cloudstack/LimitService_test.go b/test/LimitService_test.go
similarity index 91%
rename from cloudstack/LimitService_test.go
rename to test/LimitService_test.go
index 81aa2e0..594f575 100644
--- a/cloudstack/LimitService_test.go
+++ b/test/LimitService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestLimitService_ResetApiLimit(t *testing.T) {
@@ -36,7 +38,7 @@ func TestLimitService_ResetApiLimit(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Limit.NewResetApiLimitParams()
resp, err := client.Limit.ResetApiLimit(params)
if err != nil {
diff --git a/cloudstack/LoadBalancerService_test.go b/test/LoadBalancerService_test.go
similarity index 92%
rename from cloudstack/LoadBalancerService_test.go
rename to test/LoadBalancerService_test.go
index 6256fe9..3daaa24 100644
--- a/cloudstack/LoadBalancerService_test.go
+++ b/test/LoadBalancerService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestLoadBalancerService_CreateLoadBalancerRule(t *testing.T) {
@@ -36,7 +38,7 @@ func TestLoadBalancerService_CreateLoadBalancerRule(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.LoadBalancer.NewCreateLoadBalancerRuleParams("roundrobin", "testLBRule", 9090, 9090)
params.SetProtocol("tcp")
params.SetNetworkid("cc39d938-5ea0-4d9c-b89d-421da3274e54")
@@ -60,7 +62,7 @@ func TestLoadBalancerService_AssignLoadBalancerRule(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.LoadBalancer.NewAssignToLoadBalancerRuleParams("be6294cc-8f99-42c8-970d-f54c511972a3")
vmIpMap := make(map[string]string)
vmIpMap["vmid"] = "c7749abf-fadb-4658-9346-bbef95a2456f"
diff --git a/cloudstack/NetworkACLService_test.go b/test/NetworkACLService_test.go
similarity index 92%
rename from cloudstack/NetworkACLService_test.go
rename to test/NetworkACLService_test.go
index b9023aa..7d9015e 100644
--- a/cloudstack/NetworkACLService_test.go
+++ b/test/NetworkACLService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestNetworkACLService_UpdateNetworkACLList(t *testing.T) {
@@ -36,7 +38,7 @@ func TestNetworkACLService_UpdateNetworkACLList(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.NetworkACL.NewUpdateNetworkACLListParams("a31e11a0-57fe-41df-be7a-34d359673061")
resp, err := client.NetworkACL.UpdateNetworkACLList(params)
if err != nil {
diff --git a/cloudstack/NetworkOfferingService_test.go b/test/NetworkOfferingService_test.go
similarity index 91%
rename from cloudstack/NetworkOfferingService_test.go
rename to test/NetworkOfferingService_test.go
index 98e5f00..9fe87e3 100644
--- a/cloudstack/NetworkOfferingService_test.go
+++ b/test/NetworkOfferingService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestNetworkOfferingService_CreateNetworkOffering(t *testing.T) {
@@ -36,7 +38,7 @@ func TestNetworkOfferingService_CreateNetworkOffering(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.NetworkOffering.NewCreateNetworkOfferingParams("testNetOffering", "L2", "testNetOffering", "Guest")
resp, err := client.NetworkOffering.CreateNetworkOffering(params)
if err != nil {
@@ -57,7 +59,7 @@ func TestNetworkOfferingService_UpdateNetworkOffering(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.NetworkOffering.NewUpdateNetworkOfferingParams()
params.SetState("Enabled")
resp, err := client.NetworkOffering.UpdateNetworkOffering(params)
@@ -80,7 +82,7 @@ func TestNetworkOfferingService_ListNetworkOffering(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.NetworkOffering.NewListNetworkOfferingsParams()
params.SetId("c2000683-68fd-437e-a4cf-f3676e1d18c1")
resp, err := client.NetworkOffering.ListNetworkOfferings(params)
@@ -103,7 +105,7 @@ func TestNetworkOfferingService_DeleteNetworkOffering(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.NetworkOffering.NewDeleteNetworkOfferingParams("c2000683-68fd-437e-a4cf-f3676e1d18c1")
resp, err := client.NetworkOffering.DeleteNetworkOffering(params)
if err != nil {
diff --git a/cloudstack/NetworkService_test.go b/test/NetworkService_test.go
similarity index 92%
rename from cloudstack/NetworkService_test.go
rename to test/NetworkService_test.go
index 18f7508..9a77efb 100644
--- a/cloudstack/NetworkService_test.go
+++ b/test/NetworkService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestNetworkService_CreateNetwork(t *testing.T) {
@@ -36,7 +38,7 @@ func TestNetworkService_CreateNetwork(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Network.NewCreateNetworkParams("testIsolatedNet", "testIsolatedNet", "69b7f746-208a-47c3-a940-4d3ebb720372", "04ccc336-d730-42fe-8ff6-5ae36e141e81")
resp, err := client.Network.CreateNetwork(params)
if err != nil {
@@ -57,7 +59,7 @@ func TestNetworkService_ListNetworks(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Network.NewListNetworksParams()
params.SetId("eb9c270d-dd66-443b-9524-ada1eff4442a")
resp, err := client.Network.ListNetworks(params)
@@ -82,7 +84,7 @@ func TestNetworkService_DeleteNetwork(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Network.NewDeleteNetworkParams("eb9c270d-dd66-443b-9524-ada1eff4442a")
resp, err := client.Network.DeleteNetwork(params)
if err != nil {
@@ -123,7 +125,7 @@ func TestNetworkService_DeleteNetwork(t *testing.T) {
// fmt.Fprintf(writer, responses[request.FormValue("command")])
// }))
// defer server.Close()
-// client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+// client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
// params := client.Network.NewRestartNetworkParams("30358053-0f9d-4112-9948-976477896db6")
// params.SetCleanup(true)
// _, err := client.Network.RestartNetwork(params)
@@ -143,7 +145,7 @@ func TestNetworkService_CreatePhysicalNetwork(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Network.NewCreatePhysicalNetworkParams("testPhyNet", "d4a81f75-5d92-415e-ab59-e85cc2ce56d9")
resp, err := client.Network.CreatePhysicalNetwork(params)
if err != nil {
diff --git a/cloudstack/PoolService_test.go b/test/PoolService_test.go
similarity index 91%
rename from cloudstack/PoolService_test.go
rename to test/PoolService_test.go
index c0f8993..89ed90e 100644
--- a/cloudstack/PoolService_test.go
+++ b/test/PoolService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestPoolService_CreateStoragePool(t *testing.T) {
@@ -36,7 +38,7 @@ func TestPoolService_CreateStoragePool(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Pool.NewCreateStoragePoolParams("testPrimary1", "nfs://10.1.1.2/export/primary1", "6ebc7a1c-ff98-425c-ac0d-b6c2e3ae6e33")
resp, err := client.Pool.CreateStoragePool(params)
if err != nil {
@@ -59,7 +61,7 @@ func TestPoolService_ListStoragePools(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Pool.NewListStoragePoolsParams()
params.SetId("3fd44942-4881-3fb0-95f1-5d7b7ae64cfb")
resp, err := client.Pool.ListStoragePools(params)
@@ -83,7 +85,7 @@ func TestPoolService_DeleteStoragePool(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Pool.NewDeleteStoragePoolParams("3fd44942-4881-3fb0-95f1-5d7b7ae64cfb")
resp, err := client.Pool.DeleteStoragePool(params)
if err != nil {
diff --git a/cloudstack/ProjectService_test.go b/test/ProjectService_test.go
similarity index 91%
rename from cloudstack/ProjectService_test.go
rename to test/ProjectService_test.go
index 8d65869..b8d6976 100644
--- a/cloudstack/ProjectService_test.go
+++ b/test/ProjectService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestProjectService_CreateProject(t *testing.T) {
@@ -36,7 +38,7 @@ func TestProjectService_CreateProject(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Project.NewCreateProjectParams("testProject", "testProject")
resp, err := client.Project.CreateProject(params)
if err != nil {
@@ -58,7 +60,7 @@ func TestProjectService_ActivateProject(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Project.NewActivateProjectParams("99a842a4-e50f-4265-8ca7-249959506c13")
resp, err := client.Project.ActivateProject(params)
if err != nil {
@@ -80,7 +82,7 @@ func TestProjectService_SuspendProject(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Project.NewSuspendProjectParams("99a842a4-e50f-4265-8ca7-249959506c13")
resp, err := client.Project.SuspendProject(params)
if err != nil {
@@ -102,7 +104,7 @@ func TestProjectService_UpdateProject(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Project.NewUpdateProjectParams("99a842a4-e50f-4265-8ca7-249959506c13")
params.SetDisplaytext("testProjectUpdated")
resp, err := client.Project.UpdateProject(params)
@@ -126,7 +128,7 @@ func TestProjectService_listProjectRolePermissions(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Project.NewListProjectRolePermissionsParams("69646881-8d7f-4800-987d-106698a42608")
params.SetProjectroleid("fa089002-d055-46b5-aa0a-18f2eae2b4fc")
resp, err := client.Project.ListProjectRolePermissions(params)
diff --git a/cloudstack/ResourcetagsService_test.go b/test/ResourcetagsService_test.go
similarity index 92%
rename from cloudstack/ResourcetagsService_test.go
rename to test/ResourcetagsService_test.go
index 30404d4..2437511 100644
--- a/cloudstack/ResourcetagsService_test.go
+++ b/test/ResourcetagsService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestResourcetagsService_CreateTags(t *testing.T) {
@@ -36,7 +38,7 @@ func TestResourcetagsService_CreateTags(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
tags := make(map[string]string)
tags["key"] = "testKey"
tags["value"] = "testValue"
@@ -62,7 +64,7 @@ func TestResourcetagsService_DeleteTags(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Resourcetags.NewDeleteTagsParams([]string{"99a842a4-e50f-4265-8ca7-249959506c13"}, "Project")
resp, err := client.Resourcetags.DeleteTags(params)
if err != nil {
diff --git a/cloudstack/SSHService_test.go b/test/SSHService_test.go
similarity index 91%
rename from cloudstack/SSHService_test.go
rename to test/SSHService_test.go
index 6fd01f7..5c5de07 100644
--- a/cloudstack/SSHService_test.go
+++ b/test/SSHService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestSSHService_CreateSSHKeyPair(t *testing.T) {
@@ -36,7 +38,7 @@ func TestSSHService_CreateSSHKeyPair(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.SSH.NewCreateSSHKeyPairParams("testSSHKey")
resp, err := client.SSH.CreateSSHKeyPair(params)
if err != nil {
@@ -58,7 +60,7 @@ func TestSSHService_ListSSHKeyPairs(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.SSH.NewListSSHKeyPairsParams()
params.SetName("testSSHKey")
resp, err := client.SSH.ListSSHKeyPairs(params)
@@ -81,7 +83,7 @@ func TestSSHService_ResetSSHKeyForVirtualMachine(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.SSH.NewResetSSHKeyForVirtualMachineParams("8aa29529-b238-45f3-8992-5befadcd8bb0", "testSSHKey")
resp, err := client.SSH.ResetSSHKeyForVirtualMachine(params)
if err != nil {
@@ -103,7 +105,7 @@ func TestSSHService_DeleteSSHKeyPair(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.SSH.NewDeleteSSHKeyPairParams("testSSHKey")
resp, err := client.SSH.DeleteSSHKeyPair(params)
if err != nil {
diff --git a/cloudstack/ServiceOfferingService_test.go b/test/ServiceOfferingService_test.go
similarity index 91%
rename from cloudstack/ServiceOfferingService_test.go
rename to test/ServiceOfferingService_test.go
index 0fa4a48..b84e0a3 100644
--- a/cloudstack/ServiceOfferingService_test.go
+++ b/test/ServiceOfferingService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestServiceOfferingService_CreateServiceOffering(t *testing.T) {
@@ -37,7 +39,7 @@ func TestServiceOfferingService_CreateServiceOffering(t *testing.T) {
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.ServiceOffering.NewCreateServiceOfferingParams("testServiceOffering", "testServiceOffering")
resp, err := client.ServiceOffering.CreateServiceOffering(p)
if err != nil {
@@ -60,7 +62,7 @@ func TestServiceOfferingService_UpdateServiceOffering(t *testing.T) {
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.ServiceOffering.NewUpdateServiceOfferingParams("efaeeab0-4b09-4729-8b6f-62645db41b37")
p.SetName("testServiceOfferingUpdated")
resp, err := client.ServiceOffering.UpdateServiceOffering(p)
@@ -83,7 +85,7 @@ func TestServiceOfferingService_DeleteServiceOffering(t *testing.T) {
}
fmt.Fprintf(w, response[apiName])
}))
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
p := client.ServiceOffering.NewDeleteServiceOfferingParams("efaeeab0-4b09-4729-8b6f-62645db41b37")
resp, err := client.ServiceOffering.DeleteServiceOffering(p)
if err != nil {
diff --git a/cloudstack/StoragePoolService_test.go b/test/StoragePoolService_test.go
similarity index 92%
rename from cloudstack/StoragePoolService_test.go
rename to test/StoragePoolService_test.go
index a83e87c..142af84 100644
--- a/cloudstack/StoragePoolService_test.go
+++ b/test/StoragePoolService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestStoragePoolService_CancelStorageMaintenance(t *testing.T) {
@@ -36,7 +38,7 @@ func TestStoragePoolService_CancelStorageMaintenance(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.StoragePool.NewCancelStorageMaintenanceParams("44ad900d-785b-3eff-addc-a5e6bf4927ef")
resp, err := client.StoragePool.CancelStorageMaintenance(params)
if err != nil {
@@ -57,7 +59,7 @@ func TestStoragePoolService_EnableStorageMaintenance(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.StoragePool.NewEnableStorageMaintenanceParams("44ad900d-785b-3eff-addc-a5e6bf4927ef")
resp, err := client.StoragePool.EnableStorageMaintenance(params)
if err != nil {
diff --git a/cloudstack/TemplateService_test.go b/test/TemplateService_test.go
similarity index 91%
rename from cloudstack/TemplateService_test.go
rename to test/TemplateService_test.go
index fa474a0..f058353 100644
--- a/cloudstack/TemplateService_test.go
+++ b/test/TemplateService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestTemplateService_RegisterTemplate(t *testing.T) {
@@ -36,7 +38,7 @@ func TestTemplateService_RegisterTemplate(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Template.NewRegisterTemplateParams("testTemplate", "VHD",
"Simulator", "testTemplate", "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2")
resp, err := client.Template.RegisterTemplate(params)
@@ -60,7 +62,7 @@ func TestTemplateService_CreateTemplate(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Template.NewCreateTemplateParams("createTempFromVol", "createTempFromVol", "e510f742-5fdf-11ea-9a56-1e006800018c")
resp, err := client.Template.CreateTemplate(params)
if err != nil {
@@ -82,7 +84,7 @@ func TestTemplateService_ExtractTemplate(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.Template.NewExtractTemplateParams("5ce8f0b1-a910-4631-a8de-1e332bf3a6b7", "HTTP_DOWNLOAD")
resp, err := client.Template.ExtractTemplate(params)
if err != nil {
diff --git a/cloudstack/UserService_test.go b/test/UserService_test.go
similarity index 90%
rename from cloudstack/UserService_test.go
rename to test/UserService_test.go
index 50cdf2b..7f33dc4 100644
--- a/cloudstack/UserService_test.go
+++ b/test/UserService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestUserService_CreateUser(t *testing.T) {
@@ -36,7 +38,7 @@ func TestUserService_CreateUser(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.User.NewCreateUserParams("admin", "user.xyz.com",
"firstname", "lastname", "password", "dummyUser")
resp, err := client.User.CreateUser(params)
@@ -59,7 +61,7 @@ func TestUserService_EnableUser(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.User.NewEnableUserParams("cd2b5afa-db4d-4532-88ec-1356a273e534")
resp, err := client.User.EnableUser(params)
if err != nil {
@@ -82,7 +84,7 @@ func TestUserService_DisableUser(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.User.NewDisableUserParams("cd2b5afa-db4d-4532-88ec-1356a273e534")
resp, err := client.User.DisableUser(params)
if err != nil {
@@ -105,7 +107,7 @@ func TestUserService_ListUser(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.User.NewListUsersParams()
params.SetId("cd2b5afa-db4d-4532-88ec-1356a273e534")
resp, err := client.User.ListUsers(params)
@@ -129,7 +131,7 @@ func TestUserService_LockUser(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.User.NewLockUserParams("3b7325b3-849c-4314-ad19-dd3c483b6d1a")
resp, err := client.User.LockUser(params)
if err != nil {
@@ -152,7 +154,7 @@ func TestUserService_DeleteUser(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.User.NewDeleteUserParams("cd2b5afa-db4d-4532-88ec-1356a273e534")
resp, err := client.User.DeleteUser(params)
if err != nil {
@@ -175,7 +177,7 @@ func TestGetUserKeys(t *testing.T) {
fmt.Fprintf(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.User.NewGetUserKeysParams("random-id")
resp, err := client.User.GetUserKeys(params)
if err != nil {
diff --git a/cloudstack/VLANService_test.go b/test/VLANService_test.go
similarity index 92%
rename from cloudstack/VLANService_test.go
rename to test/VLANService_test.go
index 82711a3..62d3ac4 100644
--- a/cloudstack/VLANService_test.go
+++ b/test/VLANService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestNetworkService_DedicateGuestVLANRange(t *testing.T) {
@@ -36,7 +38,7 @@ func TestNetworkService_DedicateGuestVLANRange(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VLAN.NewDedicateGuestVlanRangeParams("8e27a637-7525-49ed-81ce-52bd5e5d9ea2", "100-110")
params.SetAccount("admin")
params.SetDomainid("e4874e10-5fdf-11ea-9a56-1e006800018c")
diff --git a/cloudstack/VPCService_test.go b/test/VPCService_test.go
similarity index 91%
rename from cloudstack/VPCService_test.go
rename to test/VPCService_test.go
index 80231bc..443fd59 100644
--- a/cloudstack/VPCService_test.go
+++ b/test/VPCService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestVPCService_RestartVPC(t *testing.T) {
@@ -36,7 +38,7 @@ func TestVPCService_RestartVPC(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VPC.NewRestartVPCParams("f9ec95f3-70be-448a-8ba2-cb6388dce55a")
resp, err := client.VPC.RestartVPC(params)
if err != nil {
diff --git a/cloudstack/VPNService_test.go b/test/VPNService_test.go
similarity index 92%
rename from cloudstack/VPNService_test.go
rename to test/VPNService_test.go
index 41acffc..e7aadf7 100644
--- a/cloudstack/VPNService_test.go
+++ b/test/VPNService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestVPNService_DeleteRemoteAccessVpn(t *testing.T) {
@@ -36,7 +38,7 @@ func TestVPNService_DeleteRemoteAccessVpn(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VPN.NewDeleteRemoteAccessVpnParams("8dcd19e9-dbe6-4576-9602-4c3350918983")
resp, err := client.VPN.DeleteRemoteAccessVpn(params)
if err != nil {
diff --git a/cloudstack/VirtualMachineService_test.go b/test/VirtualMachineService_test.go
similarity index 91%
rename from cloudstack/VirtualMachineService_test.go
rename to test/VirtualMachineService_test.go
index 3cc9cdc..4a751ce 100644
--- a/cloudstack/VirtualMachineService_test.go
+++ b/test/VirtualMachineService_test.go
@@ -17,13 +17,15 @@
// under the License.
//
-package cloudstack
+package test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
func TestVirtualMachineService_DeployVirtualMachine(t *testing.T) {
@@ -36,7 +38,7 @@ func TestVirtualMachineService_DeployVirtualMachine(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VirtualMachine.NewDeployVirtualMachineParams("498ce071-a077-4237-9492-e55c42553327",
"50459b99-5fe0-11ea-9a56-1e006800018c", "1d8d87d4-1425-459c-8d81-c6f57dca2bd2")
params.SetName("testDummyVM")
@@ -62,7 +64,7 @@ func TestVirtualMachineService_AddNicToVirtualMachine(t *testing.T) {
fmt.Fprintf(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VirtualMachine.NewAddNicToVirtualMachineParams("30358053-0f9d-4112-9948-976477896db6",
"915653c4-298b-4d74-bdee-4ced282114f1")
resp, err := client.VirtualMachine.AddNicToVirtualMachine(params)
@@ -86,7 +88,7 @@ func TestVirtualMachineService_StopVirtualMachine(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VirtualMachine.NewStopVirtualMachineParams("915653c4-298b-4d74-bdee-4ced282114f1")
resp, err := client.VirtualMachine.StopVirtualMachine(params)
if err != nil {
@@ -109,7 +111,7 @@ func TestVirtualMachineService_StartVirtualMachine(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VirtualMachine.NewStartVirtualMachineParams("915653c4-298b-4d74-bdee-4ced282114f1")
resp, err := client.VirtualMachine.StartVirtualMachine(params)
if err != nil {
@@ -132,7 +134,7 @@ func TestVirtualMachineService_ListVirtualMachines(t *testing.T) {
fmt.Fprintln(writer, response[apiName])
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VirtualMachine.NewListVirtualMachinesParams()
params.SetId("915653c4-298b-4d74-bdee-4ced282114f1")
resp, err := client.VirtualMachine.ListVirtualMachines(params)
@@ -156,7 +158,7 @@ func TestVirtualMachineService_ScaleVirtualMachine(t *testing.T) {
fmt.Fprintln(writer, response)
}))
defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
params := client.VirtualMachine.NewScaleVirtualMachineParams("88dedd6b-4fc0-44bf-b76f-441a13bc1f99", "57aba75e-5567-44c9-bfcc-c2c14503a5a6")
resp, err := client.VirtualMachine.ScaleVirtualMachine(params)
if err != nil {
diff --git a/cloudstack/cloudstack_test.go b/test/cloudstack_test.go
similarity index 88%
rename from cloudstack/cloudstack_test.go
rename to test/cloudstack_test.go
index 23f0f8c..4ce52dd 100644
--- a/cloudstack/cloudstack_test.go
+++ b/test/cloudstack_test.go
@@ -17,7 +17,7 @@
// under the License.
//
-package cloudstack
+package test
import (
"encoding/json"
@@ -25,6 +25,8 @@ import (
"io/ioutil"
"net/http"
"testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
)
var (
@@ -35,7 +37,7 @@ var (
func ReadData(apiName string, testDataFile string) (map[string]string, error) {
var data interface{}
- apis, err := ioutil.ReadFile("testdata/" + testDataFile + "Data.json")
+ apis, err := ioutil.ReadFile("testdata/" + testDataFile + ".json")
if err != nil {
return nil, err
}
@@ -69,11 +71,13 @@ func ParseAsyncResponse(apiName string, filename string, r http.Request) (string
return "", err
}
s, _ := json.Marshal(responses[r.FormValue("command")])
+ // fmt.Println(responses)
+ fmt.Println(string(s))
return string(s), nil
}
func TestCreateAsyncClient(t *testing.T) {
- client := NewAsyncClient(CS_API_URL, CS_API_KEY, CS_SECRET_KEY, true)
+ client := cloudstack.NewAsyncClient(CS_API_URL, CS_API_KEY, CS_SECRET_KEY, true)
if client == nil {
t.Errorf("Failed to create Cloudstack Async Client")
@@ -81,7 +85,7 @@ func TestCreateAsyncClient(t *testing.T) {
}
func TestCreateSyncClient(t *testing.T) {
- client := NewClient(CS_API_URL, CS_API_KEY, CS_SECRET_KEY, true)
+ client := cloudstack.NewClient(CS_API_URL, CS_API_KEY, CS_SECRET_KEY, true)
if client == nil {
t.Errorf("Failed to create Cloudstack Client")
@@ -89,7 +93,7 @@ func TestCreateSyncClient(t *testing.T) {
}
type UUIDStruct struct {
- Value UUID `json:"value"`
+ Value cloudstack.UUID `json:"value"`
}
func TestUUID(t *testing.T) {
diff --git a/cloudstack/testdata/AccountServiceData.json b/test/testdata/AccountService.json
similarity index 100%
rename from cloudstack/testdata/AccountServiceData.json
rename to test/testdata/AccountService.json
diff --git a/cloudstack/testdata/AddressServiceData.json b/test/testdata/AddressService.json
similarity index 100%
rename from cloudstack/testdata/AddressServiceData.json
rename to test/testdata/AddressService.json
diff --git a/cloudstack/testdata/AffinityGroupServiceData.json b/test/testdata/AffinityGroupService.json
similarity index 100%
rename from cloudstack/testdata/AffinityGroupServiceData.json
rename to test/testdata/AffinityGroupService.json
diff --git a/cloudstack/testdata/ApiDiscoveryServiceData.json b/test/testdata/ApiDiscoveryService.json
similarity index 100%
rename from cloudstack/testdata/ApiDiscoveryServiceData.json
rename to test/testdata/ApiDiscoveryService.json
diff --git a/cloudstack/testdata/AsyncJobServiceData.json b/test/testdata/AsyncJobService.json
similarity index 100%
rename from cloudstack/testdata/AsyncJobServiceData.json
rename to test/testdata/AsyncJobService.json
diff --git a/cloudstack/testdata/AuthenticationServiceData.json b/test/testdata/AuthenticationService.json
similarity index 100%
rename from cloudstack/testdata/AuthenticationServiceData.json
rename to test/testdata/AuthenticationService.json
diff --git a/cloudstack/testdata/CertificateServiceData.json b/test/testdata/CertificateService.json
similarity index 100%
rename from cloudstack/testdata/CertificateServiceData.json
rename to test/testdata/CertificateService.json
diff --git a/cloudstack/testdata/ClusterServiceData.json b/test/testdata/ClusterService.json
similarity index 100%
rename from cloudstack/testdata/ClusterServiceData.json
rename to test/testdata/ClusterService.json
diff --git a/cloudstack/testdata/ConfigurationServiceData.json b/test/testdata/ConfigurationService.json
similarity index 100%
rename from cloudstack/testdata/ConfigurationServiceData.json
rename to test/testdata/ConfigurationService.json
diff --git a/cloudstack/testdata/DiskOfferingServiceData.json b/test/testdata/DiskOfferingService.json
similarity index 100%
rename from cloudstack/testdata/DiskOfferingServiceData.json
rename to test/testdata/DiskOfferingService.json
diff --git a/cloudstack/testdata/DomainServiceData.json b/test/testdata/DomainService.json
similarity index 100%
rename from cloudstack/testdata/DomainServiceData.json
rename to test/testdata/DomainService.json
diff --git a/cloudstack/testdata/FirewallServiceData.json b/test/testdata/FirewallService.json
similarity index 100%
rename from cloudstack/testdata/FirewallServiceData.json
rename to test/testdata/FirewallService.json
diff --git a/cloudstack/testdata/HostServiceData.json b/test/testdata/HostService.json
similarity index 100%
rename from cloudstack/testdata/HostServiceData.json
rename to test/testdata/HostService.json
diff --git a/cloudstack/testdata/HypervisorServiceData.json b/test/testdata/HypervisorService.json
similarity index 100%
rename from cloudstack/testdata/HypervisorServiceData.json
rename to test/testdata/HypervisorService.json
diff --git a/cloudstack/testdata/ISOServiceData.json b/test/testdata/ISOService.json
similarity index 100%
rename from cloudstack/testdata/ISOServiceData.json
rename to test/testdata/ISOService.json
diff --git a/cloudstack/testdata/ImageStoreServiceData.json b/test/testdata/ImageStoreService.json
similarity index 100%
rename from cloudstack/testdata/ImageStoreServiceData.json
rename to test/testdata/ImageStoreService.json
diff --git a/cloudstack/testdata/LimitServiceData.json b/test/testdata/LimitService.json
similarity index 100%
rename from cloudstack/testdata/LimitServiceData.json
rename to test/testdata/LimitService.json
diff --git a/cloudstack/testdata/LoadBalancerServiceData.json b/test/testdata/LoadBalancerService.json
similarity index 100%
rename from cloudstack/testdata/LoadBalancerServiceData.json
rename to test/testdata/LoadBalancerService.json
diff --git a/cloudstack/testdata/NetworkACLServiceData.json b/test/testdata/NetworkACLService.json
similarity index 100%
rename from cloudstack/testdata/NetworkACLServiceData.json
rename to test/testdata/NetworkACLService.json
diff --git a/cloudstack/testdata/NetworkOfferingServiceData.json b/test/testdata/NetworkOfferingService.json
similarity index 100%
rename from cloudstack/testdata/NetworkOfferingServiceData.json
rename to test/testdata/NetworkOfferingService.json
diff --git a/cloudstack/testdata/NetworkServiceData.json b/test/testdata/NetworkService.json
similarity index 100%
rename from cloudstack/testdata/NetworkServiceData.json
rename to test/testdata/NetworkService.json
diff --git a/cloudstack/testdata/PoolServiceData.json b/test/testdata/PoolService.json
similarity index 100%
rename from cloudstack/testdata/PoolServiceData.json
rename to test/testdata/PoolService.json
diff --git a/cloudstack/testdata/ProjectServiceData.json b/test/testdata/ProjectService.json
similarity index 100%
rename from cloudstack/testdata/ProjectServiceData.json
rename to test/testdata/ProjectService.json
diff --git a/cloudstack/testdata/ResourceTagsServiceData.json b/test/testdata/ResourceTagsService.json
similarity index 100%
rename from cloudstack/testdata/ResourceTagsServiceData.json
rename to test/testdata/ResourceTagsService.json
diff --git a/cloudstack/testdata/SSHServiceData.json b/test/testdata/SSHService.json
similarity index 100%
rename from cloudstack/testdata/SSHServiceData.json
rename to test/testdata/SSHService.json
diff --git a/cloudstack/testdata/ServiceOfferingServiceData.json b/test/testdata/ServiceOfferingService.json
similarity index 100%
rename from cloudstack/testdata/ServiceOfferingServiceData.json
rename to test/testdata/ServiceOfferingService.json
diff --git a/cloudstack/testdata/StoragePoolServiceData.json b/test/testdata/StoragePoolService.json
similarity index 100%
rename from cloudstack/testdata/StoragePoolServiceData.json
rename to test/testdata/StoragePoolService.json
diff --git a/cloudstack/testdata/TemplateServiceData.json b/test/testdata/TemplateService.json
similarity index 100%
rename from cloudstack/testdata/TemplateServiceData.json
rename to test/testdata/TemplateService.json
diff --git a/cloudstack/testdata/UserServiceData.json b/test/testdata/UserService.json
similarity index 100%
rename from cloudstack/testdata/UserServiceData.json
rename to test/testdata/UserService.json
diff --git a/cloudstack/testdata/VLANServiceData.json b/test/testdata/VLANService.json
similarity index 100%
rename from cloudstack/testdata/VLANServiceData.json
rename to test/testdata/VLANService.json
diff --git a/cloudstack/testdata/VPCServiceData.json b/test/testdata/VPCService.json
similarity index 100%
rename from cloudstack/testdata/VPCServiceData.json
rename to test/testdata/VPCService.json
diff --git a/cloudstack/testdata/VPNServiceData.json b/test/testdata/VPNService.json
similarity index 100%
rename from cloudstack/testdata/VPNServiceData.json
rename to test/testdata/VPNService.json
diff --git a/cloudstack/testdata/VirtualMachineServiceData.json b/test/testdata/VirtualMachineService.json
similarity index 100%
rename from cloudstack/testdata/VirtualMachineServiceData.json
rename to test/testdata/VirtualMachineService.json