Autogenerate tests (#32)
* Decouple tests from autogenerated code
* Autogenereate tests
* cleanup
diff --git a/cloudstack/AccountService_test.go b/cloudstack/AccountService_test.go
deleted file mode 100644
index 3e93614..0000000
--- a/cloudstack/AccountService_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestListAccounts(t *testing.T) {
- apiName := "listAccountsResponse"
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- resp, err := ReadData(apiName, "AccountService")
- if err != nil {
- t.Errorf("Failed to read response data, due to: %v", err)
- return
- }
- fmt.Fprintln(w, resp[apiName])
- }))
- defer server.Close()
-
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- p := client.Account.NewListAccountsParams()
- acc, _ := client.Account.ListAccounts(p)
- accounts := acc.Accounts
- if len(accounts) != 1 {
- t.Errorf("length: actual %d, expected 1", len(accounts))
- }
-
- if accounts[0].Name != "admin" {
- t.Errorf("name: actual %s, expected admin", accounts[0].Name)
- }
-
- if len(accounts[0].User) != 1 {
- t.Errorf("length of user: actual %d, expected 1", len(accounts[0].User))
- }
-
- if accounts[0].User[0].Username != "admin" {
- t.Errorf("username: actual %s, expected admin", accounts[0].User[0].Username)
- }
-
- if accounts[0].Accountdetails["key0"] != "value0" {
- t.Errorf("accountdetails[\"key0\"]: actual %s, expected value0", accounts[0].Accountdetails["key0"])
- }
-}
-
-func TestCreateAccounts(t *testing.T) {
- apiName := "createAccountsResponse"
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- resp, err := ReadData(apiName, "AccountService")
- if err != nil {
- t.Errorf("Failed to read response data, due to: %v", err)
- return
- }
- fmt.Fprintln(w, resp[apiName])
- }))
- defer server.Close()
-
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- email := "user01@example.com"
- firstname := "user01"
- lastname := "user01"
- password := "password"
- username := "user01"
-
- p := client.Account.NewCreateAccountParams(email, firstname, lastname, password, username)
- p.SetAccountdetails(map[string]string{"key0": "value0", "key1": "value1"})
- account, _ := client.Account.CreateAccount(p)
-
- if account.Name != "user01" {
- t.Errorf("name: actual %s, expected user01", account.Name)
- }
-
- if len(account.User) != 1 {
- t.Errorf("length of user: actual %d, expected 1", len(account.User))
- }
-
- if account.User[0].Username != "user01" {
- t.Errorf("username: actual %s, expected admin", account.User[0].Username)
- }
-
- if account.Accountdetails["key0"] != "value0" {
- t.Errorf("accountdetails[\"key0\"]: actual %s, expected value0", account.Accountdetails["key0"])
- }
-
- if account.Accountdetails["key1"] != "value1" {
- t.Errorf("accountdetails[\"key1\"]: actual %s, expected value1", account.Accountdetails["key1"])
- }
-}
diff --git a/cloudstack/AddressService_test.go b/cloudstack/AddressService_test.go
deleted file mode 100644
index e993488..0000000
--- a/cloudstack/AddressService_test.go
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestAssociateIpAddress(t *testing.T) {
- apiName := "associateIpAddress"
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- response, err := ParseAsyncResponse(apiName, "AddressService", *r)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(w, response)
- }))
-
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- p := client.Address.NewAssociateIpAddressParams()
- p.SetZoneid("2e86e486-b472-4f12-a9b2-bb73701241e0")
- ip, err := client.Address.AssociateIpAddress(p)
- if err != nil {
- t.Errorf(err.Error())
- }
-
- if ip.Ipaddress != "10.70.3.100" {
- t.Errorf("ipaddress: actual %s, expected 10.70.3.100", ip.Ipaddress)
- }
-}
-
-func TestDisassociateIpAddress(t *testing.T) {
- apiName := "disassociateIpAddress"
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- response, err := ParseAsyncResponse(apiName, "AddressService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
-
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- p := client.Address.NewDisassociateIpAddressParams("a767fbe1-ed7a-4d7c-8221-c7d736ca622d")
- address, err := client.Address.DisassociateIpAddress(p)
- if err != nil {
- t.Errorf("Failed to disassociate IP addres due to: %v", err.Error())
- return
- }
- if address.Success != true {
- t.Errorf("Failed to disassociate IP address")
- }
-}
diff --git a/cloudstack/AffinityGroupService_test.go b/cloudstack/AffinityGroupService_test.go
deleted file mode 100644
index 03104f7..0000000
--- a/cloudstack/AffinityGroupService_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestCreateAffinityGroup(t *testing.T) {
- apiName := "createAffinityGroup"
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- responses, err := ParseAsyncResponse(apiName, "AffinityGroupService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, responses)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- p := client.AffinityGroup.NewCreateAffinityGroupParams("testAffinityGroup", "host affinity")
- ag, err := client.AffinityGroup.CreateAffinityGroup(p)
- if err != nil {
- t.Errorf("Failed to disassociate IP addres due to: %v", err.Error())
- return
- }
- if ag.Name != "testAffinityGroup" {
- t.Errorf("Failed to create affinity group of name: testAffinityGroup")
- }
-}
diff --git a/cloudstack/ApiDiscoveryService_test.go b/cloudstack/ApiDiscoveryService_test.go
deleted file mode 100644
index 30e63bf..0000000
--- a/cloudstack/ApiDiscoveryService_test.go
+++ /dev/null
@@ -1,188 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestListApis_SetName(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- response := `{
- "listapisresponse": {
- "api": [
- {
- "description": "List registered keypairs",
- "isasync": false,
- "name": "listSSHKeyPairs",
- "params": [
- {
- "description": "",
- "length": 255,
- "name": "page",
- "required": false,
- "type": "integer"
- },
- {
- "description": "A key pair name to look for",
- "length": 255,
- "name": "name",
- "required": false,
- "type": "string"
- },
- {
- "description": "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false",
- "length": 255,
- "name": "listall",
- "required": false,
- "type": "boolean"
- },
- {
- "description": "list objects by project",
- "length": 255,
- "name": "projectid",
- "related": "activateProject",
- "required": false,
- "type": "uuid"
- },
- {
- "description": "list resources by account. Must be used with the domainId parameter.",
- "length": 255,
- "name": "account",
- "required": false,
- "type": "string"
- },
- {
- "description": "A public key fingerprint to look for",
- "length": 255,
- "name": "fingerprint",
- "required": false,
- "type": "string"
- },
- {
- "description": "List by keyword",
- "length": 255,
- "name": "keyword",
- "required": false,
- "type": "string"
- },
- {
- "description": "",
- "length": 255,
- "name": "pagesize",
- "required": false,
- "type": "integer"
- },
- {
- "description": "list only resources belonging to the domain specified",
- "length": 255,
- "name": "domainid",
- "related": "listDomains",
- "required": false,
- "type": "uuid"
- },
- {
- "description": "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.",
- "length": 255,
- "name": "isrecursive",
- "required": false,
- "type": "boolean"
- }
- ],
- "related": "",
- "response": [
- {},
- {
- "description": "Name of the keypair",
- "name": "name",
- "type": "string"
- },
- {
- "description": "Fingerprint of the public key",
- "name": "fingerprint",
- "type": "string"
- },
- {
- "description": "the domain name of the keypair owner",
- "name": "domain",
- "type": "string"
- },
- {
- "description": "true if the entity/resource has annotations",
- "name": "hasannotations",
- "type": "boolean"
- },
- {
- "description": "the domain id of the keypair owner",
- "name": "domainid",
- "type": "string"
- },
- {
- "description": "the current status of the latest async job acting on this object",
- "name": "jobstatus",
- "type": "integer"
- },
- {
- "description": "the UUID of the latest async job acting on this object",
- "name": "jobid",
- "type": "string"
- },
- {
- "description": "the owner of the keypair",
- "name": "account",
- "type": "string"
- },
- {},
- {
- "description": "ID of the ssh keypair",
- "name": "id",
- "type": "string"
- }
- ]
- }
- ],
- "count": 1
- }
-}`
- fmt.Fprintln(writer, response)
- }))
-
- defer server.Close()
-
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- p := client.APIDiscovery.NewListApisParams()
- p.SetName("listSSHKeyPairs")
- resp, err := client.APIDiscovery.ListApis(p)
-
- if err != nil {
- t.Errorf("Failed to fetch listSSHKeyPairs API details, due to: %s", err)
- }
-
- if resp.Count != 1 {
- t.Errorf("Failed to fetch listSSHKeyPairs API details")
- }
-
- if resp.Apis[0].Name != "listSSHKeyPairs" {
- t.Errorf("Failed to fetch listSSHKeyPairs API details")
- }
-}
diff --git a/cloudstack/AsyncJobService_test.go b/cloudstack/AsyncJobService_test.go
deleted file mode 100644
index 7e55029..0000000
--- a/cloudstack/AsyncJobService_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestListAsyncJobs(t *testing.T) {
- apiName := "listAsyncJobs"
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- response, err := ReadData(apiName, "AsyncJobService")
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
-
- defer server.Close()
-
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- p := client.Asyncjob.NewListAsyncJobsParams()
- p.SetListall(true)
- resp, err := client.Asyncjob.ListAsyncJobs(p)
- if err != nil {
- t.Errorf("Failed to fetch listAsyncJobs response, due to: %v", err)
- }
-
- if resp.Count != 1 {
- t.Errorf("Failed to fetch listAsyncJobs response")
- }
-}
diff --git a/cloudstack/AuthenticationService_test.go b/cloudstack/AuthenticationService_test.go
deleted file mode 100644
index 2295ab5..0000000
--- a/cloudstack/AuthenticationService_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestAuthenticationService_Login(t *testing.T) {
- apiName := "login"
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- loginResponse, err := ReadData(apiName, "AuthenticationService")
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, loginResponse[apiName])
- }))
- defer server.Close()
-
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- loginParams := client.Authentication.NewLoginParams("admin", "password")
- resp, err := client.Authentication.Login(loginParams)
-
- if err != nil {
- t.Errorf("Failed to login user 'admin', due to: %v", err)
- }
-
- if resp == nil {
- t.Errorf("Failed to login user 'admin'")
- }
-
- if resp.Username != "admin" {
- t.Errorf("Failed to login user 'admin'")
- }
-}
-
-func TestAuthenticationService_Logout(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "logout"
- logoutResponse, err := ReadData(apiName, "AuthenticationService")
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, logoutResponse[apiName])
- }))
-
- defer server.Close()
-
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- logoutParams := client.Authentication.NewLogoutParams()
- logoutResp, err := client.Authentication.Logout(logoutParams)
-
- if err != nil {
- t.Errorf("Failed to logout user 'admin', due to: %v", err)
- }
-
- if logoutResp.Description != "success" {
- t.Errorf("Failed to logout user 'admin'")
- }
-}
diff --git a/cloudstack/CertificateService_test.go b/cloudstack/CertificateService_test.go
deleted file mode 100644
index 7402a06..0000000
--- a/cloudstack/CertificateService_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestUploadCustomCertificate(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "uploadCustomCertificate"
- response, err := ParseAsyncResponse(apiName, "CertificateService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
-
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Certificate.NewUploadCustomCertificateParams("test", "xyz.com")
- resp, err := client.Certificate.UploadCustomCertificate(params)
-
- if err != nil {
- t.Errorf("Failed to upload custom certificate, due to: %v", err)
- }
-
- if resp.Jobstatus == 2 {
- t.Errorf("Failed to upload custom certificate")
- }
-
- if resp.Jobstatus == 1 {
- t.Log("Successfully uploaded certificate")
- }
-
-}
diff --git a/cloudstack/ClusterService_test.go b/cloudstack/ClusterService_test.go
deleted file mode 100644
index 68feed2..0000000
--- a/cloudstack/ClusterService_test.go
+++ /dev/null
@@ -1,284 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-var (
- clusterName = "TestCluster"
- clusterType = "CloudManaged"
- hypervisorType = "KVM"
- podId = "6137ef6f-753f-4e7b-a728-8d46a92358d2"
- 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"
- resp, err := ReadData(apiName, "ClusterService")
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, resp[apiName])
- }))
- defer server.Close()
-
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- params := client.Cluster.NewListClustersParams()
- params.SetZoneid(zoneId)
- clusterResp, err := client.Cluster.ListClusters(params)
- if err != nil {
- t.Errorf("Failed to list clusters in zone %s due to: %v", zoneId, err)
- }
-
- if clusterResp.Count != 3 {
- t.Errorf("Failed to list all clusters in the zone")
- }
-}
-
-func TestClusterService_DisableHAForCluster(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "disableHAForCluster"
- responses, err := ParseAsyncResponse(apiName, "ClusterService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, responses)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Cluster.NewDisableHAForClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
- resp, err := client.Cluster.DisableHAForCluster(params)
- if err != nil {
- t.Errorf("Failed to disable HA for cluster due to %v", err)
- }
-
- if !resp.Success {
- t.Errorf("Failed to disable HA for cluster")
- }
-}
-
-func TestClusterService_EnableHAForCluster(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "enableHAForCluster"
- responses, err := ParseAsyncResponse(apiName, "ClusterService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, responses)
- }))
-
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Cluster.NewEnableHAForClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
- resp, err := client.Cluster.EnableHAForCluster(params)
- if err != nil {
- t.Errorf("Failed to enable HA for cluster due to %v", err)
- }
-
- if !resp.Success {
- t.Errorf("Failed to enable HA for cluster")
- }
-}
-
-func TestClusterService_DisableOutOfBandManagementForCluster(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "disableOutOfBandManagementForCluster"
- responses, err := ParseAsyncResponse(apiName, "ClusterService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, responses)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Cluster.NewDisableOutOfBandManagementForClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
- resp, err := client.Cluster.DisableOutOfBandManagementForCluster(params)
- if err != nil {
- t.Errorf("Failed to disable Out of band management for cluster due to %v", err)
- }
-
- if resp.Enabled {
- t.Errorf("Failed to disable out of band management for cluster")
- }
-}
-
-func TestClusterService_EnableOutOfBandManagementForCluster(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "enableOutOfBandManagementForCluster"
- responses, err := ParseAsyncResponse(apiName, "ClusterService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, responses)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Cluster.NewEnableOutOfBandManagementForClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
- resp, err := client.Cluster.EnableOutOfBandManagementForCluster(params)
- if err != nil {
- t.Errorf("Failed to enable Out of band management for cluster due to %v", err)
- }
-
- if !resp.Enabled {
- t.Errorf("Failed to enable out of band management for cluster")
- }
-}
-
-func TestClusterService_DedicateCluster(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "dedicateCluster"
- responses, err := ParseAsyncResponse(apiName, "ClusterService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, responses)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Cluster.NewDedicateClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15", "e4874e10-5fdf-11ea-9a56-1e006800018c")
- resp, err := client.Cluster.DedicateCluster(params)
- if err != nil {
- t.Errorf("Failed to dedicate cluster to ROOT domain due to %v", err)
- }
-
- if resp.Domainid != "e4874e10-5fdf-11ea-9a56-1e006800018c" {
- t.Errorf("Failed to dedicate cluster to right domain")
- }
-}
-
-func TestClusterService_ReleaseDedicatedCluster(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "releaseDedicatedCluster"
- responses, err := ParseAsyncResponse(apiName, "ClusterService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, responses)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Cluster.NewReleaseDedicatedClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
- resp, err := client.Cluster.ReleaseDedicatedCluster(params)
- if err != nil {
- t.Errorf("Failed to release dedicated cluster to ROOT domain due to %v", err)
- }
-
- if !resp.Success {
- t.Errorf("Failed to release dedicated cluster to right domain")
- }
-}
-
-func TestClusterService_UpdateCluster(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "updateCluster"
- response, err := ReadData(apiName, "ClusterService")
- if err != nil {
- t.Errorf("Failed to read response data, due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Cluster.NewUpdateClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
- params.SetClustername("TestClusterUpdated")
- params.SetManagedstate("Unmanaged")
- resp, err := client.Cluster.UpdateCluster(params)
- if err != nil {
- t.Errorf("Failed to updated cluster details - name, due to: %v", err)
- }
-
- if resp.Name != "TestClusterUpdated" {
- t.Errorf("Failed to updated cluster name")
- }
-}
-
-func TestClusterService_DeleteCluster(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteCluster"
- response, err := ReadData(apiName, "ClusterService")
- if err != nil {
- t.Errorf("Failed to read response data, due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Cluster.NewDeleteClusterParams("f1f5a259-1b55-431d-ad7e-6d39c28f1b15")
- resp, err := client.Cluster.DeleteCluster(params)
- if err != nil {
- t.Errorf("Failed to delete cluster due to: %v", err)
- }
-
- if !resp.Success {
- t.Errorf("Failed to delete cluster")
- }
-
-}
diff --git a/cloudstack/ConfigurationService_test.go b/cloudstack/ConfigurationService_test.go
deleted file mode 100644
index 00d1053..0000000
--- a/cloudstack/ConfigurationService_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestConfigurationService_ListCapabilities(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- apiName := "listCapabilities"
- resp, err := ReadData(apiName, "ConfigurationService")
- if err != nil {
- t.Errorf("Failed to read response data, due to: %v", err)
- }
- fmt.Fprintf(w, resp[apiName])
- }))
- defer server.Close()
-
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- p := client.Configuration.NewListCapabilitiesParams()
- resp, err := client.Configuration.ListCapabilities(p)
- if err != nil {
- t.Errorf("Failed to list capabilities due to: %v", err)
- }
-
- if resp == nil {
- t.Errorf("Failed to list capabilities")
- }
-}
-
-func TestConfigurationService_ListConfigurations(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- apiName := "listConfigurations"
- resp, err := ReadData(apiName, "ConfigurationService")
- if err != nil {
- t.Errorf("Failed to read response data, due to: %v", err)
- }
- fmt.Fprintf(w, resp[apiName])
- }))
- client := newClient(server.URL, "APIKEY", "SECRETKEY", true, true)
- p := client.Configuration.NewListConfigurationsParams()
- p.SetName("allow.user.create.projects")
- resp, err := client.Configuration.ListConfigurations(p)
- if err != nil {
- t.Errorf("Failed to list configuration details due to: %v", err)
- }
- if resp.Count != 1 {
- t.Errorf("Failed to list configuration details")
- }
-}
-
-func TestConfigurationService_UpdateConfigurations(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- apiName := "updateConfiguration"
- resp, err := ReadData(apiName, "ConfigurationService")
- if err != nil {
- t.Errorf("Failed to read response data, due to: %v", err)
- }
- fmt.Fprintf(w, resp[apiName])
- }))
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- p := client.Configuration.NewUpdateConfigurationParams("allow.user.create.projects")
- p.SetValue("false")
- resp, err := client.Configuration.UpdateConfiguration(p)
- if err != nil {
- t.Errorf("Failed to update configuration due to: %v", err)
- }
- if resp.Value != "false" {
- t.Errorf("Failed to update configuration")
- }
-}
diff --git a/cloudstack/DiskOfferingService_test.go b/cloudstack/DiskOfferingService_test.go
deleted file mode 100644
index 69cbfff..0000000
--- a/cloudstack/DiskOfferingService_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestDiskOfferingService_CreateDiskOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createDiskOffering"
- response, err := ReadData(apiName, "DiskOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.DiskOffering.NewCreateDiskOfferingParams("test", "test")
- resp, err := client.DiskOffering.CreateDiskOffering(params)
- if err != nil {
- t.Errorf("Failed to create disk offering due to: %v", err)
- }
-
- if resp == nil {
- t.Errorf("Failed to create disk offering")
- }
-}
-
-func TestDiskOfferingService_ListDiskOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listDiskOfferings"
- response, err := ReadData(apiName, "DiskOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.DiskOffering.NewListDiskOfferingsParams()
- params.SetId("7662b6ae-f00b-4268-973f-f3f87eaf82c5")
- resp, err := client.DiskOffering.ListDiskOfferings(params)
- if err != nil {
- t.Errorf("Failed to list disk offering due to: %v", err)
- }
-
- if resp.Count != 1 {
- t.Errorf("Failed to list disk offering")
- }
-}
-
-func TestDiskOfferingService_DeleteDiskOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteDiskOffering"
- response, err := ReadData(apiName, "DiskOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.DiskOffering.NewDeleteDiskOfferingParams("7662b6ae-f00b-4268-973f-f3f87eaf82c5")
- resp, err := client.DiskOffering.DeleteDiskOffering(params)
- if err != nil {
- t.Errorf("Failed to delete disk offering due to : %v", err)
- }
- if !resp.Success {
- t.Errorf("Failed to delete disk offering")
- }
-}
diff --git a/cloudstack/DomainService_test.go b/cloudstack/DomainService_test.go
deleted file mode 100644
index 0c34364..0000000
--- a/cloudstack/DomainService_test.go
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestDomainService_CreateDomain(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createDomain"
- response, err := ReadData(apiName, "DomainService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Domain.NewCreateDomainParams("testDomain")
- params.SetParentdomainid("e4874e10-5fdf-11ea-9a56-1e006800018c")
- resp, err := client.Domain.CreateDomain(params)
- if err != nil {
- t.Errorf("Failed to create domain due to: %v", err)
- }
-
- if resp.Name != "testDomain" {
- t.Errorf("Failed to create domain")
- }
-}
-
-func TestDomainService_UpdateDomain(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "updateDomain"
- response, err := ReadData(apiName, "DomainService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Domain.NewUpdateDomainParams("ee05fd92-7365-4421-a15b-abfa11dfc4f6")
- params.SetName("testDomainUpdated")
- resp, err := client.Domain.UpdateDomain(params)
- if err != nil {
- t.Errorf("Failed to update domain name due to: %v", err)
- }
-
- if resp.Name != "testDomainUpdated" {
- t.Errorf("Failed to update domain name")
- }
-}
-
-func TestDomainService_ListDomains(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listDomains"
- response, err := ReadData(apiName, "DomainService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Domain.NewListDomainsParams()
- params.SetId("097d3992-7a67-42e1-afb5-b4d2d81e280f")
- resp, err := client.Domain.ListDomains(params)
- if err != nil {
- t.Errorf("Failed to list specific domain details due to: %v", err)
- }
- if resp.Count != 1 {
- t.Errorf("Failed to list specific domain details")
- }
- if resp.Domains[0].Name != "DummyDomain" {
- t.Errorf("Failed to fetch details of specific domain")
- }
-}
-
-func TestDomainService_ListDomainChildren(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listDomainChildren"
- response, err := ReadData(apiName, "DomainService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Domain.NewListDomainChildrenParams()
- params.SetId("99becf06-7f0f-4eb4-bdc3-44fecb8cb829")
- resp, err := client.Domain.ListDomainChildren(params)
- if err != nil {
- t.Errorf("Failed to list specific domain's children due to: %v", err)
- }
- if resp.Count != 1 {
- t.Errorf("Failed to list specific domain's children ")
- }
-}
-
-func TestDomainService_DeleteDomain(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteDomain"
- response, err := ParseAsyncResponse(apiName, "DomainService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Domain.NewDeleteDomainParams("ee05fd92-7365-4421-a15b-abfa11dfc4f6")
- resp, err := client.Domain.DeleteDomain(params)
- if err != nil {
- t.Errorf("Failed to delete domain due to: %v", err)
- }
- if !resp.Success {
- t.Errorf("Failed to delete domain")
- }
-}
diff --git a/cloudstack/ExtFirewallService.go b/cloudstack/ExtFirewallService.go
deleted file mode 100644
index 4676b3e..0000000
--- a/cloudstack/ExtFirewallService.go
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package cloudstack
diff --git a/cloudstack/ExtFirewallService_mock.go b/cloudstack/ExtFirewallService_mock.go
deleted file mode 100644
index 601b0b4..0000000
--- a/cloudstack/ExtFirewallService_mock.go
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-// Code generated by MockGen. DO NOT EDIT.
-// Source: ./cloudstack/ExtFirewallService.go
-
-// Package cloudstack is a generated GoMock package.
-package cloudstack
diff --git a/cloudstack/ExtLoadBalancerService.go b/cloudstack/ExtLoadBalancerService.go
deleted file mode 100644
index 4676b3e..0000000
--- a/cloudstack/ExtLoadBalancerService.go
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package cloudstack
diff --git a/cloudstack/ExtLoadBalancerService_mock.go b/cloudstack/ExtLoadBalancerService_mock.go
deleted file mode 100644
index 245d4c1..0000000
--- a/cloudstack/ExtLoadBalancerService_mock.go
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-// Code generated by MockGen. DO NOT EDIT.
-// Source: ./cloudstack/ExtLoadBalancerService.go
-
-// Package cloudstack is a generated GoMock package.
-package cloudstack
diff --git a/cloudstack/ExternalDeviceService.go b/cloudstack/ExternalDeviceService.go
deleted file mode 100644
index 4676b3e..0000000
--- a/cloudstack/ExternalDeviceService.go
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package cloudstack
diff --git a/cloudstack/ExternalDeviceService_mock.go b/cloudstack/ExternalDeviceService_mock.go
deleted file mode 100644
index 7535c52..0000000
--- a/cloudstack/ExternalDeviceService_mock.go
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-// Code generated by MockGen. DO NOT EDIT.
-// Source: ./cloudstack/ExternalDeviceService.go
-
-// Package cloudstack is a generated GoMock package.
-package cloudstack
diff --git a/cloudstack/FirewallService_test.go b/cloudstack/FirewallService_test.go
deleted file mode 100644
index abfd1af..0000000
--- a/cloudstack/FirewallService_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestFirewallService_CreateFirewallRule(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createFirewallRule"
- response, err := ParseAsyncResponse(apiName, "FirewallService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Firewall.NewCreateFirewallRuleParams("192.168.2.4", "tcp")
- resp, err := client.Firewall.CreateFirewallRule(params)
- if err != nil {
- t.Errorf("Failed to create firewall rule due to: %v", err)
- }
- if resp.Ipaddress != "192.168.2.4" {
- t.Errorf("Failed to create firewall rule")
- }
-
- if resp.State != "Active" {
- t.Errorf("Failed to create firewall rule")
- }
-}
-
-func TestFirewallService_DeleteFirewallRule(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteFirewallRule"
- response, err := ParseAsyncResponse(apiName, "FirewallService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Firewall.NewDeleteFirewallRuleParams("fb4ad2ee-02c8-433e-a769-6f18afddc750")
- resp, err := client.Firewall.DeleteFirewallRule(params)
- if err != nil {
- t.Errorf("Failed to delete firewall rule due to: %v", err)
- }
- if !resp.Success {
- t.Errorf("Failed to delete firewall rule")
- }
-}
-
-func TestFirewallService_CreateEgressFirewallRule(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createEgressFirewallRule"
- response, err := ParseAsyncResponse(apiName, "FirewallService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Firewall.NewCreateEgressFirewallRuleParams("c4a3303c-376d-4d56-b336-1bd91cb130b6", "tcp")
- resp, err := client.Firewall.CreateEgressFirewallRule(params)
- if err != nil {
- t.Errorf("Failed to create egress firewall rule due to: %v", err)
- }
-
- if resp.State != "Active" {
- t.Errorf("Failed to create egress firewall rule")
- }
-}
-
-func TestFirewallService_DeleteEgressFirewallRule(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteEgressFirewallRule"
- response, err := ParseAsyncResponse(apiName, "FirewallService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Firewall.NewDeleteEgressFirewallRuleParams("fb4ad2ee-02c8-433e-a769-6f18afddc750")
- resp, err := client.Firewall.DeleteEgressFirewallRule(params)
- if err != nil {
- t.Errorf("Failed to delete egress firewall rule due to: %v", err)
- }
- if !resp.Success {
- t.Errorf("Failed to delete egress firewall rule")
- }
-}
diff --git a/cloudstack/HostService_test.go b/cloudstack/HostService_test.go
deleted file mode 100644
index 6d4acc2..0000000
--- a/cloudstack/HostService_test.go
+++ /dev/null
@@ -1,181 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestHostService_AddHost(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "addHost"
- response, err := ReadData(apiName, "HostService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
-
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- 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)
- if err != nil {
- t.Errorf("Failed to add host due to: %v", err)
- return
- }
-
- if resp == nil {
- t.Errorf("Failed to add host")
- }
-}
-
-func TestHostService_ListHosts(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listHosts"
- response, err := ReadData(apiName, "HostService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Host.NewListHostsParams()
- resp, err := client.Host.ListHosts(params)
- if err != nil {
- t.Errorf("Failed to add host due to: %v", err)
- return
- }
- if resp.Count != 1 {
- t.Errorf("Failed to add host")
- }
-}
-
-func TestHostService_PrepareHostForMaintenance(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "prepareHostForMaintenance"
- response, err := ParseAsyncResponse(apiName, "HostService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Host.NewPrepareHostForMaintenanceParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
- resp, err := client.Host.PrepareHostForMaintenance(params)
- if err != nil {
- t.Errorf("Failed to prepare host for maintenance due to: %v", err)
- return
- }
- if resp.Resourcestate != "PrepareForMaintenance" {
- t.Errorf("Failed to prepare host for maintenance")
- }
-}
-
-func TestHostService_CancelHostForMaintenance(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "cancelHostForMaintenance"
- response, err := ParseAsyncResponse(apiName, "HostService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Host.NewCancelHostMaintenanceParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
- resp, err := client.Host.CancelHostMaintenance(params)
- if err != nil {
- t.Errorf("Failed to cancel host for maintenance due to: %v", err)
- return
- }
- if resp.Resourcestate != "Enabled" {
- t.Errorf("Failed to cancel host for maintenance")
- }
-}
-
-func TestHostService_EnableOutOfBandManagementForHost(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "enableOutOfBandManagementForHost"
- response, err := ParseAsyncResponse(apiName, "HostService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Host.NewEnableOutOfBandManagementForHostParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
- resp, err := client.Host.EnableOutOfBandManagementForHost(params)
- if err != nil {
- t.Errorf("Failed to enable out of band management for due to: %v", err)
- }
- if !resp.Enabled {
- t.Errorf("Failed to enable out of band management")
- }
-}
-
-func TestHostService_DisableOutOfBandManagementForHost(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "disableOutOfBandManagementForHost"
- response, err := ParseAsyncResponse(apiName, "HostService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Host.NewDisableOutOfBandManagementForHostParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
- resp, err := client.Host.DisableOutOfBandManagementForHost(params)
- if err != nil {
- t.Errorf("Failed to disable out of band management for due to: %v", err)
- }
- if resp.Enabled {
- t.Errorf("Failed to disable out of band management")
- }
-}
-
-func TestHostService_EnableHAForHost(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "enableHAForHost"
- response, err := ParseAsyncResponse(apiName, "HostService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Host.NewEnableHAForHostParams("8e8e68e7-19ea-4a78-bbdb-6e79d27729c9")
- resp, err := client.Host.EnableHAForHost(params)
- if err != nil {
- t.Errorf("Failed to enable HA for due to: %v", err)
- }
- if !resp.Haenable {
- t.Errorf("Failed to enable HA for host")
- }
-}
diff --git a/cloudstack/HypervisorService_test.go b/cloudstack/HypervisorService_test.go
deleted file mode 100644
index 92ebf9e..0000000
--- a/cloudstack/HypervisorService_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestHypervisorService_ListSpecificHypervisorCapabilities(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listHypervisorCapabilities"
- response, err := ReadData(apiName, "HypervisorService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Hypervisor.NewListHypervisorCapabilitiesParams()
- params.SetId("1")
- resp, err := client.Hypervisor.ListHypervisorCapabilities(params)
- if err != nil {
- t.Errorf("Failed to list hypervisor capabilities due to: %v", err)
- return
- }
-
- if resp.Count != 1 {
- t.Errorf("Failed list specific hypervisor capability")
- }
-}
diff --git a/cloudstack/ISOService_test.go b/cloudstack/ISOService_test.go
deleted file mode 100644
index 4460b64..0000000
--- a/cloudstack/ISOService_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestISOService_RegisterIso(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "registerIso"
- response, err := ReadData(apiName, "ISOService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- 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)
- if err != nil {
- t.Errorf("Failed to register ISO due to: %v", err)
- return
- }
-
- if resp == nil {
- t.Errorf("Failed to register template")
- }
-}
diff --git a/cloudstack/ImageStoreService_test.go b/cloudstack/ImageStoreService_test.go
deleted file mode 100644
index 3c82e5f..0000000
--- a/cloudstack/ImageStoreService_test.go
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestImageStoreService_AddImageStore(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "addImageStore"
- response, err := ReadData(apiName, "ImageStoreService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.ImageStore.NewAddImageStoreParams("NFS")
- resp, err := client.ImageStore.AddImageStore(params)
- if err != nil {
- t.Errorf("Failed to add image store due to: %v", err)
- return
- }
-
- if resp == nil || resp.Providername != "NFS" {
- t.Errorf(" Failed to add image store")
- }
-}
-
-func TestImageStoreService_ListImageStores(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listImageStores"
- response, err := ReadData(apiName, "ImageStoreService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.ImageStore.NewListImageStoresParams()
- resp, err := client.ImageStore.ListImageStores(params)
- if err != nil {
- t.Errorf("Failed to list image stores due to: %v", err)
- return
- }
-
- if resp == nil || resp.Count != 1 {
- t.Errorf(" Failed to list image stores")
- }
-}
-
-func TestImageStoreService_DeleteImageStore(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteImageStore"
- response, err := ReadData(apiName, "ImageStoreService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.ImageStore.NewDeleteImageStoreParams("0ac85364-e31a-4840-97a4-a237b4291dfa")
- resp, err := client.ImageStore.DeleteImageStore(params)
- if err != nil {
- t.Errorf("Failed to delete image store due to: %v", err)
- return
- }
-
- if resp == nil || !resp.Success {
- t.Errorf(" Failed to delete image store")
- }
-}
diff --git a/cloudstack/LimitService_test.go b/cloudstack/LimitService_test.go
deleted file mode 100644
index 81aa2e0..0000000
--- a/cloudstack/LimitService_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestLimitService_ResetApiLimit(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "resetApiLimit"
- response, err := ReadData(apiName, "LimitService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Limit.NewResetApiLimitParams()
- resp, err := client.Limit.ResetApiLimit(params)
- if err != nil {
- t.Errorf("Failed to reset API Params limit due to: %v", err)
- return
- }
-
- if resp == nil {
- t.Errorf("Failed to register template")
- }
-}
diff --git a/cloudstack/LoadBalancerService_test.go b/cloudstack/LoadBalancerService_test.go
deleted file mode 100644
index 6256fe9..0000000
--- a/cloudstack/LoadBalancerService_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestLoadBalancerService_CreateLoadBalancerRule(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createLoadBalancerRule"
- response, err := ParseAsyncResponse(apiName, "LoadBalancerService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.LoadBalancer.NewCreateLoadBalancerRuleParams("roundrobin", "testLBRule", 9090, 9090)
- params.SetProtocol("tcp")
- params.SetNetworkid("cc39d938-5ea0-4d9c-b89d-421da3274e54")
- params.SetPublicipid("bab02a09-1244-4235-a938-150e75e04ce0")
- resp, err := client.LoadBalancer.CreateLoadBalancerRule(params)
- if err != nil {
- t.Errorf("Failed to create load balancer rule due to: %v", err)
- }
- if resp.Name != "testLBRule" {
- t.Errorf("Failed to create load balancer rule")
- }
-}
-
-func TestLoadBalancerService_AssignLoadBalancerRule(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "assignLoadBalancerRule"
- response, err := ParseAsyncResponse(apiName, "LoadBalancerService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.LoadBalancer.NewAssignToLoadBalancerRuleParams("be6294cc-8f99-42c8-970d-f54c511972a3")
- vmIpMap := make(map[string]string)
- vmIpMap["vmid"] = "c7749abf-fadb-4658-9346-bbef95a2456f"
- vmIpMap["vmip"] = "10.1.1.178"
- params.SetVmidipmap(vmIpMap)
- resp, err := client.LoadBalancer.AssignToLoadBalancerRule(params)
- if err != nil {
- t.Errorf("Failed to assign vm to loadbalancer rule due to: %v", err)
- return
- }
-
- if resp == nil {
- t.Errorf("Failed to assign vm to loadbalancer rule")
- }
-}
diff --git a/cloudstack/NetworkACLService_test.go b/cloudstack/NetworkACLService_test.go
deleted file mode 100644
index b9023aa..0000000
--- a/cloudstack/NetworkACLService_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestNetworkACLService_UpdateNetworkACLList(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "updateNetworkACLList"
- response, err := ParseAsyncResponse(apiName, "NetworkACLService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.NetworkACL.NewUpdateNetworkACLListParams("a31e11a0-57fe-41df-be7a-34d359673061")
- resp, err := client.NetworkACL.UpdateNetworkACLList(params)
- if err != nil {
- t.Errorf("Failed to update Network ACL list due to: %v", err)
- }
- if resp == nil {
- t.Errorf("Failed to update Network ACL list ")
- }
-}
diff --git a/cloudstack/NetworkOfferingService_test.go b/cloudstack/NetworkOfferingService_test.go
deleted file mode 100644
index 98e5f00..0000000
--- a/cloudstack/NetworkOfferingService_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestNetworkOfferingService_CreateNetworkOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createNetworkOffering"
- response, err := ReadData(apiName, "NetworkOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.NetworkOffering.NewCreateNetworkOfferingParams("testNetOffering", "L2", "testNetOffering", "Guest")
- resp, err := client.NetworkOffering.CreateNetworkOffering(params)
- if err != nil {
- t.Errorf("Failed to create network offering due to: %v", err)
- }
- if resp.Name != "testNetOffering" {
- t.Errorf("Failed to create network offering")
- }
-}
-
-func TestNetworkOfferingService_UpdateNetworkOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "updateNetworkOffering"
- response, err := ReadData(apiName, "NetworkOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.NetworkOffering.NewUpdateNetworkOfferingParams()
- params.SetState("Enabled")
- resp, err := client.NetworkOffering.UpdateNetworkOffering(params)
- if err != nil {
- t.Errorf("Failed to update network offering state due to: %v", err)
- }
-
- if resp.State != "Enabled" {
- t.Errorf("Failed to enable network offering")
- }
-}
-
-func TestNetworkOfferingService_ListNetworkOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listNetworkOfferings"
- response, err := ReadData(apiName, "NetworkOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.NetworkOffering.NewListNetworkOfferingsParams()
- params.SetId("c2000683-68fd-437e-a4cf-f3676e1d18c1")
- resp, err := client.NetworkOffering.ListNetworkOfferings(params)
- if err != nil {
- t.Errorf("Failed to list network offering due to: %v", err)
- }
-
- if resp.Count != 1 {
- t.Errorf("Failed to list network offering")
- }
-}
-
-func TestNetworkOfferingService_DeleteNetworkOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteNetworkOffering"
- response, err := ReadData(apiName, "NetworkOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.NetworkOffering.NewDeleteNetworkOfferingParams("c2000683-68fd-437e-a4cf-f3676e1d18c1")
- resp, err := client.NetworkOffering.DeleteNetworkOffering(params)
- if err != nil {
- t.Errorf("Failed to delete network offering due to: %v", err)
- }
-
- if !resp.Success {
- t.Errorf("Failed to list network offering")
- }
-}
diff --git a/cloudstack/NetworkService_test.go b/cloudstack/NetworkService_test.go
deleted file mode 100644
index 18f7508..0000000
--- a/cloudstack/NetworkService_test.go
+++ /dev/null
@@ -1,156 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestNetworkService_CreateNetwork(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createNetwork"
- response, err := ReadData(apiName, "NetworkService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- 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 {
- t.Errorf("Failed to create network due to: %v", err)
- }
- if resp == nil || resp.Name != "testIsolatedNet" {
- t.Errorf("Failed to create network")
- }
-}
-
-func TestNetworkService_ListNetworks(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listNetworks"
- response, err := ReadData(apiName, "NetworkService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Network.NewListNetworksParams()
- params.SetId("eb9c270d-dd66-443b-9524-ada1eff4442a")
- resp, err := client.Network.ListNetworks(params)
- if err != nil {
- t.Errorf("Failed to list specific network details due to : %v", err)
- }
- if resp.Count != 1 {
- t.Errorf("Failed to list specific network details")
- }
- if resp.Networks[0].Id != "eb9c270d-dd66-443b-9524-ada1eff4442a" {
- t.Errorf("Failed to list specific network details")
- }
-}
-
-func TestNetworkService_DeleteNetwork(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteNetwork"
- response, err := ParseAsyncResponse(apiName, "NetworkService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Network.NewDeleteNetworkParams("eb9c270d-dd66-443b-9524-ada1eff4442a")
- resp, err := client.Network.DeleteNetwork(params)
- if err != nil {
- t.Errorf("Failed to delete network due to: %v", err)
- return
- }
- if resp == nil || !resp.Success {
- t.Errorf("Failed to delete network")
- }
-}
-
-//func TestNetworkService_RestartNetworkWithCleanUp(t *testing.T) {
-// server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
-// responses := map[string]string{
-// "restartNetwork": `{
-// "restartnetworkresponse": {
-// "jobid": "09b1ab5d-02d0-410f-b373-6520962b98eb"
-// }
-// }`,
-// "queryAsyncJobResult": `{
-// "queryasyncjobresultresponse": {
-// "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
-// "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
-// "cmd": "org.apache.cloudstack.api.command.user.network.RestartNetworkCmd",
-// "jobstatus": 1,
-// "jobprocstatus": 0,
-// "jobresultcode": 0,
-// "jobresulttype": "object",
-// "jobresult": {
-// "success": true
-// },
-// "created": "2021-10-04T05:37:23+0000",
-// "completed": "2021-10-04T05:37:41+0000",
-// "jobid": "09b1ab5d-02d0-410f-b373-6520962b98eb"
-// }
-// }`,
-// }
-// fmt.Fprintf(writer, responses[request.FormValue("command")])
-// }))
-// defer server.Close()
-// client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
-// params := client.Network.NewRestartNetworkParams("30358053-0f9d-4112-9948-976477896db6")
-// params.SetCleanup(true)
-// _, err := client.Network.RestartNetwork(params)
-// if err != nil {
-// t.Errorf("Failed to restart network with cleanup due to: %v", err)
-// return
-// }
-//}
-
-func TestNetworkService_CreatePhysicalNetwork(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createPhysicalNetwork"
- response, err := ParseAsyncResponse(apiName, "NetworkService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Network.NewCreatePhysicalNetworkParams("testPhyNet", "d4a81f75-5d92-415e-ab59-e85cc2ce56d9")
- resp, err := client.Network.CreatePhysicalNetwork(params)
- if err != nil {
- t.Errorf("Failed to create physical network due to: %v", err)
- return
- }
- if resp == nil || resp.Name != "testPhyNet" {
- t.Errorf("Failed to create physical network")
- }
-}
diff --git a/cloudstack/PoolService_test.go b/cloudstack/PoolService_test.go
deleted file mode 100644
index c0f8993..0000000
--- a/cloudstack/PoolService_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestPoolService_CreateStoragePool(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "createStoragePool"
- response, err := ReadData(apiName, "PoolService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := 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 {
- t.Errorf("Failed to create storage pool due to %v", err)
- return
- }
-
- if resp == nil || resp.Name != "testPrimary1" {
- t.Errorf("Failed to create storage pool")
- }
-}
-
-func TestPoolService_ListStoragePools(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "listStoragePools"
- response, err := ReadData(apiName, "PoolService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.Pool.NewListStoragePoolsParams()
- params.SetId("3fd44942-4881-3fb0-95f1-5d7b7ae64cfb")
- resp, err := client.Pool.ListStoragePools(params)
- if err != nil {
- t.Errorf("Failed to list storage pool details due to %v", err)
- return
- }
-
- if resp == nil || resp.Count != 1 {
- t.Errorf("Failed to list storage pool")
- }
-}
-
-func TestPoolService_DeleteStoragePool(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "deleteStoragePool"
- response, err := ReadData(apiName, "PoolService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.Pool.NewDeleteStoragePoolParams("3fd44942-4881-3fb0-95f1-5d7b7ae64cfb")
- resp, err := client.Pool.DeleteStoragePool(params)
- if err != nil {
- t.Errorf("Failed to delete storage pool details due to %v", err)
- return
- }
-
- if resp == nil || !resp.Success {
- t.Errorf("Failed to delete storage pool")
- }
-}
diff --git a/cloudstack/ProjectService_test.go b/cloudstack/ProjectService_test.go
deleted file mode 100644
index 8d65869..0000000
--- a/cloudstack/ProjectService_test.go
+++ /dev/null
@@ -1,142 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestProjectService_CreateProject(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createProject"
- response, err := ParseAsyncResponse(apiName, "ProjectService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Project.NewCreateProjectParams("testProject", "testProject")
- resp, err := client.Project.CreateProject(params)
- if err != nil {
- t.Errorf("Failed to create Project due to: %v", err)
- return
- }
- if resp == nil || resp.Name != "testProject" {
- t.Errorf("Failed to create project")
- }
-}
-
-func TestProjectService_ActivateProject(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "activateProject"
- response, err := ParseAsyncResponse(apiName, "ProjectService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Project.NewActivateProjectParams("99a842a4-e50f-4265-8ca7-249959506c13")
- resp, err := client.Project.ActivateProject(params)
- if err != nil {
- t.Errorf("Failed to activate Project due to: %v", err)
- return
- }
- if resp == nil || resp.Id != "99a842a4-e50f-4265-8ca7-249959506c13" || resp.State != "Active" {
- t.Errorf("Failed to activate project")
- }
-}
-
-func TestProjectService_SuspendProject(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "suspendProject"
- response, err := ParseAsyncResponse(apiName, "ProjectService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Project.NewSuspendProjectParams("99a842a4-e50f-4265-8ca7-249959506c13")
- resp, err := client.Project.SuspendProject(params)
- if err != nil {
- t.Errorf("Failed to suspend Project due to: %v", err)
- return
- }
- if resp == nil || resp.Id != "99a842a4-e50f-4265-8ca7-249959506c13" || resp.State != "Suspended" {
- t.Errorf("Failed to suspend project")
- }
-}
-
-func TestProjectService_UpdateProject(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "updateProject"
- response, err := ParseAsyncResponse(apiName, "ProjectService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Project.NewUpdateProjectParams("99a842a4-e50f-4265-8ca7-249959506c13")
- params.SetDisplaytext("testProjectUpdated")
- resp, err := client.Project.UpdateProject(params)
- if err != nil {
- t.Errorf("Failed to update Project details due to: %v", err)
- return
- }
-
- if resp == nil || resp.Id != "69646881-8d7f-4800-987d-106698a42608" || resp.Displaytext != "testProjectUpdate" {
- t.Errorf("Failed to update project name")
- }
-}
-
-func TestProjectService_listProjectRolePermissions(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "listProjectRolePermissions"
- response, err := ReadData(apiName, "ProjectService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewAsyncClient(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)
- if err != nil {
- t.Errorf("Failed to list project role permissions due to %v", err)
- return
- }
-
- fmt.Println(resp)
- if resp == nil || resp.Count != 1 {
- t.Errorf("Failed to list VM")
- }
-}
diff --git a/cloudstack/ResourcetagsService_test.go b/cloudstack/ResourcetagsService_test.go
deleted file mode 100644
index 30404d4..0000000
--- a/cloudstack/ResourcetagsService_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestResourcetagsService_CreateTags(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createTags"
- response, err := ParseAsyncResponse(apiName, "ResourceTagsService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- tags := make(map[string]string)
- tags["key"] = "testKey"
- tags["value"] = "testValue"
- params := client.Resourcetags.NewCreateTagsParams([]string{"99a842a4-e50f-4265-8ca7-249959506c13"}, "Project", tags)
- resp, err := client.Resourcetags.CreateTags(params)
- if err != nil {
- t.Errorf("Failed to create tags for project due to: %v", err)
- return
- }
-
- if resp == nil || !resp.Success {
- t.Errorf("Failed to create project tags")
- }
-}
-
-func TestResourcetagsService_DeleteTags(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteTags"
- response, err := ParseAsyncResponse(apiName, "ResourceTagsService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.Resourcetags.NewDeleteTagsParams([]string{"99a842a4-e50f-4265-8ca7-249959506c13"}, "Project")
- resp, err := client.Resourcetags.DeleteTags(params)
- if err != nil {
- t.Errorf("Failed to delete tags for project due to: %v", err)
- return
- }
-
- if resp == nil || !resp.Success {
- t.Errorf("Failed to delete project tags")
- }
-}
diff --git a/cloudstack/SSHService_test.go b/cloudstack/SSHService_test.go
deleted file mode 100644
index 6fd01f7..0000000
--- a/cloudstack/SSHService_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestSSHService_CreateSSHKeyPair(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "createSSHKeyPair"
- response, err := ReadData(apiName, "SSHService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.SSH.NewCreateSSHKeyPairParams("testSSHKey")
- resp, err := client.SSH.CreateSSHKeyPair(params)
- if err != nil {
- t.Errorf("Failed to create SSH key pair due to %v", err)
- return
- }
- if resp == nil || resp.Name != "testSSHKey" {
- t.Errorf("Failed to create SSH key pair")
- }
-}
-
-func TestSSHService_ListSSHKeyPairs(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "listSSHKeyPairs"
- response, err := ReadData(apiName, "SSHService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.SSH.NewListSSHKeyPairsParams()
- params.SetName("testSSHKey")
- resp, err := client.SSH.ListSSHKeyPairs(params)
- if err != nil {
- t.Errorf("Failed to list SSH key pair due to %v", err)
- return
- }
- if resp == nil || resp.Count != 1 {
- t.Errorf("Failed to list SSH key pair")
- }
-}
-
-func TestSSHService_ResetSSHKeyForVirtualMachine(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "resetSSHKeyForVirtualMachine"
- response, err := ParseAsyncResponse(apiName, "SSHService", *r)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.SSH.NewResetSSHKeyForVirtualMachineParams("8aa29529-b238-45f3-8992-5befadcd8bb0", "testSSHKey")
- resp, err := client.SSH.ResetSSHKeyForVirtualMachine(params)
- if err != nil {
- t.Errorf("Failed to reset SSH key pair for VM due to %v", err)
- return
- }
- if resp == nil || resp.Keypair != "testSSHKey" {
- t.Errorf("Failed to reset SSH key pair for VM")
- }
-}
-
-func TestSSHService_DeleteSSHKeyPair(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "deleteSSHKeyPair"
- response, err := ReadData(apiName, "SSHService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.SSH.NewDeleteSSHKeyPairParams("testSSHKey")
- resp, err := client.SSH.DeleteSSHKeyPair(params)
- if err != nil {
- t.Errorf("Failed to delete SSH key pair due to %v", err)
- return
- }
- if resp == nil || !resp.Success {
- t.Errorf("Failed to delete SSH key pair")
- }
-}
diff --git a/cloudstack/ServiceOfferingService_test.go b/cloudstack/ServiceOfferingService_test.go
deleted file mode 100644
index 0fa4a48..0000000
--- a/cloudstack/ServiceOfferingService_test.go
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestServiceOfferingService_CreateServiceOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- apiName := "createServiceOffering"
- response, err := ReadData(apiName, "ServiceOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(w, response[apiName])
- }))
- defer server.Close()
-
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- p := client.ServiceOffering.NewCreateServiceOfferingParams("testServiceOffering", "testServiceOffering")
- resp, err := client.ServiceOffering.CreateServiceOffering(p)
- if err != nil {
- t.Errorf("Failed to create service offering due to %v", err)
- return
- }
- if resp == nil || resp.Name != "testServiceOffering" {
- t.Errorf("Failed to create service offering")
- }
-}
-
-func TestServiceOfferingService_UpdateServiceOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- apiName := "updateServiceOffering"
- response, err := ReadData(apiName, "ServiceOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(w, response[apiName])
- }))
- defer server.Close()
-
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- p := client.ServiceOffering.NewUpdateServiceOfferingParams("efaeeab0-4b09-4729-8b6f-62645db41b37")
- p.SetName("testServiceOfferingUpdated")
- resp, err := client.ServiceOffering.UpdateServiceOffering(p)
- if err != nil {
- t.Errorf("Failed to update service offering due to %v", err)
- return
- }
-
- if resp == nil || resp.Name != "testServiceOfferingUpdated" {
- t.Errorf("Failed to create service offering name")
- }
-}
-
-func TestServiceOfferingService_DeleteServiceOffering(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- apiName := "deleteServiceOffering"
- response, err := ReadData(apiName, "ServiceOfferingService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(w, response[apiName])
- }))
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- p := client.ServiceOffering.NewDeleteServiceOfferingParams("efaeeab0-4b09-4729-8b6f-62645db41b37")
- resp, err := client.ServiceOffering.DeleteServiceOffering(p)
- if err != nil {
- t.Errorf("Failed to delete service offering due to %v", err)
- return
- }
- if resp == nil || !resp.Success {
- t.Errorf("Failed to delete service offering")
- }
-}
diff --git a/cloudstack/StoragePoolService_test.go b/cloudstack/StoragePoolService_test.go
deleted file mode 100644
index a83e87c..0000000
--- a/cloudstack/StoragePoolService_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestStoragePoolService_CancelStorageMaintenance(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "cancelStorageMaintenance"
- response, err := ParseAsyncResponse(apiName, "StoragePoolService", *r)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.StoragePool.NewCancelStorageMaintenanceParams("44ad900d-785b-3eff-addc-a5e6bf4927ef")
- resp, err := client.StoragePool.CancelStorageMaintenance(params)
- if err != nil {
- t.Errorf("Failed to cancel storage maintenance due to %v", err)
- return
- }
- if resp == nil || resp.State != "Up" {
- t.Errorf("Failed to cancel Storage pool maintenance")
- }
-}
-func TestStoragePoolService_EnableStorageMaintenance(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "enableStorageMaintenance"
- response, err := ParseAsyncResponse(apiName, "StoragePoolService", *r)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.StoragePool.NewEnableStorageMaintenanceParams("44ad900d-785b-3eff-addc-a5e6bf4927ef")
- resp, err := client.StoragePool.EnableStorageMaintenance(params)
- if err != nil {
- t.Errorf("Failed to enable storage maintenance due to %v", err)
- return
- }
- if resp == nil || resp.State != "Maintenance" {
- t.Errorf("Failed to enable Storage pool maintenance")
- }
-}
diff --git a/cloudstack/TemplateService_test.go b/cloudstack/TemplateService_test.go
deleted file mode 100644
index fa474a0..0000000
--- a/cloudstack/TemplateService_test.go
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestTemplateService_RegisterTemplate(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "registerTemplate"
- response, err := ReadData(apiName, "TemplateService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := 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)
- if err != nil {
- t.Errorf("Failed to register template due to %v", err)
- return
- }
-
- if resp == nil || resp.Count != 1 {
- t.Errorf("Failed to register template")
- }
-}
-
-func TestTemplateService_CreateTemplate(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "createTemplate"
- response, err := ParseAsyncResponse(apiName, "TemplateService", *r)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(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 {
- t.Errorf("Failed to create template from volume due to %v", err)
- return
- }
- if resp == nil || resp.Name != "createTempFromVol" {
- t.Errorf("Failed to create template from volume")
- }
-}
-
-func TestTemplateService_ExtractTemplate(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "extractTemplate"
- response, err := ParseAsyncResponse(apiName, "TemplateService", *r)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(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 {
- t.Errorf("Failed to download template due to %v", err)
- return
- }
- if resp == nil || resp.Url == "" {
- t.Errorf("Failed to download template")
- }
-}
diff --git a/cloudstack/UserService_test.go b/cloudstack/UserService_test.go
deleted file mode 100644
index 50cdf2b..0000000
--- a/cloudstack/UserService_test.go
+++ /dev/null
@@ -1,188 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestUserService_CreateUser(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "createUser"
- response, err := ReadData(apiName, "UserService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.User.NewCreateUserParams("admin", "user.xyz.com",
- "firstname", "lastname", "password", "dummyUser")
- resp, err := client.User.CreateUser(params)
- if err != nil {
- t.Errorf("Failed to create user due to %v", err)
- return
- }
- if resp == nil || resp.Username != "dummyUser" {
- t.Errorf("Failed to create user")
- }
-}
-
-func TestUserService_EnableUser(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "enableUser"
- response, err := ReadData(apiName, "UserService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.User.NewEnableUserParams("cd2b5afa-db4d-4532-88ec-1356a273e534")
- resp, err := client.User.EnableUser(params)
- if err != nil {
- t.Errorf("Failed to enable user due to %v", err)
- return
- }
-
- if resp == nil || resp.State != "enabled" {
- t.Errorf("Failed to enable user")
- }
-}
-
-func TestUserService_DisableUser(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "disableUser"
- response, err := ParseAsyncResponse(apiName, "UserService", *request)
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.User.NewDisableUserParams("cd2b5afa-db4d-4532-88ec-1356a273e534")
- resp, err := client.User.DisableUser(params)
- if err != nil {
- t.Errorf("Failed to disable user due to %v", err)
- return
- }
-
- if resp == nil || resp.State != "disabled" {
- t.Errorf("Failed to disable user")
- }
-}
-
-func TestUserService_ListUser(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listUsers"
- response, err := ReadData(apiName, "UserService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.User.NewListUsersParams()
- params.SetId("cd2b5afa-db4d-4532-88ec-1356a273e534")
- resp, err := client.User.ListUsers(params)
- if err != nil {
- t.Errorf("Failed to list user details due to %v", err)
- return
- }
-
- if resp == nil || resp.Count != 1 {
- t.Errorf("Failed to list user details")
- }
-}
-
-func TestUserService_LockUser(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "lockUser"
- response, err := ReadData(apiName, "UserService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.User.NewLockUserParams("3b7325b3-849c-4314-ad19-dd3c483b6d1a")
- resp, err := client.User.LockUser(params)
- if err != nil {
- t.Errorf("Failed to lock user due to %v", err)
- return
- }
-
- if resp == nil || resp.State != "locked" {
- t.Errorf("Failed to lock user")
- }
-}
-
-func TestUserService_DeleteUser(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteUser"
- response, err := ReadData(apiName, "UserService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.User.NewDeleteUserParams("cd2b5afa-db4d-4532-88ec-1356a273e534")
- resp, err := client.User.DeleteUser(params)
- if err != nil {
- t.Errorf("Failed to delete user due to %v", err)
- return
- }
-
- if resp == nil || !resp.Success {
- t.Errorf("Failed to delete user")
- }
-}
-
-func TestGetUserKeys(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "getUserKeys"
- response, err := ReadData(apiName, "UserService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.User.NewGetUserKeysParams("random-id")
- resp, err := client.User.GetUserKeys(params)
- if err != nil {
- t.Errorf("Failed to get user keys due to %v", err)
- return
- }
- if resp.Apikey == "" || resp.Secretkey == "" {
- t.Errorf("Parsing failure")
- }
-}
diff --git a/cloudstack/VLANService_test.go b/cloudstack/VLANService_test.go
deleted file mode 100644
index 82711a3..0000000
--- a/cloudstack/VLANService_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestNetworkService_DedicateGuestVLANRange(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "dedicateGuestVlanRange"
- response, err := ReadData(apiName, "VLANService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.VLAN.NewDedicateGuestVlanRangeParams("8e27a637-7525-49ed-81ce-52bd5e5d9ea2", "100-110")
- params.SetAccount("admin")
- params.SetDomainid("e4874e10-5fdf-11ea-9a56-1e006800018c")
- resp, err := client.VLAN.DedicateGuestVlanRange(params)
- if err != nil {
- t.Errorf("Failed to dedicate guest VLAN range for physical network due to: %v", err)
- return
- }
-
- if resp == nil || resp.Guestvlanrange != "100-110" {
- t.Errorf("Failed to dedicate guest VLAN range for physical network")
- }
-}
diff --git a/cloudstack/VPCService_test.go b/cloudstack/VPCService_test.go
deleted file mode 100644
index 595ce1b..0000000
--- a/cloudstack/VPCService_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestVPCService_RestartVPC(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "restartVPC"
- response, err := ParseAsyncResponse(apiName, "VPCService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.VPC.NewRestartVPCParams("f9ec95f3-70be-448a-8ba2-cb6388dce55a")
-
- resp, err := client.VPC.RestartVPC(params)
- if err != nil {
- t.Errorf("Failed to restart VPC network due to: %v", err)
- }
- if resp == nil {
- t.Errorf("Failed to restart VPC network")
- }
-}
-
-func TestVPCService_ListVPCs(t *testing.T) {
-
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "listVPCs"
- response, err := ParseAsyncResponse(apiName, "VPCService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
-
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.VPC.NewListVPCsParams()
- resp, err := client.VPC.ListVPCs(params)
-
- if err != nil {
- t.Errorf("Failed to list VPCs due to: %v", err)
- }
- if resp == nil {
- t.Errorf("Failed to list VPCs")
- }
-}
diff --git a/cloudstack/VPNService_test.go b/cloudstack/VPNService_test.go
deleted file mode 100644
index 41acffc..0000000
--- a/cloudstack/VPNService_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestVPNService_DeleteRemoteAccessVpn(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
- apiName := "deleteRemoteAccessVpn"
- response, err := ParseAsyncResponse(apiName, "VPNService", *request)
- if err != nil {
- t.Errorf("Failed to parse response, due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", false)
- params := client.VPN.NewDeleteRemoteAccessVpnParams("8dcd19e9-dbe6-4576-9602-4c3350918983")
- resp, err := client.VPN.DeleteRemoteAccessVpn(params)
- if err != nil {
- t.Errorf("Failed to delete remote access VPN due to: %v", err)
- return
- }
-
- if resp == nil {
- t.Errorf("Failed to update project name")
- }
-}
diff --git a/cloudstack/VirtualMachineService_test.go b/cloudstack/VirtualMachineService_test.go
deleted file mode 100644
index 3cc9cdc..0000000
--- a/cloudstack/VirtualMachineService_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestVirtualMachineService_DeployVirtualMachine(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "deployVirtualMachine"
- response, err := ParseAsyncResponse(apiName, "VirtualMachineService", *r)
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(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")
- params.SetNetworkids([]string{"87503ba2-d59d-4a5e-8f7f-b3f486cedbd8"})
- resp, err := client.VirtualMachine.DeployVirtualMachine(params)
- if err != nil {
- t.Errorf("Failed to deploy VM with given specs due to %v", err)
- return
- }
-
- if resp == nil || resp.Name != "testDummyVM" {
- t.Errorf("Failed to deploy VM with given specs")
- }
-}
-
-func TestVirtualMachineService_AddNicToVirtualMachine(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "addNicToVirtualMachine"
- response, err := ParseAsyncResponse(apiName, "VirtualMachineService", *r)
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintf(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(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)
- if err != nil {
- t.Errorf("Failed to add nic to VM due to %v", err)
- return
- }
-
- if resp == nil || len(resp.Nic) != 2 {
- t.Errorf("Failed to add nic to VM")
- }
-}
-
-func TestVirtualMachineService_StopVirtualMachine(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "stopVirtualMachine"
- response, err := ParseAsyncResponse(apiName, "VirtualMachineService", *r)
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.VirtualMachine.NewStopVirtualMachineParams("915653c4-298b-4d74-bdee-4ced282114f1")
- resp, err := client.VirtualMachine.StopVirtualMachine(params)
- if err != nil {
- t.Errorf("Failed to stop VM due to %v", err)
- return
- }
-
- if resp == nil || resp.State != "Stopped" {
- t.Errorf("Failed to stop VM")
- }
-}
-
-func TestVirtualMachineService_StartVirtualMachine(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "startVirtualMachine"
- response, err := ParseAsyncResponse(apiName, "VirtualMachineService", *r)
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.VirtualMachine.NewStartVirtualMachineParams("915653c4-298b-4d74-bdee-4ced282114f1")
- resp, err := client.VirtualMachine.StartVirtualMachine(params)
- if err != nil {
- t.Errorf("Failed to start VM due to %v", err)
- return
- }
-
- if resp == nil || resp.State != "Running" {
- t.Errorf("Failed to start VM")
- }
-}
-
-func TestVirtualMachineService_ListVirtualMachines(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "listVirtualMachines"
- response, err := ReadData(apiName, "VirtualMachineService")
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response[apiName])
- }))
- defer server.Close()
- client := NewAsyncClient(server.URL, "APIKEY", "SECRETKEY", true)
- params := client.VirtualMachine.NewListVirtualMachinesParams()
- params.SetId("915653c4-298b-4d74-bdee-4ced282114f1")
- resp, err := client.VirtualMachine.ListVirtualMachines(params)
- if err != nil {
- t.Errorf("Failed to list VM due to %v", err)
- return
- }
-
- if resp == nil || resp.Count != 1 {
- t.Errorf("Failed to list VM")
- }
-}
-
-func TestVirtualMachineService_ScaleVirtualMachine(t *testing.T) {
- server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, r *http.Request) {
- apiName := "scaleVirtualMachine"
- response, err := ParseAsyncResponse(apiName, "VirtualMachineService", *r)
- if err != nil {
- t.Errorf("Failed to read response data due to: %v", err)
- }
- fmt.Fprintln(writer, response)
- }))
- defer server.Close()
- client := NewAsyncClient(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 {
- t.Errorf("Failed to scale VM due to %v", err)
- return
- }
-
- if resp == nil {
- t.Errorf("Failed to list VM")
- }
-}
diff --git a/cloudstack/cloudstack.go b/cloudstack/cloudstack.go
index 4933845..0e30601 100644
--- a/cloudstack/cloudstack.go
+++ b/cloudstack/cloudstack.go
@@ -39,7 +39,7 @@
"strings"
"time"
- gomock "github.com/golang/mock/gomock"
+ "github.com/golang/mock/gomock"
)
// UnlimitedResourceID is a special ID to define an unlimited resource
diff --git a/cloudstack/cloudstack_test.go b/cloudstack/cloudstack_test.go
deleted file mode 100644
index 23f0f8c..0000000
--- a/cloudstack/cloudstack_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-package cloudstack
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
- "testing"
-)
-
-var (
- CS_API_URL = "http://localhost:8080/client/api"
- CS_API_KEY = "valid-api-key"
- CS_SECRET_KEY = "valid-secret-key"
-)
-
-func ReadData(apiName string, testDataFile string) (map[string]string, error) {
- var data interface{}
- apis, err := ioutil.ReadFile("testdata/" + testDataFile + "Data.json")
- if err != nil {
- return nil, err
- }
-
- if err := json.Unmarshal([]byte(apis), &data); err != nil {
- return nil, err
- }
-
- jsonBytes, err := json.Marshal(data.(map[string]interface{})[apiName])
-
- if err != nil {
- return nil, err
- }
- response := make(map[string]string)
- response[apiName] = string(jsonBytes)
-
- return response, nil
-}
-
-func ParseAsyncResponse(apiName string, filename string, r http.Request) (string, error) {
- response, err := ReadData(apiName, filename)
- if err != nil {
- fmt.Printf("Failed to read response data, due to: %v", err)
- return "", err
- }
- jsonStr := response[apiName]
- responses := make(map[string]interface{})
- err = json.Unmarshal([]byte(jsonStr), &responses)
- if err != nil {
- fmt.Printf("Failed to parse the response, due to: %v", err)
- return "", err
- }
- s, _ := json.Marshal(responses[r.FormValue("command")])
- return string(s), nil
-}
-
-func TestCreateAsyncClient(t *testing.T) {
- client := NewAsyncClient(CS_API_URL, CS_API_KEY, CS_SECRET_KEY, true)
-
- if client == nil {
- t.Errorf("Failed to create Cloudstack Async Client")
- }
-}
-
-func TestCreateSyncClient(t *testing.T) {
- client := NewClient(CS_API_URL, CS_API_KEY, CS_SECRET_KEY, true)
-
- if client == nil {
- t.Errorf("Failed to create Cloudstack Client")
- }
-}
-
-type UUIDStruct struct {
- Value UUID `json:"value"`
-}
-
-func TestUUID(t *testing.T) {
- valLong := `{"value": 4801878}`
- valString := `{"value": "994801878"}`
- valBool := `{"value": false}`
- res := UUIDStruct{}
-
- res.Value = ""
- if err := json.Unmarshal([]byte(valLong), &res); err != nil {
- t.Errorf("could not unserialize long into UUID: %s", err)
- }
- if res.Value != "4801878" {
- t.Errorf("unepected value '%s', expecting 4801878", res.Value)
- }
-
- res.Value = ""
- if err := json.Unmarshal([]byte(valString), &res); err != nil {
- t.Errorf("could not unserialize string into UUID: %s", err)
- }
- if res.Value != "994801878" {
- t.Errorf("unepected value '%s', expecting 994801878", res.Value)
- }
-
- res.Value = ""
- if err := json.Unmarshal([]byte(valBool), &res); err == nil {
- t.Errorf("missing expected error when serializing bool into UUID")
- }
-}
diff --git a/cloudstack/testdata/AccountServiceData.json b/cloudstack/testdata/AccountServiceData.json
deleted file mode 100644
index a673dc6..0000000
--- a/cloudstack/testdata/AccountServiceData.json
+++ /dev/null
@@ -1,154 +0,0 @@
-{
- "listAccountsResponse": {
- "listaccountsresponse": {
- "account": [
- {
- "accountdetails": {
- "key0": "value0",
- "key1": "value1"
- },
- "accounttype": 1,
- "cpuavailable": "Unlimited",
- "cpulimit": "Unlimited",
- "cputotal": 1,
- "domain": "ROOT",
- "domainid": "62f5fe2e-5f5a-11e5-bc86-0242ac11180a",
- "groups": [],
- "id": "62f61a73-5f5a-11e5-bc86-0242ac11180a",
- "ipavailable": "Unlimited",
- "iplimit": "Unlimited",
- "iptotal": 1,
- "isdefault": true,
- "memoryavailable": "Unlimited",
- "memorylimit": "Unlimited",
- "memorytotal": 512,
- "name": "admin",
- "networkavailable": "Unlimited",
- "networklimit": "Unlimited",
- "networktotal": 1,
- "primarystorageavailable": "Unlimited",
- "primarystoragelimit": "Unlimited",
- "primarystoragetotal": 2,
- "projectavailable": "Unlimited",
- "projectlimit": "Unlimited",
- "projecttotal": 1,
- "receivedbytes": 100,
- "secondarystorageavailable": "Unlimited",
- "secondarystoragelimit": "Unlimited",
- "secondarystoragetotal": 0,
- "sentbytes": 100,
- "snapshotavailable": "Unlimited",
- "snapshotlimit": "Unlimited",
- "snapshottotal": 0,
- "state": "enabled",
- "templateavailable": "Unlimited",
- "templatelimit": "Unlimited",
- "templatetotal": 0,
- "user": [
- {
- "account": "admin",
- "accountid": "62f61a73-5f5a-11e5-bc86-0242ac11180a",
- "accounttype": 1,
- "apikey": "BFCyYeY0HhhrvNWC7FBwHTlso52ow3XWZUzNuiv03jmJOQn-5UH5BTVRVheiBnaRfYFE9yOzjwiqkbahq9P-Rw",
- "created": "2015-09-20T05:42:31+0000",
- "domain": "ROOT",
- "domainid": "62f5fe2e-5f5a-11e5-bc86-0242ac11180a",
- "email": "admin@mailprovider.com",
- "firstname": "Admin",
- "id": "62f6394b-5f5a-11e5-bc86-0242ac11180a",
- "iscallerchilddomain": false,
- "isdefault": true,
- "lastname": "User",
- "secretkey": "Em1UPdKTYEDaUxPXKtpqy_1uYluHWU2ZHotPi-VnBi_-MOEUAANoFHg3ycDProluDzYAXmT3YRssk367ylr_4A",
- "state": "enabled",
- "username": "admin"
- }
- ],
- "vmavailable": "Unlimited",
- "vmlimit": "Unlimited",
- "vmrunning": 1,
- "vmtotal": 1,
- "volumeavailable": "Unlimited",
- "volumelimit": "Unlimited",
- "volumetotal": 1,
- "vpcavailable": "Unlimited",
- "vpclimit": "Unlimited",
- "vpctotal": 0
- }
- ],
- "count": 1
- }
- },
- "createAccountsResponse": {
- "createaccountresponse": {
- "account": {
- "accountdetails": {
- "key0": "value0",
- "key1": "value1"
- },
- "accounttype": 2,
- "cpuavailable": "40",
- "cpulimit": "40",
- "cputotal": 0,
- "domain": "ROOT",
- "domainid": "62f5fe2e-5f5a-11e5-bc86-0242ac11180a",
- "groups": [],
- "id": "c9cb9df8-dcd5-44c5-a40d-2e7d266669a6",
- "ipavailable": "20",
- "iplimit": "20",
- "iptotal": 0,
- "isdefault": false,
- "memoryavailable": "40960",
- "memorylimit": "40960",
- "memorytotal": 0,
- "name": "user01",
- "networkavailable": "20",
- "networklimit": "20",
- "networktotal": 0,
- "primarystorageavailable": "200",
- "primarystoragelimit": "200",
- "primarystoragetotal": 0,
- "projectavailable": "Unlimited",
- "projectlimit": "Unlimited",
- "projecttotal": 0,
- "secondarystorageavailable": "400",
- "secondarystoragelimit": "400",
- "secondarystoragetotal": 0,
- "snapshotavailable": "20",
- "snapshotlimit": "20",
- "snapshottotal": 0,
- "state": "enabled",
- "templateavailable": "20",
- "templatelimit": "20",
- "templatetotal": 0,
- "user": [
- {
- "account": "user01",
- "accountid": "c9cb9df8-dcd5-44c5-a40d-2e7d266669a6",
- "accounttype": 2,
- "created": "2016-07-26T02:17:17+0000",
- "domain": "ROOT",
- "domainid": "62f5fe2e-5f5a-11e5-bc86-0242ac11180a",
- "email": "user01@example.com",
- "firstname": "user01",
- "id": "1d69ac45-a8f7-469c-ab24-d2b0382fa8be",
- "iscallerchilddomain": false,
- "isdefault": false,
- "lastname": "user01",
- "state": "enabled",
- "username": "user01"
- }
- ],
- "vmavailable": "20",
- "vmlimit": "20",
- "vmtotal": 0,
- "volumeavailable": "20",
- "volumelimit": "20",
- "volumetotal": 0,
- "vpcavailable": "20",
- "vpclimit": "20",
- "vpctotal": 0
- }
- }
- }
-}
diff --git a/cloudstack/testdata/AddressServiceData.json b/cloudstack/testdata/AddressServiceData.json
deleted file mode 100644
index 5073dae..0000000
--- a/cloudstack/testdata/AddressServiceData.json
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "associateIpAddress": {
- "associateIpAddress": {
- "associateipaddressresponse": {
- "id": "dc51835f-b0e2-4a2e-91a4-6cccc44bdae3",
- "jobid": "8e805516-1729-46cf-a7d0-7289d523871e"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.address.AssociateIPAddrCmdByAdmin",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "ipaddress": {
- "id": "dc51835f-b0e2-4a2e-91a4-6cccc44bdae3",
- "ipaddress": "10.70.3.100",
- "allocated": "2021-10-01T16:25:11+0000",
- "zoneid": "3fc049b0-87ae-4d77-90c1-cce70da17db6",
- "zonename": "testAdvZone2",
- "issourcenat": true,
- "account": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "forvirtualnetwork": true,
- "vlanid": "2e86e486-b472-4f12-a9b2-bb73701241e0",
- "vlanname": "vlan://untagged",
- "isstaticnat": false,
- "issystem": false,
- "associatednetworkid": "cf8056db-25e1-49d1-b023-f13a717e5ecc",
- "associatednetworkname": "test-adv-network",
- "networkid": "f17d38db-4810-437e-be28-d38cd30e3034",
- "state": "Allocating",
- "physicalnetworkid": "0d6c1e76-2d83-459a-bbce-c133fbd732b7",
- "tags": [],
- "isportable": false,
- "fordisplay": true
- }
- },
- "jobinstancetype": "IpAddress",
- "jobinstanceid": "dc51835f-b0e2-4a2e-91a4-6cccc44bdae3",
- "created": "2021-10-01T16:25:12+0000",
- "completed": "2021-10-01T16:25:12+0000",
- "jobid": "8e805516-1729-46cf-a7d0-7289d523871e"
- }
- }
- },
- "disassociateIpAddress": {
- "disassociateIpAddress": {
- "disassociateipaddressresponse": {
- "jobid": "44fc961e-9d57-4313-9f11-7556508b319c"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "success": true
- },
- "jobinstancetype": "IpAddress",
- "jobinstanceid": "a767fbe1-ed7a-4d7c-8221-c7d736ca622d",
- "created": "2021-10-01T16:42:32+0000",
- "completed": "2021-10-01T16:42:33+0000",
- "jobid": "44fc961e-9d57-4313-9f11-7556508b319c"
- }
- }
- }
-}
-
-
diff --git a/cloudstack/testdata/AffinityGroupServiceData.json b/cloudstack/testdata/AffinityGroupServiceData.json
deleted file mode 100644
index a398e22..0000000
--- a/cloudstack/testdata/AffinityGroupServiceData.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "createAffinityGroup": {
- "createAffinityGroup": {
- "createaffinitygroupresponse": {
- "id": "5059d7e3-9213-448d-9314-6ae4e1d95a33",
- "jobid": "58e969e8-768b-44d0-b278-fd1b2f236c00"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.affinitygroup.CreateAffinityGroupCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "affinitygroup": {
- "id": "5059d7e3-9213-448d-9314-6ae4e1d95a33",
- "name": "testAffinityGroup",
- "description": "testAffinityGroup",
- "account": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "type": "host affinity"
- }
- },
- "jobinstancetype": "AffinityGroup",
- "created": "2021-10-01T16:59:04+0000",
- "completed": "2021-10-01T16:59:04+0000",
- "jobid": "58e969e8-768b-44d0-b278-fd1b2f236c00"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/CertificateServiceData.json b/cloudstack/testdata/CertificateServiceData.json
deleted file mode 100644
index df1ef3e..0000000
--- a/cloudstack/testdata/CertificateServiceData.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "uploadCustomCertificate": {
- "uploadCustomCertificate": {
- "uploadcustomcertificateresponse": {
- "jobid": "bb14e24d-af95-4d9d-8ead-e4f42ccd83f7"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "3bcbd8be-19eb-11ec-83a0-1e00bd000159",
- "userid": "3bcd30ee-19eb-11ec-83a0-1e00bd000159",
- "cmd": "org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "customcertificate": {
- "message": "Certificate has been successfully updated, if its the server certificate we would reboot all running console proxy VMs and secondary storage VMs to propagate the new certificate, please give a few minutes for console access and storage services service to be up and working again"
- }
- },
- "created": "2021-10-02T07:43:59+0000",
- "completed": "2021-10-02T07:43:59+0000",
- "jobid": "bb14e24d-af95-4d9d-8ead-e4f42ccd83f7"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/FirewallServiceData.json b/cloudstack/testdata/FirewallServiceData.json
deleted file mode 100644
index 6edf39b..0000000
--- a/cloudstack/testdata/FirewallServiceData.json
+++ /dev/null
@@ -1,123 +0,0 @@
-{
- "createFirewallRule": {
- "createFirewallRule": {
- "createfirewallruleresponse": {
- "id": "fb4ad2ee-02c8-433e-a769-6f18afddc750",
- "jobid": "104d5139-91dc-40a1-af2b-a94730e42e89"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
- "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
- "cmd": "org.apache.cloudstack.api.command.user.firewall.CreateFirewallRuleCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "firewallrule": {
- "id": "fb4ad2ee-02c8-433e-a769-6f18afddc750",
- "protocol": "tcp",
- "ipaddressid": "a4aa35ef-34ad-4332-9247-378c83b8f927",
- "networkid": "c4a3303c-376d-4d56-b336-1bd91cb130b6",
- "ipaddress": "192.168.2.4",
- "state": "Active",
- "cidrlist": "0.0.0.0/0",
- "tags": [],
- "fordisplay": true
- }
- },
- "jobinstancetype": "FirewallRule",
- "jobinstanceid": "fb4ad2ee-02c8-433e-a769-6f18afddc750",
- "created": "2021-10-02T23:20:07+0530",
- "completed": "2021-10-02T23:20:07+0530",
- "jobid": "104d5139-91dc-40a1-af2b-a94730e42e89"
- }
- }
- },
- "deleteFirewallRule": {
- "deleteFirewallRule": {
- "deletefirewallruleresponse": {
- "jobid": "6ae96f78-1c28-45f9-a30b-761ac5f3a87b"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
- "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
- "cmd": "org.apache.cloudstack.api.command.user.firewall.DeleteFirewallRuleCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "success": true
- },
- "created": "2021-10-02T23:25:22+0530",
- "completed": "2021-10-02T23:25:22+0530",
- "jobid": "6ae96f78-1c28-45f9-a30b-761ac5f3a87b"
- }
- }
- },
- "createEgressFirewallRule": {
- "createEgressFirewallRule": {
- "createegressfirewallruleresponse": {
- "id": "b7d8b539-8c72-4d25-8539-625f665681ad",
- "jobid": "8841a004-eb50-4d4e-aed5-7bc2494dc856"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
- "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
- "cmd": "org.apache.cloudstack.api.command.user.firewall.CreateEgressFirewallRuleCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "firewallrule": {
- "id": "b7d8b539-8c72-4d25-8539-625f665681ad",
- "protocol": "tcp",
- "networkid": "c4a3303c-376d-4d56-b336-1bd91cb130b6",
- "state": "Active",
- "cidrlist": "10.1.1.0/24",
- "tags": [],
- "fordisplay": true,
- "destcidrlist": ""
- }
- },
- "jobinstancetype": "FirewallRule",
- "jobinstanceid": "b7d8b539-8c72-4d25-8539-625f665681ad",
- "created": "2021-10-02T23:29:41+0530",
- "completed": "2021-10-02T23:29:41+0530",
- "jobid": "8841a004-eb50-4d4e-aed5-7bc2494dc856"
- }
- }
- },
- "deleteEgressFirewallRule": {
- "deleteEgressFirewallRule": {
- "deleteegressfirewallruleresponse": {
- "jobid": "91b10008-2e9f-412d-afa6-3c54a0bb19f5"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
- "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
- "cmd": "org.apache.cloudstack.api.command.user.firewall.DeleteEgressFirewallRuleCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "success": true
- },
- "created": "2021-10-02T23:32:08+0530",
- "completed": "2021-10-02T23:32:08+0530",
- "jobid": "91b10008-2e9f-412d-afa6-3c54a0bb19f5"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/LoadBalancerServiceData.json b/cloudstack/testdata/LoadBalancerServiceData.json
deleted file mode 100644
index 5e8b549..0000000
--- a/cloudstack/testdata/LoadBalancerServiceData.json
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- "createLoadBalancerRule": {
- "createLoadBalancerRule": {
- "createloadbalancerruleresponse": {
- "id": "d9186a3e-b39a-473f-8d5e-70cf1a7aed44",
- "jobid": "83ab0ded-225b-4a91-9aed-c17b1da07989"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse":{
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd",
- "completed": "2021-10-04T04:37:08+0000",
- "created": "2021-10-04T04:37:08+0000",
- "jobid": "83ab0ded-225b-4a91-9aed-c17b1da07989",
- "jobinstanceid": "d9186a3e-b39a-473f-8d5e-70cf1a7aed44",
- "jobinstancetype": "FirewallRule",
- "jobprocstatus": 0,
- "jobresult": {
- "loadbalancer": {
- "account": "admin",
- "algorithm": "roundrobin",
- "cidrlist": "",
- "domain": "ROOT",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "fordisplay": true,
- "id": "d9186a3e-b39a-473f-8d5e-70cf1a7aed44",
- "name": "testLBRule",
- "networkid": "cc39d938-5ea0-4d9c-b89d-421da3274e54",
- "privateport": "9090",
- "protocol": "tcp",
- "publicip": "192.168.2.107",
- "publicipid": "bab02a09-1244-4235-a938-150e75e04ce0",
- "publicport": "9090",
- "state": "Add",
- "tags": [],
- "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
- "zonename": "SimZone1"
- }
- },
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobstatus": 1,
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c"
- }
- }
- },
- "assignLoadBalancerRule": {
- "assignToLoadBalancerRule": {
- "assigntoloadbalancerruleresponse": {
- "jobid": "7ab605d2-cddd-4f90-bd6b-884a8f62c16b"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.loadbalancer.AssignToLoadBalancerRuleCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "success": true
- },
- "created": "2021-10-03T07:52:26+0000",
- "completed": "2021-10-03T07:52:26+0000",
- "jobid": "7ab605d2-cddd-4f90-bd6b-884a8f62c16b"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/NetworkACLServiceData.json b/cloudstack/testdata/NetworkACLServiceData.json
deleted file mode 100644
index fffac7d..0000000
--- a/cloudstack/testdata/NetworkACLServiceData.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "updateNetworkACLList": {
- "updateNetworkACLList": {
- "updatenetworkacllistresponse": {
- "jobid": "6dd51379-b8cf-422c-a6ef-f96c07798c97"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.network.UpdateNetworkACLListCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "networkacllist": {
- "id": "a31e11a0-57fe-41df-be7a-34d359673061",
- "name": "test",
- "description": "testtest",
- "vpcid": "40419d33-6d48-4c54-ae2e-5c312b401593",
- "fordisplay": true
- }
- },
- "created": "2021-10-13T04:46:30+0000",
- "completed": "2021-10-13T04:46:30+0000",
- "jobid": "6dd51379-b8cf-422c-a6ef-f96c07798c97"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/ProjectServiceData.json b/cloudstack/testdata/ProjectServiceData.json
deleted file mode 100644
index 907bff0..0000000
--- a/cloudstack/testdata/ProjectServiceData.json
+++ /dev/null
@@ -1,312 +0,0 @@
-{
- "createProject": {
- "createProject": {
- "createprojectresponse": {
- "id": "69646881-8d7f-4800-987d-106698a42608",
- "jobid": "0666daab-af9b-4001-ae70-78ac6bc697e8"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.project.CreateProjectCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "project": {
- "id": "69646881-8d7f-4800-987d-106698a42608",
- "name": "testProject",
- "displaytext": "testProject",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "owner": [
- {
- "account": "admin"
- }
- ],
- "projectaccountname": "PrjAcct-testProject-1",
- "state": "Active",
- "tags": [],
- "networklimit": "20",
- "networktotal": 0,
- "networkavailable": "20",
- "vpclimit": "20",
- "vpctotal": 0,
- "vpcavailable": "20",
- "cpulimit": "40",
- "cputotal": 0,
- "cpuavailable": "40",
- "memorylimit": "40960",
- "memorytotal": 0,
- "memoryavailable": "40960",
- "primarystoragelimit": "200",
- "primarystoragetotal": 0,
- "primarystorageavailable": "200",
- "secondarystoragelimit": "400",
- "secondarystoragetotal": 0,
- "secondarystorageavailable": "400.0",
- "vmlimit": "20",
- "vmtotal": 0,
- "vmavailable": "20",
- "iplimit": "20",
- "iptotal": 0,
- "ipavailable": "20",
- "volumelimit": "20",
- "volumetotal": 0,
- "volumeavailable": "20",
- "snapshotlimit": "20",
- "snapshottotal": 0,
- "snapshotavailable": "20",
- "templatelimit": "20",
- "templatetotal": 0,
- "templateavailable": "20",
- "vmstopped": 0,
- "vmrunning": 0
- }
- },
- "jobinstancetype": "None",
- "created": "2021-10-04T06:21:54+0000",
- "completed": "2021-10-04T06:21:54+0000",
- "jobid": "0666daab-af9b-4001-ae70-78ac6bc697e8"
- }
- }
- },
- "activateProject": {
- "activateProject": {
- "activaterojectresponse": {
- "jobid": "fa12a90a-29fc-43c0-8cbd-5be49b72ed22"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.project.ActivateProjectCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "project": {
- "id": "99a842a4-e50f-4265-8ca7-249959506c13",
- "name": "Admin Project",
- "displaytext": "Admin Project",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "owner": [
- {
- "account": "admin"
- }
- ],
- "projectaccountname": "PrjAcct-Admin Project-1",
- "state": "Active",
- "tags": [],
- "networklimit": "20",
- "networktotal": 0,
- "networkavailable": "20",
- "vpclimit": "20",
- "vpctotal": 0,
- "vpcavailable": "20",
- "cpulimit": "40",
- "cputotal": 0,
- "cpuavailable": "40",
- "memorylimit": "40960",
- "memorytotal": 0,
- "memoryavailable": "40960",
- "primarystoragelimit": "200",
- "primarystoragetotal": 0,
- "primarystorageavailable": "200",
- "secondarystoragelimit": "400",
- "secondarystoragetotal": 0,
- "secondarystorageavailable": "400.0",
- "vmlimit": "20",
- "vmtotal": 0,
- "vmavailable": "20",
- "iplimit": "20",
- "iptotal": 0,
- "ipavailable": "20",
- "volumelimit": "20",
- "volumetotal": 0,
- "volumeavailable": "20",
- "snapshotlimit": "20",
- "snapshottotal": 0,
- "snapshotavailable": "20",
- "templatelimit": "20",
- "templatetotal": 0,
- "templateavailable": "20",
- "vmstopped": 0,
- "vmrunning": 0
- }
- },
- "created": "2021-10-04T06:30:39+0000",
- "completed": "2021-10-04T06:30:39+0000",
- "jobid": "fa12a90a-29fc-43c0-8cbd-5be49b72ed22"
- }
- }
- },
- "suspendProject": {
- "suspendProject": {
- "suspendprojectresponse": {
- "jobid": "608f4d53-ceae-4747-9c0d-e8c15fc52135"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.project.SuspendProjectCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "project": {
- "id": "99a842a4-e50f-4265-8ca7-249959506c13",
- "name": "Admin Project",
- "displaytext": "Admin Project",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "owner": [
- {
- "account": "admin"
- }
- ],
- "projectaccountname": "PrjAcct-Admin Project-1",
- "state": "Suspended",
- "tags": [],
- "networklimit": "20",
- "networktotal": 0,
- "networkavailable": "20",
- "vpclimit": "20",
- "vpctotal": 0,
- "vpcavailable": "20",
- "cpulimit": "40",
- "cputotal": 0,
- "cpuavailable": "40",
- "memorylimit": "40960",
- "memorytotal": 0,
- "memoryavailable": "40960",
- "primarystoragelimit": "200",
- "primarystoragetotal": 0,
- "primarystorageavailable": "200",
- "secondarystoragelimit": "400",
- "secondarystoragetotal": 0,
- "secondarystorageavailable": "400.0",
- "vmlimit": "20",
- "vmtotal": 0,
- "vmavailable": "20",
- "iplimit": "20",
- "iptotal": 0,
- "ipavailable": "20",
- "volumelimit": "20",
- "volumetotal": 0,
- "volumeavailable": "20",
- "snapshotlimit": "20",
- "snapshottotal": 0,
- "snapshotavailable": "20",
- "templatelimit": "20",
- "templatetotal": 0,
- "templateavailable": "20",
- "vmstopped": 0,
- "vmrunning": 0
- }
- },
- "created": "2021-10-04T06:34:01+0000",
- "completed": "2021-10-04T06:34:01+0000",
- "jobid": "608f4d53-ceae-4747-9c0d-e8c15fc52135"
- }
- }
- },
- "updateProject": {
- "updateProject": {
- "updateprojectresponse": {
- "jobid": "1330d540-c099-4943-ac22-3fd5846c0e5b"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.project.UpdateProjectCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "project": {
- "id": "69646881-8d7f-4800-987d-106698a42608",
- "name": "testProject",
- "displaytext": "testProjectUpdate",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "owner": [
- {
- "account": "admin"
- }
- ],
- "projectaccountname": "PrjAcct-testProject-1",
- "state": "Active",
- "tags": [],
- "networklimit": "20",
- "networktotal": 0,
- "networkavailable": "20",
- "vpclimit": "20",
- "vpctotal": 0,
- "vpcavailable": "20",
- "cpulimit": "40",
- "cputotal": 0,
- "cpuavailable": "40",
- "memorylimit": "40960",
- "memorytotal": 0,
- "memoryavailable": "40960",
- "primarystoragelimit": "200",
- "primarystoragetotal": 0,
- "primarystorageavailable": "200",
- "secondarystoragelimit": "400",
- "secondarystoragetotal": 0,
- "secondarystorageavailable": "400.0",
- "vmlimit": "20",
- "vmtotal": 0,
- "vmavailable": "20",
- "iplimit": "20",
- "iptotal": 0,
- "ipavailable": "20",
- "volumelimit": "20",
- "volumetotal": 0,
- "volumeavailable": "20",
- "snapshotlimit": "20",
- "snapshottotal": 0,
- "snapshotavailable": "20",
- "templatelimit": "20",
- "templatetotal": 0,
- "templateavailable": "20",
- "vmstopped": 0,
- "vmrunning": 0
- }
- },
- "created": "2021-10-04T06:35:29+0000",
- "completed": "2021-10-04T06:35:29+0000",
- "jobid": "1330d540-c099-4943-ac22-3fd5846c0e5b"
- }
- }
- },
- "listProjectRolePermissions": {
- "listprojectrolepermissionsresponse": {
- "count": 1,
- "projectrolepermission": [
- {
- "id": "e68daeca-556f-4fd2-b4ee-378cb994ef76",
- "projectroleid": "fa089002-d055-46b5-aa0a-18f2eae2b4fc",
- "projectid": "69646881-8d7f-4800-987d-106698a42608",
- "projectrolename": "testProjectPerm",
- "rule": "activateProject",
- "permission": "deny",
- "description": ""
- }
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/ResourceTagsServiceData.json b/cloudstack/testdata/ResourceTagsServiceData.json
deleted file mode 100644
index e8419e0..0000000
--- a/cloudstack/testdata/ResourceTagsServiceData.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "createTags": {
- "createTags": {
- "createtagsresponse": {
- "jobid": "fb96bb6b-c192-492d-9671-42cea59a3709"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.tag.CreateTagsCmd",
- "completed": "2021-10-04T06:58:35+0000",
- "created": "2021-10-04T06:58:35+0000",
- "jobid": "4901a56e-60aa-4385-8ab6-8f9591ef0469",
- "jobprocstatus": 0,
- "jobresult": {
- "success": true
- },
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobstatus": 1,
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c"
- }
- }
- },
- "deleteTags": {
- "deleteTags": {
- "deletetagsresponse": {
- "jobid": "494d0f35-057a-4cc7-bf5d-b52d3b803a36"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd",
- "completed": "2021-10-04T07:07:22+0000",
- "created": "2021-10-04T07:07:22+0000",
- "jobid": "494d0f35-057a-4cc7-bf5d-b52d3b803a36",
- "jobprocstatus": 0,
- "jobresult": {
- "success": true
- },
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobstatus": 1,
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/SSHServiceData.json b/cloudstack/testdata/SSHServiceData.json
deleted file mode 100644
index b782bf2..0000000
--- a/cloudstack/testdata/SSHServiceData.json
+++ /dev/null
@@ -1,145 +0,0 @@
-{
- "createSSHKeyPair": {
- "createsshkeypairresponse": {
- "keypair": {
- "privatekey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAlMDlCrzlmEBwmPmQBhvD4PeRdEUV2tyoEuLLwkg7FkZFrjdd\nZaC8+N82Jm/lr27sqq5xVoo6n54k3hG9HVxNZjQBY5IiRNeQIF30Ye5c6TzboCCH\nAJVZYf4Dj5ucJvxg+V1+rZMNNJs6y2tMRGfmQ9zdrHZwOutKBeWTlGLtXyMabc5o\nVVe4hjngxh7s+CbEAA8oE9KFk1ZyhJ7SDj6G9vrMoBYNgqNGG6DHF/NM0A0yaEnj\nZU5MECXnw9qT7W8ggy5UM9AYtfzAyWBrS3jDwFgOjEZ+TW7vvC1Q3lnGkzpTHlye\nRppPm/7Xa8xapIdDV2UdEXnChHj9+Jwpa5nBJQIDAQABAoIBABaReW56oD7MMAkV\ne+NhXQOJq/i+7oTpC1rqK83LFaPYf4PiBHqBu4nqm5WTTn6iTqfKlYlyqVhELwW+\nHToSIfAKnddUeXyGU+iFOKmO92uvfwa5SKIvBoOWfUXRbwx/J9tNcwW0lMFRd8ca\n/VQ3izjqjns28OoPfoiMfyp5I9hWCNoC0KmIqHClqSVU5rpYpEcm70jA1PhLMItf\n8ECEPRQBBoFAEQSnyqohFBOKxna0Urs8qUOJ38FfK883h+ltRSzna7D9QetC+lny\n9OTuAMYe7ytnzGPJITLXjIN3Nj40n+dNmcRl7y0u00FdVpN92HlosCJvQqeJYY5V\nhcfi/aECgYEAxSKvGknRtQjuT+emmG4TmC110ZCcQY1tgIMwkPL++rR9Qp8M5t5p\nocxpK5NYhGgai4Kep5F4P2nePHFemwgP1jHawxsc3G/IA+0c27Y+9uAZSM2mDCcf\nXIvBxkOGcI1UcJYUTwAYdfgtJmVkS3Mj519r1lk2+pJAN14NkC87wekCgYEAwSvS\no7ILlqZo//DThhHakFFLFRKD82ghNMc0b8yheSY+V+tkzW+nugqvm5rhH3GH+M8U\nMLm5sdWauT2/1l7kaUla923lwMDxhd4Buv6v6IZYVNyzJLA5DAT3T7i5fmixE1MG\ncpmZhbpsuikFRUP3Z2td1D8cuZxHN6OrWtCso90CgYEAtJIGji/b1NVvZOWtZaY+\ncIADkYfCeREQokyIqdzKzd2Rdvq1GKvVWg0gsHdw9ydcWTm2FYtb98oDdJ3rqFoE\nF5Dm7xvgndIOBfqlGmOe3Qd8YYFtfWhAg8bIIdEsTeBG3jG6PHq77SL8SFVLPwki\ndAalgluJzo80HwMZrV52gDECgYA5JXm/K6D6BGjzro8lDosWPrZzmXKnw5pvPq9o\nk6UBbirrX5wGmo2IIDkrU3peDvwmwzw53fftgD+xpW7nQFNaQnVC1aQujeXlsHPa\nmhX4OCZRlKj6pZd60s1HLGLT3qzkBp/Vr1MXmLspp5EDmMPMOJsdez5IOs9mymib\nCTjJkQKBgFv0d3RnnxOU9EuTA6DmqxrYnWCQVEl1jwTJwfX6+1hfiBzLMCKWxEZ4\nla4rcmvMkL+uWwfLp/R29ciZC+G08Tc7tPVmZunqT3XBgSAt0y3Q3WXkkZG9RHlS\nCK2YbtViHML+G5dackvASf1p7+w2b3WS8fHFH2GTSTiM/OqReBVF\n-----END RSA PRIVATE KEY-----\n",
- "name": "testSSHKey",
- "account": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "fingerprint": "3b:f7:0b:34:40:0d:a5:3c:2a:75:f8:82:1d:88:99:36"
- }
- }
- },
- "listSSHKeyPairs": {
- "listsshkeypairsresponse": {
- "count": 1,
- "sshkeypair": [
- {
- "account": "admin",
- "domain": "ROOT",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "fingerprint": "3b:f7:0b:34:40:0d:a5:3c:2a:75:f8:82:1d:88:99:36",
- "name": "testSSHKey"
- }
- ]
- }
- },
- "resetSSHKeyForVirtualMachine": {
- "resetSSHKeyForVirtualMachine": {
- "resetSSHKeyforvirtualmachineresponse": {
- "jobid": "da766971-3902-4675-9cf2-8bcb2398aba3"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.vm.ResetVMSSHKeyCmdByAdmin",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "virtualmachine": {
- "id": "8aa29529-b238-45f3-8992-5befadcd8bb0",
- "name": "Admin-VPC-T3-VM",
- "displayname": "abc12",
- "account": "admin",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "username": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "created": "2021-07-05T09:16:22+0000",
- "state": "Stopped",
- "haenable": false,
- "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
- "zonename": "shouldwork",
- "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
- "templatename": "CentOS 5.6 (64-bit)",
- "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
- "passwordenabled": false,
- "serviceofferingid": "79802d1a-186b-4e34-a550-220987cb03c2",
- "serviceofferingname": "const1",
- "diskofferingid": "3d321179-f9c6-4a77-8f47-6fae3a8126d1",
- "diskofferingname": "Medium",
- "backupofferingid": "7c42d74e-c029-4431-9025-6caa8b903472",
- "backupofferingname": "BackupGoldDummy",
- "cpunumber": 1,
- "cpuspeed": 1000,
- "memory": 256,
- "cpuused": "10%",
- "networkkbsread": 209485824,
- "networkkbswrite": 104742912,
- "diskkbsread": 0,
- "diskkbswrite": 0,
- "memorykbs": 0,
- "memoryintfreekbs": 0,
- "memorytargetkbs": 0,
- "diskioread": 0,
- "diskiowrite": 0,
- "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "rootdeviceid": 1,
- "rootdevicetype": "DATADISK",
- "securitygroup": [],
- "nic": [
- {
- "id": "511941ff-229d-4a3b-8b09-f83b0608ed6b",
- "networkid": "30358053-0f9d-4112-9948-976477896db6",
- "networkname": "test-network-2",
- "netmask": "255.255.255.0",
- "gateway": "10.1.2.1",
- "ipaddress": "10.1.2.71",
- "traffictype": "Guest",
- "type": "Isolated",
- "isdefault": true,
- "macaddress": "02:00:35:ff:00:0c",
- "secondaryip": [],
- "extradhcpoption": []
- },
- {
- "id": "186e56ee-8de8-4869-ac00-dc91dc51d6f2",
- "networkid": "6463e120-c36a-4569-aaa7-729922a55825",
- "networkname": "sw1",
- "traffictype": "Guest",
- "type": "L2",
- "isdefault": false,
- "macaddress": "02:00:3d:a2:00:02",
- "secondaryip": [],
- "extradhcpoption": []
- }
- ],
- "hypervisor": "Simulator",
- "instancename": "i-2-613-QA",
- "details": {
- "cpuNumber": "1",
- "memory": "256",
- "Message.ReservedCapacityFreed.Flag": "true",
- "SSH.PublicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCUwOUKvOWYQHCY+ZAGG8Pg95F0RRXa3KgS4svCSDsWRkWuN11loLz43zYmb+WvbuyqrnFWijqfniTeEb0dXE1mNAFjkiJE15AgXfRh7lzpPNugIIcAlVlh/gOPm5wm/GD5XX6tkw00mzrLa0xEZ+ZD3N2sdnA660oF5ZOUYu1fIxptzmhVV7iGOeDGHuz4JsQADygT0oWTVnKEntIOPob2+sygFg2Co0YboMcX80zQDTJoSeNlTkwQJefD2pPtbyCDLlQz0Bi1/MDJYGtLeMPAWA6MRn5Nbu+8LVDeWcaTOlMeXJ5Gmk+b/tdrzFqkh0NXZR0RecKEeP34nClrmcEl \n",
- "Encrypted.Password": "YcyvikAL5LHq4gXwGVE3yW0j7iuuTWcxnMpYQDqHn+6R1agzIibv3eoF1onUFgHYQ0XtJUzMR4QfZDzlHnqYDTB+rKjjc9YcZzWhVSoVKQ45bUqAKFBXJTfDLQ3ZmvULxJ2VXf/HuuOh5Th5S62bP68QrrVCMPUArUYRRFPw0EkQVdvjwF1raNXpKWDAtcwITaroxW0pL9S8ome5R7JHKPxyK9G8/lqC4ywodvPaG+vGV0eHTiQeUab/dQ8Pxze6Ny88uwv8oH2vu+zMbs91uDDL9lMl7WV5Rq6RucKRAjOBLfPj+f+8jq3xnCG8JzUa63G2lAvP9qIzk3eYzoeYkw=="
- },
- "keypair": "testSSHKey",
- "affinitygroup": [],
- "displayvm": true,
- "isdynamicallyscalable": false,
- "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "osdisplayname": "CentOS 5.6 (64-bit)",
- "tags": [],
- "jobid": "da766971-3902-4675-9cf2-8bcb2398aba3",
- "jobstatus": 0
- }
- },
- "jobinstancetype": "VirtualMachine",
- "jobinstanceid": "8aa29529-b238-45f3-8992-5befadcd8bb0",
- "created": "2021-10-04T07:39:55+0000",
- "completed": "2021-10-04T07:39:55+0000",
- "jobid": "da766971-3902-4675-9cf2-8bcb2398aba3"
- }
- }
- },
- "deleteSSHKeyPair": {
- "deletesshkeypairresponse": {
- "success": true
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/VPCServiceData.json b/cloudstack/testdata/VPCServiceData.json
deleted file mode 100644
index 595f832..0000000
--- a/cloudstack/testdata/VPCServiceData.json
+++ /dev/null
@@ -1,336 +0,0 @@
-{
- "restartVPC": {
- "restartVPC": {
- "restartvpcresponse": {
- "jobid": "98272f42-917c-4286-8c05-4e38d85d32e0"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "0644f184-269b-11ec-ad12-1e00bc0003a5",
- "userid": "06466ac0-269b-11ec-ad12-1e00bc0003a5",
- "cmd": "org.apache.cloudstack.api.command.user.vpc.RestartVPCCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "success": true
- },
- "created": "2021-10-13T04:36:30+0000",
- "completed": "2021-10-13T04:36:30+0000",
- "jobid": "98272f42-917c-4286-8c05-4e38d85d32e0"
- }
- }
- },
- "listVPCs": {
- "listVPCs": {
- "listvpcresponse": {
- "count": 2,
- "vpc": [
- {
- "id": "49b5fa29-e98f-4078-b407-7e7928105ec0",
- "name": "my-vpc",
- "displaytext": "my-vpc-text",
- "state": "Enabled",
- "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
- "zonename": "SimZone1",
- "service": [
- { "name": "Dns", "provider": [{ "name": "VpcVirtualRouter" }] },
- { "name": "Dhcp", "provider": [{ "name": "VpcVirtualRouter" }] },
- {
- "name": "PortForwarding",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- {
- "name": "StaticNat",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- { "name": "Vpn", "provider": [{ "name": "VpcVirtualRouter" }] },
- {
- "name": "SourceNat",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- {
- "name": "NetworkACL",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- {
- "name": "UserData",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- {
- "name": "Lb",
- "provider": [
- { "name": "VpcVirtualRouter" },
- { "name": "InternalLbVm" }
- ]
- }
- ],
- "cidr": "10.0.0.0/8",
- "vpcofferingid": "8142b164-0fa2-40c6-9067-2a90ae526df5",
- "vpcofferingname": "Default VPC offering",
- "created": "2021-12-26T22:26:18+0000",
- "account": "admin",
- "domainid": "bbae9696-627f-11ec-8fb6-0242ac110002",
- "domain": "ROOT",
- "network": [],
- "restartrequired": false,
- "networkdomain": "my-domain",
- "tags": [{ "key": "my-tag", "value": "true" }],
- "fordisplay": true,
- "distributedvpcrouter": false,
- "regionlevelvpc": false,
- "redundantvpcrouter": false,
- "hasannotations": false
- },
- {
- "id": "78d49100-e4af-4692-9a49-284fa2444eb9",
- "name": "my-vpc",
- "displaytext": "my-vpc",
- "state": "Enabled",
- "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
- "zonename": "SimZone1",
- "service": [
- { "name": "Dns", "provider": [{ "name": "VpcVirtualRouter" }] },
- { "name": "Dhcp", "provider": [{ "name": "VpcVirtualRouter" }] },
- {
- "name": "PortForwarding",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- {
- "name": "StaticNat",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- { "name": "Vpn", "provider": [{ "name": "VpcVirtualRouter" }] },
- {
- "name": "SourceNat",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- {
- "name": "NetworkACL",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- {
- "name": "UserData",
- "provider": [{ "name": "VpcVirtualRouter" }]
- },
- {
- "name": "Lb",
- "provider": [
- { "name": "VpcVirtualRouter" },
- { "name": "InternalLbVm" }
- ]
- }
- ],
- "cidr": "10.0.0.0/8",
- "vpcofferingid": "8142b164-0fa2-40c6-9067-2a90ae526df5",
- "vpcofferingname": "Default VPC offering",
- "created": "2021-12-26T22:28:44+0000",
- "account": "admin",
- "domainid": "bbae9696-627f-11ec-8fb6-0242ac110002",
- "domain": "ROOT",
- "network": [
- {
- "id": "e22cab07-58ac-4a1b-b0a8-fcee1bbecc7d",
- "name": "my-network",
- "displaytext": "my-network",
- "broadcastdomaintype": "Vlan",
- "traffictype": "Guest",
- "gateway": "10.1.1.1",
- "netmask": "255.255.255.0",
- "cidr": "10.1.1.0/24",
- "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
- "zonename": "SimZone1",
- "networkofferingid": "f26a1059-24df-4f76-9daf-16d42ce9df11",
- "networkofferingname": "DefaultIsolatedNetworkOfferingForVpcNetworks",
- "networkofferingdisplaytext": "Offering for Isolated Vpc networks with Source Nat service enabled",
- "networkofferingconservemode": false,
- "networkofferingavailability": "Optional",
- "issystem": false,
- "state": "Allocated",
- "related": "e22cab07-58ac-4a1b-b0a8-fcee1bbecc7d",
- "dns1": "10.147.28.6",
- "type": "Isolated",
- "acltype": "Account",
- "account": "admin",
- "domainid": "bbae9696-627f-11ec-8fb6-0242ac110002",
- "domain": "ROOT",
- "service": [
- {
- "name": "Dns",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": [
- {
- "name": "AllowDnsSuffixModification",
- "value": "true",
- "canchooseservicecapability": false
- }
- ]
- },
- {
- "name": "Dhcp",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": [
- {
- "name": "DhcpAccrossMultipleSubnets",
- "value": "true",
- "canchooseservicecapability": false
- }
- ]
- },
- {
- "name": "PortForwarding",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": [
- {
- "name": "SupportedProtocols",
- "value": "tcp,udp",
- "canchooseservicecapability": false
- }
- ]
- },
- {
- "name": "StaticNat",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": [
- {
- "name": "ElasticIp",
- "value": "false",
- "canchooseservicecapability": false
- },
- {
- "name": "AssociatePublicIP",
- "value": "true",
- "canchooseservicecapability": false
- }
- ]
- },
- {
- "name": "Vpn",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": [
- {
- "name": "SupportedVpnTypes",
- "value": "pptp,l2tp,ipsec",
- "canchooseservicecapability": false
- },
- {
- "name": "VpnTypes",
- "value": "s2svpn",
- "canchooseservicecapability": false
- }
- ]
- },
- {
- "name": "SourceNat",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": [
- {
- "name": "SupportedSourceNatTypes",
- "value": "peraccount",
- "canchooseservicecapability": true
- },
- {
- "name": "RedundantRouter",
- "value": "false",
- "canchooseservicecapability": true
- }
- ]
- },
- {
- "name": "NetworkACL",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": [
- {
- "name": "SupportedProtocols",
- "value": "tcp,udp,icmp",
- "canchooseservicecapability": false
- }
- ]
- },
- {
- "name": "UserData",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": []
- },
- {
- "name": "Lb",
- "provider": [{ "name": "VpcVirtualRouter" }],
- "capability": [
- {
- "name": "SupportedStickinessMethods",
- "value": "[{\"methodname\":\"LbCookie\",\"paramlist\":[{\"paramname\":\"cookie-name\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"mode\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"nocache\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"indirect\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"postonly\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"domain\",\"required\":false,\"isflag\":false,\"description\":\" \"}],\"description\":\"This is loadbalancer cookie based stickiness method.\"},{\"methodname\":\"AppCookie\",\"paramlist\":[{\"paramname\":\"cookie-name\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"length\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"holdtime\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"request-learn\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"prefix\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"mode\",\"required\":false,\"isflag\":false,\"description\":\" \"}],\"description\":\"This is App session based sticky method. Define session stickiness on an existing application cookie. It can be used only for a specific http traffic\"},{\"methodname\":\"SourceBased\",\"paramlist\":[{\"paramname\":\"tablesize\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"expire\",\"required\":false,\"isflag\":false,\"description\":\" \"}],\"description\":\"This is source based Stickiness method, it can be used for any type of protocol.\"}]",
- "canchooseservicecapability": false
- },
- {
- "name": "SupportedLbAlgorithms",
- "value": "roundrobin,leastconn,source",
- "canchooseservicecapability": false
- },
- {
- "name": "LbSchemes",
- "value": "Public",
- "canchooseservicecapability": false
- },
- {
- "name": "SupportedProtocols",
- "value": "tcp, udp, tcp-proxy",
- "canchooseservicecapability": false
- },
- {
- "name": "SupportedLBIsolation",
- "value": "dedicated",
- "canchooseservicecapability": true
- },
- {
- "name": "AutoScaleCounters",
- "value": "[{\"methodname\":\"cpu\",\"paramlist\":[]},{\"methodname\":\"memory\",\"paramlist\":[]}]",
- "canchooseservicecapability": false
- },
- {
- "name": "ElasticLb",
- "value": "false",
- "canchooseservicecapability": false
- },
- {
- "name": "InlineMode",
- "value": "false",
- "canchooseservicecapability": false
- }
- ]
- }
- ],
- "networkdomain": "my-domain",
- "physicalnetworkid": "ffcffe07-5cbf-4862-9c52-8e7153a5239a",
- "restartrequired": false,
- "specifyipranges": false,
- "vpcid": "78d49100-e4af-4692-9a49-284fa2444eb9",
- "vpcname": "my-vpc",
- "canusefordeploy": true,
- "ispersistent": false,
- "tags": [],
- "details": {},
- "displaynetwork": true,
- "strechedl2subnet": false,
- "redundantrouter": false,
- "created": "2021-12-26T22:28:52+0000",
- "receivedbytes": 0,
- "sentbytes": 0,
- "hasannotations": false
- }
- ],
- "restartrequired": false,
- "networkdomain": "my-domain",
- "tags": [{ "key": "my-tag", "value": "true" }],
- "fordisplay": true,
- "distributedvpcrouter": false,
- "regionlevelvpc": false,
- "redundantvpcrouter": false,
- "hasannotations": false
- }
- ]
- }
- }
- }
-}
diff --git a/cloudstack/testdata/VPNServiceData.json b/cloudstack/testdata/VPNServiceData.json
deleted file mode 100644
index 790ede9..0000000
--- a/cloudstack/testdata/VPNServiceData.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "deleteRemoteAccessVpn": {
- "deleteRemoteAccessVpn": {
- "deleteremoteaccessvpnresponse": {
- "jobid": "3697537c-f796-44f2-b997-0b71ff4f4e07"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "7a2fad8f-2bde-11ec-b173-1e0086000207",
- "cmd": "org.apache.cloudstack.api.command.user.vpn.DeleteRemoteAccessVpnCmd",
- "completed": "2021-10-13T07:38:53+0000",
- "created": "2021-10-13T07:38:51+0000",
- "jobid": "50bdd6c2-6958-48ba-94fe-3e6ec410dcce",
- "jobprocstatus": 0,
- "jobresult": {
- "success": true
- },
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobstatus": 1,
- "userid": "7a309dc2-2bde-11ec-b173-1e0086000207"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/cloudstack/testdata/VirtualMachineServiceData.json b/cloudstack/testdata/VirtualMachineServiceData.json
deleted file mode 100644
index 918a8b1..0000000
--- a/cloudstack/testdata/VirtualMachineServiceData.json
+++ /dev/null
@@ -1,545 +0,0 @@
-{
- "deployVirtualMachine": {
- "deployVirtualMachine": {
- "deployvirtualmachineresponse": {
- "id": "915653c4-298b-4d74-bdee-4ced282114f1",
- "jobid": "74bbb422-fb74-47ac-a22a-ad86a7831d3f"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.vm.DeployVMCmdByAdmin",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "virtualmachine": {
- "id": "915653c4-298b-4d74-bdee-4ced282114f1",
- "name": "testDummyVM",
- "displayname": "testDummyVM",
- "account": "admin",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "username": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "created": "2021-10-04T09:24:38+0000",
- "state": "Running",
- "haenable": false,
- "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
- "zonename": "shouldwork",
- "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
- "hostname": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
- "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
- "templatename": "CentOS 5.6 (64-bit)",
- "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
- "passwordenabled": false,
- "serviceofferingid": "498ce071-a077-4237-9492-e55c42553327",
- "serviceofferingname": "Very small instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "rootdeviceid": 0,
- "rootdevicetype": "ROOT",
- "securitygroup": [],
- "nic": [
- {
- "id": "47d79da1-2fe1-4a44-a503-523055714a72",
- "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
- "networkname": "test",
- "netmask": "255.255.255.0",
- "gateway": "10.1.1.1",
- "ipaddress": "10.1.1.62",
- "isolationuri": "vlan://1850",
- "broadcasturi": "vlan://1850",
- "traffictype": "Guest",
- "type": "Isolated",
- "isdefault": true,
- "macaddress": "02:00:34:fb:00:01",
- "secondaryip": [],
- "extradhcpoption": []
- }
- ],
- "hypervisor": "Simulator",
- "instancename": "i-2-683-QA",
- "details": {},
- "affinitygroup": [],
- "displayvm": true,
- "isdynamicallyscalable": false,
- "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "osdisplayname": "CentOS 5.6 (64-bit)",
- "bootmode": "legacy",
- "boottype": "Bios",
- "tags": [],
- "jobid": "74bbb422-fb74-47ac-a22a-ad86a7831d3f",
- "jobstatus": 0
- }
- },
- "jobinstancetype": "VirtualMachine",
- "jobinstanceid": "915653c4-298b-4d74-bdee-4ced282114f1",
- "created": "2021-10-04T09:24:38+0000",
- "completed": "2021-10-04T09:24:42+0000",
- "jobid": "74bbb422-fb74-47ac-a22a-ad86a7831d3f"
- }
- }
- },
- "addNicToVirtualMachine": {
- "addNicToVirtualMachine": {
- "addnictovirtualmachineresponse": {
- "jobid": "ec9d4711-b334-4750-868b-fb4d79d5801c"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.vm.AddNicToVMCmdByAdmin",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "virtualmachine": {
- "id": "915653c4-298b-4d74-bdee-4ced282114f1",
- "name": "testDummyVM",
- "displayname": "testDummyVM",
- "account": "admin",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "username": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "created": "2021-10-04T09:24:38+0000",
- "state": "Running",
- "haenable": false,
- "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
- "zonename": "shouldwork",
- "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
- "hostname": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
- "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "securitygroup": [],
- "nic": [
- {
- "id": "0921d201-f7ac-4f49-bf09-ffe9497fdab0",
- "networkid": "30358053-0f9d-4112-9948-976477896db6",
- "networkname": "test-network-2",
- "netmask": "255.255.255.0",
- "gateway": "10.1.2.1",
- "ipaddress": "10.1.2.102",
- "isolationuri": "vlan://1955",
- "broadcasturi": "vlan://1955",
- "traffictype": "Guest",
- "type": "Isolated",
- "isdefault": false,
- "macaddress": "02:00:13:a4:00:21",
- "secondaryip": [],
- "extradhcpoption": []
- },
- {
- "id": "47d79da1-2fe1-4a44-a503-523055714a72",
- "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
- "networkname": "test",
- "netmask": "255.255.255.0",
- "gateway": "10.1.1.1",
- "ipaddress": "10.1.1.62",
- "isolationuri": "vlan://1850",
- "broadcasturi": "vlan://1850",
- "traffictype": "Guest",
- "type": "Isolated",
- "isdefault": true,
- "macaddress": "02:00:34:fb:00:01",
- "secondaryip": [],
- "extradhcpoption": []
- }
- ],
- "hypervisor": "Simulator",
- "instancename": "i-2-683-QA",
- "details": {},
- "affinitygroup": [],
- "displayvm": true,
- "isdynamicallyscalable": false,
- "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "osdisplayname": "CentOS 5.6 (64-bit)",
- "bootmode": "legacy",
- "boottype": "Bios",
- "tags": []
- }
- },
- "created": "2021-10-04T09:29:51+0000",
- "completed": "2021-10-04T09:29:54+0000",
- "jobid": "ec9d4711-b334-4750-868b-fb4d79d5801c"
- }
- }
- },
- "stopVirtualMachine": {
- "stopVirtualMachine": {
- "stopvirtualmachineresponse": {
- "jobid": "604bc5ed-1b7e-4d63-abc8-a55077a4c2c1"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.vm.StopVMCmdByAdmin",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "virtualmachine": {
- "id": "915653c4-298b-4d74-bdee-4ced282114f1",
- "name": "testDummyVM",
- "displayname": "testDummyVM",
- "account": "admin",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "username": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "created": "2021-10-04T09:24:38+0000",
- "state": "Stopped",
- "haenable": false,
- "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
- "zonename": "shouldwork",
- "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
- "templatename": "CentOS 5.6 (64-bit)",
- "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
- "passwordenabled": false,
- "serviceofferingid": "498ce071-a077-4237-9492-e55c42553327",
- "serviceofferingname": "Very small instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- "cpuused": "10%",
- "networkkbsread": 917504,
- "networkkbswrite": 458752,
- "diskkbsread": 0,
- "diskkbswrite": 0,
- "memorykbs": 0,
- "memoryintfreekbs": 0,
- "memorytargetkbs": 0,
- "diskioread": 0,
- "diskiowrite": 0,
- "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "rootdeviceid": 0,
- "rootdevicetype": "ROOT",
- "securitygroup": [],
- "nic": [
- {
- "id": "47d79da1-2fe1-4a44-a503-523055714a72",
- "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
- "networkname": "test",
- "netmask": "255.255.255.0",
- "gateway": "10.1.1.1",
- "ipaddress": "10.1.1.62",
- "traffictype": "Guest",
- "type": "Isolated",
- "isdefault": true,
- "macaddress": "02:00:34:fb:00:01",
- "secondaryip": [],
- "extradhcpoption": []
- }
- ],
- "hypervisor": "Simulator",
- "instancename": "i-2-683-QA",
- "details": {
- "Message.ReservedCapacityFreed.Flag": "false"
- },
- "affinitygroup": [],
- "displayvm": true,
- "isdynamicallyscalable": false,
- "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "osdisplayname": "CentOS 5.6 (64-bit)",
- "tags": [],
- "jobid": "604bc5ed-1b7e-4d63-abc8-a55077a4c2c1",
- "jobstatus": 0
- }
- },
- "jobinstancetype": "VirtualMachine",
- "jobinstanceid": "915653c4-298b-4d74-bdee-4ced282114f1",
- "created": "2021-10-04T09:53:06+0000",
- "completed": "2021-10-04T09:53:08+0000",
- "jobid": "604bc5ed-1b7e-4d63-abc8-a55077a4c2c1"
- }
- }
- },
- "startVirtualMachine": {
- "startVirtualMachine": {
- "startvirtualmachineresponse": {
- "jobid": "468d69d7-f327-4105-bec2-0e43107ae956"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.vm.StartVMCmdByAdmin",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "virtualmachine": {
- "id": "915653c4-298b-4d74-bdee-4ced282114f1",
- "name": "testDummyVM",
- "displayname": "testDummyVM",
- "account": "admin",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "username": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "created": "2021-10-04T09:24:38+0000",
- "state": "Running",
- "haenable": false,
- "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
- "zonename": "shouldwork",
- "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
- "hostname": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
- "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
- "templatename": "CentOS 5.6 (64-bit)",
- "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
- "passwordenabled": false,
- "serviceofferingid": "498ce071-a077-4237-9492-e55c42553327",
- "serviceofferingname": "Very small instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- "cpuused": "10%",
- "networkkbsread": 917504,
- "networkkbswrite": 458752,
- "diskkbsread": 0,
- "diskkbswrite": 0,
- "memorykbs": 0,
- "memoryintfreekbs": 0,
- "memorytargetkbs": 0,
- "diskioread": 0,
- "diskiowrite": 0,
- "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "rootdeviceid": 0,
- "rootdevicetype": "ROOT",
- "securitygroup": [],
- "nic": [
- {
- "id": "47d79da1-2fe1-4a44-a503-523055714a72",
- "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
- "networkname": "test",
- "netmask": "255.255.255.0",
- "gateway": "10.1.1.1",
- "ipaddress": "10.1.1.62",
- "isolationuri": "vlan://1994",
- "broadcasturi": "vlan://1994",
- "traffictype": "Guest",
- "type": "Isolated",
- "isdefault": true,
- "macaddress": "02:00:34:fb:00:01",
- "secondaryip": [],
- "extradhcpoption": []
- }
- ],
- "hypervisor": "Simulator",
- "instancename": "i-2-683-QA",
- "details": {
- "Message.ReservedCapacityFreed.Flag": "false"
- },
- "affinitygroup": [],
- "displayvm": true,
- "isdynamicallyscalable": false,
- "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "osdisplayname": "CentOS 5.6 (64-bit)",
- "tags": [],
- "jobid": "468d69d7-f327-4105-bec2-0e43107ae956",
- "jobstatus": 0
- }
- },
- "jobinstancetype": "VirtualMachine",
- "jobinstanceid": "915653c4-298b-4d74-bdee-4ced282114f1",
- "created": "2021-10-04T09:57:19+0000",
- "completed": "2021-10-04T09:57:22+0000",
- "jobid": "468d69d7-f327-4105-bec2-0e43107ae956"
- }
- }
- },
- "listVirtualMachines": {
- "listVirtualMachines": {
- "count": 1,
- "virtualmachine": [
- {
- "account": "admin",
- "affinitygroup": [],
- "cpunumber": 1,
- "cpuspeed": 100,
- "cpuused": "10%",
- "created": "2021-10-04T09:24:38+0000",
- "details": {
- "Message.ReservedCapacityFreed.Flag": "false"
- },
- "diskioread": 0,
- "diskiowrite": 0,
- "diskkbsread": 0,
- "diskkbswrite": 0,
- "displayname": "testDummyVM",
- "displayvm": true,
- "domain": "ROOT",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "haenable": false,
- "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
- "hostname": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
- "hypervisor": "Simulator",
- "id": "915653c4-298b-4d74-bdee-4ced282114f1",
- "instancename": "i-2-683-QA",
- "isdynamicallyscalable": false,
- "memory": 256,
- "memoryintfreekbs": 0,
- "memorykbs": 0,
- "memorytargetkbs": 0,
- "name": "testDummyVM",
- "networkkbsread": 1015808,
- "networkkbswrite": 507904,
- "nic": [
- {
- "broadcasturi": "vlan://1994",
- "extradhcpoption": [],
- "gateway": "10.1.1.1",
- "id": "47d79da1-2fe1-4a44-a503-523055714a72",
- "ipaddress": "10.1.1.62",
- "isdefault": true,
- "isolationuri": "vlan://1994",
- "macaddress": "02:00:34:fb:00:01",
- "netmask": "255.255.255.0",
- "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
- "networkname": "test",
- "secondaryip": [],
- "traffictype": "Guest",
- "type": "Isolated"
- }
- ],
- "osdisplayname": "CentOS 5.6 (64-bit)",
- "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
- "passwordenabled": false,
- "rootdeviceid": 0,
- "rootdevicetype": "ROOT",
- "securitygroup": [],
- "serviceofferingid": "498ce071-a077-4237-9492-e55c42553327",
- "serviceofferingname": "Very small instance",
- "state": "Running",
- "tags": [],
- "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
- "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
- "templatename": "CentOS 5.6 (64-bit)",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "username": "admin",
- "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
- "zonename": "shouldwork"
- }
- ]
- }
- },
- "scaleVirtualMachine": {
- "scaleVirtualMachine": {
- "scalevirtualmachineresponse": {
- "jobid": "f9a9af61-47ea-4fb7-acc9-93ea50f12042"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.vm.ScaleVMCmdByAdmin",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "virtualmachine": {
- "id": "88dedd6b-4fc0-44bf-b76f-441a13bc1f99",
- "name": "QA-88dedd6b-4fc0-44bf-b76f-441a13bc1f99",
- "displayname": "QA-88dedd6b-4fc0-44bf-b76f-441a13bc1f99",
- "account": "admin",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "username": "admin",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "domain": "ROOT",
- "created": "2020-05-22T19:52:22+0000",
- "lastupdated": "2021-10-06T09:57:19+0000",
- "state": "Stopped",
- "haenable": false,
- "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
- "zonename": "SimZone1",
- "templateid": "56217438-4f36-450b-9246-850a10a3e57b",
- "templatename": "macha-sim1",
- "templatedisplaytext": "macha-simm",
- "passwordenabled": true,
- "isoid": "169fe81d-47e0-4119-b38c-f6ce42dcf451",
- "isoname": "k8s-1.16.3-Kubernetes-Binaries-ISO",
- "isodisplaytext": "k8s-1.16.3-Kubernetes-Binaries-IS",
- "serviceofferingid": "57aba75e-5567-44c9-bfcc-c2c14503a5a6",
- "serviceofferingname": "Medium Instanc",
- "backupofferingid": "7c42d74e-c029-4431-9025-6caa8b903472",
- "backupofferingname": "BackupGoldDummy",
- "cpunumber": 1,
- "cpuspeed": 1000,
- "memory": 1024,
- "guestosid": "12fea95b-5fe0-11ea-9a56-1e006800018c",
- "rootdeviceid": 0,
- "rootdevicetype": "ROOT",
- "securitygroup": [],
- "nic": [
- {
- "id": "c26193a6-9b41-4149-b836-e48bc46fc5c8",
- "networkid": "b9bb5ef5-16cd-413c-996e-3671d8a2bc20",
- "networkname": "test",
- "netmask": "255.255.255.0",
- "gateway": "10.1.1.1",
- "ipaddress": "10.1.1.208",
- "traffictype": "Guest",
- "type": "Isolated",
- "isdefault": false,
- "macaddress": "02:00:63:59:00:05",
- "secondaryip": [],
- "extradhcpoption": [],
- "deviceid": "1"
- },
- {
- "id": "d9f8203d-e680-438a-86b6-327c69271011",
- "networkid": "cc39d938-5ea0-4d9c-b89d-421da3274e54",
- "networkname": "testNet2",
- "netmask": "255.255.255.0",
- "gateway": "10.1.1.1",
- "ipaddress": "10.1.1.177",
- "traffictype": "Guest",
- "type": "Isolated",
- "isdefault": true,
- "macaddress": "02:00:22:f7:00:08",
- "secondaryip": [],
- "extradhcpoption": [],
- "deviceid": "0"
- }
- ],
- "hypervisor": "Simulator",
- "instancename": "i-2-101-QA",
- "details": {
- "keyboard": "us",
- "Message.ReservedCapacityFreed.Flag": "true"
- },
- "affinitygroup": [],
- "displayvm": true,
- "isdynamicallyscalable": false,
- "ostypeid": "12fea95b-5fe0-11ea-9a56-1e006800018c",
- "osdisplayname": "CentOS 6 (64-bit)",
- "pooltype": "NetworkFilesystem",
- "receivedbytes": 0,
- "sentbytes": 0,
- "tags": [],
- "hasannotations": true
- }
- },
- "created": "2021-10-13T04:54:55+0000",
- "completed": "2021-10-13T04:54:56+0000",
- "jobid": "f9a9af61-47ea-4fb7-acc9-93ea50f12042"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/generate/generate.go b/generate/generate.go
index 1fc5f38..b50dc62 100644
--- a/generate/generate.go
+++ b/generate/generate.go
@@ -226,6 +226,15 @@
errors = append(errors, &goimportError{string(out)})
}
+ testdir, err := testDir()
+ if err != nil {
+ log.Fatal(err)
+ }
+ out, err = exec.Command("goimports", "-w", testdir).CombinedOutput()
+ if err != nil {
+ errors = append(errors, &goimportError{string(out)})
+ }
+
if len(errors) > 0 {
log.Printf("%d API(s) failed to generate:", len(errors))
for _, ce := range errors {
@@ -769,6 +778,16 @@
return err
}
+ if s.name != "CustomService" {
+ tests, err := s.GenerateTestCode()
+ if err != nil {
+ return err
+ }
+ testdir, err := testDir()
+ file := path.Join(testdir, s.name+"_test.go")
+ ioutil.WriteFile(file, tests, 0644)
+ }
+
file := path.Join(outdir, s.name+".go")
return ioutil.WriteFile(file, code, 0644)
}
@@ -974,6 +993,105 @@
return clean, nil
}
+func (s *service) GenerateTestCode() ([]byte, error) {
+ var buf bytes.Buffer
+ s.p = func(format string, args ...interface{}) {
+ _, err := fmt.Fprintf(&buf, format, args...)
+ if err != nil {
+ panic(err)
+ }
+ }
+ s.pn = func(format string, args ...interface{}) {
+ s.p(format+"\n", args...)
+ }
+ pn := s.pn
+
+ pn("//")
+ pn("// Licensed to the Apache Software Foundation (ASF) under one")
+ pn("// or more contributor license agreements. See the NOTICE file")
+ pn("// distributed with this work for additional information")
+ pn("// regarding copyright ownership. The ASF licenses this file")
+ pn("// to you under the Apache License, Version 2.0 (the")
+ pn("// \"License\"); you may not use this file except in compliance")
+ pn("// with the License. You may obtain a copy of the License at")
+ pn("//")
+ pn("// http://www.apache.org/licenses/LICENSE-2.0")
+ pn("//")
+ pn("// Unless required by applicable law or agreed to in writing,")
+ pn("// software distributed under the License is distributed on an")
+ pn("// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY")
+ pn("// KIND, either express or implied. See the License for the")
+ pn("// specific language governing permissions and limitations")
+ pn("// under the License.")
+ pn("//")
+ pn("")
+ pn("package test")
+ pn("")
+
+ pn("func Test%s(t *testing.T) {", s.name)
+ pn(" service := \"%s\"", s.name)
+ pn(" response, err := readData(service)")
+ pn(" if err != nil {")
+ pn(" t.Skipf(\"Skipping test as %%v\", err)")
+ pn(" }")
+ pn(" server := CreateTestServer(t, response)")
+ pn(" client := cloudstack.NewClient(server.URL, \"APIKEY\", \"SECRETKEY\", true)")
+ pn(" defer server.Close()")
+ pn("")
+
+ for _, a := range s.apis {
+ s.generateAPITest(a)
+ }
+ pn("}")
+
+ clean, err := format.Source(buf.Bytes())
+ if err != nil {
+ buf.WriteTo(os.Stdout)
+ return buf.Bytes(), err
+ }
+ return clean, nil
+}
+
+func (s *service) generateAPITest(a *API) {
+ p, pn := s.p, s.pn
+ tn := capitalize(a.Name + "Params")
+ rp := APIParams{}
+ pn(" test%s := func(t *testing.T) {", a.Name)
+ pn(" if _, ok := response[\"%s\"]; !ok {", a.Name)
+ pn(" t.Skipf(\"Skipping as no json response is provided in testdata\")")
+ pn(" }")
+ p(" p := client.%s.New%s(", strings.TrimSuffix(s.name, "Service"), tn)
+ for _, ap := range a.Params {
+ if ap.Required {
+ rp = append(rp, ap)
+ p("%s, ", getDefaultValueForType(a.Name, ap.Name, ap.Type))
+ }
+ }
+ pn(")")
+ pn(" _, err := client.%s.%s(p)", strings.TrimSuffix(s.name, "Service"), capitalize(a.Name))
+ pn(" if err != nil {")
+ pn(" t.Errorf(err.Error())")
+ pn(" }")
+ pn(" }")
+ pn(" t.Run(\"%s\", test%s)", capitalize(a.Name), a.Name)
+ pn("")
+}
+
+func getDefaultValueForType(aName string, pName string, pType string) string {
+ switch pType {
+ case "boolean":
+ return "true"
+ case "short", "int", "integer", "long", "float", "double":
+ return "0"
+ case "list":
+ return "[]string{}"
+ case "map":
+ return "map[string]string{}"
+ default:
+ return fmt.Sprintf("\"%s\"", pName)
+ }
+}
+
func (s *service) generateParamType(a *API) {
pn := s.pn
@@ -1831,6 +1949,20 @@
return outdir, nil
}
+func testDir() (string, error) {
+ wd, err := os.Getwd()
+ if err != nil {
+ return "", err
+ }
+ testdir := path.Join(wd, "test")
+
+ if err := os.MkdirAll(testdir, 0755); err != nil {
+ return "", fmt.Errorf("Failed to Mkdir %s: %v", testdir, err)
+ }
+ return testdir, nil
+
+}
+
func mapType(aName string, pName string, pType string) string {
if _, ok := longToStringConvertedParams[pName]; ok {
pType = "UUID"
diff --git a/test/APIDiscoveryService_test.go b/test/APIDiscoveryService_test.go
new file mode 100644
index 0000000..ccd60d1
--- /dev/null
+++ b/test/APIDiscoveryService_test.go
@@ -0,0 +1,50 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestAPIDiscoveryService(t *testing.T) {
+ service := "APIDiscoveryService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testlistApis := func(t *testing.T) {
+ if _, ok := response["listApis"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.APIDiscovery.NewListApisParams()
+ _, err := client.APIDiscovery.ListApis(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListApis", testlistApis)
+
+}
diff --git a/test/AccountService_test.go b/test/AccountService_test.go
new file mode 100644
index 0000000..7810e9d
--- /dev/null
+++ b/test/AccountService_test.go
@@ -0,0 +1,182 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestAccountService(t *testing.T) {
+ service := "AccountService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddAccountToProject := func(t *testing.T) {
+ if _, ok := response["addAccountToProject"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewAddAccountToProjectParams("projectid")
+ _, err := client.Account.AddAccountToProject(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddAccountToProject", testaddAccountToProject)
+
+ testcreateAccount := func(t *testing.T) {
+ if _, ok := response["createAccount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewCreateAccountParams("email", "firstname", "lastname", "password", "username")
+ _, err := client.Account.CreateAccount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateAccount", testcreateAccount)
+
+ testdeleteAccount := func(t *testing.T) {
+ if _, ok := response["deleteAccount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewDeleteAccountParams("id")
+ _, err := client.Account.DeleteAccount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteAccount", testdeleteAccount)
+
+ testdeleteAccountFromProject := func(t *testing.T) {
+ if _, ok := response["deleteAccountFromProject"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewDeleteAccountFromProjectParams("account", "projectid")
+ _, err := client.Account.DeleteAccountFromProject(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteAccountFromProject", testdeleteAccountFromProject)
+
+ testdisableAccount := func(t *testing.T) {
+ if _, ok := response["disableAccount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewDisableAccountParams(true)
+ _, err := client.Account.DisableAccount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableAccount", testdisableAccount)
+
+ testenableAccount := func(t *testing.T) {
+ if _, ok := response["enableAccount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewEnableAccountParams()
+ _, err := client.Account.EnableAccount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableAccount", testenableAccount)
+
+ testgetSolidFireAccountId := func(t *testing.T) {
+ if _, ok := response["getSolidFireAccountId"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewGetSolidFireAccountIdParams("accountid", "storageid")
+ _, err := client.Account.GetSolidFireAccountId(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetSolidFireAccountId", testgetSolidFireAccountId)
+
+ testlistAccounts := func(t *testing.T) {
+ if _, ok := response["listAccounts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewListAccountsParams()
+ _, err := client.Account.ListAccounts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListAccounts", testlistAccounts)
+
+ testlistProjectAccounts := func(t *testing.T) {
+ if _, ok := response["listProjectAccounts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewListProjectAccountsParams("projectid")
+ _, err := client.Account.ListProjectAccounts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListProjectAccounts", testlistProjectAccounts)
+
+ testlockAccount := func(t *testing.T) {
+ if _, ok := response["lockAccount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewLockAccountParams("account", "domainid")
+ _, err := client.Account.LockAccount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("LockAccount", testlockAccount)
+
+ testmarkDefaultZoneForAccount := func(t *testing.T) {
+ if _, ok := response["markDefaultZoneForAccount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewMarkDefaultZoneForAccountParams("account", "domainid", "zoneid")
+ _, err := client.Account.MarkDefaultZoneForAccount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("MarkDefaultZoneForAccount", testmarkDefaultZoneForAccount)
+
+ testupdateAccount := func(t *testing.T) {
+ if _, ok := response["updateAccount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Account.NewUpdateAccountParams()
+ _, err := client.Account.UpdateAccount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateAccount", testupdateAccount)
+
+}
diff --git a/test/AddressService_test.go b/test/AddressService_test.go
new file mode 100644
index 0000000..5a71b71
--- /dev/null
+++ b/test/AddressService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestAddressService(t *testing.T) {
+ service := "AddressService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testassociateIpAddress := func(t *testing.T) {
+ if _, ok := response["associateIpAddress"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Address.NewAssociateIpAddressParams()
+ _, err := client.Address.AssociateIpAddress(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AssociateIpAddress", testassociateIpAddress)
+
+ testdisassociateIpAddress := func(t *testing.T) {
+ if _, ok := response["disassociateIpAddress"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Address.NewDisassociateIpAddressParams("id")
+ _, err := client.Address.DisassociateIpAddress(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisassociateIpAddress", testdisassociateIpAddress)
+
+ testlistPublicIpAddresses := func(t *testing.T) {
+ if _, ok := response["listPublicIpAddresses"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Address.NewListPublicIpAddressesParams()
+ _, err := client.Address.ListPublicIpAddresses(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListPublicIpAddresses", testlistPublicIpAddresses)
+
+ testupdateIpAddress := func(t *testing.T) {
+ if _, ok := response["updateIpAddress"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Address.NewUpdateIpAddressParams("id")
+ _, err := client.Address.UpdateIpAddress(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateIpAddress", testupdateIpAddress)
+
+}
diff --git a/test/AffinityGroupService_test.go b/test/AffinityGroupService_test.go
new file mode 100644
index 0000000..e841b4a
--- /dev/null
+++ b/test/AffinityGroupService_test.go
@@ -0,0 +1,98 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestAffinityGroupService(t *testing.T) {
+ service := "AffinityGroupService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateAffinityGroup := func(t *testing.T) {
+ if _, ok := response["createAffinityGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AffinityGroup.NewCreateAffinityGroupParams("name", "type")
+ _, err := client.AffinityGroup.CreateAffinityGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateAffinityGroup", testcreateAffinityGroup)
+
+ testdeleteAffinityGroup := func(t *testing.T) {
+ if _, ok := response["deleteAffinityGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AffinityGroup.NewDeleteAffinityGroupParams()
+ _, err := client.AffinityGroup.DeleteAffinityGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteAffinityGroup", testdeleteAffinityGroup)
+
+ testlistAffinityGroupTypes := func(t *testing.T) {
+ if _, ok := response["listAffinityGroupTypes"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AffinityGroup.NewListAffinityGroupTypesParams()
+ _, err := client.AffinityGroup.ListAffinityGroupTypes(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListAffinityGroupTypes", testlistAffinityGroupTypes)
+
+ testlistAffinityGroups := func(t *testing.T) {
+ if _, ok := response["listAffinityGroups"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AffinityGroup.NewListAffinityGroupsParams()
+ _, err := client.AffinityGroup.ListAffinityGroups(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListAffinityGroups", testlistAffinityGroups)
+
+ testupdateVMAffinityGroup := func(t *testing.T) {
+ if _, ok := response["updateVMAffinityGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AffinityGroup.NewUpdateVMAffinityGroupParams("id")
+ _, err := client.AffinityGroup.UpdateVMAffinityGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVMAffinityGroup", testupdateVMAffinityGroup)
+
+}
diff --git a/test/AlertService_test.go b/test/AlertService_test.go
new file mode 100644
index 0000000..e409fe2
--- /dev/null
+++ b/test/AlertService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestAlertService(t *testing.T) {
+ service := "AlertService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testarchiveAlerts := func(t *testing.T) {
+ if _, ok := response["archiveAlerts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Alert.NewArchiveAlertsParams()
+ _, err := client.Alert.ArchiveAlerts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ArchiveAlerts", testarchiveAlerts)
+
+ testdeleteAlerts := func(t *testing.T) {
+ if _, ok := response["deleteAlerts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Alert.NewDeleteAlertsParams()
+ _, err := client.Alert.DeleteAlerts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteAlerts", testdeleteAlerts)
+
+ testgenerateAlert := func(t *testing.T) {
+ if _, ok := response["generateAlert"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Alert.NewGenerateAlertParams("description", "name", 0)
+ _, err := client.Alert.GenerateAlert(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GenerateAlert", testgenerateAlert)
+
+ testlistAlerts := func(t *testing.T) {
+ if _, ok := response["listAlerts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Alert.NewListAlertsParams()
+ _, err := client.Alert.ListAlerts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListAlerts", testlistAlerts)
+
+}
diff --git a/test/AsyncjobService_test.go b/test/AsyncjobService_test.go
new file mode 100644
index 0000000..e89c2bf
--- /dev/null
+++ b/test/AsyncjobService_test.go
@@ -0,0 +1,62 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestAsyncjobService(t *testing.T) {
+ service := "AsyncjobService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testlistAsyncJobs := func(t *testing.T) {
+ if _, ok := response["listAsyncJobs"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Asyncjob.NewListAsyncJobsParams()
+ _, err := client.Asyncjob.ListAsyncJobs(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListAsyncJobs", testlistAsyncJobs)
+
+ testqueryAsyncJobResult := func(t *testing.T) {
+ if _, ok := response["queryAsyncJobResult"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Asyncjob.NewQueryAsyncJobResultParams("jobid")
+ _, err := client.Asyncjob.QueryAsyncJobResult(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("QueryAsyncJobResult", testqueryAsyncJobResult)
+
+}
diff --git a/test/AuthenticationService_test.go b/test/AuthenticationService_test.go
new file mode 100644
index 0000000..891b0a5
--- /dev/null
+++ b/test/AuthenticationService_test.go
@@ -0,0 +1,62 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestAuthenticationService(t *testing.T) {
+ service := "AuthenticationService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testlogin := func(t *testing.T) {
+ if _, ok := response["login"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Authentication.NewLoginParams("password", "username")
+ _, err := client.Authentication.Login(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("Login", testlogin)
+
+ testlogout := func(t *testing.T) {
+ if _, ok := response["logout"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Authentication.NewLogoutParams()
+ _, err := client.Authentication.Logout(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("Logout", testlogout)
+
+}
diff --git a/test/AutoScaleService_test.go b/test/AutoScaleService_test.go
new file mode 100644
index 0000000..0eb73f8
--- /dev/null
+++ b/test/AutoScaleService_test.go
@@ -0,0 +1,278 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestAutoScaleService(t *testing.T) {
+ service := "AutoScaleService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateAutoScalePolicy := func(t *testing.T) {
+ if _, ok := response["createAutoScalePolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewCreateAutoScalePolicyParams("action", []string{}, 0)
+ _, err := client.AutoScale.CreateAutoScalePolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateAutoScalePolicy", testcreateAutoScalePolicy)
+
+ testcreateAutoScaleVmGroup := func(t *testing.T) {
+ if _, ok := response["createAutoScaleVmGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewCreateAutoScaleVmGroupParams("lbruleid", 0, 0, []string{}, []string{}, "vmprofileid")
+ _, err := client.AutoScale.CreateAutoScaleVmGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateAutoScaleVmGroup", testcreateAutoScaleVmGroup)
+
+ testcreateAutoScaleVmProfile := func(t *testing.T) {
+ if _, ok := response["createAutoScaleVmProfile"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewCreateAutoScaleVmProfileParams("serviceofferingid", "templateid", "zoneid")
+ _, err := client.AutoScale.CreateAutoScaleVmProfile(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateAutoScaleVmProfile", testcreateAutoScaleVmProfile)
+
+ testcreateCondition := func(t *testing.T) {
+ if _, ok := response["createCondition"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewCreateConditionParams("counterid", "relationaloperator", 0)
+ _, err := client.AutoScale.CreateCondition(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateCondition", testcreateCondition)
+
+ testcreateCounter := func(t *testing.T) {
+ if _, ok := response["createCounter"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewCreateCounterParams("name", "source", "value")
+ _, err := client.AutoScale.CreateCounter(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateCounter", testcreateCounter)
+
+ testdeleteAutoScalePolicy := func(t *testing.T) {
+ if _, ok := response["deleteAutoScalePolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewDeleteAutoScalePolicyParams("id")
+ _, err := client.AutoScale.DeleteAutoScalePolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteAutoScalePolicy", testdeleteAutoScalePolicy)
+
+ testdeleteAutoScaleVmGroup := func(t *testing.T) {
+ if _, ok := response["deleteAutoScaleVmGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewDeleteAutoScaleVmGroupParams("id")
+ _, err := client.AutoScale.DeleteAutoScaleVmGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteAutoScaleVmGroup", testdeleteAutoScaleVmGroup)
+
+ testdeleteAutoScaleVmProfile := func(t *testing.T) {
+ if _, ok := response["deleteAutoScaleVmProfile"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewDeleteAutoScaleVmProfileParams("id")
+ _, err := client.AutoScale.DeleteAutoScaleVmProfile(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteAutoScaleVmProfile", testdeleteAutoScaleVmProfile)
+
+ testdeleteCondition := func(t *testing.T) {
+ if _, ok := response["deleteCondition"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewDeleteConditionParams("id")
+ _, err := client.AutoScale.DeleteCondition(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteCondition", testdeleteCondition)
+
+ testdeleteCounter := func(t *testing.T) {
+ if _, ok := response["deleteCounter"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewDeleteCounterParams("id")
+ _, err := client.AutoScale.DeleteCounter(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteCounter", testdeleteCounter)
+
+ testdisableAutoScaleVmGroup := func(t *testing.T) {
+ if _, ok := response["disableAutoScaleVmGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewDisableAutoScaleVmGroupParams("id")
+ _, err := client.AutoScale.DisableAutoScaleVmGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableAutoScaleVmGroup", testdisableAutoScaleVmGroup)
+
+ testenableAutoScaleVmGroup := func(t *testing.T) {
+ if _, ok := response["enableAutoScaleVmGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewEnableAutoScaleVmGroupParams("id")
+ _, err := client.AutoScale.EnableAutoScaleVmGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableAutoScaleVmGroup", testenableAutoScaleVmGroup)
+
+ testlistAutoScalePolicies := func(t *testing.T) {
+ if _, ok := response["listAutoScalePolicies"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewListAutoScalePoliciesParams()
+ _, err := client.AutoScale.ListAutoScalePolicies(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListAutoScalePolicies", testlistAutoScalePolicies)
+
+ testlistAutoScaleVmGroups := func(t *testing.T) {
+ if _, ok := response["listAutoScaleVmGroups"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewListAutoScaleVmGroupsParams()
+ _, err := client.AutoScale.ListAutoScaleVmGroups(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListAutoScaleVmGroups", testlistAutoScaleVmGroups)
+
+ testlistAutoScaleVmProfiles := func(t *testing.T) {
+ if _, ok := response["listAutoScaleVmProfiles"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewListAutoScaleVmProfilesParams()
+ _, err := client.AutoScale.ListAutoScaleVmProfiles(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListAutoScaleVmProfiles", testlistAutoScaleVmProfiles)
+
+ testlistConditions := func(t *testing.T) {
+ if _, ok := response["listConditions"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewListConditionsParams()
+ _, err := client.AutoScale.ListConditions(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListConditions", testlistConditions)
+
+ testlistCounters := func(t *testing.T) {
+ if _, ok := response["listCounters"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewListCountersParams()
+ _, err := client.AutoScale.ListCounters(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListCounters", testlistCounters)
+
+ testupdateAutoScalePolicy := func(t *testing.T) {
+ if _, ok := response["updateAutoScalePolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewUpdateAutoScalePolicyParams("id")
+ _, err := client.AutoScale.UpdateAutoScalePolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateAutoScalePolicy", testupdateAutoScalePolicy)
+
+ testupdateAutoScaleVmGroup := func(t *testing.T) {
+ if _, ok := response["updateAutoScaleVmGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewUpdateAutoScaleVmGroupParams("id")
+ _, err := client.AutoScale.UpdateAutoScaleVmGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateAutoScaleVmGroup", testupdateAutoScaleVmGroup)
+
+ testupdateAutoScaleVmProfile := func(t *testing.T) {
+ if _, ok := response["updateAutoScaleVmProfile"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.AutoScale.NewUpdateAutoScaleVmProfileParams("id")
+ _, err := client.AutoScale.UpdateAutoScaleVmProfile(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateAutoScaleVmProfile", testupdateAutoScaleVmProfile)
+
+}
diff --git a/test/BaremetalService_test.go b/test/BaremetalService_test.go
new file mode 100644
index 0000000..77a53ba
--- /dev/null
+++ b/test/BaremetalService_test.go
@@ -0,0 +1,146 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestBaremetalService(t *testing.T) {
+ service := "BaremetalService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddBaremetalDhcp := func(t *testing.T) {
+ if _, ok := response["addBaremetalDhcp"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewAddBaremetalDhcpParams("dhcpservertype", "password", "physicalnetworkid", "url", "username")
+ _, err := client.Baremetal.AddBaremetalDhcp(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddBaremetalDhcp", testaddBaremetalDhcp)
+
+ testaddBaremetalPxeKickStartServer := func(t *testing.T) {
+ if _, ok := response["addBaremetalPxeKickStartServer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewAddBaremetalPxeKickStartServerParams("password", "physicalnetworkid", "pxeservertype", "tftpdir", "url", "username")
+ _, err := client.Baremetal.AddBaremetalPxeKickStartServer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddBaremetalPxeKickStartServer", testaddBaremetalPxeKickStartServer)
+
+ testaddBaremetalPxePingServer := func(t *testing.T) {
+ if _, ok := response["addBaremetalPxePingServer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewAddBaremetalPxePingServerParams("password", "physicalnetworkid", "pingdir", "pingstorageserverip", "pxeservertype", "tftpdir", "url", "username")
+ _, err := client.Baremetal.AddBaremetalPxePingServer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddBaremetalPxePingServer", testaddBaremetalPxePingServer)
+
+ testaddBaremetalRct := func(t *testing.T) {
+ if _, ok := response["addBaremetalRct"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewAddBaremetalRctParams("baremetalrcturl")
+ _, err := client.Baremetal.AddBaremetalRct(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddBaremetalRct", testaddBaremetalRct)
+
+ testdeleteBaremetalRct := func(t *testing.T) {
+ if _, ok := response["deleteBaremetalRct"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewDeleteBaremetalRctParams("id")
+ _, err := client.Baremetal.DeleteBaremetalRct(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteBaremetalRct", testdeleteBaremetalRct)
+
+ testlistBaremetalDhcp := func(t *testing.T) {
+ if _, ok := response["listBaremetalDhcp"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewListBaremetalDhcpParams("physicalnetworkid")
+ _, err := client.Baremetal.ListBaremetalDhcp(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListBaremetalDhcp", testlistBaremetalDhcp)
+
+ testlistBaremetalPxeServers := func(t *testing.T) {
+ if _, ok := response["listBaremetalPxeServers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewListBaremetalPxeServersParams("physicalnetworkid")
+ _, err := client.Baremetal.ListBaremetalPxeServers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListBaremetalPxeServers", testlistBaremetalPxeServers)
+
+ testlistBaremetalRct := func(t *testing.T) {
+ if _, ok := response["listBaremetalRct"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewListBaremetalRctParams()
+ _, err := client.Baremetal.ListBaremetalRct(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListBaremetalRct", testlistBaremetalRct)
+
+ testnotifyBaremetalProvisionDone := func(t *testing.T) {
+ if _, ok := response["notifyBaremetalProvisionDone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Baremetal.NewNotifyBaremetalProvisionDoneParams("mac")
+ _, err := client.Baremetal.NotifyBaremetalProvisionDone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("NotifyBaremetalProvisionDone", testnotifyBaremetalProvisionDone)
+
+}
diff --git a/test/BigSwitchBCFService_test.go b/test/BigSwitchBCFService_test.go
new file mode 100644
index 0000000..87d377f
--- /dev/null
+++ b/test/BigSwitchBCFService_test.go
@@ -0,0 +1,74 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestBigSwitchBCFService(t *testing.T) {
+ service := "BigSwitchBCFService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddBigSwitchBcfDevice := func(t *testing.T) {
+ if _, ok := response["addBigSwitchBcfDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.BigSwitchBCF.NewAddBigSwitchBcfDeviceParams("hostname", true, "password", "physicalnetworkid", "username")
+ _, err := client.BigSwitchBCF.AddBigSwitchBcfDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddBigSwitchBcfDevice", testaddBigSwitchBcfDevice)
+
+ testdeleteBigSwitchBcfDevice := func(t *testing.T) {
+ if _, ok := response["deleteBigSwitchBcfDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.BigSwitchBCF.NewDeleteBigSwitchBcfDeviceParams("bcfdeviceid")
+ _, err := client.BigSwitchBCF.DeleteBigSwitchBcfDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteBigSwitchBcfDevice", testdeleteBigSwitchBcfDevice)
+
+ testlistBigSwitchBcfDevices := func(t *testing.T) {
+ if _, ok := response["listBigSwitchBcfDevices"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.BigSwitchBCF.NewListBigSwitchBcfDevicesParams()
+ _, err := client.BigSwitchBCF.ListBigSwitchBcfDevices(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListBigSwitchBcfDevices", testlistBigSwitchBcfDevices)
+
+}
diff --git a/test/BrocadeVCSService_test.go b/test/BrocadeVCSService_test.go
new file mode 100644
index 0000000..bbd6685
--- /dev/null
+++ b/test/BrocadeVCSService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestBrocadeVCSService(t *testing.T) {
+ service := "BrocadeVCSService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddBrocadeVcsDevice := func(t *testing.T) {
+ if _, ok := response["addBrocadeVcsDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.BrocadeVCS.NewAddBrocadeVcsDeviceParams("hostname", "password", "physicalnetworkid", "username")
+ _, err := client.BrocadeVCS.AddBrocadeVcsDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddBrocadeVcsDevice", testaddBrocadeVcsDevice)
+
+ testdeleteBrocadeVcsDevice := func(t *testing.T) {
+ if _, ok := response["deleteBrocadeVcsDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.BrocadeVCS.NewDeleteBrocadeVcsDeviceParams("vcsdeviceid")
+ _, err := client.BrocadeVCS.DeleteBrocadeVcsDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteBrocadeVcsDevice", testdeleteBrocadeVcsDevice)
+
+ testlistBrocadeVcsDeviceNetworks := func(t *testing.T) {
+ if _, ok := response["listBrocadeVcsDeviceNetworks"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.BrocadeVCS.NewListBrocadeVcsDeviceNetworksParams("vcsdeviceid")
+ _, err := client.BrocadeVCS.ListBrocadeVcsDeviceNetworks(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListBrocadeVcsDeviceNetworks", testlistBrocadeVcsDeviceNetworks)
+
+ testlistBrocadeVcsDevices := func(t *testing.T) {
+ if _, ok := response["listBrocadeVcsDevices"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.BrocadeVCS.NewListBrocadeVcsDevicesParams()
+ _, err := client.BrocadeVCS.ListBrocadeVcsDevices(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListBrocadeVcsDevices", testlistBrocadeVcsDevices)
+
+}
diff --git a/test/CertificateService_test.go b/test/CertificateService_test.go
new file mode 100644
index 0000000..1a6caae
--- /dev/null
+++ b/test/CertificateService_test.go
@@ -0,0 +1,50 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestCertificateService(t *testing.T) {
+ service := "CertificateService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testuploadCustomCertificate := func(t *testing.T) {
+ if _, ok := response["uploadCustomCertificate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Certificate.NewUploadCustomCertificateParams("certificate", "domainsuffix")
+ _, err := client.Certificate.UploadCustomCertificate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UploadCustomCertificate", testuploadCustomCertificate)
+
+}
diff --git a/test/CloudIdentifierService_test.go b/test/CloudIdentifierService_test.go
new file mode 100644
index 0000000..6173ff8
--- /dev/null
+++ b/test/CloudIdentifierService_test.go
@@ -0,0 +1,50 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestCloudIdentifierService(t *testing.T) {
+ service := "CloudIdentifierService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testgetCloudIdentifier := func(t *testing.T) {
+ if _, ok := response["getCloudIdentifier"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.CloudIdentifier.NewGetCloudIdentifierParams("userid")
+ _, err := client.CloudIdentifier.GetCloudIdentifier(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetCloudIdentifier", testgetCloudIdentifier)
+
+}
diff --git a/test/ClusterService_test.go b/test/ClusterService_test.go
new file mode 100644
index 0000000..d08f0b1
--- /dev/null
+++ b/test/ClusterService_test.go
@@ -0,0 +1,182 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestClusterService(t *testing.T) {
+ service := "ClusterService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddCluster := func(t *testing.T) {
+ if _, ok := response["addCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewAddClusterParams("clustername", "clustertype", "hypervisor", "podid", "zoneid")
+ _, err := client.Cluster.AddCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddCluster", testaddCluster)
+
+ testdedicateCluster := func(t *testing.T) {
+ if _, ok := response["dedicateCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewDedicateClusterParams("clusterid", "domainid")
+ _, err := client.Cluster.DedicateCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DedicateCluster", testdedicateCluster)
+
+ testdeleteCluster := func(t *testing.T) {
+ if _, ok := response["deleteCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewDeleteClusterParams("id")
+ _, err := client.Cluster.DeleteCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteCluster", testdeleteCluster)
+
+ testdisableOutOfBandManagementForCluster := func(t *testing.T) {
+ if _, ok := response["disableOutOfBandManagementForCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewDisableOutOfBandManagementForClusterParams("clusterid")
+ _, err := client.Cluster.DisableOutOfBandManagementForCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableOutOfBandManagementForCluster", testdisableOutOfBandManagementForCluster)
+
+ testenableOutOfBandManagementForCluster := func(t *testing.T) {
+ if _, ok := response["enableOutOfBandManagementForCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewEnableOutOfBandManagementForClusterParams("clusterid")
+ _, err := client.Cluster.EnableOutOfBandManagementForCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableOutOfBandManagementForCluster", testenableOutOfBandManagementForCluster)
+
+ testenableHAForCluster := func(t *testing.T) {
+ if _, ok := response["enableHAForCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewEnableHAForClusterParams("clusterid")
+ _, err := client.Cluster.EnableHAForCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableHAForCluster", testenableHAForCluster)
+
+ testdisableHAForCluster := func(t *testing.T) {
+ if _, ok := response["disableHAForCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewDisableHAForClusterParams("clusterid")
+ _, err := client.Cluster.DisableHAForCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableHAForCluster", testdisableHAForCluster)
+
+ testlistClusters := func(t *testing.T) {
+ if _, ok := response["listClusters"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewListClustersParams()
+ _, err := client.Cluster.ListClusters(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListClusters", testlistClusters)
+
+ testlistClustersMetrics := func(t *testing.T) {
+ if _, ok := response["listClustersMetrics"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewListClustersMetricsParams()
+ _, err := client.Cluster.ListClustersMetrics(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListClustersMetrics", testlistClustersMetrics)
+
+ testlistDedicatedClusters := func(t *testing.T) {
+ if _, ok := response["listDedicatedClusters"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewListDedicatedClustersParams()
+ _, err := client.Cluster.ListDedicatedClusters(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDedicatedClusters", testlistDedicatedClusters)
+
+ testreleaseDedicatedCluster := func(t *testing.T) {
+ if _, ok := response["releaseDedicatedCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewReleaseDedicatedClusterParams("clusterid")
+ _, err := client.Cluster.ReleaseDedicatedCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReleaseDedicatedCluster", testreleaseDedicatedCluster)
+
+ testupdateCluster := func(t *testing.T) {
+ if _, ok := response["updateCluster"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Cluster.NewUpdateClusterParams("id")
+ _, err := client.Cluster.UpdateCluster(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateCluster", testupdateCluster)
+
+}
diff --git a/test/ConfigurationService_test.go b/test/ConfigurationService_test.go
new file mode 100644
index 0000000..355fb73
--- /dev/null
+++ b/test/ConfigurationService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestConfigurationService(t *testing.T) {
+ service := "ConfigurationService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testlistCapabilities := func(t *testing.T) {
+ if _, ok := response["listCapabilities"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Configuration.NewListCapabilitiesParams()
+ _, err := client.Configuration.ListCapabilities(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListCapabilities", testlistCapabilities)
+
+ testlistConfigurations := func(t *testing.T) {
+ if _, ok := response["listConfigurations"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Configuration.NewListConfigurationsParams()
+ _, err := client.Configuration.ListConfigurations(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListConfigurations", testlistConfigurations)
+
+ testlistDeploymentPlanners := func(t *testing.T) {
+ if _, ok := response["listDeploymentPlanners"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Configuration.NewListDeploymentPlannersParams()
+ _, err := client.Configuration.ListDeploymentPlanners(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDeploymentPlanners", testlistDeploymentPlanners)
+
+ testupdateConfiguration := func(t *testing.T) {
+ if _, ok := response["updateConfiguration"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Configuration.NewUpdateConfigurationParams("name")
+ _, err := client.Configuration.UpdateConfiguration(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateConfiguration", testupdateConfiguration)
+
+}
diff --git a/test/DiskOfferingService_test.go b/test/DiskOfferingService_test.go
new file mode 100644
index 0000000..87ed9a9
--- /dev/null
+++ b/test/DiskOfferingService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestDiskOfferingService(t *testing.T) {
+ service := "DiskOfferingService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateDiskOffering := func(t *testing.T) {
+ if _, ok := response["createDiskOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.DiskOffering.NewCreateDiskOfferingParams("displaytext", "name")
+ _, err := client.DiskOffering.CreateDiskOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateDiskOffering", testcreateDiskOffering)
+
+ testdeleteDiskOffering := func(t *testing.T) {
+ if _, ok := response["deleteDiskOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.DiskOffering.NewDeleteDiskOfferingParams("id")
+ _, err := client.DiskOffering.DeleteDiskOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteDiskOffering", testdeleteDiskOffering)
+
+ testlistDiskOfferings := func(t *testing.T) {
+ if _, ok := response["listDiskOfferings"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.DiskOffering.NewListDiskOfferingsParams()
+ _, err := client.DiskOffering.ListDiskOfferings(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDiskOfferings", testlistDiskOfferings)
+
+ testupdateDiskOffering := func(t *testing.T) {
+ if _, ok := response["updateDiskOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.DiskOffering.NewUpdateDiskOfferingParams("id")
+ _, err := client.DiskOffering.UpdateDiskOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateDiskOffering", testupdateDiskOffering)
+
+}
diff --git a/test/DomainService_test.go b/test/DomainService_test.go
new file mode 100644
index 0000000..cd8dfa5
--- /dev/null
+++ b/test/DomainService_test.go
@@ -0,0 +1,98 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestDomainService(t *testing.T) {
+ service := "DomainService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateDomain := func(t *testing.T) {
+ if _, ok := response["createDomain"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Domain.NewCreateDomainParams("name")
+ _, err := client.Domain.CreateDomain(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateDomain", testcreateDomain)
+
+ testdeleteDomain := func(t *testing.T) {
+ if _, ok := response["deleteDomain"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Domain.NewDeleteDomainParams("id")
+ _, err := client.Domain.DeleteDomain(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteDomain", testdeleteDomain)
+
+ testlistDomainChildren := func(t *testing.T) {
+ if _, ok := response["listDomainChildren"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Domain.NewListDomainChildrenParams()
+ _, err := client.Domain.ListDomainChildren(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDomainChildren", testlistDomainChildren)
+
+ testlistDomains := func(t *testing.T) {
+ if _, ok := response["listDomains"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Domain.NewListDomainsParams()
+ _, err := client.Domain.ListDomains(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDomains", testlistDomains)
+
+ testupdateDomain := func(t *testing.T) {
+ if _, ok := response["updateDomain"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Domain.NewUpdateDomainParams("id")
+ _, err := client.Domain.UpdateDomain(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateDomain", testupdateDomain)
+
+}
diff --git a/test/EventService_test.go b/test/EventService_test.go
new file mode 100644
index 0000000..a38ad53
--- /dev/null
+++ b/test/EventService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestEventService(t *testing.T) {
+ service := "EventService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testarchiveEvents := func(t *testing.T) {
+ if _, ok := response["archiveEvents"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Event.NewArchiveEventsParams()
+ _, err := client.Event.ArchiveEvents(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ArchiveEvents", testarchiveEvents)
+
+ testdeleteEvents := func(t *testing.T) {
+ if _, ok := response["deleteEvents"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Event.NewDeleteEventsParams()
+ _, err := client.Event.DeleteEvents(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteEvents", testdeleteEvents)
+
+ testlistEventTypes := func(t *testing.T) {
+ if _, ok := response["listEventTypes"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Event.NewListEventTypesParams()
+ _, err := client.Event.ListEventTypes(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListEventTypes", testlistEventTypes)
+
+ testlistEvents := func(t *testing.T) {
+ if _, ok := response["listEvents"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Event.NewListEventsParams()
+ _, err := client.Event.ListEvents(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListEvents", testlistEvents)
+
+}
diff --git a/test/FirewallService_test.go b/test/FirewallService_test.go
new file mode 100644
index 0000000..f49ef89
--- /dev/null
+++ b/test/FirewallService_test.go
@@ -0,0 +1,230 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestFirewallService(t *testing.T) {
+ service := "FirewallService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddPaloAltoFirewall := func(t *testing.T) {
+ if _, ok := response["addPaloAltoFirewall"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewAddPaloAltoFirewallParams("networkdevicetype", "password", "physicalnetworkid", "url", "username")
+ _, err := client.Firewall.AddPaloAltoFirewall(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddPaloAltoFirewall", testaddPaloAltoFirewall)
+
+ testconfigurePaloAltoFirewall := func(t *testing.T) {
+ if _, ok := response["configurePaloAltoFirewall"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewConfigurePaloAltoFirewallParams("fwdeviceid")
+ _, err := client.Firewall.ConfigurePaloAltoFirewall(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ConfigurePaloAltoFirewall", testconfigurePaloAltoFirewall)
+
+ testcreateEgressFirewallRule := func(t *testing.T) {
+ if _, ok := response["createEgressFirewallRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewCreateEgressFirewallRuleParams("networkid", "protocol")
+ _, err := client.Firewall.CreateEgressFirewallRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateEgressFirewallRule", testcreateEgressFirewallRule)
+
+ testcreateFirewallRule := func(t *testing.T) {
+ if _, ok := response["createFirewallRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewCreateFirewallRuleParams("ipaddressid", "protocol")
+ _, err := client.Firewall.CreateFirewallRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateFirewallRule", testcreateFirewallRule)
+
+ testcreatePortForwardingRule := func(t *testing.T) {
+ if _, ok := response["createPortForwardingRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewCreatePortForwardingRuleParams("ipaddressid", 0, "protocol", 0, "virtualmachineid")
+ _, err := client.Firewall.CreatePortForwardingRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreatePortForwardingRule", testcreatePortForwardingRule)
+
+ testdeleteEgressFirewallRule := func(t *testing.T) {
+ if _, ok := response["deleteEgressFirewallRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewDeleteEgressFirewallRuleParams("id")
+ _, err := client.Firewall.DeleteEgressFirewallRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteEgressFirewallRule", testdeleteEgressFirewallRule)
+
+ testdeleteFirewallRule := func(t *testing.T) {
+ if _, ok := response["deleteFirewallRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewDeleteFirewallRuleParams("id")
+ _, err := client.Firewall.DeleteFirewallRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteFirewallRule", testdeleteFirewallRule)
+
+ testdeletePaloAltoFirewall := func(t *testing.T) {
+ if _, ok := response["deletePaloAltoFirewall"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewDeletePaloAltoFirewallParams("fwdeviceid")
+ _, err := client.Firewall.DeletePaloAltoFirewall(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeletePaloAltoFirewall", testdeletePaloAltoFirewall)
+
+ testdeletePortForwardingRule := func(t *testing.T) {
+ if _, ok := response["deletePortForwardingRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewDeletePortForwardingRuleParams("id")
+ _, err := client.Firewall.DeletePortForwardingRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeletePortForwardingRule", testdeletePortForwardingRule)
+
+ testlistEgressFirewallRules := func(t *testing.T) {
+ if _, ok := response["listEgressFirewallRules"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewListEgressFirewallRulesParams()
+ _, err := client.Firewall.ListEgressFirewallRules(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListEgressFirewallRules", testlistEgressFirewallRules)
+
+ testlistFirewallRules := func(t *testing.T) {
+ if _, ok := response["listFirewallRules"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewListFirewallRulesParams()
+ _, err := client.Firewall.ListFirewallRules(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListFirewallRules", testlistFirewallRules)
+
+ testlistPaloAltoFirewalls := func(t *testing.T) {
+ if _, ok := response["listPaloAltoFirewalls"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewListPaloAltoFirewallsParams()
+ _, err := client.Firewall.ListPaloAltoFirewalls(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListPaloAltoFirewalls", testlistPaloAltoFirewalls)
+
+ testlistPortForwardingRules := func(t *testing.T) {
+ if _, ok := response["listPortForwardingRules"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewListPortForwardingRulesParams()
+ _, err := client.Firewall.ListPortForwardingRules(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListPortForwardingRules", testlistPortForwardingRules)
+
+ testupdateEgressFirewallRule := func(t *testing.T) {
+ if _, ok := response["updateEgressFirewallRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewUpdateEgressFirewallRuleParams("id")
+ _, err := client.Firewall.UpdateEgressFirewallRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateEgressFirewallRule", testupdateEgressFirewallRule)
+
+ testupdateFirewallRule := func(t *testing.T) {
+ if _, ok := response["updateFirewallRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewUpdateFirewallRuleParams("id")
+ _, err := client.Firewall.UpdateFirewallRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateFirewallRule", testupdateFirewallRule)
+
+ testupdatePortForwardingRule := func(t *testing.T) {
+ if _, ok := response["updatePortForwardingRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Firewall.NewUpdatePortForwardingRuleParams("id")
+ _, err := client.Firewall.UpdatePortForwardingRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdatePortForwardingRule", testupdatePortForwardingRule)
+
+}
diff --git a/test/GuestOSService_test.go b/test/GuestOSService_test.go
new file mode 100644
index 0000000..7877db2
--- /dev/null
+++ b/test/GuestOSService_test.go
@@ -0,0 +1,146 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestGuestOSService(t *testing.T) {
+ service := "GuestOSService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddGuestOs := func(t *testing.T) {
+ if _, ok := response["addGuestOs"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewAddGuestOsParams(map[string]string{}, "oscategoryid", "osdisplayname")
+ _, err := client.GuestOS.AddGuestOs(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddGuestOs", testaddGuestOs)
+
+ testaddGuestOsMapping := func(t *testing.T) {
+ if _, ok := response["addGuestOsMapping"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewAddGuestOsMappingParams("hypervisor", "hypervisorversion", "osnameforhypervisor")
+ _, err := client.GuestOS.AddGuestOsMapping(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddGuestOsMapping", testaddGuestOsMapping)
+
+ testlistGuestOsMapping := func(t *testing.T) {
+ if _, ok := response["listGuestOsMapping"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewListGuestOsMappingParams()
+ _, err := client.GuestOS.ListGuestOsMapping(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListGuestOsMapping", testlistGuestOsMapping)
+
+ testlistOsCategories := func(t *testing.T) {
+ if _, ok := response["listOsCategories"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewListOsCategoriesParams()
+ _, err := client.GuestOS.ListOsCategories(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListOsCategories", testlistOsCategories)
+
+ testlistOsTypes := func(t *testing.T) {
+ if _, ok := response["listOsTypes"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewListOsTypesParams()
+ _, err := client.GuestOS.ListOsTypes(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListOsTypes", testlistOsTypes)
+
+ testremoveGuestOs := func(t *testing.T) {
+ if _, ok := response["removeGuestOs"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewRemoveGuestOsParams("id")
+ _, err := client.GuestOS.RemoveGuestOs(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveGuestOs", testremoveGuestOs)
+
+ testremoveGuestOsMapping := func(t *testing.T) {
+ if _, ok := response["removeGuestOsMapping"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewRemoveGuestOsMappingParams("id")
+ _, err := client.GuestOS.RemoveGuestOsMapping(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveGuestOsMapping", testremoveGuestOsMapping)
+
+ testupdateGuestOs := func(t *testing.T) {
+ if _, ok := response["updateGuestOs"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewUpdateGuestOsParams(map[string]string{}, "id", "osdisplayname")
+ _, err := client.GuestOS.UpdateGuestOs(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateGuestOs", testupdateGuestOs)
+
+ testupdateGuestOsMapping := func(t *testing.T) {
+ if _, ok := response["updateGuestOsMapping"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.GuestOS.NewUpdateGuestOsMappingParams("id", "osnameforhypervisor")
+ _, err := client.GuestOS.UpdateGuestOsMapping(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateGuestOsMapping", testupdateGuestOsMapping)
+
+}
diff --git a/test/HostService_test.go b/test/HostService_test.go
new file mode 100644
index 0000000..1ad6e25
--- /dev/null
+++ b/test/HostService_test.go
@@ -0,0 +1,302 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestHostService(t *testing.T) {
+ service := "HostService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddBaremetalHost := func(t *testing.T) {
+ if _, ok := response["addBaremetalHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewAddBaremetalHostParams("hypervisor", "podid", "url", "zoneid")
+ _, err := client.Host.AddBaremetalHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddBaremetalHost", testaddBaremetalHost)
+
+ testaddGloboDnsHost := func(t *testing.T) {
+ if _, ok := response["addGloboDnsHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewAddGloboDnsHostParams("password", "physicalnetworkid", "url", "username")
+ _, err := client.Host.AddGloboDnsHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddGloboDnsHost", testaddGloboDnsHost)
+
+ testaddHost := func(t *testing.T) {
+ if _, ok := response["addHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewAddHostParams("hypervisor", "podid", "url", "zoneid")
+ _, err := client.Host.AddHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddHost", testaddHost)
+
+ testaddSecondaryStorage := func(t *testing.T) {
+ if _, ok := response["addSecondaryStorage"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewAddSecondaryStorageParams("url")
+ _, err := client.Host.AddSecondaryStorage(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddSecondaryStorage", testaddSecondaryStorage)
+
+ testcancelHostMaintenance := func(t *testing.T) {
+ if _, ok := response["cancelHostMaintenance"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewCancelHostMaintenanceParams("id")
+ _, err := client.Host.CancelHostMaintenance(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CancelHostMaintenance", testcancelHostMaintenance)
+
+ testconfigureHAForHost := func(t *testing.T) {
+ if _, ok := response["configureHAForHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewConfigureHAForHostParams("hostid", "provider")
+ _, err := client.Host.ConfigureHAForHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ConfigureHAForHost", testconfigureHAForHost)
+
+ testenableHAForHost := func(t *testing.T) {
+ if _, ok := response["enableHAForHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewEnableHAForHostParams("hostid")
+ _, err := client.Host.EnableHAForHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableHAForHost", testenableHAForHost)
+
+ testdedicateHost := func(t *testing.T) {
+ if _, ok := response["dedicateHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewDedicateHostParams("domainid", "hostid")
+ _, err := client.Host.DedicateHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DedicateHost", testdedicateHost)
+
+ testdeleteHost := func(t *testing.T) {
+ if _, ok := response["deleteHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewDeleteHostParams("id")
+ _, err := client.Host.DeleteHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteHost", testdeleteHost)
+
+ testdisableOutOfBandManagementForHost := func(t *testing.T) {
+ if _, ok := response["disableOutOfBandManagementForHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewDisableOutOfBandManagementForHostParams("hostid")
+ _, err := client.Host.DisableOutOfBandManagementForHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableOutOfBandManagementForHost", testdisableOutOfBandManagementForHost)
+
+ testenableOutOfBandManagementForHost := func(t *testing.T) {
+ if _, ok := response["enableOutOfBandManagementForHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewEnableOutOfBandManagementForHostParams("hostid")
+ _, err := client.Host.EnableOutOfBandManagementForHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableOutOfBandManagementForHost", testenableOutOfBandManagementForHost)
+
+ testfindHostsForMigration := func(t *testing.T) {
+ if _, ok := response["findHostsForMigration"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewFindHostsForMigrationParams("virtualmachineid")
+ _, err := client.Host.FindHostsForMigration(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("FindHostsForMigration", testfindHostsForMigration)
+
+ testlistDedicatedHosts := func(t *testing.T) {
+ if _, ok := response["listDedicatedHosts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewListDedicatedHostsParams()
+ _, err := client.Host.ListDedicatedHosts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDedicatedHosts", testlistDedicatedHosts)
+
+ testlistHostTags := func(t *testing.T) {
+ if _, ok := response["listHostTags"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewListHostTagsParams()
+ _, err := client.Host.ListHostTags(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListHostTags", testlistHostTags)
+
+ testlistHosts := func(t *testing.T) {
+ if _, ok := response["listHosts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewListHostsParams()
+ _, err := client.Host.ListHosts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListHosts", testlistHosts)
+
+ testlistHostsMetrics := func(t *testing.T) {
+ if _, ok := response["listHostsMetrics"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewListHostsMetricsParams()
+ _, err := client.Host.ListHostsMetrics(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListHostsMetrics", testlistHostsMetrics)
+
+ testprepareHostForMaintenance := func(t *testing.T) {
+ if _, ok := response["prepareHostForMaintenance"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewPrepareHostForMaintenanceParams("id")
+ _, err := client.Host.PrepareHostForMaintenance(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("PrepareHostForMaintenance", testprepareHostForMaintenance)
+
+ testreconnectHost := func(t *testing.T) {
+ if _, ok := response["reconnectHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewReconnectHostParams("id")
+ _, err := client.Host.ReconnectHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReconnectHost", testreconnectHost)
+
+ testreleaseDedicatedHost := func(t *testing.T) {
+ if _, ok := response["releaseDedicatedHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewReleaseDedicatedHostParams("hostid")
+ _, err := client.Host.ReleaseDedicatedHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReleaseDedicatedHost", testreleaseDedicatedHost)
+
+ testreleaseHostReservation := func(t *testing.T) {
+ if _, ok := response["releaseHostReservation"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewReleaseHostReservationParams("id")
+ _, err := client.Host.ReleaseHostReservation(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReleaseHostReservation", testreleaseHostReservation)
+
+ testupdateHost := func(t *testing.T) {
+ if _, ok := response["updateHost"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewUpdateHostParams("id")
+ _, err := client.Host.UpdateHost(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateHost", testupdateHost)
+
+ testupdateHostPassword := func(t *testing.T) {
+ if _, ok := response["updateHostPassword"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Host.NewUpdateHostPasswordParams("password", "username")
+ _, err := client.Host.UpdateHostPassword(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateHostPassword", testupdateHostPassword)
+
+}
diff --git a/test/HypervisorService_test.go b/test/HypervisorService_test.go
new file mode 100644
index 0000000..e0ec6ca
--- /dev/null
+++ b/test/HypervisorService_test.go
@@ -0,0 +1,74 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestHypervisorService(t *testing.T) {
+ service := "HypervisorService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testlistHypervisorCapabilities := func(t *testing.T) {
+ if _, ok := response["listHypervisorCapabilities"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Hypervisor.NewListHypervisorCapabilitiesParams()
+ _, err := client.Hypervisor.ListHypervisorCapabilities(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListHypervisorCapabilities", testlistHypervisorCapabilities)
+
+ testlistHypervisors := func(t *testing.T) {
+ if _, ok := response["listHypervisors"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Hypervisor.NewListHypervisorsParams()
+ _, err := client.Hypervisor.ListHypervisors(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListHypervisors", testlistHypervisors)
+
+ testupdateHypervisorCapabilities := func(t *testing.T) {
+ if _, ok := response["updateHypervisorCapabilities"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Hypervisor.NewUpdateHypervisorCapabilitiesParams()
+ _, err := client.Hypervisor.UpdateHypervisorCapabilities(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateHypervisorCapabilities", testupdateHypervisorCapabilities)
+
+}
diff --git a/test/ISOService_test.go b/test/ISOService_test.go
new file mode 100644
index 0000000..01d397c
--- /dev/null
+++ b/test/ISOService_test.go
@@ -0,0 +1,158 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestISOService(t *testing.T) {
+ service := "ISOService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testattachIso := func(t *testing.T) {
+ if _, ok := response["attachIso"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewAttachIsoParams("id", "virtualmachineid")
+ _, err := client.ISO.AttachIso(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AttachIso", testattachIso)
+
+ testcopyIso := func(t *testing.T) {
+ if _, ok := response["copyIso"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewCopyIsoParams("id")
+ _, err := client.ISO.CopyIso(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CopyIso", testcopyIso)
+
+ testdeleteIso := func(t *testing.T) {
+ if _, ok := response["deleteIso"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewDeleteIsoParams("id")
+ _, err := client.ISO.DeleteIso(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteIso", testdeleteIso)
+
+ testdetachIso := func(t *testing.T) {
+ if _, ok := response["detachIso"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewDetachIsoParams("virtualmachineid")
+ _, err := client.ISO.DetachIso(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DetachIso", testdetachIso)
+
+ testextractIso := func(t *testing.T) {
+ if _, ok := response["extractIso"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewExtractIsoParams("id", "mode")
+ _, err := client.ISO.ExtractIso(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ExtractIso", testextractIso)
+
+ testlistIsoPermissions := func(t *testing.T) {
+ if _, ok := response["listIsoPermissions"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewListIsoPermissionsParams("id")
+ _, err := client.ISO.ListIsoPermissions(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListIsoPermissions", testlistIsoPermissions)
+
+ testlistIsos := func(t *testing.T) {
+ if _, ok := response["listIsos"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewListIsosParams()
+ _, err := client.ISO.ListIsos(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListIsos", testlistIsos)
+
+ testregisterIso := func(t *testing.T) {
+ if _, ok := response["registerIso"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewRegisterIsoParams("displaytext", "name", "url", "zoneid")
+ _, err := client.ISO.RegisterIso(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RegisterIso", testregisterIso)
+
+ testupdateIso := func(t *testing.T) {
+ if _, ok := response["updateIso"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewUpdateIsoParams("id")
+ _, err := client.ISO.UpdateIso(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateIso", testupdateIso)
+
+ testupdateIsoPermissions := func(t *testing.T) {
+ if _, ok := response["updateIsoPermissions"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ISO.NewUpdateIsoPermissionsParams("id")
+ _, err := client.ISO.UpdateIsoPermissions(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateIsoPermissions", testupdateIsoPermissions)
+
+}
diff --git a/test/ImageStoreService_test.go b/test/ImageStoreService_test.go
new file mode 100644
index 0000000..31fee6a
--- /dev/null
+++ b/test/ImageStoreService_test.go
@@ -0,0 +1,134 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestImageStoreService(t *testing.T) {
+ service := "ImageStoreService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddImageStore := func(t *testing.T) {
+ if _, ok := response["addImageStore"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ImageStore.NewAddImageStoreParams("provider")
+ _, err := client.ImageStore.AddImageStore(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddImageStore", testaddImageStore)
+
+ testaddImageStoreS3 := func(t *testing.T) {
+ if _, ok := response["addImageStoreS3"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ImageStore.NewAddImageStoreS3Params("accesskey", "bucket", "endpoint", "secretkey")
+ _, err := client.ImageStore.AddImageStoreS3(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddImageStoreS3", testaddImageStoreS3)
+
+ testcreateSecondaryStagingStore := func(t *testing.T) {
+ if _, ok := response["createSecondaryStagingStore"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ImageStore.NewCreateSecondaryStagingStoreParams("url")
+ _, err := client.ImageStore.CreateSecondaryStagingStore(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateSecondaryStagingStore", testcreateSecondaryStagingStore)
+
+ testdeleteImageStore := func(t *testing.T) {
+ if _, ok := response["deleteImageStore"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ImageStore.NewDeleteImageStoreParams("id")
+ _, err := client.ImageStore.DeleteImageStore(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteImageStore", testdeleteImageStore)
+
+ testdeleteSecondaryStagingStore := func(t *testing.T) {
+ if _, ok := response["deleteSecondaryStagingStore"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ImageStore.NewDeleteSecondaryStagingStoreParams("id")
+ _, err := client.ImageStore.DeleteSecondaryStagingStore(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteSecondaryStagingStore", testdeleteSecondaryStagingStore)
+
+ testlistImageStores := func(t *testing.T) {
+ if _, ok := response["listImageStores"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ImageStore.NewListImageStoresParams()
+ _, err := client.ImageStore.ListImageStores(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListImageStores", testlistImageStores)
+
+ testlistSecondaryStagingStores := func(t *testing.T) {
+ if _, ok := response["listSecondaryStagingStores"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ImageStore.NewListSecondaryStagingStoresParams()
+ _, err := client.ImageStore.ListSecondaryStagingStores(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSecondaryStagingStores", testlistSecondaryStagingStores)
+
+ testupdateCloudToUseObjectStore := func(t *testing.T) {
+ if _, ok := response["updateCloudToUseObjectStore"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ImageStore.NewUpdateCloudToUseObjectStoreParams("provider")
+ _, err := client.ImageStore.UpdateCloudToUseObjectStore(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateCloudToUseObjectStore", testupdateCloudToUseObjectStore)
+
+}
diff --git a/test/InternalLBService_test.go b/test/InternalLBService_test.go
new file mode 100644
index 0000000..7477127
--- /dev/null
+++ b/test/InternalLBService_test.go
@@ -0,0 +1,110 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestInternalLBService(t *testing.T) {
+ service := "InternalLBService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testconfigureInternalLoadBalancerElement := func(t *testing.T) {
+ if _, ok := response["configureInternalLoadBalancerElement"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.InternalLB.NewConfigureInternalLoadBalancerElementParams(true, "id")
+ _, err := client.InternalLB.ConfigureInternalLoadBalancerElement(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ConfigureInternalLoadBalancerElement", testconfigureInternalLoadBalancerElement)
+
+ testcreateInternalLoadBalancerElement := func(t *testing.T) {
+ if _, ok := response["createInternalLoadBalancerElement"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.InternalLB.NewCreateInternalLoadBalancerElementParams("nspid")
+ _, err := client.InternalLB.CreateInternalLoadBalancerElement(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateInternalLoadBalancerElement", testcreateInternalLoadBalancerElement)
+
+ testlistInternalLoadBalancerElements := func(t *testing.T) {
+ if _, ok := response["listInternalLoadBalancerElements"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.InternalLB.NewListInternalLoadBalancerElementsParams()
+ _, err := client.InternalLB.ListInternalLoadBalancerElements(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListInternalLoadBalancerElements", testlistInternalLoadBalancerElements)
+
+ testlistInternalLoadBalancerVMs := func(t *testing.T) {
+ if _, ok := response["listInternalLoadBalancerVMs"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.InternalLB.NewListInternalLoadBalancerVMsParams()
+ _, err := client.InternalLB.ListInternalLoadBalancerVMs(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListInternalLoadBalancerVMs", testlistInternalLoadBalancerVMs)
+
+ teststartInternalLoadBalancerVM := func(t *testing.T) {
+ if _, ok := response["startInternalLoadBalancerVM"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.InternalLB.NewStartInternalLoadBalancerVMParams("id")
+ _, err := client.InternalLB.StartInternalLoadBalancerVM(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("StartInternalLoadBalancerVM", teststartInternalLoadBalancerVM)
+
+ teststopInternalLoadBalancerVM := func(t *testing.T) {
+ if _, ok := response["stopInternalLoadBalancerVM"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.InternalLB.NewStopInternalLoadBalancerVMParams("id")
+ _, err := client.InternalLB.StopInternalLoadBalancerVM(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("StopInternalLoadBalancerVM", teststopInternalLoadBalancerVM)
+
+}
diff --git a/test/LDAPService_test.go b/test/LDAPService_test.go
new file mode 100644
index 0000000..15e852d
--- /dev/null
+++ b/test/LDAPService_test.go
@@ -0,0 +1,158 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestLDAPService(t *testing.T) {
+ service := "LDAPService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddLdapConfiguration := func(t *testing.T) {
+ if _, ok := response["addLdapConfiguration"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewAddLdapConfigurationParams("hostname", 0)
+ _, err := client.LDAP.AddLdapConfiguration(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddLdapConfiguration", testaddLdapConfiguration)
+
+ testdeleteLdapConfiguration := func(t *testing.T) {
+ if _, ok := response["deleteLdapConfiguration"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewDeleteLdapConfigurationParams("hostname")
+ _, err := client.LDAP.DeleteLdapConfiguration(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteLdapConfiguration", testdeleteLdapConfiguration)
+
+ testimportLdapUsers := func(t *testing.T) {
+ if _, ok := response["importLdapUsers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewImportLdapUsersParams()
+ _, err := client.LDAP.ImportLdapUsers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ImportLdapUsers", testimportLdapUsers)
+
+ testldapConfig := func(t *testing.T) {
+ if _, ok := response["ldapConfig"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewLdapConfigParams()
+ _, err := client.LDAP.LdapConfig(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("LdapConfig", testldapConfig)
+
+ testldapCreateAccount := func(t *testing.T) {
+ if _, ok := response["ldapCreateAccount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewLdapCreateAccountParams("username")
+ _, err := client.LDAP.LdapCreateAccount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("LdapCreateAccount", testldapCreateAccount)
+
+ testldapRemove := func(t *testing.T) {
+ if _, ok := response["ldapRemove"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewLdapRemoveParams()
+ _, err := client.LDAP.LdapRemove(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("LdapRemove", testldapRemove)
+
+ testlinkDomainToLdap := func(t *testing.T) {
+ if _, ok := response["linkDomainToLdap"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewLinkDomainToLdapParams(0, "domainid", "type")
+ _, err := client.LDAP.LinkDomainToLdap(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("LinkDomainToLdap", testlinkDomainToLdap)
+
+ testlistLdapConfigurations := func(t *testing.T) {
+ if _, ok := response["listLdapConfigurations"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewListLdapConfigurationsParams()
+ _, err := client.LDAP.ListLdapConfigurations(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListLdapConfigurations", testlistLdapConfigurations)
+
+ testlistLdapUsers := func(t *testing.T) {
+ if _, ok := response["listLdapUsers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewListLdapUsersParams()
+ _, err := client.LDAP.ListLdapUsers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListLdapUsers", testlistLdapUsers)
+
+ testsearchLdap := func(t *testing.T) {
+ if _, ok := response["searchLdap"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LDAP.NewSearchLdapParams("query")
+ _, err := client.LDAP.SearchLdap(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("SearchLdap", testsearchLdap)
+
+}
diff --git a/test/LimitService_test.go b/test/LimitService_test.go
new file mode 100644
index 0000000..57d1991
--- /dev/null
+++ b/test/LimitService_test.go
@@ -0,0 +1,98 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestLimitService(t *testing.T) {
+ service := "LimitService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testgetApiLimit := func(t *testing.T) {
+ if _, ok := response["getApiLimit"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Limit.NewGetApiLimitParams()
+ _, err := client.Limit.GetApiLimit(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetApiLimit", testgetApiLimit)
+
+ testlistResourceLimits := func(t *testing.T) {
+ if _, ok := response["listResourceLimits"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Limit.NewListResourceLimitsParams()
+ _, err := client.Limit.ListResourceLimits(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListResourceLimits", testlistResourceLimits)
+
+ testresetApiLimit := func(t *testing.T) {
+ if _, ok := response["resetApiLimit"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Limit.NewResetApiLimitParams()
+ _, err := client.Limit.ResetApiLimit(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ResetApiLimit", testresetApiLimit)
+
+ testupdateResourceCount := func(t *testing.T) {
+ if _, ok := response["updateResourceCount"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Limit.NewUpdateResourceCountParams("domainid")
+ _, err := client.Limit.UpdateResourceCount(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateResourceCount", testupdateResourceCount)
+
+ testupdateResourceLimit := func(t *testing.T) {
+ if _, ok := response["updateResourceLimit"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Limit.NewUpdateResourceLimitParams(0)
+ _, err := client.Limit.UpdateResourceLimit(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateResourceLimit", testupdateResourceLimit)
+
+}
diff --git a/test/LoadBalancerService_test.go b/test/LoadBalancerService_test.go
new file mode 100644
index 0000000..00131f1
--- /dev/null
+++ b/test/LoadBalancerService_test.go
@@ -0,0 +1,446 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestLoadBalancerService(t *testing.T) {
+ service := "LoadBalancerService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddNetscalerLoadBalancer := func(t *testing.T) {
+ if _, ok := response["addNetscalerLoadBalancer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewAddNetscalerLoadBalancerParams("networkdevicetype", "password", "physicalnetworkid", "url", "username")
+ _, err := client.LoadBalancer.AddNetscalerLoadBalancer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddNetscalerLoadBalancer", testaddNetscalerLoadBalancer)
+
+ testassignCertToLoadBalancer := func(t *testing.T) {
+ if _, ok := response["assignCertToLoadBalancer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewAssignCertToLoadBalancerParams("certid", "lbruleid")
+ _, err := client.LoadBalancer.AssignCertToLoadBalancer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AssignCertToLoadBalancer", testassignCertToLoadBalancer)
+
+ testassignToGlobalLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["assignToGlobalLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewAssignToGlobalLoadBalancerRuleParams("id", []string{})
+ _, err := client.LoadBalancer.AssignToGlobalLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AssignToGlobalLoadBalancerRule", testassignToGlobalLoadBalancerRule)
+
+ testassignToLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["assignToLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewAssignToLoadBalancerRuleParams("id")
+ _, err := client.LoadBalancer.AssignToLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AssignToLoadBalancerRule", testassignToLoadBalancerRule)
+
+ testconfigureNetscalerLoadBalancer := func(t *testing.T) {
+ if _, ok := response["configureNetscalerLoadBalancer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewConfigureNetscalerLoadBalancerParams("lbdeviceid")
+ _, err := client.LoadBalancer.ConfigureNetscalerLoadBalancer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ConfigureNetscalerLoadBalancer", testconfigureNetscalerLoadBalancer)
+
+ testcreateGlobalLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["createGlobalLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewCreateGlobalLoadBalancerRuleParams("gslbdomainname", "gslbservicetype", "name", 0)
+ _, err := client.LoadBalancer.CreateGlobalLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateGlobalLoadBalancerRule", testcreateGlobalLoadBalancerRule)
+
+ testcreateLBHealthCheckPolicy := func(t *testing.T) {
+ if _, ok := response["createLBHealthCheckPolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewCreateLBHealthCheckPolicyParams("lbruleid")
+ _, err := client.LoadBalancer.CreateLBHealthCheckPolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateLBHealthCheckPolicy", testcreateLBHealthCheckPolicy)
+
+ testcreateLBStickinessPolicy := func(t *testing.T) {
+ if _, ok := response["createLBStickinessPolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewCreateLBStickinessPolicyParams("lbruleid", "methodname", "name")
+ _, err := client.LoadBalancer.CreateLBStickinessPolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateLBStickinessPolicy", testcreateLBStickinessPolicy)
+
+ testcreateLoadBalancer := func(t *testing.T) {
+ if _, ok := response["createLoadBalancer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewCreateLoadBalancerParams("algorithm", 0, "name", "networkid", "scheme", "sourceipaddressnetworkid", 0)
+ _, err := client.LoadBalancer.CreateLoadBalancer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateLoadBalancer", testcreateLoadBalancer)
+
+ testcreateLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["createLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewCreateLoadBalancerRuleParams("algorithm", "name", 0, 0)
+ _, err := client.LoadBalancer.CreateLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateLoadBalancerRule", testcreateLoadBalancerRule)
+
+ testdeleteGlobalLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["deleteGlobalLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewDeleteGlobalLoadBalancerRuleParams("id")
+ _, err := client.LoadBalancer.DeleteGlobalLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteGlobalLoadBalancerRule", testdeleteGlobalLoadBalancerRule)
+
+ testdeleteLBHealthCheckPolicy := func(t *testing.T) {
+ if _, ok := response["deleteLBHealthCheckPolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewDeleteLBHealthCheckPolicyParams("id")
+ _, err := client.LoadBalancer.DeleteLBHealthCheckPolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteLBHealthCheckPolicy", testdeleteLBHealthCheckPolicy)
+
+ testdeleteLBStickinessPolicy := func(t *testing.T) {
+ if _, ok := response["deleteLBStickinessPolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewDeleteLBStickinessPolicyParams("id")
+ _, err := client.LoadBalancer.DeleteLBStickinessPolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteLBStickinessPolicy", testdeleteLBStickinessPolicy)
+
+ testdeleteLoadBalancer := func(t *testing.T) {
+ if _, ok := response["deleteLoadBalancer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewDeleteLoadBalancerParams("id")
+ _, err := client.LoadBalancer.DeleteLoadBalancer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteLoadBalancer", testdeleteLoadBalancer)
+
+ testdeleteLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["deleteLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewDeleteLoadBalancerRuleParams("id")
+ _, err := client.LoadBalancer.DeleteLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteLoadBalancerRule", testdeleteLoadBalancerRule)
+
+ testdeleteNetscalerLoadBalancer := func(t *testing.T) {
+ if _, ok := response["deleteNetscalerLoadBalancer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewDeleteNetscalerLoadBalancerParams("lbdeviceid")
+ _, err := client.LoadBalancer.DeleteNetscalerLoadBalancer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteNetscalerLoadBalancer", testdeleteNetscalerLoadBalancer)
+
+ testdeleteSslCert := func(t *testing.T) {
+ if _, ok := response["deleteSslCert"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewDeleteSslCertParams("id")
+ _, err := client.LoadBalancer.DeleteSslCert(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteSslCert", testdeleteSslCert)
+
+ testlistGlobalLoadBalancerRules := func(t *testing.T) {
+ if _, ok := response["listGlobalLoadBalancerRules"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewListGlobalLoadBalancerRulesParams()
+ _, err := client.LoadBalancer.ListGlobalLoadBalancerRules(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListGlobalLoadBalancerRules", testlistGlobalLoadBalancerRules)
+
+ testlistLBHealthCheckPolicies := func(t *testing.T) {
+ if _, ok := response["listLBHealthCheckPolicies"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewListLBHealthCheckPoliciesParams()
+ _, err := client.LoadBalancer.ListLBHealthCheckPolicies(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListLBHealthCheckPolicies", testlistLBHealthCheckPolicies)
+
+ testlistLBStickinessPolicies := func(t *testing.T) {
+ if _, ok := response["listLBStickinessPolicies"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewListLBStickinessPoliciesParams()
+ _, err := client.LoadBalancer.ListLBStickinessPolicies(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListLBStickinessPolicies", testlistLBStickinessPolicies)
+
+ testlistLoadBalancerRuleInstances := func(t *testing.T) {
+ if _, ok := response["listLoadBalancerRuleInstances"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewListLoadBalancerRuleInstancesParams("id")
+ _, err := client.LoadBalancer.ListLoadBalancerRuleInstances(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListLoadBalancerRuleInstances", testlistLoadBalancerRuleInstances)
+
+ testlistLoadBalancerRules := func(t *testing.T) {
+ if _, ok := response["listLoadBalancerRules"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewListLoadBalancerRulesParams()
+ _, err := client.LoadBalancer.ListLoadBalancerRules(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListLoadBalancerRules", testlistLoadBalancerRules)
+
+ testlistLoadBalancers := func(t *testing.T) {
+ if _, ok := response["listLoadBalancers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewListLoadBalancersParams()
+ _, err := client.LoadBalancer.ListLoadBalancers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListLoadBalancers", testlistLoadBalancers)
+
+ testlistNetscalerLoadBalancers := func(t *testing.T) {
+ if _, ok := response["listNetscalerLoadBalancers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewListNetscalerLoadBalancersParams()
+ _, err := client.LoadBalancer.ListNetscalerLoadBalancers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetscalerLoadBalancers", testlistNetscalerLoadBalancers)
+
+ testlistSslCerts := func(t *testing.T) {
+ if _, ok := response["listSslCerts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewListSslCertsParams()
+ _, err := client.LoadBalancer.ListSslCerts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSslCerts", testlistSslCerts)
+
+ testremoveCertFromLoadBalancer := func(t *testing.T) {
+ if _, ok := response["removeCertFromLoadBalancer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewRemoveCertFromLoadBalancerParams("lbruleid")
+ _, err := client.LoadBalancer.RemoveCertFromLoadBalancer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveCertFromLoadBalancer", testremoveCertFromLoadBalancer)
+
+ testremoveFromGlobalLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["removeFromGlobalLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewRemoveFromGlobalLoadBalancerRuleParams("id", []string{})
+ _, err := client.LoadBalancer.RemoveFromGlobalLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveFromGlobalLoadBalancerRule", testremoveFromGlobalLoadBalancerRule)
+
+ testremoveFromLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["removeFromLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewRemoveFromLoadBalancerRuleParams("id")
+ _, err := client.LoadBalancer.RemoveFromLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveFromLoadBalancerRule", testremoveFromLoadBalancerRule)
+
+ testupdateGlobalLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["updateGlobalLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewUpdateGlobalLoadBalancerRuleParams("id")
+ _, err := client.LoadBalancer.UpdateGlobalLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateGlobalLoadBalancerRule", testupdateGlobalLoadBalancerRule)
+
+ testupdateLBHealthCheckPolicy := func(t *testing.T) {
+ if _, ok := response["updateLBHealthCheckPolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewUpdateLBHealthCheckPolicyParams("id")
+ _, err := client.LoadBalancer.UpdateLBHealthCheckPolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateLBHealthCheckPolicy", testupdateLBHealthCheckPolicy)
+
+ testupdateLBStickinessPolicy := func(t *testing.T) {
+ if _, ok := response["updateLBStickinessPolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewUpdateLBStickinessPolicyParams("id")
+ _, err := client.LoadBalancer.UpdateLBStickinessPolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateLBStickinessPolicy", testupdateLBStickinessPolicy)
+
+ testupdateLoadBalancer := func(t *testing.T) {
+ if _, ok := response["updateLoadBalancer"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewUpdateLoadBalancerParams("id")
+ _, err := client.LoadBalancer.UpdateLoadBalancer(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateLoadBalancer", testupdateLoadBalancer)
+
+ testupdateLoadBalancerRule := func(t *testing.T) {
+ if _, ok := response["updateLoadBalancerRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewUpdateLoadBalancerRuleParams("id")
+ _, err := client.LoadBalancer.UpdateLoadBalancerRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateLoadBalancerRule", testupdateLoadBalancerRule)
+
+ testuploadSslCert := func(t *testing.T) {
+ if _, ok := response["uploadSslCert"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.LoadBalancer.NewUploadSslCertParams("certificate", "name", "privatekey")
+ _, err := client.LoadBalancer.UploadSslCert(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UploadSslCert", testuploadSslCert)
+
+}
diff --git a/test/NATService_test.go b/test/NATService_test.go
new file mode 100644
index 0000000..b57322a
--- /dev/null
+++ b/test/NATService_test.go
@@ -0,0 +1,98 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestNATService(t *testing.T) {
+ service := "NATService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateIpForwardingRule := func(t *testing.T) {
+ if _, ok := response["createIpForwardingRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NAT.NewCreateIpForwardingRuleParams("ipaddressid", "protocol", 0)
+ _, err := client.NAT.CreateIpForwardingRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateIpForwardingRule", testcreateIpForwardingRule)
+
+ testdeleteIpForwardingRule := func(t *testing.T) {
+ if _, ok := response["deleteIpForwardingRule"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NAT.NewDeleteIpForwardingRuleParams("id")
+ _, err := client.NAT.DeleteIpForwardingRule(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteIpForwardingRule", testdeleteIpForwardingRule)
+
+ testdisableStaticNat := func(t *testing.T) {
+ if _, ok := response["disableStaticNat"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NAT.NewDisableStaticNatParams("ipaddressid")
+ _, err := client.NAT.DisableStaticNat(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableStaticNat", testdisableStaticNat)
+
+ testenableStaticNat := func(t *testing.T) {
+ if _, ok := response["enableStaticNat"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NAT.NewEnableStaticNatParams("ipaddressid", "virtualmachineid")
+ _, err := client.NAT.EnableStaticNat(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableStaticNat", testenableStaticNat)
+
+ testlistIpForwardingRules := func(t *testing.T) {
+ if _, ok := response["listIpForwardingRules"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NAT.NewListIpForwardingRulesParams()
+ _, err := client.NAT.ListIpForwardingRules(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListIpForwardingRules", testlistIpForwardingRules)
+
+}
diff --git a/test/NetworkACLService_test.go b/test/NetworkACLService_test.go
new file mode 100644
index 0000000..4364ecf
--- /dev/null
+++ b/test/NetworkACLService_test.go
@@ -0,0 +1,146 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestNetworkACLService(t *testing.T) {
+ service := "NetworkACLService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateNetworkACL := func(t *testing.T) {
+ if _, ok := response["createNetworkACL"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewCreateNetworkACLParams("protocol")
+ _, err := client.NetworkACL.CreateNetworkACL(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateNetworkACL", testcreateNetworkACL)
+
+ testcreateNetworkACLList := func(t *testing.T) {
+ if _, ok := response["createNetworkACLList"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewCreateNetworkACLListParams("name", "vpcid")
+ _, err := client.NetworkACL.CreateNetworkACLList(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateNetworkACLList", testcreateNetworkACLList)
+
+ testdeleteNetworkACL := func(t *testing.T) {
+ if _, ok := response["deleteNetworkACL"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewDeleteNetworkACLParams("id")
+ _, err := client.NetworkACL.DeleteNetworkACL(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteNetworkACL", testdeleteNetworkACL)
+
+ testdeleteNetworkACLList := func(t *testing.T) {
+ if _, ok := response["deleteNetworkACLList"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewDeleteNetworkACLListParams("id")
+ _, err := client.NetworkACL.DeleteNetworkACLList(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteNetworkACLList", testdeleteNetworkACLList)
+
+ testlistNetworkACLLists := func(t *testing.T) {
+ if _, ok := response["listNetworkACLLists"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewListNetworkACLListsParams()
+ _, err := client.NetworkACL.ListNetworkACLLists(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetworkACLLists", testlistNetworkACLLists)
+
+ testlistNetworkACLs := func(t *testing.T) {
+ if _, ok := response["listNetworkACLs"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewListNetworkACLsParams()
+ _, err := client.NetworkACL.ListNetworkACLs(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetworkACLs", testlistNetworkACLs)
+
+ testreplaceNetworkACLList := func(t *testing.T) {
+ if _, ok := response["replaceNetworkACLList"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewReplaceNetworkACLListParams("aclid")
+ _, err := client.NetworkACL.ReplaceNetworkACLList(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReplaceNetworkACLList", testreplaceNetworkACLList)
+
+ testupdateNetworkACLItem := func(t *testing.T) {
+ if _, ok := response["updateNetworkACLItem"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewUpdateNetworkACLItemParams("id")
+ _, err := client.NetworkACL.UpdateNetworkACLItem(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateNetworkACLItem", testupdateNetworkACLItem)
+
+ testupdateNetworkACLList := func(t *testing.T) {
+ if _, ok := response["updateNetworkACLList"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkACL.NewUpdateNetworkACLListParams("id")
+ _, err := client.NetworkACL.UpdateNetworkACLList(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateNetworkACLList", testupdateNetworkACLList)
+
+}
diff --git a/test/NetworkDeviceService_test.go b/test/NetworkDeviceService_test.go
new file mode 100644
index 0000000..47b8613
--- /dev/null
+++ b/test/NetworkDeviceService_test.go
@@ -0,0 +1,74 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestNetworkDeviceService(t *testing.T) {
+ service := "NetworkDeviceService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddNetworkDevice := func(t *testing.T) {
+ if _, ok := response["addNetworkDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkDevice.NewAddNetworkDeviceParams()
+ _, err := client.NetworkDevice.AddNetworkDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddNetworkDevice", testaddNetworkDevice)
+
+ testdeleteNetworkDevice := func(t *testing.T) {
+ if _, ok := response["deleteNetworkDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkDevice.NewDeleteNetworkDeviceParams("id")
+ _, err := client.NetworkDevice.DeleteNetworkDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteNetworkDevice", testdeleteNetworkDevice)
+
+ testlistNetworkDevice := func(t *testing.T) {
+ if _, ok := response["listNetworkDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkDevice.NewListNetworkDeviceParams()
+ _, err := client.NetworkDevice.ListNetworkDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetworkDevice", testlistNetworkDevice)
+
+}
diff --git a/test/NetworkOfferingService_test.go b/test/NetworkOfferingService_test.go
new file mode 100644
index 0000000..839b0a2
--- /dev/null
+++ b/test/NetworkOfferingService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestNetworkOfferingService(t *testing.T) {
+ service := "NetworkOfferingService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateNetworkOffering := func(t *testing.T) {
+ if _, ok := response["createNetworkOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkOffering.NewCreateNetworkOfferingParams("displaytext", "guestiptype", "name", "traffictype")
+ _, err := client.NetworkOffering.CreateNetworkOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateNetworkOffering", testcreateNetworkOffering)
+
+ testdeleteNetworkOffering := func(t *testing.T) {
+ if _, ok := response["deleteNetworkOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkOffering.NewDeleteNetworkOfferingParams("id")
+ _, err := client.NetworkOffering.DeleteNetworkOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteNetworkOffering", testdeleteNetworkOffering)
+
+ testlistNetworkOfferings := func(t *testing.T) {
+ if _, ok := response["listNetworkOfferings"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkOffering.NewListNetworkOfferingsParams()
+ _, err := client.NetworkOffering.ListNetworkOfferings(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetworkOfferings", testlistNetworkOfferings)
+
+ testupdateNetworkOffering := func(t *testing.T) {
+ if _, ok := response["updateNetworkOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NetworkOffering.NewUpdateNetworkOfferingParams()
+ _, err := client.NetworkOffering.UpdateNetworkOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateNetworkOffering", testupdateNetworkOffering)
+
+}
diff --git a/test/NetworkService_test.go b/test/NetworkService_test.go
new file mode 100644
index 0000000..e1c5d9a
--- /dev/null
+++ b/test/NetworkService_test.go
@@ -0,0 +1,374 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestNetworkService(t *testing.T) {
+ service := "NetworkService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddNetworkServiceProvider := func(t *testing.T) {
+ if _, ok := response["addNetworkServiceProvider"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewAddNetworkServiceProviderParams("name", "physicalnetworkid")
+ _, err := client.Network.AddNetworkServiceProvider(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddNetworkServiceProvider", testaddNetworkServiceProvider)
+
+ testaddOpenDaylightController := func(t *testing.T) {
+ if _, ok := response["addOpenDaylightController"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewAddOpenDaylightControllerParams("password", "physicalnetworkid", "url", "username")
+ _, err := client.Network.AddOpenDaylightController(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddOpenDaylightController", testaddOpenDaylightController)
+
+ testcreateNetwork := func(t *testing.T) {
+ if _, ok := response["createNetwork"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewCreateNetworkParams("displaytext", "name", "networkofferingid", "zoneid")
+ _, err := client.Network.CreateNetwork(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateNetwork", testcreateNetwork)
+
+ testcreatePhysicalNetwork := func(t *testing.T) {
+ if _, ok := response["createPhysicalNetwork"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewCreatePhysicalNetworkParams("name", "zoneid")
+ _, err := client.Network.CreatePhysicalNetwork(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreatePhysicalNetwork", testcreatePhysicalNetwork)
+
+ testcreateServiceInstance := func(t *testing.T) {
+ if _, ok := response["createServiceInstance"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewCreateServiceInstanceParams("leftnetworkid", "name", "rightnetworkid", "serviceofferingid", "templateid", "zoneid")
+ _, err := client.Network.CreateServiceInstance(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateServiceInstance", testcreateServiceInstance)
+
+ testcreateStorageNetworkIpRange := func(t *testing.T) {
+ if _, ok := response["createStorageNetworkIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewCreateStorageNetworkIpRangeParams("gateway", "netmask", "podid", "startip")
+ _, err := client.Network.CreateStorageNetworkIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateStorageNetworkIpRange", testcreateStorageNetworkIpRange)
+
+ testdedicatePublicIpRange := func(t *testing.T) {
+ if _, ok := response["dedicatePublicIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewDedicatePublicIpRangeParams("domainid", "id")
+ _, err := client.Network.DedicatePublicIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DedicatePublicIpRange", testdedicatePublicIpRange)
+
+ testdeleteNetwork := func(t *testing.T) {
+ if _, ok := response["deleteNetwork"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewDeleteNetworkParams("id")
+ _, err := client.Network.DeleteNetwork(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteNetwork", testdeleteNetwork)
+
+ testdeleteNetworkServiceProvider := func(t *testing.T) {
+ if _, ok := response["deleteNetworkServiceProvider"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewDeleteNetworkServiceProviderParams("id")
+ _, err := client.Network.DeleteNetworkServiceProvider(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteNetworkServiceProvider", testdeleteNetworkServiceProvider)
+
+ testdeleteOpenDaylightController := func(t *testing.T) {
+ if _, ok := response["deleteOpenDaylightController"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewDeleteOpenDaylightControllerParams("id")
+ _, err := client.Network.DeleteOpenDaylightController(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteOpenDaylightController", testdeleteOpenDaylightController)
+
+ testdeletePhysicalNetwork := func(t *testing.T) {
+ if _, ok := response["deletePhysicalNetwork"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewDeletePhysicalNetworkParams("id")
+ _, err := client.Network.DeletePhysicalNetwork(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeletePhysicalNetwork", testdeletePhysicalNetwork)
+
+ testdeleteStorageNetworkIpRange := func(t *testing.T) {
+ if _, ok := response["deleteStorageNetworkIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewDeleteStorageNetworkIpRangeParams("id")
+ _, err := client.Network.DeleteStorageNetworkIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteStorageNetworkIpRange", testdeleteStorageNetworkIpRange)
+
+ testlistNetscalerLoadBalancerNetworks := func(t *testing.T) {
+ if _, ok := response["listNetscalerLoadBalancerNetworks"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListNetscalerLoadBalancerNetworksParams("lbdeviceid")
+ _, err := client.Network.ListNetscalerLoadBalancerNetworks(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetscalerLoadBalancerNetworks", testlistNetscalerLoadBalancerNetworks)
+
+ testlistNetworkIsolationMethods := func(t *testing.T) {
+ if _, ok := response["listNetworkIsolationMethods"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListNetworkIsolationMethodsParams()
+ _, err := client.Network.ListNetworkIsolationMethods(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetworkIsolationMethods", testlistNetworkIsolationMethods)
+
+ testlistNetworkServiceProviders := func(t *testing.T) {
+ if _, ok := response["listNetworkServiceProviders"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListNetworkServiceProvidersParams()
+ _, err := client.Network.ListNetworkServiceProviders(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetworkServiceProviders", testlistNetworkServiceProviders)
+
+ testlistNetworks := func(t *testing.T) {
+ if _, ok := response["listNetworks"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListNetworksParams()
+ _, err := client.Network.ListNetworks(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNetworks", testlistNetworks)
+
+ testlistNiciraNvpDeviceNetworks := func(t *testing.T) {
+ if _, ok := response["listNiciraNvpDeviceNetworks"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListNiciraNvpDeviceNetworksParams("nvpdeviceid")
+ _, err := client.Network.ListNiciraNvpDeviceNetworks(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNiciraNvpDeviceNetworks", testlistNiciraNvpDeviceNetworks)
+
+ testlistOpenDaylightControllers := func(t *testing.T) {
+ if _, ok := response["listOpenDaylightControllers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListOpenDaylightControllersParams()
+ _, err := client.Network.ListOpenDaylightControllers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListOpenDaylightControllers", testlistOpenDaylightControllers)
+
+ testlistPaloAltoFirewallNetworks := func(t *testing.T) {
+ if _, ok := response["listPaloAltoFirewallNetworks"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListPaloAltoFirewallNetworksParams("lbdeviceid")
+ _, err := client.Network.ListPaloAltoFirewallNetworks(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListPaloAltoFirewallNetworks", testlistPaloAltoFirewallNetworks)
+
+ testlistPhysicalNetworks := func(t *testing.T) {
+ if _, ok := response["listPhysicalNetworks"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListPhysicalNetworksParams()
+ _, err := client.Network.ListPhysicalNetworks(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListPhysicalNetworks", testlistPhysicalNetworks)
+
+ testlistStorageNetworkIpRange := func(t *testing.T) {
+ if _, ok := response["listStorageNetworkIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListStorageNetworkIpRangeParams()
+ _, err := client.Network.ListStorageNetworkIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListStorageNetworkIpRange", testlistStorageNetworkIpRange)
+
+ testlistSupportedNetworkServices := func(t *testing.T) {
+ if _, ok := response["listSupportedNetworkServices"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewListSupportedNetworkServicesParams()
+ _, err := client.Network.ListSupportedNetworkServices(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSupportedNetworkServices", testlistSupportedNetworkServices)
+
+ testreleasePublicIpRange := func(t *testing.T) {
+ if _, ok := response["releasePublicIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewReleasePublicIpRangeParams("id")
+ _, err := client.Network.ReleasePublicIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReleasePublicIpRange", testreleasePublicIpRange)
+
+ testrestartNetwork := func(t *testing.T) {
+ if _, ok := response["restartNetwork"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewRestartNetworkParams("id")
+ _, err := client.Network.RestartNetwork(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RestartNetwork", testrestartNetwork)
+
+ testupdateNetwork := func(t *testing.T) {
+ if _, ok := response["updateNetwork"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewUpdateNetworkParams("id")
+ _, err := client.Network.UpdateNetwork(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateNetwork", testupdateNetwork)
+
+ testupdateNetworkServiceProvider := func(t *testing.T) {
+ if _, ok := response["updateNetworkServiceProvider"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewUpdateNetworkServiceProviderParams("id")
+ _, err := client.Network.UpdateNetworkServiceProvider(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateNetworkServiceProvider", testupdateNetworkServiceProvider)
+
+ testupdatePhysicalNetwork := func(t *testing.T) {
+ if _, ok := response["updatePhysicalNetwork"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewUpdatePhysicalNetworkParams("id")
+ _, err := client.Network.UpdatePhysicalNetwork(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdatePhysicalNetwork", testupdatePhysicalNetwork)
+
+ testupdateStorageNetworkIpRange := func(t *testing.T) {
+ if _, ok := response["updateStorageNetworkIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Network.NewUpdateStorageNetworkIpRangeParams("id")
+ _, err := client.Network.UpdateStorageNetworkIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateStorageNetworkIpRange", testupdateStorageNetworkIpRange)
+
+}
diff --git a/test/NicService_test.go b/test/NicService_test.go
new file mode 100644
index 0000000..67caa28
--- /dev/null
+++ b/test/NicService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestNicService(t *testing.T) {
+ service := "NicService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddIpToNic := func(t *testing.T) {
+ if _, ok := response["addIpToNic"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Nic.NewAddIpToNicParams("nicid")
+ _, err := client.Nic.AddIpToNic(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddIpToNic", testaddIpToNic)
+
+ testlistNics := func(t *testing.T) {
+ if _, ok := response["listNics"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Nic.NewListNicsParams("virtualmachineid")
+ _, err := client.Nic.ListNics(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNics", testlistNics)
+
+ testremoveIpFromNic := func(t *testing.T) {
+ if _, ok := response["removeIpFromNic"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Nic.NewRemoveIpFromNicParams("id")
+ _, err := client.Nic.RemoveIpFromNic(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveIpFromNic", testremoveIpFromNic)
+
+ testupdateVmNicIp := func(t *testing.T) {
+ if _, ok := response["updateVmNicIp"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Nic.NewUpdateVmNicIpParams("nicid")
+ _, err := client.Nic.UpdateVmNicIp(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVmNicIp", testupdateVmNicIp)
+
+}
diff --git a/test/NiciraNVPService_test.go b/test/NiciraNVPService_test.go
new file mode 100644
index 0000000..86e90cc
--- /dev/null
+++ b/test/NiciraNVPService_test.go
@@ -0,0 +1,74 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestNiciraNVPService(t *testing.T) {
+ service := "NiciraNVPService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddNiciraNvpDevice := func(t *testing.T) {
+ if _, ok := response["addNiciraNvpDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NiciraNVP.NewAddNiciraNvpDeviceParams("hostname", "password", "physicalnetworkid", "transportzoneuuid", "username")
+ _, err := client.NiciraNVP.AddNiciraNvpDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddNiciraNvpDevice", testaddNiciraNvpDevice)
+
+ testdeleteNiciraNvpDevice := func(t *testing.T) {
+ if _, ok := response["deleteNiciraNvpDevice"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NiciraNVP.NewDeleteNiciraNvpDeviceParams("nvpdeviceid")
+ _, err := client.NiciraNVP.DeleteNiciraNvpDevice(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteNiciraNvpDevice", testdeleteNiciraNvpDevice)
+
+ testlistNiciraNvpDevices := func(t *testing.T) {
+ if _, ok := response["listNiciraNvpDevices"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.NiciraNVP.NewListNiciraNvpDevicesParams()
+ _, err := client.NiciraNVP.ListNiciraNvpDevices(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListNiciraNvpDevices", testlistNiciraNvpDevices)
+
+}
diff --git a/test/OutofbandManagementService_test.go b/test/OutofbandManagementService_test.go
new file mode 100644
index 0000000..96d7683
--- /dev/null
+++ b/test/OutofbandManagementService_test.go
@@ -0,0 +1,74 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestOutofbandManagementService(t *testing.T) {
+ service := "OutofbandManagementService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testchangeOutOfBandManagementPassword := func(t *testing.T) {
+ if _, ok := response["changeOutOfBandManagementPassword"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.OutofbandManagement.NewChangeOutOfBandManagementPasswordParams("hostid")
+ _, err := client.OutofbandManagement.ChangeOutOfBandManagementPassword(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ChangeOutOfBandManagementPassword", testchangeOutOfBandManagementPassword)
+
+ testconfigureOutOfBandManagement := func(t *testing.T) {
+ if _, ok := response["configureOutOfBandManagement"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.OutofbandManagement.NewConfigureOutOfBandManagementParams("address", "driver", "hostid", "password", "port", "username")
+ _, err := client.OutofbandManagement.ConfigureOutOfBandManagement(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ConfigureOutOfBandManagement", testconfigureOutOfBandManagement)
+
+ testissueOutOfBandManagementPowerAction := func(t *testing.T) {
+ if _, ok := response["issueOutOfBandManagementPowerAction"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.OutofbandManagement.NewIssueOutOfBandManagementPowerActionParams("action", "hostid")
+ _, err := client.OutofbandManagement.IssueOutOfBandManagementPowerAction(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("IssueOutOfBandManagementPowerAction", testissueOutOfBandManagementPowerAction)
+
+}
diff --git a/test/OvsElementService_test.go b/test/OvsElementService_test.go
new file mode 100644
index 0000000..3172247
--- /dev/null
+++ b/test/OvsElementService_test.go
@@ -0,0 +1,62 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestOvsElementService(t *testing.T) {
+ service := "OvsElementService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testconfigureOvsElement := func(t *testing.T) {
+ if _, ok := response["configureOvsElement"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.OvsElement.NewConfigureOvsElementParams(true, "id")
+ _, err := client.OvsElement.ConfigureOvsElement(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ConfigureOvsElement", testconfigureOvsElement)
+
+ testlistOvsElements := func(t *testing.T) {
+ if _, ok := response["listOvsElements"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.OvsElement.NewListOvsElementsParams()
+ _, err := client.OvsElement.ListOvsElements(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListOvsElements", testlistOvsElements)
+
+}
diff --git a/test/PodService_test.go b/test/PodService_test.go
new file mode 100644
index 0000000..ab461e0
--- /dev/null
+++ b/test/PodService_test.go
@@ -0,0 +1,122 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestPodService(t *testing.T) {
+ service := "PodService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreatePod := func(t *testing.T) {
+ if _, ok := response["createPod"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pod.NewCreatePodParams("gateway", "name", "netmask", "startip", "zoneid")
+ _, err := client.Pod.CreatePod(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreatePod", testcreatePod)
+
+ testdedicatePod := func(t *testing.T) {
+ if _, ok := response["dedicatePod"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pod.NewDedicatePodParams("domainid", "podid")
+ _, err := client.Pod.DedicatePod(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DedicatePod", testdedicatePod)
+
+ testdeletePod := func(t *testing.T) {
+ if _, ok := response["deletePod"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pod.NewDeletePodParams("id")
+ _, err := client.Pod.DeletePod(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeletePod", testdeletePod)
+
+ testlistDedicatedPods := func(t *testing.T) {
+ if _, ok := response["listDedicatedPods"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pod.NewListDedicatedPodsParams()
+ _, err := client.Pod.ListDedicatedPods(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDedicatedPods", testlistDedicatedPods)
+
+ testlistPods := func(t *testing.T) {
+ if _, ok := response["listPods"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pod.NewListPodsParams()
+ _, err := client.Pod.ListPods(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListPods", testlistPods)
+
+ testreleaseDedicatedPod := func(t *testing.T) {
+ if _, ok := response["releaseDedicatedPod"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pod.NewReleaseDedicatedPodParams("podid")
+ _, err := client.Pod.ReleaseDedicatedPod(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReleaseDedicatedPod", testreleaseDedicatedPod)
+
+ testupdatePod := func(t *testing.T) {
+ if _, ok := response["updatePod"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pod.NewUpdatePodParams("id")
+ _, err := client.Pod.UpdatePod(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdatePod", testupdatePod)
+
+}
diff --git a/test/PoolService_test.go b/test/PoolService_test.go
new file mode 100644
index 0000000..1adb952
--- /dev/null
+++ b/test/PoolService_test.go
@@ -0,0 +1,98 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestPoolService(t *testing.T) {
+ service := "PoolService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateStoragePool := func(t *testing.T) {
+ if _, ok := response["createStoragePool"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pool.NewCreateStoragePoolParams("name", "url", "zoneid")
+ _, err := client.Pool.CreateStoragePool(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateStoragePool", testcreateStoragePool)
+
+ testdeleteStoragePool := func(t *testing.T) {
+ if _, ok := response["deleteStoragePool"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pool.NewDeleteStoragePoolParams("id")
+ _, err := client.Pool.DeleteStoragePool(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteStoragePool", testdeleteStoragePool)
+
+ testfindStoragePoolsForMigration := func(t *testing.T) {
+ if _, ok := response["findStoragePoolsForMigration"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pool.NewFindStoragePoolsForMigrationParams("id")
+ _, err := client.Pool.FindStoragePoolsForMigration(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("FindStoragePoolsForMigration", testfindStoragePoolsForMigration)
+
+ testlistStoragePools := func(t *testing.T) {
+ if _, ok := response["listStoragePools"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pool.NewListStoragePoolsParams()
+ _, err := client.Pool.ListStoragePools(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListStoragePools", testlistStoragePools)
+
+ testupdateStoragePool := func(t *testing.T) {
+ if _, ok := response["updateStoragePool"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Pool.NewUpdateStoragePoolParams("id")
+ _, err := client.Pool.UpdateStoragePool(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateStoragePool", testupdateStoragePool)
+
+}
diff --git a/test/PortableIPService_test.go b/test/PortableIPService_test.go
new file mode 100644
index 0000000..aafcdf0
--- /dev/null
+++ b/test/PortableIPService_test.go
@@ -0,0 +1,74 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestPortableIPService(t *testing.T) {
+ service := "PortableIPService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreatePortableIpRange := func(t *testing.T) {
+ if _, ok := response["createPortableIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.PortableIP.NewCreatePortableIpRangeParams("endip", "gateway", "netmask", 0, "startip")
+ _, err := client.PortableIP.CreatePortableIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreatePortableIpRange", testcreatePortableIpRange)
+
+ testdeletePortableIpRange := func(t *testing.T) {
+ if _, ok := response["deletePortableIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.PortableIP.NewDeletePortableIpRangeParams("id")
+ _, err := client.PortableIP.DeletePortableIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeletePortableIpRange", testdeletePortableIpRange)
+
+ testlistPortableIpRanges := func(t *testing.T) {
+ if _, ok := response["listPortableIpRanges"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.PortableIP.NewListPortableIpRangesParams()
+ _, err := client.PortableIP.ListPortableIpRanges(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListPortableIpRanges", testlistPortableIpRanges)
+
+}
diff --git a/test/ProjectService_test.go b/test/ProjectService_test.go
new file mode 100644
index 0000000..aa5d050
--- /dev/null
+++ b/test/ProjectService_test.go
@@ -0,0 +1,194 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestProjectService(t *testing.T) {
+ service := "ProjectService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testactivateProject := func(t *testing.T) {
+ if _, ok := response["activateProject"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewActivateProjectParams("id")
+ _, err := client.Project.ActivateProject(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ActivateProject", testactivateProject)
+
+ testcreateProject := func(t *testing.T) {
+ if _, ok := response["createProject"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewCreateProjectParams("displaytext", "name")
+ _, err := client.Project.CreateProject(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateProject", testcreateProject)
+
+ testdeleteProject := func(t *testing.T) {
+ if _, ok := response["deleteProject"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewDeleteProjectParams("id")
+ _, err := client.Project.DeleteProject(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteProject", testdeleteProject)
+
+ testdeleteProjectInvitation := func(t *testing.T) {
+ if _, ok := response["deleteProjectInvitation"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewDeleteProjectInvitationParams("id")
+ _, err := client.Project.DeleteProjectInvitation(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteProjectInvitation", testdeleteProjectInvitation)
+
+ testlistProjectInvitations := func(t *testing.T) {
+ if _, ok := response["listProjectInvitations"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewListProjectInvitationsParams()
+ _, err := client.Project.ListProjectInvitations(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListProjectInvitations", testlistProjectInvitations)
+
+ testlistProjects := func(t *testing.T) {
+ if _, ok := response["listProjects"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewListProjectsParams()
+ _, err := client.Project.ListProjects(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListProjects", testlistProjects)
+
+ testsuspendProject := func(t *testing.T) {
+ if _, ok := response["suspendProject"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewSuspendProjectParams("id")
+ _, err := client.Project.SuspendProject(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("SuspendProject", testsuspendProject)
+
+ testupdateProject := func(t *testing.T) {
+ if _, ok := response["updateProject"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewUpdateProjectParams("id")
+ _, err := client.Project.UpdateProject(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateProject", testupdateProject)
+
+ testupdateProjectInvitation := func(t *testing.T) {
+ if _, ok := response["updateProjectInvitation"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewUpdateProjectInvitationParams("projectid")
+ _, err := client.Project.UpdateProjectInvitation(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateProjectInvitation", testupdateProjectInvitation)
+
+ testlistProjectRolePermissions := func(t *testing.T) {
+ if _, ok := response["listProjectRolePermissions"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewListProjectRolePermissionsParams("projectid")
+ _, err := client.Project.ListProjectRolePermissions(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListProjectRolePermissions", testlistProjectRolePermissions)
+
+ testcreateProjectRolePermission := func(t *testing.T) {
+ if _, ok := response["createProjectRolePermission"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewCreateProjectRolePermissionParams("permission", "projectid", "projectroleid", "rule")
+ _, err := client.Project.CreateProjectRolePermission(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateProjectRolePermission", testcreateProjectRolePermission)
+
+ testupdateProjectRolePermission := func(t *testing.T) {
+ if _, ok := response["updateProjectRolePermission"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewUpdateProjectRolePermissionParams("projectid", "projectroleid")
+ _, err := client.Project.UpdateProjectRolePermission(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateProjectRolePermission", testupdateProjectRolePermission)
+
+ testdeleteProjectRolePermission := func(t *testing.T) {
+ if _, ok := response["deleteProjectRolePermission"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Project.NewDeleteProjectRolePermissionParams("id", "projectid")
+ _, err := client.Project.DeleteProjectRolePermission(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteProjectRolePermission", testdeleteProjectRolePermission)
+
+}
diff --git a/test/QuotaService_test.go b/test/QuotaService_test.go
new file mode 100644
index 0000000..8d1c04f
--- /dev/null
+++ b/test/QuotaService_test.go
@@ -0,0 +1,50 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestQuotaService(t *testing.T) {
+ service := "QuotaService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testquotaIsEnabled := func(t *testing.T) {
+ if _, ok := response["quotaIsEnabled"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Quota.NewQuotaIsEnabledParams()
+ _, err := client.Quota.QuotaIsEnabled(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("QuotaIsEnabled", testquotaIsEnabled)
+
+}
diff --git a/test/RegionService_test.go b/test/RegionService_test.go
new file mode 100644
index 0000000..1cf2ed0
--- /dev/null
+++ b/test/RegionService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestRegionService(t *testing.T) {
+ service := "RegionService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddRegion := func(t *testing.T) {
+ if _, ok := response["addRegion"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Region.NewAddRegionParams("endpoint", 0, "name")
+ _, err := client.Region.AddRegion(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddRegion", testaddRegion)
+
+ testlistRegions := func(t *testing.T) {
+ if _, ok := response["listRegions"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Region.NewListRegionsParams()
+ _, err := client.Region.ListRegions(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListRegions", testlistRegions)
+
+ testremoveRegion := func(t *testing.T) {
+ if _, ok := response["removeRegion"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Region.NewRemoveRegionParams(0)
+ _, err := client.Region.RemoveRegion(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveRegion", testremoveRegion)
+
+ testupdateRegion := func(t *testing.T) {
+ if _, ok := response["updateRegion"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Region.NewUpdateRegionParams(0)
+ _, err := client.Region.UpdateRegion(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateRegion", testupdateRegion)
+
+}
diff --git a/test/ResourcemetadataService_test.go b/test/ResourcemetadataService_test.go
new file mode 100644
index 0000000..3c1f520
--- /dev/null
+++ b/test/ResourcemetadataService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestResourcemetadataService(t *testing.T) {
+ service := "ResourcemetadataService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddResourceDetail := func(t *testing.T) {
+ if _, ok := response["addResourceDetail"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Resourcemetadata.NewAddResourceDetailParams(map[string]string{}, "resourceid", "resourcetype")
+ _, err := client.Resourcemetadata.AddResourceDetail(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddResourceDetail", testaddResourceDetail)
+
+ testgetVolumeSnapshotDetails := func(t *testing.T) {
+ if _, ok := response["getVolumeSnapshotDetails"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Resourcemetadata.NewGetVolumeSnapshotDetailsParams("snapshotid")
+ _, err := client.Resourcemetadata.GetVolumeSnapshotDetails(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetVolumeSnapshotDetails", testgetVolumeSnapshotDetails)
+
+ testlistResourceDetails := func(t *testing.T) {
+ if _, ok := response["listResourceDetails"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Resourcemetadata.NewListResourceDetailsParams("resourcetype")
+ _, err := client.Resourcemetadata.ListResourceDetails(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListResourceDetails", testlistResourceDetails)
+
+ testremoveResourceDetail := func(t *testing.T) {
+ if _, ok := response["removeResourceDetail"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Resourcemetadata.NewRemoveResourceDetailParams("resourceid", "resourcetype")
+ _, err := client.Resourcemetadata.RemoveResourceDetail(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveResourceDetail", testremoveResourceDetail)
+
+}
diff --git a/test/ResourcetagsService_test.go b/test/ResourcetagsService_test.go
new file mode 100644
index 0000000..77d5e2a
--- /dev/null
+++ b/test/ResourcetagsService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestResourcetagsService(t *testing.T) {
+ service := "ResourcetagsService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateTags := func(t *testing.T) {
+ if _, ok := response["createTags"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Resourcetags.NewCreateTagsParams([]string{}, "resourcetype", map[string]string{})
+ _, err := client.Resourcetags.CreateTags(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateTags", testcreateTags)
+
+ testdeleteTags := func(t *testing.T) {
+ if _, ok := response["deleteTags"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Resourcetags.NewDeleteTagsParams([]string{}, "resourcetype")
+ _, err := client.Resourcetags.DeleteTags(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteTags", testdeleteTags)
+
+ testlistStorageTags := func(t *testing.T) {
+ if _, ok := response["listStorageTags"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Resourcetags.NewListStorageTagsParams()
+ _, err := client.Resourcetags.ListStorageTags(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListStorageTags", testlistStorageTags)
+
+ testlistTags := func(t *testing.T) {
+ if _, ok := response["listTags"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Resourcetags.NewListTagsParams()
+ _, err := client.Resourcetags.ListTags(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListTags", testlistTags)
+
+}
diff --git a/test/RoleService_test.go b/test/RoleService_test.go
new file mode 100644
index 0000000..43fe4d3
--- /dev/null
+++ b/test/RoleService_test.go
@@ -0,0 +1,134 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestRoleService(t *testing.T) {
+ service := "RoleService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateRole := func(t *testing.T) {
+ if _, ok := response["createRole"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Role.NewCreateRoleParams("name")
+ _, err := client.Role.CreateRole(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateRole", testcreateRole)
+
+ testcreateRolePermission := func(t *testing.T) {
+ if _, ok := response["createRolePermission"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Role.NewCreateRolePermissionParams("permission", "roleid", "rule")
+ _, err := client.Role.CreateRolePermission(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateRolePermission", testcreateRolePermission)
+
+ testdeleteRole := func(t *testing.T) {
+ if _, ok := response["deleteRole"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Role.NewDeleteRoleParams("id")
+ _, err := client.Role.DeleteRole(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteRole", testdeleteRole)
+
+ testdeleteRolePermission := func(t *testing.T) {
+ if _, ok := response["deleteRolePermission"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Role.NewDeleteRolePermissionParams("id")
+ _, err := client.Role.DeleteRolePermission(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteRolePermission", testdeleteRolePermission)
+
+ testlistRolePermissions := func(t *testing.T) {
+ if _, ok := response["listRolePermissions"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Role.NewListRolePermissionsParams()
+ _, err := client.Role.ListRolePermissions(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListRolePermissions", testlistRolePermissions)
+
+ testlistRoles := func(t *testing.T) {
+ if _, ok := response["listRoles"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Role.NewListRolesParams()
+ _, err := client.Role.ListRoles(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListRoles", testlistRoles)
+
+ testupdateRole := func(t *testing.T) {
+ if _, ok := response["updateRole"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Role.NewUpdateRoleParams("id")
+ _, err := client.Role.UpdateRole(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateRole", testupdateRole)
+
+ testupdateRolePermission := func(t *testing.T) {
+ if _, ok := response["updateRolePermission"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Role.NewUpdateRolePermissionParams("roleid")
+ _, err := client.Role.UpdateRolePermission(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateRolePermission", testupdateRolePermission)
+
+}
diff --git a/test/RouterService_test.go b/test/RouterService_test.go
new file mode 100644
index 0000000..cf3e7cb
--- /dev/null
+++ b/test/RouterService_test.go
@@ -0,0 +1,146 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestRouterService(t *testing.T) {
+ service := "RouterService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testchangeServiceForRouter := func(t *testing.T) {
+ if _, ok := response["changeServiceForRouter"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewChangeServiceForRouterParams("id", "serviceofferingid")
+ _, err := client.Router.ChangeServiceForRouter(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ChangeServiceForRouter", testchangeServiceForRouter)
+
+ testconfigureVirtualRouterElement := func(t *testing.T) {
+ if _, ok := response["configureVirtualRouterElement"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewConfigureVirtualRouterElementParams(true, "id")
+ _, err := client.Router.ConfigureVirtualRouterElement(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ConfigureVirtualRouterElement", testconfigureVirtualRouterElement)
+
+ testcreateVirtualRouterElement := func(t *testing.T) {
+ if _, ok := response["createVirtualRouterElement"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewCreateVirtualRouterElementParams("nspid")
+ _, err := client.Router.CreateVirtualRouterElement(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVirtualRouterElement", testcreateVirtualRouterElement)
+
+ testdestroyRouter := func(t *testing.T) {
+ if _, ok := response["destroyRouter"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewDestroyRouterParams("id")
+ _, err := client.Router.DestroyRouter(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DestroyRouter", testdestroyRouter)
+
+ testlistRouters := func(t *testing.T) {
+ if _, ok := response["listRouters"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewListRoutersParams()
+ _, err := client.Router.ListRouters(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListRouters", testlistRouters)
+
+ testlistVirtualRouterElements := func(t *testing.T) {
+ if _, ok := response["listVirtualRouterElements"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewListVirtualRouterElementsParams()
+ _, err := client.Router.ListVirtualRouterElements(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVirtualRouterElements", testlistVirtualRouterElements)
+
+ testrebootRouter := func(t *testing.T) {
+ if _, ok := response["rebootRouter"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewRebootRouterParams("id")
+ _, err := client.Router.RebootRouter(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RebootRouter", testrebootRouter)
+
+ teststartRouter := func(t *testing.T) {
+ if _, ok := response["startRouter"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewStartRouterParams("id")
+ _, err := client.Router.StartRouter(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("StartRouter", teststartRouter)
+
+ teststopRouter := func(t *testing.T) {
+ if _, ok := response["stopRouter"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Router.NewStopRouterParams("id")
+ _, err := client.Router.StopRouter(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("StopRouter", teststopRouter)
+
+}
diff --git a/test/SSHService_test.go b/test/SSHService_test.go
new file mode 100644
index 0000000..e402656
--- /dev/null
+++ b/test/SSHService_test.go
@@ -0,0 +1,98 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestSSHService(t *testing.T) {
+ service := "SSHService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateSSHKeyPair := func(t *testing.T) {
+ if _, ok := response["createSSHKeyPair"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SSH.NewCreateSSHKeyPairParams("name")
+ _, err := client.SSH.CreateSSHKeyPair(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateSSHKeyPair", testcreateSSHKeyPair)
+
+ testdeleteSSHKeyPair := func(t *testing.T) {
+ if _, ok := response["deleteSSHKeyPair"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SSH.NewDeleteSSHKeyPairParams("name")
+ _, err := client.SSH.DeleteSSHKeyPair(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteSSHKeyPair", testdeleteSSHKeyPair)
+
+ testlistSSHKeyPairs := func(t *testing.T) {
+ if _, ok := response["listSSHKeyPairs"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SSH.NewListSSHKeyPairsParams()
+ _, err := client.SSH.ListSSHKeyPairs(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSSHKeyPairs", testlistSSHKeyPairs)
+
+ testregisterSSHKeyPair := func(t *testing.T) {
+ if _, ok := response["registerSSHKeyPair"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SSH.NewRegisterSSHKeyPairParams("name", "publickey")
+ _, err := client.SSH.RegisterSSHKeyPair(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RegisterSSHKeyPair", testregisterSSHKeyPair)
+
+ testresetSSHKeyForVirtualMachine := func(t *testing.T) {
+ if _, ok := response["resetSSHKeyForVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SSH.NewResetSSHKeyForVirtualMachineParams("id", "keypair")
+ _, err := client.SSH.ResetSSHKeyForVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ResetSSHKeyForVirtualMachine", testresetSSHKeyForVirtualMachine)
+
+}
diff --git a/test/SecurityGroupService_test.go b/test/SecurityGroupService_test.go
new file mode 100644
index 0000000..55259d8
--- /dev/null
+++ b/test/SecurityGroupService_test.go
@@ -0,0 +1,122 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestSecurityGroupService(t *testing.T) {
+ service := "SecurityGroupService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testauthorizeSecurityGroupEgress := func(t *testing.T) {
+ if _, ok := response["authorizeSecurityGroupEgress"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SecurityGroup.NewAuthorizeSecurityGroupEgressParams()
+ _, err := client.SecurityGroup.AuthorizeSecurityGroupEgress(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AuthorizeSecurityGroupEgress", testauthorizeSecurityGroupEgress)
+
+ testauthorizeSecurityGroupIngress := func(t *testing.T) {
+ if _, ok := response["authorizeSecurityGroupIngress"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SecurityGroup.NewAuthorizeSecurityGroupIngressParams()
+ _, err := client.SecurityGroup.AuthorizeSecurityGroupIngress(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AuthorizeSecurityGroupIngress", testauthorizeSecurityGroupIngress)
+
+ testcreateSecurityGroup := func(t *testing.T) {
+ if _, ok := response["createSecurityGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SecurityGroup.NewCreateSecurityGroupParams("name")
+ _, err := client.SecurityGroup.CreateSecurityGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateSecurityGroup", testcreateSecurityGroup)
+
+ testdeleteSecurityGroup := func(t *testing.T) {
+ if _, ok := response["deleteSecurityGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SecurityGroup.NewDeleteSecurityGroupParams()
+ _, err := client.SecurityGroup.DeleteSecurityGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteSecurityGroup", testdeleteSecurityGroup)
+
+ testlistSecurityGroups := func(t *testing.T) {
+ if _, ok := response["listSecurityGroups"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SecurityGroup.NewListSecurityGroupsParams()
+ _, err := client.SecurityGroup.ListSecurityGroups(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSecurityGroups", testlistSecurityGroups)
+
+ testrevokeSecurityGroupEgress := func(t *testing.T) {
+ if _, ok := response["revokeSecurityGroupEgress"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SecurityGroup.NewRevokeSecurityGroupEgressParams("id")
+ _, err := client.SecurityGroup.RevokeSecurityGroupEgress(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RevokeSecurityGroupEgress", testrevokeSecurityGroupEgress)
+
+ testrevokeSecurityGroupIngress := func(t *testing.T) {
+ if _, ok := response["revokeSecurityGroupIngress"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SecurityGroup.NewRevokeSecurityGroupIngressParams("id")
+ _, err := client.SecurityGroup.RevokeSecurityGroupIngress(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RevokeSecurityGroupIngress", testrevokeSecurityGroupIngress)
+
+}
diff --git a/test/ServiceOfferingService_test.go b/test/ServiceOfferingService_test.go
new file mode 100644
index 0000000..7305541
--- /dev/null
+++ b/test/ServiceOfferingService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestServiceOfferingService(t *testing.T) {
+ service := "ServiceOfferingService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateServiceOffering := func(t *testing.T) {
+ if _, ok := response["createServiceOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ServiceOffering.NewCreateServiceOfferingParams("displaytext", "name")
+ _, err := client.ServiceOffering.CreateServiceOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateServiceOffering", testcreateServiceOffering)
+
+ testdeleteServiceOffering := func(t *testing.T) {
+ if _, ok := response["deleteServiceOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ServiceOffering.NewDeleteServiceOfferingParams("id")
+ _, err := client.ServiceOffering.DeleteServiceOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteServiceOffering", testdeleteServiceOffering)
+
+ testlistServiceOfferings := func(t *testing.T) {
+ if _, ok := response["listServiceOfferings"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ServiceOffering.NewListServiceOfferingsParams()
+ _, err := client.ServiceOffering.ListServiceOfferings(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListServiceOfferings", testlistServiceOfferings)
+
+ testupdateServiceOffering := func(t *testing.T) {
+ if _, ok := response["updateServiceOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.ServiceOffering.NewUpdateServiceOfferingParams("id")
+ _, err := client.ServiceOffering.UpdateServiceOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateServiceOffering", testupdateServiceOffering)
+
+}
diff --git a/test/SnapshotService_test.go b/test/SnapshotService_test.go
new file mode 100644
index 0000000..513c3ae
--- /dev/null
+++ b/test/SnapshotService_test.go
@@ -0,0 +1,182 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestSnapshotService(t *testing.T) {
+ service := "SnapshotService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateSnapshot := func(t *testing.T) {
+ if _, ok := response["createSnapshot"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewCreateSnapshotParams("volumeid")
+ _, err := client.Snapshot.CreateSnapshot(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateSnapshot", testcreateSnapshot)
+
+ testcreateSnapshotPolicy := func(t *testing.T) {
+ if _, ok := response["createSnapshotPolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewCreateSnapshotPolicyParams("intervaltype", 0, "schedule", "timezone", "volumeid")
+ _, err := client.Snapshot.CreateSnapshotPolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateSnapshotPolicy", testcreateSnapshotPolicy)
+
+ testcreateVMSnapshot := func(t *testing.T) {
+ if _, ok := response["createVMSnapshot"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewCreateVMSnapshotParams("virtualmachineid")
+ _, err := client.Snapshot.CreateVMSnapshot(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVMSnapshot", testcreateVMSnapshot)
+
+ testdeleteSnapshot := func(t *testing.T) {
+ if _, ok := response["deleteSnapshot"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewDeleteSnapshotParams("id")
+ _, err := client.Snapshot.DeleteSnapshot(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteSnapshot", testdeleteSnapshot)
+
+ testdeleteSnapshotPolicies := func(t *testing.T) {
+ if _, ok := response["deleteSnapshotPolicies"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewDeleteSnapshotPoliciesParams()
+ _, err := client.Snapshot.DeleteSnapshotPolicies(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteSnapshotPolicies", testdeleteSnapshotPolicies)
+
+ testdeleteVMSnapshot := func(t *testing.T) {
+ if _, ok := response["deleteVMSnapshot"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewDeleteVMSnapshotParams("vmsnapshotid")
+ _, err := client.Snapshot.DeleteVMSnapshot(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteVMSnapshot", testdeleteVMSnapshot)
+
+ testlistSnapshotPolicies := func(t *testing.T) {
+ if _, ok := response["listSnapshotPolicies"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewListSnapshotPoliciesParams()
+ _, err := client.Snapshot.ListSnapshotPolicies(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSnapshotPolicies", testlistSnapshotPolicies)
+
+ testlistSnapshots := func(t *testing.T) {
+ if _, ok := response["listSnapshots"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewListSnapshotsParams()
+ _, err := client.Snapshot.ListSnapshots(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSnapshots", testlistSnapshots)
+
+ testlistVMSnapshot := func(t *testing.T) {
+ if _, ok := response["listVMSnapshot"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewListVMSnapshotParams()
+ _, err := client.Snapshot.ListVMSnapshot(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVMSnapshot", testlistVMSnapshot)
+
+ testrevertSnapshot := func(t *testing.T) {
+ if _, ok := response["revertSnapshot"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewRevertSnapshotParams("id")
+ _, err := client.Snapshot.RevertSnapshot(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RevertSnapshot", testrevertSnapshot)
+
+ testrevertToVMSnapshot := func(t *testing.T) {
+ if _, ok := response["revertToVMSnapshot"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewRevertToVMSnapshotParams("vmsnapshotid")
+ _, err := client.Snapshot.RevertToVMSnapshot(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RevertToVMSnapshot", testrevertToVMSnapshot)
+
+ testupdateSnapshotPolicy := func(t *testing.T) {
+ if _, ok := response["updateSnapshotPolicy"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Snapshot.NewUpdateSnapshotPolicyParams()
+ _, err := client.Snapshot.UpdateSnapshotPolicy(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateSnapshotPolicy", testupdateSnapshotPolicy)
+
+}
diff --git a/test/StoragePoolService_test.go b/test/StoragePoolService_test.go
new file mode 100644
index 0000000..364c153
--- /dev/null
+++ b/test/StoragePoolService_test.go
@@ -0,0 +1,74 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestStoragePoolService(t *testing.T) {
+ service := "StoragePoolService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcancelStorageMaintenance := func(t *testing.T) {
+ if _, ok := response["cancelStorageMaintenance"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.StoragePool.NewCancelStorageMaintenanceParams("id")
+ _, err := client.StoragePool.CancelStorageMaintenance(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CancelStorageMaintenance", testcancelStorageMaintenance)
+
+ testenableStorageMaintenance := func(t *testing.T) {
+ if _, ok := response["enableStorageMaintenance"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.StoragePool.NewEnableStorageMaintenanceParams("id")
+ _, err := client.StoragePool.EnableStorageMaintenance(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableStorageMaintenance", testenableStorageMaintenance)
+
+ testlistStorageProviders := func(t *testing.T) {
+ if _, ok := response["listStorageProviders"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.StoragePool.NewListStorageProvidersParams("type")
+ _, err := client.StoragePool.ListStorageProviders(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListStorageProviders", testlistStorageProviders)
+
+}
diff --git a/test/StratosphereSSPService_test.go b/test/StratosphereSSPService_test.go
new file mode 100644
index 0000000..4edd2bf
--- /dev/null
+++ b/test/StratosphereSSPService_test.go
@@ -0,0 +1,62 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestStratosphereSSPService(t *testing.T) {
+ service := "StratosphereSSPService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddStratosphereSsp := func(t *testing.T) {
+ if _, ok := response["addStratosphereSsp"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.StratosphereSSP.NewAddStratosphereSspParams("name", "url", "zoneid")
+ _, err := client.StratosphereSSP.AddStratosphereSsp(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddStratosphereSsp", testaddStratosphereSsp)
+
+ testdeleteStratosphereSsp := func(t *testing.T) {
+ if _, ok := response["deleteStratosphereSsp"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.StratosphereSSP.NewDeleteStratosphereSspParams("hostid")
+ _, err := client.StratosphereSSP.DeleteStratosphereSsp(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteStratosphereSsp", testdeleteStratosphereSsp)
+
+}
diff --git a/test/SwiftService_test.go b/test/SwiftService_test.go
new file mode 100644
index 0000000..5c7bceb
--- /dev/null
+++ b/test/SwiftService_test.go
@@ -0,0 +1,62 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestSwiftService(t *testing.T) {
+ service := "SwiftService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddSwift := func(t *testing.T) {
+ if _, ok := response["addSwift"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Swift.NewAddSwiftParams("url")
+ _, err := client.Swift.AddSwift(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddSwift", testaddSwift)
+
+ testlistSwifts := func(t *testing.T) {
+ if _, ok := response["listSwifts"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Swift.NewListSwiftsParams()
+ _, err := client.Swift.ListSwifts(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSwifts", testlistSwifts)
+
+}
diff --git a/test/SystemCapacityService_test.go b/test/SystemCapacityService_test.go
new file mode 100644
index 0000000..7f6e5bd
--- /dev/null
+++ b/test/SystemCapacityService_test.go
@@ -0,0 +1,50 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestSystemCapacityService(t *testing.T) {
+ service := "SystemCapacityService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testlistCapacity := func(t *testing.T) {
+ if _, ok := response["listCapacity"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemCapacity.NewListCapacityParams()
+ _, err := client.SystemCapacity.ListCapacity(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListCapacity", testlistCapacity)
+
+}
diff --git a/test/SystemVMService_test.go b/test/SystemVMService_test.go
new file mode 100644
index 0000000..587efcc
--- /dev/null
+++ b/test/SystemVMService_test.go
@@ -0,0 +1,134 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestSystemVMService(t *testing.T) {
+ service := "SystemVMService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testchangeServiceForSystemVm := func(t *testing.T) {
+ if _, ok := response["changeServiceForSystemVm"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemVM.NewChangeServiceForSystemVmParams("id", "serviceofferingid")
+ _, err := client.SystemVM.ChangeServiceForSystemVm(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ChangeServiceForSystemVm", testchangeServiceForSystemVm)
+
+ testdestroySystemVm := func(t *testing.T) {
+ if _, ok := response["destroySystemVm"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemVM.NewDestroySystemVmParams("id")
+ _, err := client.SystemVM.DestroySystemVm(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DestroySystemVm", testdestroySystemVm)
+
+ testlistSystemVms := func(t *testing.T) {
+ if _, ok := response["listSystemVms"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemVM.NewListSystemVmsParams()
+ _, err := client.SystemVM.ListSystemVms(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListSystemVms", testlistSystemVms)
+
+ testmigrateSystemVm := func(t *testing.T) {
+ if _, ok := response["migrateSystemVm"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemVM.NewMigrateSystemVmParams("virtualmachineid")
+ _, err := client.SystemVM.MigrateSystemVm(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("MigrateSystemVm", testmigrateSystemVm)
+
+ testrebootSystemVm := func(t *testing.T) {
+ if _, ok := response["rebootSystemVm"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemVM.NewRebootSystemVmParams("id")
+ _, err := client.SystemVM.RebootSystemVm(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RebootSystemVm", testrebootSystemVm)
+
+ testscaleSystemVm := func(t *testing.T) {
+ if _, ok := response["scaleSystemVm"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemVM.NewScaleSystemVmParams("id", "serviceofferingid")
+ _, err := client.SystemVM.ScaleSystemVm(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ScaleSystemVm", testscaleSystemVm)
+
+ teststartSystemVm := func(t *testing.T) {
+ if _, ok := response["startSystemVm"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemVM.NewStartSystemVmParams("id")
+ _, err := client.SystemVM.StartSystemVm(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("StartSystemVm", teststartSystemVm)
+
+ teststopSystemVm := func(t *testing.T) {
+ if _, ok := response["stopSystemVm"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.SystemVM.NewStopSystemVmParams("id")
+ _, err := client.SystemVM.StopSystemVm(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("StopSystemVm", teststopSystemVm)
+
+}
diff --git a/test/TemplateService_test.go b/test/TemplateService_test.go
new file mode 100644
index 0000000..ea4035d
--- /dev/null
+++ b/test/TemplateService_test.go
@@ -0,0 +1,182 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestTemplateService(t *testing.T) {
+ service := "TemplateService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcopyTemplate := func(t *testing.T) {
+ if _, ok := response["copyTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewCopyTemplateParams("id")
+ _, err := client.Template.CopyTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CopyTemplate", testcopyTemplate)
+
+ testcreateTemplate := func(t *testing.T) {
+ if _, ok := response["createTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewCreateTemplateParams("displaytext", "name", "ostypeid")
+ _, err := client.Template.CreateTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateTemplate", testcreateTemplate)
+
+ testdeleteTemplate := func(t *testing.T) {
+ if _, ok := response["deleteTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewDeleteTemplateParams("id")
+ _, err := client.Template.DeleteTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteTemplate", testdeleteTemplate)
+
+ testextractTemplate := func(t *testing.T) {
+ if _, ok := response["extractTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewExtractTemplateParams("id", "mode")
+ _, err := client.Template.ExtractTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ExtractTemplate", testextractTemplate)
+
+ testgetUploadParamsForTemplate := func(t *testing.T) {
+ if _, ok := response["getUploadParamsForTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewGetUploadParamsForTemplateParams("displaytext", "format", "hypervisor", "name", "zoneid")
+ _, err := client.Template.GetUploadParamsForTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetUploadParamsForTemplate", testgetUploadParamsForTemplate)
+
+ testlistTemplatePermissions := func(t *testing.T) {
+ if _, ok := response["listTemplatePermissions"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewListTemplatePermissionsParams("id")
+ _, err := client.Template.ListTemplatePermissions(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListTemplatePermissions", testlistTemplatePermissions)
+
+ testlistTemplates := func(t *testing.T) {
+ if _, ok := response["listTemplates"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewListTemplatesParams("templatefilter")
+ _, err := client.Template.ListTemplates(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListTemplates", testlistTemplates)
+
+ testprepareTemplate := func(t *testing.T) {
+ if _, ok := response["prepareTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewPrepareTemplateParams("templateid", "zoneid")
+ _, err := client.Template.PrepareTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("PrepareTemplate", testprepareTemplate)
+
+ testregisterTemplate := func(t *testing.T) {
+ if _, ok := response["registerTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewRegisterTemplateParams("displaytext", "format", "hypervisor", "name", "url")
+ _, err := client.Template.RegisterTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RegisterTemplate", testregisterTemplate)
+
+ testupdateTemplate := func(t *testing.T) {
+ if _, ok := response["updateTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewUpdateTemplateParams("id")
+ _, err := client.Template.UpdateTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateTemplate", testupdateTemplate)
+
+ testupdateTemplatePermissions := func(t *testing.T) {
+ if _, ok := response["updateTemplatePermissions"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewUpdateTemplatePermissionsParams("id")
+ _, err := client.Template.UpdateTemplatePermissions(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateTemplatePermissions", testupdateTemplatePermissions)
+
+ testupgradeRouterTemplate := func(t *testing.T) {
+ if _, ok := response["upgradeRouterTemplate"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Template.NewUpgradeRouterTemplateParams()
+ _, err := client.Template.UpgradeRouterTemplate(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpgradeRouterTemplate", testupgradeRouterTemplate)
+
+}
diff --git a/test/UCSService_test.go b/test/UCSService_test.go
new file mode 100644
index 0000000..46108f2
--- /dev/null
+++ b/test/UCSService_test.go
@@ -0,0 +1,110 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestUCSService(t *testing.T) {
+ service := "UCSService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddUcsManager := func(t *testing.T) {
+ if _, ok := response["addUcsManager"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.UCS.NewAddUcsManagerParams("password", "url", "username", "zoneid")
+ _, err := client.UCS.AddUcsManager(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddUcsManager", testaddUcsManager)
+
+ testassociateUcsProfileToBlade := func(t *testing.T) {
+ if _, ok := response["associateUcsProfileToBlade"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.UCS.NewAssociateUcsProfileToBladeParams("bladeid", "profiledn", "ucsmanagerid")
+ _, err := client.UCS.AssociateUcsProfileToBlade(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AssociateUcsProfileToBlade", testassociateUcsProfileToBlade)
+
+ testdeleteUcsManager := func(t *testing.T) {
+ if _, ok := response["deleteUcsManager"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.UCS.NewDeleteUcsManagerParams("ucsmanagerid")
+ _, err := client.UCS.DeleteUcsManager(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteUcsManager", testdeleteUcsManager)
+
+ testlistUcsBlades := func(t *testing.T) {
+ if _, ok := response["listUcsBlades"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.UCS.NewListUcsBladesParams("ucsmanagerid")
+ _, err := client.UCS.ListUcsBlades(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListUcsBlades", testlistUcsBlades)
+
+ testlistUcsManagers := func(t *testing.T) {
+ if _, ok := response["listUcsManagers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.UCS.NewListUcsManagersParams()
+ _, err := client.UCS.ListUcsManagers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListUcsManagers", testlistUcsManagers)
+
+ testlistUcsProfiles := func(t *testing.T) {
+ if _, ok := response["listUcsProfiles"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.UCS.NewListUcsProfilesParams("ucsmanagerid")
+ _, err := client.UCS.ListUcsProfiles(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListUcsProfiles", testlistUcsProfiles)
+
+}
diff --git a/test/UsageService_test.go b/test/UsageService_test.go
new file mode 100644
index 0000000..012dc52
--- /dev/null
+++ b/test/UsageService_test.go
@@ -0,0 +1,182 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestUsageService(t *testing.T) {
+ service := "UsageService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddTrafficMonitor := func(t *testing.T) {
+ if _, ok := response["addTrafficMonitor"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewAddTrafficMonitorParams("url", "zoneid")
+ _, err := client.Usage.AddTrafficMonitor(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddTrafficMonitor", testaddTrafficMonitor)
+
+ testaddTrafficType := func(t *testing.T) {
+ if _, ok := response["addTrafficType"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewAddTrafficTypeParams("physicalnetworkid", "traffictype")
+ _, err := client.Usage.AddTrafficType(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddTrafficType", testaddTrafficType)
+
+ testdeleteTrafficMonitor := func(t *testing.T) {
+ if _, ok := response["deleteTrafficMonitor"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewDeleteTrafficMonitorParams("id")
+ _, err := client.Usage.DeleteTrafficMonitor(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteTrafficMonitor", testdeleteTrafficMonitor)
+
+ testdeleteTrafficType := func(t *testing.T) {
+ if _, ok := response["deleteTrafficType"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewDeleteTrafficTypeParams("id")
+ _, err := client.Usage.DeleteTrafficType(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteTrafficType", testdeleteTrafficType)
+
+ testgenerateUsageRecords := func(t *testing.T) {
+ if _, ok := response["generateUsageRecords"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewGenerateUsageRecordsParams("enddate", "startdate")
+ _, err := client.Usage.GenerateUsageRecords(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GenerateUsageRecords", testgenerateUsageRecords)
+
+ testlistTrafficMonitors := func(t *testing.T) {
+ if _, ok := response["listTrafficMonitors"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewListTrafficMonitorsParams("zoneid")
+ _, err := client.Usage.ListTrafficMonitors(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListTrafficMonitors", testlistTrafficMonitors)
+
+ testlistTrafficTypeImplementors := func(t *testing.T) {
+ if _, ok := response["listTrafficTypeImplementors"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewListTrafficTypeImplementorsParams()
+ _, err := client.Usage.ListTrafficTypeImplementors(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListTrafficTypeImplementors", testlistTrafficTypeImplementors)
+
+ testlistTrafficTypes := func(t *testing.T) {
+ if _, ok := response["listTrafficTypes"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewListTrafficTypesParams("physicalnetworkid")
+ _, err := client.Usage.ListTrafficTypes(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListTrafficTypes", testlistTrafficTypes)
+
+ testlistUsageRecords := func(t *testing.T) {
+ if _, ok := response["listUsageRecords"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewListUsageRecordsParams("enddate", "startdate")
+ _, err := client.Usage.ListUsageRecords(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListUsageRecords", testlistUsageRecords)
+
+ testlistUsageTypes := func(t *testing.T) {
+ if _, ok := response["listUsageTypes"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewListUsageTypesParams()
+ _, err := client.Usage.ListUsageTypes(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListUsageTypes", testlistUsageTypes)
+
+ testremoveRawUsageRecords := func(t *testing.T) {
+ if _, ok := response["removeRawUsageRecords"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewRemoveRawUsageRecordsParams(0)
+ _, err := client.Usage.RemoveRawUsageRecords(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveRawUsageRecords", testremoveRawUsageRecords)
+
+ testupdateTrafficType := func(t *testing.T) {
+ if _, ok := response["updateTrafficType"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Usage.NewUpdateTrafficTypeParams("id")
+ _, err := client.Usage.UpdateTrafficType(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateTrafficType", testupdateTrafficType)
+
+}
diff --git a/test/UserService_test.go b/test/UserService_test.go
new file mode 100644
index 0000000..f5579a9
--- /dev/null
+++ b/test/UserService_test.go
@@ -0,0 +1,170 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestUserService(t *testing.T) {
+ service := "UserService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateUser := func(t *testing.T) {
+ if _, ok := response["createUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewCreateUserParams("account", "email", "firstname", "lastname", "password", "username")
+ _, err := client.User.CreateUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateUser", testcreateUser)
+
+ testdeleteUser := func(t *testing.T) {
+ if _, ok := response["deleteUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewDeleteUserParams("id")
+ _, err := client.User.DeleteUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteUser", testdeleteUser)
+
+ testdisableUser := func(t *testing.T) {
+ if _, ok := response["disableUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewDisableUserParams("id")
+ _, err := client.User.DisableUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableUser", testdisableUser)
+
+ testenableUser := func(t *testing.T) {
+ if _, ok := response["enableUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewEnableUserParams("id")
+ _, err := client.User.EnableUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableUser", testenableUser)
+
+ testgetUser := func(t *testing.T) {
+ if _, ok := response["getUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewGetUserParams("userapikey")
+ _, err := client.User.GetUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetUser", testgetUser)
+
+ testgetUserKeys := func(t *testing.T) {
+ if _, ok := response["getUserKeys"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewGetUserKeysParams("id")
+ _, err := client.User.GetUserKeys(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetUserKeys", testgetUserKeys)
+
+ testgetVirtualMachineUserData := func(t *testing.T) {
+ if _, ok := response["getVirtualMachineUserData"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewGetVirtualMachineUserDataParams("virtualmachineid")
+ _, err := client.User.GetVirtualMachineUserData(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetVirtualMachineUserData", testgetVirtualMachineUserData)
+
+ testlistUsers := func(t *testing.T) {
+ if _, ok := response["listUsers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewListUsersParams()
+ _, err := client.User.ListUsers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListUsers", testlistUsers)
+
+ testlockUser := func(t *testing.T) {
+ if _, ok := response["lockUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewLockUserParams("id")
+ _, err := client.User.LockUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("LockUser", testlockUser)
+
+ testregisterUserKeys := func(t *testing.T) {
+ if _, ok := response["registerUserKeys"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewRegisterUserKeysParams("id")
+ _, err := client.User.RegisterUserKeys(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RegisterUserKeys", testregisterUserKeys)
+
+ testupdateUser := func(t *testing.T) {
+ if _, ok := response["updateUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.User.NewUpdateUserParams("id")
+ _, err := client.User.UpdateUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateUser", testupdateUser)
+
+}
diff --git a/test/VLANService_test.go b/test/VLANService_test.go
new file mode 100644
index 0000000..ca58ac7
--- /dev/null
+++ b/test/VLANService_test.go
@@ -0,0 +1,110 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestVLANService(t *testing.T) {
+ service := "VLANService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateVlanIpRange := func(t *testing.T) {
+ if _, ok := response["createVlanIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VLAN.NewCreateVlanIpRangeParams()
+ _, err := client.VLAN.CreateVlanIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVlanIpRange", testcreateVlanIpRange)
+
+ testdedicateGuestVlanRange := func(t *testing.T) {
+ if _, ok := response["dedicateGuestVlanRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VLAN.NewDedicateGuestVlanRangeParams("physicalnetworkid", "vlanrange")
+ _, err := client.VLAN.DedicateGuestVlanRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DedicateGuestVlanRange", testdedicateGuestVlanRange)
+
+ testdeleteVlanIpRange := func(t *testing.T) {
+ if _, ok := response["deleteVlanIpRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VLAN.NewDeleteVlanIpRangeParams("id")
+ _, err := client.VLAN.DeleteVlanIpRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteVlanIpRange", testdeleteVlanIpRange)
+
+ testlistDedicatedGuestVlanRanges := func(t *testing.T) {
+ if _, ok := response["listDedicatedGuestVlanRanges"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VLAN.NewListDedicatedGuestVlanRangesParams()
+ _, err := client.VLAN.ListDedicatedGuestVlanRanges(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDedicatedGuestVlanRanges", testlistDedicatedGuestVlanRanges)
+
+ testlistVlanIpRanges := func(t *testing.T) {
+ if _, ok := response["listVlanIpRanges"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VLAN.NewListVlanIpRangesParams()
+ _, err := client.VLAN.ListVlanIpRanges(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVlanIpRanges", testlistVlanIpRanges)
+
+ testreleaseDedicatedGuestVlanRange := func(t *testing.T) {
+ if _, ok := response["releaseDedicatedGuestVlanRange"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VLAN.NewReleaseDedicatedGuestVlanRangeParams("id")
+ _, err := client.VLAN.ReleaseDedicatedGuestVlanRange(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReleaseDedicatedGuestVlanRange", testreleaseDedicatedGuestVlanRange)
+
+}
diff --git a/test/VMGroupService_test.go b/test/VMGroupService_test.go
new file mode 100644
index 0000000..3382f5c
--- /dev/null
+++ b/test/VMGroupService_test.go
@@ -0,0 +1,86 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestVMGroupService(t *testing.T) {
+ service := "VMGroupService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateInstanceGroup := func(t *testing.T) {
+ if _, ok := response["createInstanceGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VMGroup.NewCreateInstanceGroupParams("name")
+ _, err := client.VMGroup.CreateInstanceGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateInstanceGroup", testcreateInstanceGroup)
+
+ testdeleteInstanceGroup := func(t *testing.T) {
+ if _, ok := response["deleteInstanceGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VMGroup.NewDeleteInstanceGroupParams("id")
+ _, err := client.VMGroup.DeleteInstanceGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteInstanceGroup", testdeleteInstanceGroup)
+
+ testlistInstanceGroups := func(t *testing.T) {
+ if _, ok := response["listInstanceGroups"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VMGroup.NewListInstanceGroupsParams()
+ _, err := client.VMGroup.ListInstanceGroups(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListInstanceGroups", testlistInstanceGroups)
+
+ testupdateInstanceGroup := func(t *testing.T) {
+ if _, ok := response["updateInstanceGroup"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VMGroup.NewUpdateInstanceGroupParams("id")
+ _, err := client.VMGroup.UpdateInstanceGroup(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateInstanceGroup", testupdateInstanceGroup)
+
+}
diff --git a/test/VPCService_test.go b/test/VPCService_test.go
new file mode 100644
index 0000000..782c9de
--- /dev/null
+++ b/test/VPCService_test.go
@@ -0,0 +1,218 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestVPCService(t *testing.T) {
+ service := "VPCService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreatePrivateGateway := func(t *testing.T) {
+ if _, ok := response["createPrivateGateway"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewCreatePrivateGatewayParams("gateway", "ipaddress", "netmask", "vlan", "vpcid")
+ _, err := client.VPC.CreatePrivateGateway(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreatePrivateGateway", testcreatePrivateGateway)
+
+ testcreateStaticRoute := func(t *testing.T) {
+ if _, ok := response["createStaticRoute"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewCreateStaticRouteParams("cidr", "gatewayid")
+ _, err := client.VPC.CreateStaticRoute(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateStaticRoute", testcreateStaticRoute)
+
+ testcreateVPC := func(t *testing.T) {
+ if _, ok := response["createVPC"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewCreateVPCParams("cidr", "displaytext", "name", "vpcofferingid", "zoneid")
+ _, err := client.VPC.CreateVPC(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVPC", testcreateVPC)
+
+ testcreateVPCOffering := func(t *testing.T) {
+ if _, ok := response["createVPCOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewCreateVPCOfferingParams("displaytext", "name", []string{})
+ _, err := client.VPC.CreateVPCOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVPCOffering", testcreateVPCOffering)
+
+ testdeletePrivateGateway := func(t *testing.T) {
+ if _, ok := response["deletePrivateGateway"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewDeletePrivateGatewayParams("id")
+ _, err := client.VPC.DeletePrivateGateway(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeletePrivateGateway", testdeletePrivateGateway)
+
+ testdeleteStaticRoute := func(t *testing.T) {
+ if _, ok := response["deleteStaticRoute"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewDeleteStaticRouteParams("id")
+ _, err := client.VPC.DeleteStaticRoute(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteStaticRoute", testdeleteStaticRoute)
+
+ testdeleteVPC := func(t *testing.T) {
+ if _, ok := response["deleteVPC"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewDeleteVPCParams("id")
+ _, err := client.VPC.DeleteVPC(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteVPC", testdeleteVPC)
+
+ testdeleteVPCOffering := func(t *testing.T) {
+ if _, ok := response["deleteVPCOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewDeleteVPCOfferingParams("id")
+ _, err := client.VPC.DeleteVPCOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteVPCOffering", testdeleteVPCOffering)
+
+ testlistPrivateGateways := func(t *testing.T) {
+ if _, ok := response["listPrivateGateways"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewListPrivateGatewaysParams()
+ _, err := client.VPC.ListPrivateGateways(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListPrivateGateways", testlistPrivateGateways)
+
+ testlistStaticRoutes := func(t *testing.T) {
+ if _, ok := response["listStaticRoutes"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewListStaticRoutesParams()
+ _, err := client.VPC.ListStaticRoutes(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListStaticRoutes", testlistStaticRoutes)
+
+ testlistVPCOfferings := func(t *testing.T) {
+ if _, ok := response["listVPCOfferings"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewListVPCOfferingsParams()
+ _, err := client.VPC.ListVPCOfferings(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVPCOfferings", testlistVPCOfferings)
+
+ testlistVPCs := func(t *testing.T) {
+ if _, ok := response["listVPCs"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewListVPCsParams()
+ _, err := client.VPC.ListVPCs(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVPCs", testlistVPCs)
+
+ testrestartVPC := func(t *testing.T) {
+ if _, ok := response["restartVPC"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewRestartVPCParams("id")
+ _, err := client.VPC.RestartVPC(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RestartVPC", testrestartVPC)
+
+ testupdateVPC := func(t *testing.T) {
+ if _, ok := response["updateVPC"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewUpdateVPCParams("id")
+ _, err := client.VPC.UpdateVPC(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVPC", testupdateVPC)
+
+ testupdateVPCOffering := func(t *testing.T) {
+ if _, ok := response["updateVPCOffering"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPC.NewUpdateVPCOfferingParams("id")
+ _, err := client.VPC.UpdateVPCOffering(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVPCOffering", testupdateVPCOffering)
+
+}
diff --git a/test/VPNService_test.go b/test/VPNService_test.go
new file mode 100644
index 0000000..ae7d0bb
--- /dev/null
+++ b/test/VPNService_test.go
@@ -0,0 +1,278 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestVPNService(t *testing.T) {
+ service := "VPNService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddVpnUser := func(t *testing.T) {
+ if _, ok := response["addVpnUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewAddVpnUserParams("password", "username")
+ _, err := client.VPN.AddVpnUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddVpnUser", testaddVpnUser)
+
+ testcreateRemoteAccessVpn := func(t *testing.T) {
+ if _, ok := response["createRemoteAccessVpn"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewCreateRemoteAccessVpnParams("publicipid")
+ _, err := client.VPN.CreateRemoteAccessVpn(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateRemoteAccessVpn", testcreateRemoteAccessVpn)
+
+ testcreateVpnConnection := func(t *testing.T) {
+ if _, ok := response["createVpnConnection"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewCreateVpnConnectionParams("s2scustomergatewayid", "s2svpngatewayid")
+ _, err := client.VPN.CreateVpnConnection(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVpnConnection", testcreateVpnConnection)
+
+ testcreateVpnCustomerGateway := func(t *testing.T) {
+ if _, ok := response["createVpnCustomerGateway"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewCreateVpnCustomerGatewayParams("cidrlist", "esppolicy", "gateway", "ikepolicy", "ipsecpsk")
+ _, err := client.VPN.CreateVpnCustomerGateway(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVpnCustomerGateway", testcreateVpnCustomerGateway)
+
+ testcreateVpnGateway := func(t *testing.T) {
+ if _, ok := response["createVpnGateway"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewCreateVpnGatewayParams("vpcid")
+ _, err := client.VPN.CreateVpnGateway(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVpnGateway", testcreateVpnGateway)
+
+ testdeleteRemoteAccessVpn := func(t *testing.T) {
+ if _, ok := response["deleteRemoteAccessVpn"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewDeleteRemoteAccessVpnParams("publicipid")
+ _, err := client.VPN.DeleteRemoteAccessVpn(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteRemoteAccessVpn", testdeleteRemoteAccessVpn)
+
+ testdeleteVpnConnection := func(t *testing.T) {
+ if _, ok := response["deleteVpnConnection"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewDeleteVpnConnectionParams("id")
+ _, err := client.VPN.DeleteVpnConnection(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteVpnConnection", testdeleteVpnConnection)
+
+ testdeleteVpnCustomerGateway := func(t *testing.T) {
+ if _, ok := response["deleteVpnCustomerGateway"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewDeleteVpnCustomerGatewayParams("id")
+ _, err := client.VPN.DeleteVpnCustomerGateway(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteVpnCustomerGateway", testdeleteVpnCustomerGateway)
+
+ testdeleteVpnGateway := func(t *testing.T) {
+ if _, ok := response["deleteVpnGateway"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewDeleteVpnGatewayParams("id")
+ _, err := client.VPN.DeleteVpnGateway(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteVpnGateway", testdeleteVpnGateway)
+
+ testlistRemoteAccessVpns := func(t *testing.T) {
+ if _, ok := response["listRemoteAccessVpns"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewListRemoteAccessVpnsParams()
+ _, err := client.VPN.ListRemoteAccessVpns(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListRemoteAccessVpns", testlistRemoteAccessVpns)
+
+ testlistVpnConnections := func(t *testing.T) {
+ if _, ok := response["listVpnConnections"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewListVpnConnectionsParams()
+ _, err := client.VPN.ListVpnConnections(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVpnConnections", testlistVpnConnections)
+
+ testlistVpnCustomerGateways := func(t *testing.T) {
+ if _, ok := response["listVpnCustomerGateways"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewListVpnCustomerGatewaysParams()
+ _, err := client.VPN.ListVpnCustomerGateways(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVpnCustomerGateways", testlistVpnCustomerGateways)
+
+ testlistVpnGateways := func(t *testing.T) {
+ if _, ok := response["listVpnGateways"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewListVpnGatewaysParams()
+ _, err := client.VPN.ListVpnGateways(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVpnGateways", testlistVpnGateways)
+
+ testlistVpnUsers := func(t *testing.T) {
+ if _, ok := response["listVpnUsers"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewListVpnUsersParams()
+ _, err := client.VPN.ListVpnUsers(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVpnUsers", testlistVpnUsers)
+
+ testremoveVpnUser := func(t *testing.T) {
+ if _, ok := response["removeVpnUser"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewRemoveVpnUserParams("username")
+ _, err := client.VPN.RemoveVpnUser(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveVpnUser", testremoveVpnUser)
+
+ testresetVpnConnection := func(t *testing.T) {
+ if _, ok := response["resetVpnConnection"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewResetVpnConnectionParams("id")
+ _, err := client.VPN.ResetVpnConnection(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ResetVpnConnection", testresetVpnConnection)
+
+ testupdateRemoteAccessVpn := func(t *testing.T) {
+ if _, ok := response["updateRemoteAccessVpn"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewUpdateRemoteAccessVpnParams("id")
+ _, err := client.VPN.UpdateRemoteAccessVpn(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateRemoteAccessVpn", testupdateRemoteAccessVpn)
+
+ testupdateVpnConnection := func(t *testing.T) {
+ if _, ok := response["updateVpnConnection"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewUpdateVpnConnectionParams("id")
+ _, err := client.VPN.UpdateVpnConnection(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVpnConnection", testupdateVpnConnection)
+
+ testupdateVpnCustomerGateway := func(t *testing.T) {
+ if _, ok := response["updateVpnCustomerGateway"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewUpdateVpnCustomerGatewayParams("cidrlist", "esppolicy", "gateway", "id", "ikepolicy", "ipsecpsk")
+ _, err := client.VPN.UpdateVpnCustomerGateway(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVpnCustomerGateway", testupdateVpnCustomerGateway)
+
+ testupdateVpnGateway := func(t *testing.T) {
+ if _, ok := response["updateVpnGateway"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VPN.NewUpdateVpnGatewayParams("id")
+ _, err := client.VPN.UpdateVpnGateway(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVpnGateway", testupdateVpnGateway)
+
+}
diff --git a/test/VirtualMachineService_test.go b/test/VirtualMachineService_test.go
new file mode 100644
index 0000000..71822e7
--- /dev/null
+++ b/test/VirtualMachineService_test.go
@@ -0,0 +1,302 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestVirtualMachineService(t *testing.T) {
+ service := "VirtualMachineService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testaddNicToVirtualMachine := func(t *testing.T) {
+ if _, ok := response["addNicToVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewAddNicToVirtualMachineParams("networkid", "virtualmachineid")
+ _, err := client.VirtualMachine.AddNicToVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AddNicToVirtualMachine", testaddNicToVirtualMachine)
+
+ testassignVirtualMachine := func(t *testing.T) {
+ if _, ok := response["assignVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewAssignVirtualMachineParams("virtualmachineid")
+ _, err := client.VirtualMachine.AssignVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AssignVirtualMachine", testassignVirtualMachine)
+
+ testchangeServiceForVirtualMachine := func(t *testing.T) {
+ if _, ok := response["changeServiceForVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewChangeServiceForVirtualMachineParams("id", "serviceofferingid")
+ _, err := client.VirtualMachine.ChangeServiceForVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ChangeServiceForVirtualMachine", testchangeServiceForVirtualMachine)
+
+ testcleanVMReservations := func(t *testing.T) {
+ if _, ok := response["cleanVMReservations"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewCleanVMReservationsParams()
+ _, err := client.VirtualMachine.CleanVMReservations(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CleanVMReservations", testcleanVMReservations)
+
+ testdeployVirtualMachine := func(t *testing.T) {
+ if _, ok := response["deployVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewDeployVirtualMachineParams("serviceofferingid", "templateid", "zoneid")
+ _, err := client.VirtualMachine.DeployVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeployVirtualMachine", testdeployVirtualMachine)
+
+ testdestroyVirtualMachine := func(t *testing.T) {
+ if _, ok := response["destroyVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewDestroyVirtualMachineParams("id")
+ _, err := client.VirtualMachine.DestroyVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DestroyVirtualMachine", testdestroyVirtualMachine)
+
+ testexpungeVirtualMachine := func(t *testing.T) {
+ if _, ok := response["expungeVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewExpungeVirtualMachineParams("id")
+ _, err := client.VirtualMachine.ExpungeVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ExpungeVirtualMachine", testexpungeVirtualMachine)
+
+ testgetVMPassword := func(t *testing.T) {
+ if _, ok := response["getVMPassword"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewGetVMPasswordParams("id")
+ _, err := client.VirtualMachine.GetVMPassword(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetVMPassword", testgetVMPassword)
+
+ testlistVirtualMachines := func(t *testing.T) {
+ if _, ok := response["listVirtualMachines"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewListVirtualMachinesParams()
+ _, err := client.VirtualMachine.ListVirtualMachines(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVirtualMachines", testlistVirtualMachines)
+
+ testlistVirtualMachinesMetrics := func(t *testing.T) {
+ if _, ok := response["listVirtualMachinesMetrics"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewListVirtualMachinesMetricsParams()
+ _, err := client.VirtualMachine.ListVirtualMachinesMetrics(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVirtualMachinesMetrics", testlistVirtualMachinesMetrics)
+
+ testmigrateVirtualMachine := func(t *testing.T) {
+ if _, ok := response["migrateVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewMigrateVirtualMachineParams("virtualmachineid")
+ _, err := client.VirtualMachine.MigrateVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("MigrateVirtualMachine", testmigrateVirtualMachine)
+
+ testmigrateVirtualMachineWithVolume := func(t *testing.T) {
+ if _, ok := response["migrateVirtualMachineWithVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewMigrateVirtualMachineWithVolumeParams("virtualmachineid")
+ _, err := client.VirtualMachine.MigrateVirtualMachineWithVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("MigrateVirtualMachineWithVolume", testmigrateVirtualMachineWithVolume)
+
+ testrebootVirtualMachine := func(t *testing.T) {
+ if _, ok := response["rebootVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewRebootVirtualMachineParams("id")
+ _, err := client.VirtualMachine.RebootVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RebootVirtualMachine", testrebootVirtualMachine)
+
+ testrecoverVirtualMachine := func(t *testing.T) {
+ if _, ok := response["recoverVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewRecoverVirtualMachineParams("id")
+ _, err := client.VirtualMachine.RecoverVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RecoverVirtualMachine", testrecoverVirtualMachine)
+
+ testremoveNicFromVirtualMachine := func(t *testing.T) {
+ if _, ok := response["removeNicFromVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewRemoveNicFromVirtualMachineParams("nicid", "virtualmachineid")
+ _, err := client.VirtualMachine.RemoveNicFromVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RemoveNicFromVirtualMachine", testremoveNicFromVirtualMachine)
+
+ testresetPasswordForVirtualMachine := func(t *testing.T) {
+ if _, ok := response["resetPasswordForVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewResetPasswordForVirtualMachineParams("id")
+ _, err := client.VirtualMachine.ResetPasswordForVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ResetPasswordForVirtualMachine", testresetPasswordForVirtualMachine)
+
+ testrestoreVirtualMachine := func(t *testing.T) {
+ if _, ok := response["restoreVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewRestoreVirtualMachineParams("virtualmachineid")
+ _, err := client.VirtualMachine.RestoreVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("RestoreVirtualMachine", testrestoreVirtualMachine)
+
+ testscaleVirtualMachine := func(t *testing.T) {
+ if _, ok := response["scaleVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewScaleVirtualMachineParams("id", "serviceofferingid")
+ _, err := client.VirtualMachine.ScaleVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ScaleVirtualMachine", testscaleVirtualMachine)
+
+ teststartVirtualMachine := func(t *testing.T) {
+ if _, ok := response["startVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewStartVirtualMachineParams("id")
+ _, err := client.VirtualMachine.StartVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("StartVirtualMachine", teststartVirtualMachine)
+
+ teststopVirtualMachine := func(t *testing.T) {
+ if _, ok := response["stopVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewStopVirtualMachineParams("id")
+ _, err := client.VirtualMachine.StopVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("StopVirtualMachine", teststopVirtualMachine)
+
+ testupdateDefaultNicForVirtualMachine := func(t *testing.T) {
+ if _, ok := response["updateDefaultNicForVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewUpdateDefaultNicForVirtualMachineParams("nicid", "virtualmachineid")
+ _, err := client.VirtualMachine.UpdateDefaultNicForVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateDefaultNicForVirtualMachine", testupdateDefaultNicForVirtualMachine)
+
+ testupdateVirtualMachine := func(t *testing.T) {
+ if _, ok := response["updateVirtualMachine"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.VirtualMachine.NewUpdateVirtualMachineParams("id")
+ _, err := client.VirtualMachine.UpdateVirtualMachine(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVirtualMachine", testupdateVirtualMachine)
+
+}
diff --git a/test/VolumeService_test.go b/test/VolumeService_test.go
new file mode 100644
index 0000000..4de6f95
--- /dev/null
+++ b/test/VolumeService_test.go
@@ -0,0 +1,206 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestVolumeService(t *testing.T) {
+ service := "VolumeService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testattachVolume := func(t *testing.T) {
+ if _, ok := response["attachVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewAttachVolumeParams("id", "virtualmachineid")
+ _, err := client.Volume.AttachVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("AttachVolume", testattachVolume)
+
+ testcreateVolume := func(t *testing.T) {
+ if _, ok := response["createVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewCreateVolumeParams()
+ _, err := client.Volume.CreateVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateVolume", testcreateVolume)
+
+ testdeleteVolume := func(t *testing.T) {
+ if _, ok := response["deleteVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewDeleteVolumeParams("id")
+ _, err := client.Volume.DeleteVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteVolume", testdeleteVolume)
+
+ testdetachVolume := func(t *testing.T) {
+ if _, ok := response["detachVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewDetachVolumeParams()
+ _, err := client.Volume.DetachVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DetachVolume", testdetachVolume)
+
+ testextractVolume := func(t *testing.T) {
+ if _, ok := response["extractVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewExtractVolumeParams("id", "mode", "zoneid")
+ _, err := client.Volume.ExtractVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ExtractVolume", testextractVolume)
+
+ testgetPathForVolume := func(t *testing.T) {
+ if _, ok := response["getPathForVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewGetPathForVolumeParams("volumeid")
+ _, err := client.Volume.GetPathForVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetPathForVolume", testgetPathForVolume)
+
+ testgetSolidFireVolumeSize := func(t *testing.T) {
+ if _, ok := response["getSolidFireVolumeSize"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewGetSolidFireVolumeSizeParams("volumeid")
+ _, err := client.Volume.GetSolidFireVolumeSize(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetSolidFireVolumeSize", testgetSolidFireVolumeSize)
+
+ testgetUploadParamsForVolume := func(t *testing.T) {
+ if _, ok := response["getUploadParamsForVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewGetUploadParamsForVolumeParams("format", "name", "zoneid")
+ _, err := client.Volume.GetUploadParamsForVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetUploadParamsForVolume", testgetUploadParamsForVolume)
+
+ testgetVolumeiScsiName := func(t *testing.T) {
+ if _, ok := response["getVolumeiScsiName"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewGetVolumeiScsiNameParams("volumeid")
+ _, err := client.Volume.GetVolumeiScsiName(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("GetVolumeiScsiName", testgetVolumeiScsiName)
+
+ testlistVolumes := func(t *testing.T) {
+ if _, ok := response["listVolumes"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewListVolumesParams()
+ _, err := client.Volume.ListVolumes(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListVolumes", testlistVolumes)
+
+ testmigrateVolume := func(t *testing.T) {
+ if _, ok := response["migrateVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewMigrateVolumeParams("storageid", "volumeid")
+ _, err := client.Volume.MigrateVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("MigrateVolume", testmigrateVolume)
+
+ testresizeVolume := func(t *testing.T) {
+ if _, ok := response["resizeVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewResizeVolumeParams("id")
+ _, err := client.Volume.ResizeVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ResizeVolume", testresizeVolume)
+
+ testupdateVolume := func(t *testing.T) {
+ if _, ok := response["updateVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewUpdateVolumeParams()
+ _, err := client.Volume.UpdateVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateVolume", testupdateVolume)
+
+ testuploadVolume := func(t *testing.T) {
+ if _, ok := response["uploadVolume"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Volume.NewUploadVolumeParams("format", "name", "url", "zoneid")
+ _, err := client.Volume.UploadVolume(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UploadVolume", testuploadVolume)
+
+}
diff --git a/test/ZoneService_test.go b/test/ZoneService_test.go
new file mode 100644
index 0000000..7633859
--- /dev/null
+++ b/test/ZoneService_test.go
@@ -0,0 +1,170 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+func TestZoneService(t *testing.T) {
+ service := "ZoneService"
+ response, err := readData(service)
+ if err != nil {
+ t.Skipf("Skipping test as %v", err)
+ }
+ server := CreateTestServer(t, response)
+ client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
+ defer server.Close()
+
+ testcreateZone := func(t *testing.T) {
+ if _, ok := response["createZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewCreateZoneParams("dns1", "internaldns1", "name", "networktype")
+ _, err := client.Zone.CreateZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("CreateZone", testcreateZone)
+
+ testdedicateZone := func(t *testing.T) {
+ if _, ok := response["dedicateZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewDedicateZoneParams("domainid", "zoneid")
+ _, err := client.Zone.DedicateZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DedicateZone", testdedicateZone)
+
+ testdeleteZone := func(t *testing.T) {
+ if _, ok := response["deleteZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewDeleteZoneParams("id")
+ _, err := client.Zone.DeleteZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DeleteZone", testdeleteZone)
+
+ testdisableOutOfBandManagementForZone := func(t *testing.T) {
+ if _, ok := response["disableOutOfBandManagementForZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewDisableOutOfBandManagementForZoneParams("zoneid")
+ _, err := client.Zone.DisableOutOfBandManagementForZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableOutOfBandManagementForZone", testdisableOutOfBandManagementForZone)
+
+ testenableOutOfBandManagementForZone := func(t *testing.T) {
+ if _, ok := response["enableOutOfBandManagementForZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewEnableOutOfBandManagementForZoneParams("zoneid")
+ _, err := client.Zone.EnableOutOfBandManagementForZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableOutOfBandManagementForZone", testenableOutOfBandManagementForZone)
+
+ testdisableHAForZone := func(t *testing.T) {
+ if _, ok := response["disableHAForZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewDisableHAForZoneParams("zoneid")
+ _, err := client.Zone.DisableHAForZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("DisableHAForZone", testdisableHAForZone)
+
+ testenableHAForZone := func(t *testing.T) {
+ if _, ok := response["enableHAForZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewEnableHAForZoneParams("zoneid")
+ _, err := client.Zone.EnableHAForZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("EnableHAForZone", testenableHAForZone)
+
+ testlistDedicatedZones := func(t *testing.T) {
+ if _, ok := response["listDedicatedZones"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewListDedicatedZonesParams()
+ _, err := client.Zone.ListDedicatedZones(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListDedicatedZones", testlistDedicatedZones)
+
+ testlistZones := func(t *testing.T) {
+ if _, ok := response["listZones"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewListZonesParams()
+ _, err := client.Zone.ListZones(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ListZones", testlistZones)
+
+ testreleaseDedicatedZone := func(t *testing.T) {
+ if _, ok := response["releaseDedicatedZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewReleaseDedicatedZoneParams("zoneid")
+ _, err := client.Zone.ReleaseDedicatedZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("ReleaseDedicatedZone", testreleaseDedicatedZone)
+
+ testupdateZone := func(t *testing.T) {
+ if _, ok := response["updateZone"]; !ok {
+ t.Skipf("Skipping as no json response is provided in testdata")
+ }
+ p := client.Zone.NewUpdateZoneParams("id")
+ _, err := client.Zone.UpdateZone(p)
+ if err != nil {
+ t.Errorf(err.Error())
+ }
+ }
+ t.Run("UpdateZone", testupdateZone)
+
+}
diff --git a/test/cloudstack_test.go b/test/cloudstack_test.go
new file mode 100644
index 0000000..802779a
--- /dev/null
+++ b/test/cloudstack_test.go
@@ -0,0 +1,146 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package test
+
+import (
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+
+ "github.com/apache/cloudstack-go/v2/cloudstack"
+)
+
+var (
+ CS_API_URL = "http://localhost:8080/client/api"
+ CS_API_KEY = "valid-api-key"
+ CS_SECRET_KEY = "valid-secret-key"
+)
+
+func CreateTestServer(t *testing.T, responses map[string]json.RawMessage) *httptest.Server {
+ return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ response := responses[r.FormValue("command")]
+ rawResult, _ := getRawValue(response)
+
+ var result map[string]json.RawMessage
+ err := json.Unmarshal(rawResult, &result)
+ if err != nil {
+ fmt.Fprintln(w, string(response))
+ return
+ }
+
+ // Since we're using a sync client, pass the job result as the response
+ val, ok := result["jobresult"]
+ if !ok {
+ fmt.Fprintln(w, string(response))
+ return
+ }
+
+ err = json.Unmarshal(val, &result)
+ if err != nil {
+ fmt.Fprintln(w, string(response))
+ return
+ }
+
+ // Handle success response separately
+ if _, ok := result["success"]; ok {
+ fmt.Fprintf(w, `{"jobresult":{"success":true}}`)
+ return
+ }
+
+ fmt.Fprintln(w, string(val))
+
+ }))
+}
+
+func getRawValue(b json.RawMessage) (json.RawMessage, error) {
+ var m map[string]json.RawMessage
+ if err := json.Unmarshal(b, &m); err != nil {
+ return nil, err
+ }
+ for _, v := range m {
+ return v, nil
+ }
+ return nil, fmt.Errorf("Unable to extract the raw value from:\n\n%s\n\n", string(b))
+}
+
+func readData(file string) (map[string]json.RawMessage, error) {
+ var data map[string]json.RawMessage
+ apis, err := ioutil.ReadFile("testdata/" + file + ".json")
+ if err != nil {
+ return nil, err
+ }
+
+ if err := json.Unmarshal(apis, &data); err != nil {
+ return nil, err
+ }
+
+ return data, nil
+}
+
+func TestCreateAsyncClient(t *testing.T) {
+ client := cloudstack.NewAsyncClient(CS_API_URL, CS_API_KEY, CS_SECRET_KEY, true)
+
+ if client == nil {
+ t.Errorf("Failed to create Cloudstack Async Client")
+ }
+}
+
+func TestCreateSyncClient(t *testing.T) {
+ client := cloudstack.NewClient(CS_API_URL, CS_API_KEY, CS_SECRET_KEY, true)
+
+ if client == nil {
+ t.Errorf("Failed to create Cloudstack Client")
+ }
+}
+
+type UUIDStruct struct {
+ Value cloudstack.UUID `json:"value"`
+}
+
+func TestUUID(t *testing.T) {
+ valLong := `{"value": 4801878}`
+ valString := `{"value": "994801878"}`
+ valBool := `{"value": false}`
+ res := UUIDStruct{}
+
+ res.Value = ""
+ if err := json.Unmarshal([]byte(valLong), &res); err != nil {
+ t.Errorf("could not unserialize long into UUID: %s", err)
+ }
+ if res.Value != "4801878" {
+ t.Errorf("unepected value '%s', expecting 4801878", res.Value)
+ }
+
+ res.Value = ""
+ if err := json.Unmarshal([]byte(valString), &res); err != nil {
+ t.Errorf("could not unserialize string into UUID: %s", err)
+ }
+ if res.Value != "994801878" {
+ t.Errorf("unepected value '%s', expecting 994801878", res.Value)
+ }
+
+ res.Value = ""
+ if err := json.Unmarshal([]byte(valBool), &res); err == nil {
+ t.Errorf("missing expected error when serializing bool into UUID")
+ }
+}
diff --git a/test/testdata/AccountService.json b/test/testdata/AccountService.json
new file mode 100644
index 0000000..8ae2952
--- /dev/null
+++ b/test/testdata/AccountService.json
@@ -0,0 +1,154 @@
+{
+ "listAccounts": {
+ "listaccountsresponse": {
+ "account": [
+ {
+ "accountdetails": {
+ "key0": "value0",
+ "key1": "value1"
+ },
+ "accounttype": 1,
+ "cpuavailable": "Unlimited",
+ "cpulimit": "Unlimited",
+ "cputotal": 1,
+ "domain": "ROOT",
+ "domainid": "62f5fe2e-5f5a-11e5-bc86-0242ac11180a",
+ "groups": [],
+ "id": "62f61a73-5f5a-11e5-bc86-0242ac11180a",
+ "ipavailable": "Unlimited",
+ "iplimit": "Unlimited",
+ "iptotal": 1,
+ "isdefault": true,
+ "memoryavailable": "Unlimited",
+ "memorylimit": "Unlimited",
+ "memorytotal": 512,
+ "name": "admin",
+ "networkavailable": "Unlimited",
+ "networklimit": "Unlimited",
+ "networktotal": 1,
+ "primarystorageavailable": "Unlimited",
+ "primarystoragelimit": "Unlimited",
+ "primarystoragetotal": 2,
+ "projectavailable": "Unlimited",
+ "projectlimit": "Unlimited",
+ "projecttotal": 1,
+ "receivedbytes": 100,
+ "secondarystorageavailable": "Unlimited",
+ "secondarystoragelimit": "Unlimited",
+ "secondarystoragetotal": 0,
+ "sentbytes": 100,
+ "snapshotavailable": "Unlimited",
+ "snapshotlimit": "Unlimited",
+ "snapshottotal": 0,
+ "state": "enabled",
+ "templateavailable": "Unlimited",
+ "templatelimit": "Unlimited",
+ "templatetotal": 0,
+ "user": [
+ {
+ "account": "admin",
+ "accountid": "62f61a73-5f5a-11e5-bc86-0242ac11180a",
+ "accounttype": 1,
+ "apikey": "BFCyYeY0HhhrvNWC7FBwHTlso52ow3XWZUzNuiv03jmJOQn-5UH5BTVRVheiBnaRfYFE9yOzjwiqkbahq9P-Rw",
+ "created": "2015-09-20T05:42:31+0000",
+ "domain": "ROOT",
+ "domainid": "62f5fe2e-5f5a-11e5-bc86-0242ac11180a",
+ "email": "admin@mailprovider.com",
+ "firstname": "Admin",
+ "id": "62f6394b-5f5a-11e5-bc86-0242ac11180a",
+ "iscallerchilddomain": false,
+ "isdefault": true,
+ "lastname": "User",
+ "secretkey": "Em1UPdKTYEDaUxPXKtpqy_1uYluHWU2ZHotPi-VnBi_-MOEUAANoFHg3ycDProluDzYAXmT3YRssk367ylr_4A",
+ "state": "enabled",
+ "username": "admin"
+ }
+ ],
+ "vmavailable": "Unlimited",
+ "vmlimit": "Unlimited",
+ "vmrunning": 1,
+ "vmtotal": 1,
+ "volumeavailable": "Unlimited",
+ "volumelimit": "Unlimited",
+ "volumetotal": 1,
+ "vpcavailable": "Unlimited",
+ "vpclimit": "Unlimited",
+ "vpctotal": 0
+ }
+ ],
+ "count": 1
+ }
+ },
+ "createAccount": {
+ "createaccountresponse": {
+ "account": {
+ "accountdetails": {
+ "key0": "value0",
+ "key1": "value1"
+ },
+ "accounttype": 2,
+ "cpuavailable": "40",
+ "cpulimit": "40",
+ "cputotal": 0,
+ "domain": "ROOT",
+ "domainid": "62f5fe2e-5f5a-11e5-bc86-0242ac11180a",
+ "groups": [],
+ "id": "c9cb9df8-dcd5-44c5-a40d-2e7d266669a6",
+ "ipavailable": "20",
+ "iplimit": "20",
+ "iptotal": 0,
+ "isdefault": false,
+ "memoryavailable": "40960",
+ "memorylimit": "40960",
+ "memorytotal": 0,
+ "name": "user01",
+ "networkavailable": "20",
+ "networklimit": "20",
+ "networktotal": 0,
+ "primarystorageavailable": "200",
+ "primarystoragelimit": "200",
+ "primarystoragetotal": 0,
+ "projectavailable": "Unlimited",
+ "projectlimit": "Unlimited",
+ "projecttotal": 0,
+ "secondarystorageavailable": "400",
+ "secondarystoragelimit": "400",
+ "secondarystoragetotal": 0,
+ "snapshotavailable": "20",
+ "snapshotlimit": "20",
+ "snapshottotal": 0,
+ "state": "enabled",
+ "templateavailable": "20",
+ "templatelimit": "20",
+ "templatetotal": 0,
+ "user": [
+ {
+ "account": "user01",
+ "accountid": "c9cb9df8-dcd5-44c5-a40d-2e7d266669a6",
+ "accounttype": 2,
+ "created": "2016-07-26T02:17:17+0000",
+ "domain": "ROOT",
+ "domainid": "62f5fe2e-5f5a-11e5-bc86-0242ac11180a",
+ "email": "user01@example.com",
+ "firstname": "user01",
+ "id": "1d69ac45-a8f7-469c-ab24-d2b0382fa8be",
+ "iscallerchilddomain": false,
+ "isdefault": false,
+ "lastname": "user01",
+ "state": "enabled",
+ "username": "user01"
+ }
+ ],
+ "vmavailable": "20",
+ "vmlimit": "20",
+ "vmtotal": 0,
+ "volumeavailable": "20",
+ "volumelimit": "20",
+ "volumetotal": 0,
+ "vpcavailable": "20",
+ "vpclimit": "20",
+ "vpctotal": 0
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/test/testdata/AddressService.json b/test/testdata/AddressService.json
new file mode 100644
index 0000000..a161e08
--- /dev/null
+++ b/test/testdata/AddressService.json
@@ -0,0 +1,63 @@
+{
+ "associateIpAddress": {
+ "associateipaddressresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.address.AssociateIPAddrCmdByAdmin",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "ipaddress": {
+ "id": "dc51835f-b0e2-4a2e-91a4-6cccc44bdae3",
+ "ipaddress": "10.70.3.100",
+ "allocated": "2021-10-01T16:25:11+0000",
+ "zoneid": "3fc049b0-87ae-4d77-90c1-cce70da17db6",
+ "zonename": "testAdvZone2",
+ "issourcenat": true,
+ "account": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "forvirtualnetwork": true,
+ "vlanid": "2e86e486-b472-4f12-a9b2-bb73701241e0",
+ "vlanname": "vlan://untagged",
+ "isstaticnat": false,
+ "issystem": false,
+ "associatednetworkid": "cf8056db-25e1-49d1-b023-f13a717e5ecc",
+ "associatednetworkname": "test-adv-network",
+ "networkid": "f17d38db-4810-437e-be28-d38cd30e3034",
+ "state": "Allocating",
+ "physicalnetworkid": "0d6c1e76-2d83-459a-bbce-c133fbd732b7",
+ "tags": [],
+ "isportable": false,
+ "fordisplay": true
+ }
+ },
+ "jobinstancetype": "IpAddress",
+ "jobinstanceid": "dc51835f-b0e2-4a2e-91a4-6cccc44bdae3",
+ "created": "2021-10-01T16:25:12+0000",
+ "completed": "2021-10-01T16:25:12+0000",
+ "jobid": "8e805516-1729-46cf-a7d0-7289d523871e"
+ }
+ },
+ "disassociateIpAddress": {
+ "disassociateipaddressresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "success": true
+ },
+ "jobinstancetype": "IpAddress",
+ "jobinstanceid": "a767fbe1-ed7a-4d7c-8221-c7d736ca622d",
+ "created": "2021-10-01T16:42:32+0000",
+ "completed": "2021-10-01T16:42:33+0000",
+ "jobid": "44fc961e-9d57-4313-9f11-7556508b319c"
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/testdata/AffinityGroupService.json b/test/testdata/AffinityGroupService.json
new file mode 100644
index 0000000..22035a3
--- /dev/null
+++ b/test/testdata/AffinityGroupService.json
@@ -0,0 +1,28 @@
+{
+ "createAffinityGroup": {
+ "createaffinitygroupresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.affinitygroup.CreateAffinityGroupCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "affinitygroup": {
+ "id": "5059d7e3-9213-448d-9314-6ae4e1d95a33",
+ "name": "testAffinityGroup",
+ "description": "testAffinityGroup",
+ "account": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "type": "host affinity"
+ }
+ },
+ "jobinstancetype": "AffinityGroup",
+ "created": "2021-10-01T16:59:04+0000",
+ "completed": "2021-10-01T16:59:04+0000",
+ "jobid": "58e969e8-768b-44d0-b278-fd1b2f236c00"
+ }
+ }
+}
\ No newline at end of file
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/test/testdata/CertificateService.json b/test/testdata/CertificateService.json
new file mode 100644
index 0000000..ef608e3
--- /dev/null
+++ b/test/testdata/CertificateService.json
@@ -0,0 +1,21 @@
+{
+ "uploadCustomCertificate": {
+ "uploadcustomcertificateresponse": {
+ "accountid": "3bcbd8be-19eb-11ec-83a0-1e00bd000159",
+ "userid": "3bcd30ee-19eb-11ec-83a0-1e00bd000159",
+ "cmd": "org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "customcertificate": {
+ "message": "Certificate has been successfully updated, if its the server certificate we would reboot all running console proxy VMs and secondary storage VMs to propagate the new certificate, please give a few minutes for console access and storage services service to be up and working again"
+ }
+ },
+ "created": "2021-10-02T07:43:59+0000",
+ "completed": "2021-10-02T07:43:59+0000",
+ "jobid": "bb14e24d-af95-4d9d-8ead-e4f42ccd83f7"
+ }
+ }
+}
\ No newline at end of file
diff --git a/cloudstack/testdata/ClusterServiceData.json b/test/testdata/ClusterService.json
similarity index 65%
rename from cloudstack/testdata/ClusterServiceData.json
rename to test/testdata/ClusterService.json
index 70b6e2a..470ed14 100644
--- a/cloudstack/testdata/ClusterServiceData.json
+++ b/test/testdata/ClusterService.json
@@ -69,13 +69,7 @@
}
},
"disableHAForCluster": {
- "disableHAForCluster": {
- "disablehaforclusterresponse": {
- "jobid": "c0591985-d022-4a2d-b5b5-1ac209849f66"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "disablehaforclusterresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.ha.DisableHAForClusterCmd",
@@ -84,22 +78,15 @@
"jobresultcode": 0,
"jobresulttype": "object",
"jobresult": {
- "success": true
+ "success": true
},
"created": "2021-10-02T08:59:13+0000",
"completed": "2021-10-02T08:59:13+0000",
"jobid": "c0591985-d022-4a2d-b5b5-1ac209849f66"
- }
}
},
"enableHAForCluster": {
- "enableHAForCluster": {
- "enablehaforclusterresponse": {
- "jobid": "875ead2d-7b78-4bb0-83f5-c40a2a944dde"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "enablehaforclusterresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.ha.EnableHAForClusterCmd",
@@ -109,21 +96,14 @@
"jobresulttype": "object",
"jobresult": {
"success": true
- },
+ },
"created": "2021-10-02T09:05:15+0000",
"completed": "2021-10-02T09:05:15+0000",
"jobid": "875ead2d-7b78-4bb0-83f5-c40a2a944dde"
- }
}
},
"disableOutOfBandManagementForCluster": {
- "disableOutOfBandManagementForCluster": {
- "disableoutofbandmanagementforclusterresponse": {
- "jobid": "067b171f-ca63-4d41-bb87-461589e20223"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "disableoutofbandmanagementforclusterresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.outofbandmanagement.DisableOutOfBandManagementForClusterCmd",
@@ -135,49 +115,35 @@
"outofbandmanagement": {
"enabled": false,
"status": true
- }
- },
+ }
+ },
"created": "2021-10-02T09:09:04+0000",
"completed": "2021-10-02T09:09:04+0000",
"jobid": "067b171f-ca63-4d41-bb87-461589e20223"
- }
}
},
"enableOutOfBandManagementForCluster": {
- "enableOutOfBandManagementForCluster": {
- "enableoutofbandmanagementforclusterresponse": {
- "jobid": "16f517a5-247b-4f96-aba4-0e876e1e9720"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.outofbandmanagement.EnableOutOfBandManagementForClusterCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "outofbandmanagement": {
- "enabled": true,
- "status": true
- }
- },
- "created": "2021-10-02T09:14:30+0000",
- "completed": "2021-10-02T09:14:30+0000",
- "jobid": "16f517a5-247b-4f96-aba4-0e876e1e9720"
+ "enableoutofbandmanagementforclusterresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.outofbandmanagement.EnableOutOfBandManagementForClusterCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "outofbandmanagement": {
+ "enabled": true,
+ "status": true
}
- }
+ },
+ "created": "2021-10-02T09:14:30+0000",
+ "completed": "2021-10-02T09:14:30+0000",
+ "jobid": "16f517a5-247b-4f96-aba4-0e876e1e9720"
+ }
},
"dedicateCluster": {
- "dedicateCluster": {
- "dedicateclusterresponse": {
- "jobid": "64e777d8-9c72-4639-aa75-057971ecd289"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "dedicateclusterresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.commands.DedicateClusterCmd",
@@ -186,43 +152,35 @@
"jobresultcode": 0,
"jobresulttype": "object",
"jobresult": {
- "dedicatedcluster": {
- "id": "60a97ad1-702b-40dd-9ca5-a67954a28fbd",
- "clusterid": "f1f5a259-1b55-431d-ad7e-6d39c28f1b15",
- "clustername": "TestCluster",
- "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "affinitygroupid": "a8725454-1680-4517-85ce-6f8ec08300fb"
+ "dedicatedcluster": {
+ "id": "60a97ad1-702b-40dd-9ca5-a67954a28fbd",
+ "clusterid": "f1f5a259-1b55-431d-ad7e-6d39c28f1b15",
+ "clustername": "TestCluster",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "affinitygroupid": "a8725454-1680-4517-85ce-6f8ec08300fb"
}
},
"created": "2021-10-02T09:16:25+0000",
"completed": "2021-10-02T09:16:25+0000",
"jobid": "64e777d8-9c72-4639-aa75-057971ecd289"
- }
}
},
"releaseDedicatedCluster": {
- "releaseDedicatedCluster": {
- "releasededicatedclusterresponse": {
- "jobid": "e7cb7eb7-b77d-4568-9bcf-11bb5fd78938"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.commands.ReleaseDedicatedClusterCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "success": true
- },
- "created": "2021-10-02T14:40:30+0000",
- "completed": "2021-10-02T14:40:30+0000",
- "jobid": "e7cb7eb7-b77d-4568-9bcf-11bb5fd78938"
- }
+ "releasededicatedclusterresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.commands.ReleaseDedicatedClusterCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "success": true
+ },
+ "created": "2021-10-02T14:40:30+0000",
+ "completed": "2021-10-02T14:40:30+0000",
+ "jobid": "e7cb7eb7-b77d-4568-9bcf-11bb5fd78938"
}
},
"updateCluster": {
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 84%
rename from cloudstack/testdata/DomainServiceData.json
rename to test/testdata/DomainService.json
index 469964c..ede5147 100644
--- a/cloudstack/testdata/DomainServiceData.json
+++ b/test/testdata/DomainService.json
@@ -98,27 +98,20 @@
}
},
"deleteDomain": {
- "deleteDomain": {
- "deletedomainresponse": {
- "jobid": "318c77c0-8c42-42fb-8c23-363819c85dd3"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.domain.DeleteDomainCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "success": true
- },
+ "deletedomainresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.domain.DeleteDomainCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "success": true
+ },
"created": "2021-10-02T17:44:42+0000",
"completed": "2021-10-02T17:44:42+0000",
"jobid": "318c77c0-8c42-42fb-8c23-363819c85dd3"
- }
}
}
}
\ No newline at end of file
diff --git a/test/testdata/FirewallService.json b/test/testdata/FirewallService.json
new file mode 100644
index 0000000..873ffe1
--- /dev/null
+++ b/test/testdata/FirewallService.json
@@ -0,0 +1,93 @@
+{
+ "createFirewallRule": {
+ "createfirewallruleresponse": {
+ "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
+ "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
+ "cmd": "org.apache.cloudstack.api.command.user.firewall.CreateFirewallRuleCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "firewallrule": {
+ "id": "fb4ad2ee-02c8-433e-a769-6f18afddc750",
+ "protocol": "tcp",
+ "ipaddressid": "a4aa35ef-34ad-4332-9247-378c83b8f927",
+ "networkid": "c4a3303c-376d-4d56-b336-1bd91cb130b6",
+ "ipaddress": "192.168.2.4",
+ "state": "Active",
+ "cidrlist": "0.0.0.0/0",
+ "tags": [],
+ "fordisplay": true
+ }
+ },
+ "jobinstancetype": "FirewallRule",
+ "jobinstanceid": "fb4ad2ee-02c8-433e-a769-6f18afddc750",
+ "created": "2021-10-02T23:20:07+0530",
+ "completed": "2021-10-02T23:20:07+0530",
+ "jobid": "104d5139-91dc-40a1-af2b-a94730e42e89"
+ }
+ },
+ "deleteFirewallRule": {
+ "deletefirewallruleresponse": {
+ "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
+ "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
+ "cmd": "org.apache.cloudstack.api.command.user.firewall.DeleteFirewallRuleCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "success": true
+ },
+ "created": "2021-10-02T23:25:22+0530",
+ "completed": "2021-10-02T23:25:22+0530",
+ "jobid": "6ae96f78-1c28-45f9-a30b-761ac5f3a87b"
+ }
+ },
+ "createEgressFirewallRule": {
+ "createegressfirewallruleresponse": {
+ "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
+ "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
+ "cmd": "org.apache.cloudstack.api.command.user.firewall.CreateEgressFirewallRuleCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "firewallrule": {
+ "id": "b7d8b539-8c72-4d25-8539-625f665681ad",
+ "protocol": "tcp",
+ "networkid": "c4a3303c-376d-4d56-b336-1bd91cb130b6",
+ "state": "Active",
+ "cidrlist": "10.1.1.0/24",
+ "tags": [],
+ "fordisplay": true,
+ "destcidrlist": ""
+ }
+ },
+ "jobinstancetype": "FirewallRule",
+ "jobinstanceid": "b7d8b539-8c72-4d25-8539-625f665681ad",
+ "created": "2021-10-02T23:29:41+0530",
+ "completed": "2021-10-02T23:29:41+0530",
+ "jobid": "8841a004-eb50-4d4e-aed5-7bc2494dc856"
+ }
+ },
+ "deleteEgressFirewallRule": {
+ "deleteegressfirewallruleresponse": {
+ "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
+ "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
+ "cmd": "org.apache.cloudstack.api.command.user.firewall.DeleteEgressFirewallRuleCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "success": true
+ },
+ "created": "2021-10-02T23:32:08+0530",
+ "completed": "2021-10-02T23:32:08+0530",
+ "jobid": "91b10008-2e9f-412d-afa6-3c54a0bb19f5"
+ }
+ }
+}
\ No newline at end of file
diff --git a/cloudstack/testdata/HostServiceData.json b/test/testdata/HostService.json
similarity index 83%
rename from cloudstack/testdata/HostServiceData.json
rename to test/testdata/HostService.json
index 425d402..5badd62 100644
--- a/cloudstack/testdata/HostServiceData.json
+++ b/test/testdata/HostService.json
@@ -106,13 +106,7 @@
}
},
"prepareHostForMaintenance": {
- "prepareHostForMaintenance": {
- "preparehostformaintenanceresponse": {
- "jobid": "0931656b-d30d-474b-aa79-13077d275400"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "preparehostformaintenanceresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd",
@@ -177,24 +171,17 @@
"hahost": false,
"jobid": "0931656b-d30d-474b-aa79-13077d275400",
"jobstatus": 0
- }
- },
+ }
+ },
"jobinstancetype": "Host",
"jobinstanceid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
"created": "2021-10-03T06:52:21+0000",
"completed": "2021-10-03T06:52:21+0000",
"jobid": "0931656b-d30d-474b-aa79-13077d275400"
- }
}
},
"cancelHostForMaintenance": {
- "cancelHostMaintenance": {
- "cancelhostmaintenanceresponse": {
- "jobid": "b40f561d-9d0d-4eae-a376-fbafdff966f1"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "cancelhostmaintenanceresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.host.CancelMaintenanceCmd",
@@ -202,8 +189,8 @@
"jobprocstatus": 0,
"jobresultcode": 0,
"jobresulttype": "object",
- "jobresult": {
- "host": {
+ "jobresult": {
+ "host": {
"id": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
"name": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
"state": "Up",
@@ -249,42 +236,35 @@
"haenable": true,
"hastate": "Disabled",
"haprovider": "simulatorhaprovider"
- },
+ },
"outofbandmanagement": {
"powerstate": "Disabled",
"enabled": false
- },
+ },
"resourcestate": "Enabled",
"hypervisorversion": "4.14.0.0-SNAPSHOT",
"hahost": false,
"jobid": "b40f561d-9d0d-4eae-a376-fbafdff966f1",
"jobstatus": 0
- }
- },
+ }
+ },
"jobinstancetype": "Host",
"jobinstanceid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
"created": "2021-10-03T06:57:12+0000",
"completed": "2021-10-03T06:57:12+0000",
"jobid": "b40f561d-9d0d-4eae-a376-fbafdff966f1"
- }
}
},
"enableOutOfBandManagementForHost": {
- "enableOutOfBandManagementForHost": {
- "enableoutofbandmanagementforhostresponse": {
- "jobid": "049f5a42-343b-4156-9fb6-683f01433dca"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.outofbandmanagement.EnableOutOfBandManagementForHostCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
+ "enableoutofbandmanagementforhostresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.outofbandmanagement.EnableOutOfBandManagementForHostCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
"outofbandmanagement": {
"hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
"enabled": true,
@@ -294,25 +274,18 @@
"created": "2021-10-03T07:05:08+0000",
"completed": "2021-10-03T07:05:08+0000",
"jobid": "1c3022d1-c882-430c-ada7-ebf9d06d3e84"
- }
}
},
"disableOutOfBandManagementForHost": {
- "disableOutOfBandManagementForHost": {
- "disableoutofbandmanagementforhostresponse": {
- "jobid": "a389b543-ce49-410f-8f9a-831be0480ee5"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.outofbandmanagement.DisableOutOfBandManagementForHostCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
+ "disableoutofbandmanagementforhostresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.outofbandmanagement.DisableOutOfBandManagementForHostCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
"outofbandmanagement": {
"hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
"enabled": false,
@@ -322,17 +295,10 @@
"created": "2021-10-03T07:06:25+0000",
"completed": "2021-10-03T07:06:25+0000",
"jobid": "a389b543-ce49-410f-8f9a-831be0480ee5"
- }
}
},
"enableHAForHost": {
- "enableHAForHost": {
- "enablehaforhostresponse": {
- "jobid": "79da9d4b-6368-4ce5-9054-952295fc2c8a"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "enablehaforhostresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.ha.EnableHAForHostCmd",
@@ -342,18 +308,14 @@
"jobresulttype": "object",
"jobresult": {
"hostha": {
- "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
- "haenable": true,
- "status": true
+ "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
+ "haenable": true,
+ "status": true
}
},
"created": "2021-10-03T07:10:09+0000",
"completed": "2021-10-03T07:10:09+0000",
"jobid": "79da9d4b-6368-4ce5-9054-952295fc2c8a"
- }
}
- },
- "disableHAForHost": {
-
}
}
\ No newline at end of file
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/test/testdata/LoadBalancerService.json b/test/testdata/LoadBalancerService.json
new file mode 100644
index 0000000..f693e05
--- /dev/null
+++ b/test/testdata/LoadBalancerService.json
@@ -0,0 +1,57 @@
+{
+ "createLoadBalancerRule": {
+ "createloadbalancerruleresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd",
+ "completed": "2021-10-04T04:37:08+0000",
+ "created": "2021-10-04T04:37:08+0000",
+ "jobid": "83ab0ded-225b-4a91-9aed-c17b1da07989",
+ "jobinstanceid": "d9186a3e-b39a-473f-8d5e-70cf1a7aed44",
+ "jobinstancetype": "FirewallRule",
+ "jobprocstatus": 0,
+ "jobresult": {
+ "loadbalancer": {
+ "account": "admin",
+ "algorithm": "roundrobin",
+ "cidrlist": "",
+ "domain": "ROOT",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "fordisplay": true,
+ "id": "d9186a3e-b39a-473f-8d5e-70cf1a7aed44",
+ "name": "testLBRule",
+ "networkid": "cc39d938-5ea0-4d9c-b89d-421da3274e54",
+ "privateport": "9090",
+ "protocol": "tcp",
+ "publicip": "192.168.2.107",
+ "publicipid": "bab02a09-1244-4235-a938-150e75e04ce0",
+ "publicport": "9090",
+ "state": "Add",
+ "tags": [],
+ "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
+ "zonename": "SimZone1"
+ }
+ },
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobstatus": 1,
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c"
+ }
+ },
+ "assignLoadBalancerRule": {
+ "assigntoloadbalancerruleresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.loadbalancer.AssignToLoadBalancerRuleCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "success": true
+ },
+ "created": "2021-10-03T07:52:26+0000",
+ "completed": "2021-10-03T07:52:26+0000",
+ "jobid": "7ab605d2-cddd-4f90-bd6b-884a8f62c16b"
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/testdata/NetworkACLService.json b/test/testdata/NetworkACLService.json
new file mode 100644
index 0000000..5a80231
--- /dev/null
+++ b/test/testdata/NetworkACLService.json
@@ -0,0 +1,25 @@
+{
+ "updateNetworkACLList": {
+ "updatenetworkacllistresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.network.UpdateNetworkACLListCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "networkacllist": {
+ "id": "a31e11a0-57fe-41df-be7a-34d359673061",
+ "name": "test",
+ "description": "testtest",
+ "vpcid": "40419d33-6d48-4c54-ae2e-5c312b401593",
+ "fordisplay": true
+ }
+ },
+ "created": "2021-10-13T04:46:30+0000",
+ "completed": "2021-10-13T04:46:30+0000",
+ "jobid": "6dd51379-b8cf-422c-a6ef-f96c07798c97"
+ }
+ }
+}
\ No newline at end of file
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 87%
rename from cloudstack/testdata/NetworkServiceData.json
rename to test/testdata/NetworkService.json
index b90d76a..6c86428 100644
--- a/cloudstack/testdata/NetworkServiceData.json
+++ b/test/testdata/NetworkService.json
@@ -351,63 +351,48 @@
}
},
"deleteNetwork": {
- "deleteNetwork": {
- "deletenetworkresponse": {
- "jobid": "8fe59207-90f5-4382-af17-e8b413bda517"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.network.DeleteNetworkCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "success": true
- },
- "jobinstancetype": "Network",
- "created": "2021-10-04T05:11:01+0000",
- "completed": "2021-10-04T05:11:02+0000",
- "jobid": "8fe59207-90f5-4382-af17-e8b413bda517"
- }
+ "deletenetworkresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.network.DeleteNetworkCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "success": true
+ },
+ "jobinstancetype": "Network",
+ "created": "2021-10-04T05:11:01+0000",
+ "completed": "2021-10-04T05:11:02+0000",
+ "jobid": "8fe59207-90f5-4382-af17-e8b413bda517"
}
},
- "createPhysicalNetwork": {
- "createPhysicalNetwork": {
- "createphysicalnetworkresponse": {
+ "createPhysicalNetwork": {
+ "createphysicalnetworkresponse": {
+ "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
+ "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
+ "cmd": "org.apache.cloudstack.api.command.admin.network.CreatePhysicalNetworkCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "physicalnetwork": {
"id": "256b3b3f-4a31-48f3-a939-79b01357fb87",
- "jobid": "a52138ee-752e-400a-8289-c534eebca026"
+ "name": "testPhyNet",
+ "broadcastdomainrange": "ZONE",
+ "zoneid": "d4a81f75-5d92-415e-ab59-e85cc2ce56d9",
+ "zonename": "Sandbox-simulator",
+ "state": "Disabled",
+ "isolationmethods": "VLAN"
}
},
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "bc1b501c-1d18-11ec-9173-50eb7122da94",
- "userid": "bc1b6b47-1d18-11ec-9173-50eb7122da94",
- "cmd": "org.apache.cloudstack.api.command.admin.network.CreatePhysicalNetworkCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "physicalnetwork": {
- "id": "256b3b3f-4a31-48f3-a939-79b01357fb87",
- "name": "testPhyNet",
- "broadcastdomainrange": "ZONE",
- "zoneid": "d4a81f75-5d92-415e-ab59-e85cc2ce56d9",
- "zonename": "Sandbox-simulator",
- "state": "Disabled",
- "isolationmethods": "VLAN"
- }
- },
- "jobinstancetype": "PhysicalNetwork",
- "jobinstanceid": "256b3b3f-4a31-48f3-a939-79b01357fb87",
- "created": "2021-10-04T11:26:38+0530",
- "completed": "2021-10-04T11:26:38+0530",
- "jobid": "a52138ee-752e-400a-8289-c534eebca026"
- }
- }
+ "jobinstancetype": "PhysicalNetwork",
+ "jobinstanceid": "256b3b3f-4a31-48f3-a939-79b01357fb87",
+ "created": "2021-10-04T11:26:38+0530",
+ "completed": "2021-10-04T11:26:38+0530",
+ "jobid": "a52138ee-752e-400a-8289-c534eebca026"
}
+ }
}
\ No newline at end of file
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/test/testdata/ProjectService.json b/test/testdata/ProjectService.json
new file mode 100644
index 0000000..22a9bb9
--- /dev/null
+++ b/test/testdata/ProjectService.json
@@ -0,0 +1,283 @@
+{
+ "createProject": {
+ "createprojectresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.project.CreateProjectCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "project": {
+ "id": "69646881-8d7f-4800-987d-106698a42608",
+ "name": "testProject",
+ "displaytext": "testProject",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "owner": [
+ {
+ "account": "admin"
+ }
+ ],
+ "projectaccountname": "PrjAcct-testProject-1",
+ "state": "Active",
+ "tags": [],
+ "networklimit": "20",
+ "networktotal": 0,
+ "networkavailable": "20",
+ "vpclimit": "20",
+ "vpctotal": 0,
+ "vpcavailable": "20",
+ "cpulimit": "40",
+ "cputotal": 0,
+ "cpuavailable": "40",
+ "memorylimit": "40960",
+ "memorytotal": 0,
+ "memoryavailable": "40960",
+ "primarystoragelimit": "200",
+ "primarystoragetotal": 0,
+ "primarystorageavailable": "200",
+ "secondarystoragelimit": "400",
+ "secondarystoragetotal": 0,
+ "secondarystorageavailable": "400.0",
+ "vmlimit": "20",
+ "vmtotal": 0,
+ "vmavailable": "20",
+ "iplimit": "20",
+ "iptotal": 0,
+ "ipavailable": "20",
+ "volumelimit": "20",
+ "volumetotal": 0,
+ "volumeavailable": "20",
+ "snapshotlimit": "20",
+ "snapshottotal": 0,
+ "snapshotavailable": "20",
+ "templatelimit": "20",
+ "templatetotal": 0,
+ "templateavailable": "20",
+ "vmstopped": 0,
+ "vmrunning": 0
+ }
+ },
+ "jobinstancetype": "None",
+ "created": "2021-10-04T06:21:54+0000",
+ "completed": "2021-10-04T06:21:54+0000",
+ "jobid": "0666daab-af9b-4001-ae70-78ac6bc697e8"
+ }
+ },
+ "activateProject": {
+ "activaterojectresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.project.ActivateProjectCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "project": {
+ "id": "99a842a4-e50f-4265-8ca7-249959506c13",
+ "name": "Admin Project",
+ "displaytext": "Admin Project",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "owner": [
+ {
+ "account": "admin"
+ }
+ ],
+ "projectaccountname": "PrjAcct-Admin Project-1",
+ "state": "Active",
+ "tags": [],
+ "networklimit": "20",
+ "networktotal": 0,
+ "networkavailable": "20",
+ "vpclimit": "20",
+ "vpctotal": 0,
+ "vpcavailable": "20",
+ "cpulimit": "40",
+ "cputotal": 0,
+ "cpuavailable": "40",
+ "memorylimit": "40960",
+ "memorytotal": 0,
+ "memoryavailable": "40960",
+ "primarystoragelimit": "200",
+ "primarystoragetotal": 0,
+ "primarystorageavailable": "200",
+ "secondarystoragelimit": "400",
+ "secondarystoragetotal": 0,
+ "secondarystorageavailable": "400.0",
+ "vmlimit": "20",
+ "vmtotal": 0,
+ "vmavailable": "20",
+ "iplimit": "20",
+ "iptotal": 0,
+ "ipavailable": "20",
+ "volumelimit": "20",
+ "volumetotal": 0,
+ "volumeavailable": "20",
+ "snapshotlimit": "20",
+ "snapshottotal": 0,
+ "snapshotavailable": "20",
+ "templatelimit": "20",
+ "templatetotal": 0,
+ "templateavailable": "20",
+ "vmstopped": 0,
+ "vmrunning": 0
+ }
+ },
+ "created": "2021-10-04T06:30:39+0000",
+ "completed": "2021-10-04T06:30:39+0000",
+ "jobid": "fa12a90a-29fc-43c0-8cbd-5be49b72ed22"
+ }
+ },
+ "suspendProject": {
+ "suspendprojectresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.project.SuspendProjectCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "project": {
+ "id": "99a842a4-e50f-4265-8ca7-249959506c13",
+ "name": "Admin Project",
+ "displaytext": "Admin Project",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "owner": [
+ {
+ "account": "admin"
+ }
+ ],
+ "projectaccountname": "PrjAcct-Admin Project-1",
+ "state": "Suspended",
+ "tags": [],
+ "networklimit": "20",
+ "networktotal": 0,
+ "networkavailable": "20",
+ "vpclimit": "20",
+ "vpctotal": 0,
+ "vpcavailable": "20",
+ "cpulimit": "40",
+ "cputotal": 0,
+ "cpuavailable": "40",
+ "memorylimit": "40960",
+ "memorytotal": 0,
+ "memoryavailable": "40960",
+ "primarystoragelimit": "200",
+ "primarystoragetotal": 0,
+ "primarystorageavailable": "200",
+ "secondarystoragelimit": "400",
+ "secondarystoragetotal": 0,
+ "secondarystorageavailable": "400.0",
+ "vmlimit": "20",
+ "vmtotal": 0,
+ "vmavailable": "20",
+ "iplimit": "20",
+ "iptotal": 0,
+ "ipavailable": "20",
+ "volumelimit": "20",
+ "volumetotal": 0,
+ "volumeavailable": "20",
+ "snapshotlimit": "20",
+ "snapshottotal": 0,
+ "snapshotavailable": "20",
+ "templatelimit": "20",
+ "templatetotal": 0,
+ "templateavailable": "20",
+ "vmstopped": 0,
+ "vmrunning": 0
+ }
+ },
+ "created": "2021-10-04T06:34:01+0000",
+ "completed": "2021-10-04T06:34:01+0000",
+ "jobid": "608f4d53-ceae-4747-9c0d-e8c15fc52135"
+ }
+ },
+ "updateProject": {
+ "updateprojectresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.project.UpdateProjectCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "project": {
+ "id": "69646881-8d7f-4800-987d-106698a42608",
+ "name": "testProject",
+ "displaytext": "testProjectUpdate",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "owner": [
+ {
+ "account": "admin"
+ }
+ ],
+ "projectaccountname": "PrjAcct-testProject-1",
+ "state": "Active",
+ "tags": [],
+ "networklimit": "20",
+ "networktotal": 0,
+ "networkavailable": "20",
+ "vpclimit": "20",
+ "vpctotal": 0,
+ "vpcavailable": "20",
+ "cpulimit": "40",
+ "cputotal": 0,
+ "cpuavailable": "40",
+ "memorylimit": "40960",
+ "memorytotal": 0,
+ "memoryavailable": "40960",
+ "primarystoragelimit": "200",
+ "primarystoragetotal": 0,
+ "primarystorageavailable": "200",
+ "secondarystoragelimit": "400",
+ "secondarystoragetotal": 0,
+ "secondarystorageavailable": "400.0",
+ "vmlimit": "20",
+ "vmtotal": 0,
+ "vmavailable": "20",
+ "iplimit": "20",
+ "iptotal": 0,
+ "ipavailable": "20",
+ "volumelimit": "20",
+ "volumetotal": 0,
+ "volumeavailable": "20",
+ "snapshotlimit": "20",
+ "snapshottotal": 0,
+ "snapshotavailable": "20",
+ "templatelimit": "20",
+ "templatetotal": 0,
+ "templateavailable": "20",
+ "vmstopped": 0,
+ "vmrunning": 0
+ }
+ },
+ "created": "2021-10-04T06:35:29+0000",
+ "completed": "2021-10-04T06:35:29+0000",
+ "jobid": "1330d540-c099-4943-ac22-3fd5846c0e5b"
+ }
+ },
+ "listProjectRolePermissions": {
+ "listprojectrolepermissionsresponse": {
+ "count": 1,
+ "projectrolepermission": [
+ {
+ "id": "e68daeca-556f-4fd2-b4ee-378cb994ef76",
+ "projectroleid": "fa089002-d055-46b5-aa0a-18f2eae2b4fc",
+ "projectid": "69646881-8d7f-4800-987d-106698a42608",
+ "projectrolename": "testProjectPerm",
+ "rule": "activateProject",
+ "permission": "deny",
+ "description": ""
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/testdata/ResourceTagsService.json b/test/testdata/ResourceTagsService.json
new file mode 100644
index 0000000..4fc4dbf
--- /dev/null
+++ b/test/testdata/ResourceTagsService.json
@@ -0,0 +1,36 @@
+{
+ "createTags": {
+ "createtagsresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.tag.CreateTagsCmd",
+ "completed": "2021-10-04T06:58:35+0000",
+ "created": "2021-10-04T06:58:35+0000",
+ "jobid": "4901a56e-60aa-4385-8ab6-8f9591ef0469",
+ "jobprocstatus": 0,
+ "jobresult": {
+ "success": true
+ },
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobstatus": 1,
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c"
+ }
+ },
+ "deleteTags": {
+ "deletetagsresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd",
+ "completed": "2021-10-04T07:07:22+0000",
+ "created": "2021-10-04T07:07:22+0000",
+ "jobid": "494d0f35-057a-4cc7-bf5d-b52d3b803a36",
+ "jobprocstatus": 0,
+ "jobresult": {
+ "success": true
+ },
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobstatus": 1,
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c"
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/testdata/SSHService.json b/test/testdata/SSHService.json
new file mode 100644
index 0000000..ab3a1b0
--- /dev/null
+++ b/test/testdata/SSHService.json
@@ -0,0 +1,138 @@
+{
+ "createSSHKeyPair": {
+ "createsshkeypairresponse": {
+ "keypair": {
+ "privatekey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAlMDlCrzlmEBwmPmQBhvD4PeRdEUV2tyoEuLLwkg7FkZFrjdd\nZaC8+N82Jm/lr27sqq5xVoo6n54k3hG9HVxNZjQBY5IiRNeQIF30Ye5c6TzboCCH\nAJVZYf4Dj5ucJvxg+V1+rZMNNJs6y2tMRGfmQ9zdrHZwOutKBeWTlGLtXyMabc5o\nVVe4hjngxh7s+CbEAA8oE9KFk1ZyhJ7SDj6G9vrMoBYNgqNGG6DHF/NM0A0yaEnj\nZU5MECXnw9qT7W8ggy5UM9AYtfzAyWBrS3jDwFgOjEZ+TW7vvC1Q3lnGkzpTHlye\nRppPm/7Xa8xapIdDV2UdEXnChHj9+Jwpa5nBJQIDAQABAoIBABaReW56oD7MMAkV\ne+NhXQOJq/i+7oTpC1rqK83LFaPYf4PiBHqBu4nqm5WTTn6iTqfKlYlyqVhELwW+\nHToSIfAKnddUeXyGU+iFOKmO92uvfwa5SKIvBoOWfUXRbwx/J9tNcwW0lMFRd8ca\n/VQ3izjqjns28OoPfoiMfyp5I9hWCNoC0KmIqHClqSVU5rpYpEcm70jA1PhLMItf\n8ECEPRQBBoFAEQSnyqohFBOKxna0Urs8qUOJ38FfK883h+ltRSzna7D9QetC+lny\n9OTuAMYe7ytnzGPJITLXjIN3Nj40n+dNmcRl7y0u00FdVpN92HlosCJvQqeJYY5V\nhcfi/aECgYEAxSKvGknRtQjuT+emmG4TmC110ZCcQY1tgIMwkPL++rR9Qp8M5t5p\nocxpK5NYhGgai4Kep5F4P2nePHFemwgP1jHawxsc3G/IA+0c27Y+9uAZSM2mDCcf\nXIvBxkOGcI1UcJYUTwAYdfgtJmVkS3Mj519r1lk2+pJAN14NkC87wekCgYEAwSvS\no7ILlqZo//DThhHakFFLFRKD82ghNMc0b8yheSY+V+tkzW+nugqvm5rhH3GH+M8U\nMLm5sdWauT2/1l7kaUla923lwMDxhd4Buv6v6IZYVNyzJLA5DAT3T7i5fmixE1MG\ncpmZhbpsuikFRUP3Z2td1D8cuZxHN6OrWtCso90CgYEAtJIGji/b1NVvZOWtZaY+\ncIADkYfCeREQokyIqdzKzd2Rdvq1GKvVWg0gsHdw9ydcWTm2FYtb98oDdJ3rqFoE\nF5Dm7xvgndIOBfqlGmOe3Qd8YYFtfWhAg8bIIdEsTeBG3jG6PHq77SL8SFVLPwki\ndAalgluJzo80HwMZrV52gDECgYA5JXm/K6D6BGjzro8lDosWPrZzmXKnw5pvPq9o\nk6UBbirrX5wGmo2IIDkrU3peDvwmwzw53fftgD+xpW7nQFNaQnVC1aQujeXlsHPa\nmhX4OCZRlKj6pZd60s1HLGLT3qzkBp/Vr1MXmLspp5EDmMPMOJsdez5IOs9mymib\nCTjJkQKBgFv0d3RnnxOU9EuTA6DmqxrYnWCQVEl1jwTJwfX6+1hfiBzLMCKWxEZ4\nla4rcmvMkL+uWwfLp/R29ciZC+G08Tc7tPVmZunqT3XBgSAt0y3Q3WXkkZG9RHlS\nCK2YbtViHML+G5dackvASf1p7+w2b3WS8fHFH2GTSTiM/OqReBVF\n-----END RSA PRIVATE KEY-----\n",
+ "name": "testSSHKey",
+ "account": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "fingerprint": "3b:f7:0b:34:40:0d:a5:3c:2a:75:f8:82:1d:88:99:36"
+ }
+ }
+ },
+ "listSSHKeyPairs": {
+ "listsshkeypairsresponse": {
+ "count": 1,
+ "sshkeypair": [
+ {
+ "account": "admin",
+ "domain": "ROOT",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "fingerprint": "3b:f7:0b:34:40:0d:a5:3c:2a:75:f8:82:1d:88:99:36",
+ "name": "testSSHKey"
+ }
+ ]
+ }
+ },
+ "resetSSHKeyForVirtualMachine": {
+ "resetSSHKeyforvirtualmachineresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.vm.ResetVMSSHKeyCmdByAdmin",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "virtualmachine": {
+ "id": "8aa29529-b238-45f3-8992-5befadcd8bb0",
+ "name": "Admin-VPC-T3-VM",
+ "displayname": "abc12",
+ "account": "admin",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "username": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "created": "2021-07-05T09:16:22+0000",
+ "state": "Stopped",
+ "haenable": false,
+ "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
+ "zonename": "shouldwork",
+ "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
+ "templatename": "CentOS 5.6 (64-bit)",
+ "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
+ "passwordenabled": false,
+ "serviceofferingid": "79802d1a-186b-4e34-a550-220987cb03c2",
+ "serviceofferingname": "const1",
+ "diskofferingid": "3d321179-f9c6-4a77-8f47-6fae3a8126d1",
+ "diskofferingname": "Medium",
+ "backupofferingid": "7c42d74e-c029-4431-9025-6caa8b903472",
+ "backupofferingname": "BackupGoldDummy",
+ "cpunumber": 1,
+ "cpuspeed": 1000,
+ "memory": 256,
+ "cpuused": "10%",
+ "networkkbsread": 209485824,
+ "networkkbswrite": 104742912,
+ "diskkbsread": 0,
+ "diskkbswrite": 0,
+ "memorykbs": 0,
+ "memoryintfreekbs": 0,
+ "memorytargetkbs": 0,
+ "diskioread": 0,
+ "diskiowrite": 0,
+ "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "rootdeviceid": 1,
+ "rootdevicetype": "DATADISK",
+ "securitygroup": [],
+ "nic": [
+ {
+ "id": "511941ff-229d-4a3b-8b09-f83b0608ed6b",
+ "networkid": "30358053-0f9d-4112-9948-976477896db6",
+ "networkname": "test-network-2",
+ "netmask": "255.255.255.0",
+ "gateway": "10.1.2.1",
+ "ipaddress": "10.1.2.71",
+ "traffictype": "Guest",
+ "type": "Isolated",
+ "isdefault": true,
+ "macaddress": "02:00:35:ff:00:0c",
+ "secondaryip": [],
+ "extradhcpoption": []
+ },
+ {
+ "id": "186e56ee-8de8-4869-ac00-dc91dc51d6f2",
+ "networkid": "6463e120-c36a-4569-aaa7-729922a55825",
+ "networkname": "sw1",
+ "traffictype": "Guest",
+ "type": "L2",
+ "isdefault": false,
+ "macaddress": "02:00:3d:a2:00:02",
+ "secondaryip": [],
+ "extradhcpoption": []
+ }
+ ],
+ "hypervisor": "Simulator",
+ "instancename": "i-2-613-QA",
+ "details": {
+ "cpuNumber": "1",
+ "memory": "256",
+ "Message.ReservedCapacityFreed.Flag": "true",
+ "SSH.PublicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCUwOUKvOWYQHCY+ZAGG8Pg95F0RRXa3KgS4svCSDsWRkWuN11loLz43zYmb+WvbuyqrnFWijqfniTeEb0dXE1mNAFjkiJE15AgXfRh7lzpPNugIIcAlVlh/gOPm5wm/GD5XX6tkw00mzrLa0xEZ+ZD3N2sdnA660oF5ZOUYu1fIxptzmhVV7iGOeDGHuz4JsQADygT0oWTVnKEntIOPob2+sygFg2Co0YboMcX80zQDTJoSeNlTkwQJefD2pPtbyCDLlQz0Bi1/MDJYGtLeMPAWA6MRn5Nbu+8LVDeWcaTOlMeXJ5Gmk+b/tdrzFqkh0NXZR0RecKEeP34nClrmcEl \n",
+ "Encrypted.Password": "YcyvikAL5LHq4gXwGVE3yW0j7iuuTWcxnMpYQDqHn+6R1agzIibv3eoF1onUFgHYQ0XtJUzMR4QfZDzlHnqYDTB+rKjjc9YcZzWhVSoVKQ45bUqAKFBXJTfDLQ3ZmvULxJ2VXf/HuuOh5Th5S62bP68QrrVCMPUArUYRRFPw0EkQVdvjwF1raNXpKWDAtcwITaroxW0pL9S8ome5R7JHKPxyK9G8/lqC4ywodvPaG+vGV0eHTiQeUab/dQ8Pxze6Ny88uwv8oH2vu+zMbs91uDDL9lMl7WV5Rq6RucKRAjOBLfPj+f+8jq3xnCG8JzUa63G2lAvP9qIzk3eYzoeYkw=="
+ },
+ "keypair": "testSSHKey",
+ "affinitygroup": [],
+ "displayvm": true,
+ "isdynamicallyscalable": false,
+ "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "osdisplayname": "CentOS 5.6 (64-bit)",
+ "tags": [],
+ "jobid": "da766971-3902-4675-9cf2-8bcb2398aba3",
+ "jobstatus": 0
+ }
+ },
+ "jobinstancetype": "VirtualMachine",
+ "jobinstanceid": "8aa29529-b238-45f3-8992-5befadcd8bb0",
+ "created": "2021-10-04T07:39:55+0000",
+ "completed": "2021-10-04T07:39:55+0000",
+ "jobid": "da766971-3902-4675-9cf2-8bcb2398aba3"
+ }
+ },
+ "deleteSSHKeyPair": {
+ "deletesshkeypairresponse": {
+ "success": true
+ }
+ }
+}
\ No newline at end of file
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 66%
rename from cloudstack/testdata/StoragePoolServiceData.json
rename to test/testdata/StoragePoolService.json
index ef67c27..f7e67d2 100644
--- a/cloudstack/testdata/StoragePoolServiceData.json
+++ b/test/testdata/StoragePoolService.json
@@ -1,21 +1,15 @@
{
"cancelStorageMaintenance": {
- "cancelStorageMaintenance": {
- "cancelprimarystoragemaintenanceresponse": {
- "jobid": "7cc3faa4-73c5-45cb-a982-683a13023827"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "storagepool": {
+ "cancelprimarystoragemaintenanceresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "storagepool": {
"id": "44ad900d-785b-3eff-addc-a5e6bf4927ef",
"zoneid": "753941b6-5239-4ab3-b2b3-7522d2a6d1ba",
"zonename": "DummySG",
@@ -36,24 +30,17 @@
"provider": "DefaultPrimary",
"jobid": "7cc3faa4-73c5-45cb-a982-683a13023827",
"jobstatus": 0
- }
- },
- "jobinstancetype": "StoragePool",
- "jobinstanceid": "44ad900d-785b-3eff-addc-a5e6bf4927ef",
- "created": "2021-10-04T08:06:55+0000",
- "completed": "2021-10-04T08:06:55+0000",
- "jobid": "7cc3faa4-73c5-45cb-a982-683a13023827"
- }
+ }
+ },
+ "jobinstancetype": "StoragePool",
+ "jobinstanceid": "44ad900d-785b-3eff-addc-a5e6bf4927ef",
+ "created": "2021-10-04T08:06:55+0000",
+ "completed": "2021-10-04T08:06:55+0000",
+ "jobid": "7cc3faa4-73c5-45cb-a982-683a13023827"
}
},
"enableStorageMaintenance": {
- "enableStorageMaintenance": {
- "prepareprimarystorageformaintenanceresponse": {
- "jobid": "3036df18-12ca-44a0-9c77-19fcf81dad75"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "prepareprimarystorageformaintenanceresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageForMaintenanceCmd",
@@ -83,14 +70,13 @@
"provider": "DefaultPrimary",
"jobid": "3036df18-12ca-44a0-9c77-19fcf81dad75",
"jobstatus": 0
- }
- },
+ }
+ },
"jobinstancetype": "StoragePool",
"jobinstanceid": "44ad900d-785b-3eff-addc-a5e6bf4927ef",
"created": "2021-10-04T08:13:01+0000",
"completed": "2021-10-04T08:13:02+0000",
"jobid": "3036df18-12ca-44a0-9c77-19fcf81dad75"
- }
}
}
}
\ No newline at end of file
diff --git a/cloudstack/testdata/TemplateServiceData.json b/test/testdata/TemplateService.json
similarity index 66%
rename from cloudstack/testdata/TemplateServiceData.json
rename to test/testdata/TemplateService.json
index f4f4ca2..3d873cc 100644
--- a/cloudstack/testdata/TemplateServiceData.json
+++ b/test/testdata/TemplateService.json
@@ -48,14 +48,7 @@
}
},
"createTemplate": {
- "createTemplate": {
- "createtemplateresponse": {
- "id": "b07dd9e4-1720-4122-b840-1e57a79e0dd9",
- "jobid": "13cc57e2-f388-49d5-95f3-de5ba43835fb"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
+ "createtemplateresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.template.CreateTemplateCmdByAdmin",
@@ -90,9 +83,9 @@
"details": {},
"downloaddetails": [
{
- "downloadState": "DOWNLOADED",
- "datastore": "secon",
- "downloadPercent": "100"
+ "downloadState": "DOWNLOADED",
+ "datastore": "secon",
+ "downloadPercent": "100"
}
],
"bits": 0,
@@ -102,49 +95,41 @@
"deployasis": false,
"requireshvm": false,
"tags": []
- }
- },
+ }
+ },
"jobinstancetype": "Template",
"jobinstanceid": "b07dd9e4-1720-4122-b840-1e57a79e0dd9",
"created": "2021-10-04T08:45:37+0000",
"completed": "2021-10-04T08:45:37+0000",
"jobid": "13cc57e2-f388-49d5-95f3-de5ba43835fb"
- }
}
},
"extractTemplate": {
- "extractTemplate": {
- "extracttemplateresponse": {
- "jobid": "d2c86fca-26ca-436e-b5cf-60754c598da3"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
- "cmd": "org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd",
- "jobstatus": 1,
- "jobprocstatus": 0,
- "jobresultcode": 0,
- "jobresulttype": "object",
- "jobresult": {
- "template": {
- "id": "5ce8f0b1-a910-4631-a8de-1e332bf3a6b7",
- "name": "testTemplate",
- "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
- "state": "DOWNLOAD_URL_CREATED",
- "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
- "zonename": "shouldwork",
- "extractMode": "HTTP_DOWNLOAD",
- "url": "http://172.17.1.11/userdata/a7a2ca0e-65c7-4b9e-bc61-3a4ab6adf6c0.vhd"
- }
- },
- "jobinstancetype": "Template",
- "jobinstanceid": "5ce8f0b1-a910-4631-a8de-1e332bf3a6b7",
- "created": "2021-10-04T08:50:45+0000",
- "completed": "2021-10-04T08:50:46+0000",
- "jobid": "d2c86fca-26ca-436e-b5cf-60754c598da3"
- }
+ "extracttemplateresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "template": {
+ "id": "5ce8f0b1-a910-4631-a8de-1e332bf3a6b7",
+ "name": "testTemplate",
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "state": "DOWNLOAD_URL_CREATED",
+ "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
+ "zonename": "shouldwork",
+ "extractMode": "HTTP_DOWNLOAD",
+ "url": "http://172.17.1.11/userdata/a7a2ca0e-65c7-4b9e-bc61-3a4ab6adf6c0.vhd"
+ }
+ },
+ "jobinstancetype": "Template",
+ "jobinstanceid": "5ce8f0b1-a910-4631-a8de-1e332bf3a6b7",
+ "created": "2021-10-04T08:50:45+0000",
+ "completed": "2021-10-04T08:50:46+0000",
+ "jobid": "d2c86fca-26ca-436e-b5cf-60754c598da3"
}
}
}
\ No newline at end of file
diff --git a/cloudstack/testdata/UserServiceData.json b/test/testdata/UserService.json
similarity index 95%
rename from cloudstack/testdata/UserServiceData.json
rename to test/testdata/UserService.json
index c4a3847..ff55471 100644
--- a/cloudstack/testdata/UserServiceData.json
+++ b/test/testdata/UserService.json
@@ -48,13 +48,7 @@
}
},
"disableUser": {
- "disableUser": {
"disableResponse": {
- "jobid": "e4eb553f-6188-441c-beb8-09056b0a1e1f"
- }
- },
- "queryAsyncJobResult": {
- "queryasyncjobresultresponse": {
"accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
"cmd": "org.apache.cloudstack.api.command.admin.user.DisableUserCmd",
"completed": "2021-10-04T09:06:53+0000",
@@ -88,7 +82,7 @@
"jobstatus": 1,
"userid": "27f2484f-5fe0-11ea-9a56-1e006800018c"
}
- }
+
},
"listUsers": {
"listusersresponse": {
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/test/testdata/VPCService.json b/test/testdata/VPCService.json
new file mode 100644
index 0000000..6f95b90
--- /dev/null
+++ b/test/testdata/VPCService.json
@@ -0,0 +1,463 @@
+{
+ "restartVPC": {
+ "restartvpcresponse": {
+ "accountid": "0644f184-269b-11ec-ad12-1e00bc0003a5",
+ "userid": "06466ac0-269b-11ec-ad12-1e00bc0003a5",
+ "cmd": "org.apache.cloudstack.api.command.user.vpc.RestartVPCCmd",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "success": true
+ },
+ "created": "2021-10-13T04:36:30+0000",
+ "completed": "2021-10-13T04:36:30+0000",
+ "jobid": "98272f42-917c-4286-8c05-4e38d85d32e0"
+ }
+ },
+ "listVPCs": {
+ "listvpcresponse": {
+ "count": 2,
+ "vpc": [
+ {
+ "id": "49b5fa29-e98f-4078-b407-7e7928105ec0",
+ "name": "my-vpc",
+ "displaytext": "my-vpc-text",
+ "state": "Enabled",
+ "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
+ "zonename": "SimZone1",
+ "service": [
+ {
+ "name": "Dns",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "Dhcp",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "PortForwarding",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "StaticNat",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "Vpn",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "SourceNat",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "NetworkACL",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "UserData",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "Lb",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ },
+ {
+ "name": "InternalLbVm"
+ }
+ ]
+ }
+ ],
+ "cidr": "10.0.0.0/8",
+ "vpcofferingid": "8142b164-0fa2-40c6-9067-2a90ae526df5",
+ "vpcofferingname": "Default VPC offering",
+ "created": "2021-12-26T22:26:18+0000",
+ "account": "admin",
+ "domainid": "bbae9696-627f-11ec-8fb6-0242ac110002",
+ "domain": "ROOT",
+ "network": [],
+ "restartrequired": false,
+ "networkdomain": "my-domain",
+ "tags": [
+ {
+ "key": "my-tag",
+ "value": "true"
+ }
+ ],
+ "fordisplay": true,
+ "distributedvpcrouter": false,
+ "regionlevelvpc": false,
+ "redundantvpcrouter": false,
+ "hasannotations": false
+ },
+ {
+ "id": "78d49100-e4af-4692-9a49-284fa2444eb9",
+ "name": "my-vpc",
+ "displaytext": "my-vpc",
+ "state": "Enabled",
+ "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
+ "zonename": "SimZone1",
+ "service": [
+ {
+ "name": "Dns",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "Dhcp",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "PortForwarding",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "StaticNat",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "Vpn",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "SourceNat",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "NetworkACL",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "UserData",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ]
+ },
+ {
+ "name": "Lb",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ },
+ {
+ "name": "InternalLbVm"
+ }
+ ]
+ }
+ ],
+ "cidr": "10.0.0.0/8",
+ "vpcofferingid": "8142b164-0fa2-40c6-9067-2a90ae526df5",
+ "vpcofferingname": "Default VPC offering",
+ "created": "2021-12-26T22:28:44+0000",
+ "account": "admin",
+ "domainid": "bbae9696-627f-11ec-8fb6-0242ac110002",
+ "domain": "ROOT",
+ "network": [
+ {
+ "id": "e22cab07-58ac-4a1b-b0a8-fcee1bbecc7d",
+ "name": "my-network",
+ "displaytext": "my-network",
+ "broadcastdomaintype": "Vlan",
+ "traffictype": "Guest",
+ "gateway": "10.1.1.1",
+ "netmask": "255.255.255.0",
+ "cidr": "10.1.1.0/24",
+ "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
+ "zonename": "SimZone1",
+ "networkofferingid": "f26a1059-24df-4f76-9daf-16d42ce9df11",
+ "networkofferingname": "DefaultIsolatedNetworkOfferingForVpcNetworks",
+ "networkofferingdisplaytext": "Offering for Isolated Vpc networks with Source Nat service enabled",
+ "networkofferingconservemode": false,
+ "networkofferingavailability": "Optional",
+ "issystem": false,
+ "state": "Allocated",
+ "related": "e22cab07-58ac-4a1b-b0a8-fcee1bbecc7d",
+ "dns1": "10.147.28.6",
+ "type": "Isolated",
+ "acltype": "Account",
+ "account": "admin",
+ "domainid": "bbae9696-627f-11ec-8fb6-0242ac110002",
+ "domain": "ROOT",
+ "service": [
+ {
+ "name": "Dns",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": [
+ {
+ "name": "AllowDnsSuffixModification",
+ "value": "true",
+ "canchooseservicecapability": false
+ }
+ ]
+ },
+ {
+ "name": "Dhcp",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": [
+ {
+ "name": "DhcpAccrossMultipleSubnets",
+ "value": "true",
+ "canchooseservicecapability": false
+ }
+ ]
+ },
+ {
+ "name": "PortForwarding",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": [
+ {
+ "name": "SupportedProtocols",
+ "value": "tcp,udp",
+ "canchooseservicecapability": false
+ }
+ ]
+ },
+ {
+ "name": "StaticNat",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": [
+ {
+ "name": "ElasticIp",
+ "value": "false",
+ "canchooseservicecapability": false
+ },
+ {
+ "name": "AssociatePublicIP",
+ "value": "true",
+ "canchooseservicecapability": false
+ }
+ ]
+ },
+ {
+ "name": "Vpn",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": [
+ {
+ "name": "SupportedVpnTypes",
+ "value": "pptp,l2tp,ipsec",
+ "canchooseservicecapability": false
+ },
+ {
+ "name": "VpnTypes",
+ "value": "s2svpn",
+ "canchooseservicecapability": false
+ }
+ ]
+ },
+ {
+ "name": "SourceNat",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": [
+ {
+ "name": "SupportedSourceNatTypes",
+ "value": "peraccount",
+ "canchooseservicecapability": true
+ },
+ {
+ "name": "RedundantRouter",
+ "value": "false",
+ "canchooseservicecapability": true
+ }
+ ]
+ },
+ {
+ "name": "NetworkACL",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": [
+ {
+ "name": "SupportedProtocols",
+ "value": "tcp,udp,icmp",
+ "canchooseservicecapability": false
+ }
+ ]
+ },
+ {
+ "name": "UserData",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": []
+ },
+ {
+ "name": "Lb",
+ "provider": [
+ {
+ "name": "VpcVirtualRouter"
+ }
+ ],
+ "capability": [
+ {
+ "name": "SupportedStickinessMethods",
+ "value": "[{\"methodname\":\"LbCookie\",\"paramlist\":[{\"paramname\":\"cookie-name\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"mode\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"nocache\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"indirect\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"postonly\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"domain\",\"required\":false,\"isflag\":false,\"description\":\" \"}],\"description\":\"This is loadbalancer cookie based stickiness method.\"},{\"methodname\":\"AppCookie\",\"paramlist\":[{\"paramname\":\"cookie-name\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"length\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"holdtime\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"request-learn\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"prefix\",\"required\":false,\"isflag\":true,\"description\":\" \"},{\"paramname\":\"mode\",\"required\":false,\"isflag\":false,\"description\":\" \"}],\"description\":\"This is App session based sticky method. Define session stickiness on an existing application cookie. It can be used only for a specific http traffic\"},{\"methodname\":\"SourceBased\",\"paramlist\":[{\"paramname\":\"tablesize\",\"required\":false,\"isflag\":false,\"description\":\" \"},{\"paramname\":\"expire\",\"required\":false,\"isflag\":false,\"description\":\" \"}],\"description\":\"This is source based Stickiness method, it can be used for any type of protocol.\"}]",
+ "canchooseservicecapability": false
+ },
+ {
+ "name": "SupportedLbAlgorithms",
+ "value": "roundrobin,leastconn,source",
+ "canchooseservicecapability": false
+ },
+ {
+ "name": "LbSchemes",
+ "value": "Public",
+ "canchooseservicecapability": false
+ },
+ {
+ "name": "SupportedProtocols",
+ "value": "tcp, udp, tcp-proxy",
+ "canchooseservicecapability": false
+ },
+ {
+ "name": "SupportedLBIsolation",
+ "value": "dedicated",
+ "canchooseservicecapability": true
+ },
+ {
+ "name": "AutoScaleCounters",
+ "value": "[{\"methodname\":\"cpu\",\"paramlist\":[]},{\"methodname\":\"memory\",\"paramlist\":[]}]",
+ "canchooseservicecapability": false
+ },
+ {
+ "name": "ElasticLb",
+ "value": "false",
+ "canchooseservicecapability": false
+ },
+ {
+ "name": "InlineMode",
+ "value": "false",
+ "canchooseservicecapability": false
+ }
+ ]
+ }
+ ],
+ "networkdomain": "my-domain",
+ "physicalnetworkid": "ffcffe07-5cbf-4862-9c52-8e7153a5239a",
+ "restartrequired": false,
+ "specifyipranges": false,
+ "vpcid": "78d49100-e4af-4692-9a49-284fa2444eb9",
+ "vpcname": "my-vpc",
+ "canusefordeploy": true,
+ "ispersistent": false,
+ "tags": [],
+ "details": {},
+ "displaynetwork": true,
+ "strechedl2subnet": false,
+ "redundantrouter": false,
+ "created": "2021-12-26T22:28:52+0000",
+ "receivedbytes": 0,
+ "sentbytes": 0,
+ "hasannotations": false
+ }
+ ],
+ "restartrequired": false,
+ "networkdomain": "my-domain",
+ "tags": [
+ {
+ "key": "my-tag",
+ "value": "true"
+ }
+ ],
+ "fordisplay": true,
+ "distributedvpcrouter": false,
+ "regionlevelvpc": false,
+ "redundantvpcrouter": false,
+ "hasannotations": false
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/testdata/VPNService.json b/test/testdata/VPNService.json
new file mode 100644
index 0000000..396d501
--- /dev/null
+++ b/test/testdata/VPNService.json
@@ -0,0 +1,19 @@
+{
+ "deleteRemoteAccessVpn": {
+ "deleteremoteaccessvpnresponse": {
+ "accountid": "7a2fad8f-2bde-11ec-b173-1e0086000207",
+ "cmd": "org.apache.cloudstack.api.command.user.vpn.DeleteRemoteAccessVpnCmd",
+ "completed": "2021-10-13T07:38:53+0000",
+ "created": "2021-10-13T07:38:51+0000",
+ "jobid": "50bdd6c2-6958-48ba-94fe-3e6ec410dcce",
+ "jobprocstatus": 0,
+ "jobresult": {
+ "success": true
+ },
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobstatus": 1,
+ "userid": "7a309dc2-2bde-11ec-b173-1e0086000207"
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/testdata/VirtualMachineService.json b/test/testdata/VirtualMachineService.json
new file mode 100644
index 0000000..d0f36a3
--- /dev/null
+++ b/test/testdata/VirtualMachineService.json
@@ -0,0 +1,509 @@
+{
+ "deployVirtualMachine": {
+ "deployvirtualmachineresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.vm.DeployVMCmdByAdmin",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "virtualmachine": {
+ "id": "915653c4-298b-4d74-bdee-4ced282114f1",
+ "name": "testDummyVM",
+ "displayname": "testDummyVM",
+ "account": "admin",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "username": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "created": "2021-10-04T09:24:38+0000",
+ "state": "Running",
+ "haenable": false,
+ "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
+ "zonename": "shouldwork",
+ "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
+ "hostname": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
+ "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
+ "templatename": "CentOS 5.6 (64-bit)",
+ "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
+ "passwordenabled": false,
+ "serviceofferingid": "498ce071-a077-4237-9492-e55c42553327",
+ "serviceofferingname": "Very small instance",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ "memory": 256,
+ "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "rootdeviceid": 0,
+ "rootdevicetype": "ROOT",
+ "securitygroup": [],
+ "nic": [
+ {
+ "id": "47d79da1-2fe1-4a44-a503-523055714a72",
+ "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
+ "networkname": "test",
+ "netmask": "255.255.255.0",
+ "gateway": "10.1.1.1",
+ "ipaddress": "10.1.1.62",
+ "isolationuri": "vlan://1850",
+ "broadcasturi": "vlan://1850",
+ "traffictype": "Guest",
+ "type": "Isolated",
+ "isdefault": true,
+ "macaddress": "02:00:34:fb:00:01",
+ "secondaryip": [],
+ "extradhcpoption": []
+ }
+ ],
+ "hypervisor": "Simulator",
+ "instancename": "i-2-683-QA",
+ "details": {},
+ "affinitygroup": [],
+ "displayvm": true,
+ "isdynamicallyscalable": false,
+ "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "osdisplayname": "CentOS 5.6 (64-bit)",
+ "bootmode": "legacy",
+ "boottype": "Bios",
+ "tags": [],
+ "jobid": "74bbb422-fb74-47ac-a22a-ad86a7831d3f",
+ "jobstatus": 0
+ }
+ },
+ "jobinstancetype": "VirtualMachine",
+ "jobinstanceid": "915653c4-298b-4d74-bdee-4ced282114f1",
+ "created": "2021-10-04T09:24:38+0000",
+ "completed": "2021-10-04T09:24:42+0000",
+ "jobid": "74bbb422-fb74-47ac-a22a-ad86a7831d3f"
+ }
+ },
+ "addNicToVirtualMachine": {
+ "addnictovirtualmachineresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.vm.AddNicToVMCmdByAdmin",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "virtualmachine": {
+ "id": "915653c4-298b-4d74-bdee-4ced282114f1",
+ "name": "testDummyVM",
+ "displayname": "testDummyVM",
+ "account": "admin",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "username": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "created": "2021-10-04T09:24:38+0000",
+ "state": "Running",
+ "haenable": false,
+ "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
+ "zonename": "shouldwork",
+ "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
+ "hostname": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
+ "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "securitygroup": [],
+ "nic": [
+ {
+ "id": "0921d201-f7ac-4f49-bf09-ffe9497fdab0",
+ "networkid": "30358053-0f9d-4112-9948-976477896db6",
+ "networkname": "test-network-2",
+ "netmask": "255.255.255.0",
+ "gateway": "10.1.2.1",
+ "ipaddress": "10.1.2.102",
+ "isolationuri": "vlan://1955",
+ "broadcasturi": "vlan://1955",
+ "traffictype": "Guest",
+ "type": "Isolated",
+ "isdefault": false,
+ "macaddress": "02:00:13:a4:00:21",
+ "secondaryip": [],
+ "extradhcpoption": []
+ },
+ {
+ "id": "47d79da1-2fe1-4a44-a503-523055714a72",
+ "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
+ "networkname": "test",
+ "netmask": "255.255.255.0",
+ "gateway": "10.1.1.1",
+ "ipaddress": "10.1.1.62",
+ "isolationuri": "vlan://1850",
+ "broadcasturi": "vlan://1850",
+ "traffictype": "Guest",
+ "type": "Isolated",
+ "isdefault": true,
+ "macaddress": "02:00:34:fb:00:01",
+ "secondaryip": [],
+ "extradhcpoption": []
+ }
+ ],
+ "hypervisor": "Simulator",
+ "instancename": "i-2-683-QA",
+ "details": {},
+ "affinitygroup": [],
+ "displayvm": true,
+ "isdynamicallyscalable": false,
+ "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "osdisplayname": "CentOS 5.6 (64-bit)",
+ "bootmode": "legacy",
+ "boottype": "Bios",
+ "tags": []
+ }
+ },
+ "created": "2021-10-04T09:29:51+0000",
+ "completed": "2021-10-04T09:29:54+0000",
+ "jobid": "ec9d4711-b334-4750-868b-fb4d79d5801c"
+ }
+ },
+ "stopVirtualMachine": {
+ "stopvirtualmachineresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.vm.StopVMCmdByAdmin",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "virtualmachine": {
+ "id": "915653c4-298b-4d74-bdee-4ced282114f1",
+ "name": "testDummyVM",
+ "displayname": "testDummyVM",
+ "account": "admin",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "username": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "created": "2021-10-04T09:24:38+0000",
+ "state": "Stopped",
+ "haenable": false,
+ "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
+ "zonename": "shouldwork",
+ "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
+ "templatename": "CentOS 5.6 (64-bit)",
+ "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
+ "passwordenabled": false,
+ "serviceofferingid": "498ce071-a077-4237-9492-e55c42553327",
+ "serviceofferingname": "Very small instance",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ "memory": 256,
+ "cpuused": "10%",
+ "networkkbsread": 917504,
+ "networkkbswrite": 458752,
+ "diskkbsread": 0,
+ "diskkbswrite": 0,
+ "memorykbs": 0,
+ "memoryintfreekbs": 0,
+ "memorytargetkbs": 0,
+ "diskioread": 0,
+ "diskiowrite": 0,
+ "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "rootdeviceid": 0,
+ "rootdevicetype": "ROOT",
+ "securitygroup": [],
+ "nic": [
+ {
+ "id": "47d79da1-2fe1-4a44-a503-523055714a72",
+ "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
+ "networkname": "test",
+ "netmask": "255.255.255.0",
+ "gateway": "10.1.1.1",
+ "ipaddress": "10.1.1.62",
+ "traffictype": "Guest",
+ "type": "Isolated",
+ "isdefault": true,
+ "macaddress": "02:00:34:fb:00:01",
+ "secondaryip": [],
+ "extradhcpoption": []
+ }
+ ],
+ "hypervisor": "Simulator",
+ "instancename": "i-2-683-QA",
+ "details": {
+ "Message.ReservedCapacityFreed.Flag": "false"
+ },
+ "affinitygroup": [],
+ "displayvm": true,
+ "isdynamicallyscalable": false,
+ "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "osdisplayname": "CentOS 5.6 (64-bit)",
+ "tags": [],
+ "jobid": "604bc5ed-1b7e-4d63-abc8-a55077a4c2c1",
+ "jobstatus": 0
+ }
+ },
+ "jobinstancetype": "VirtualMachine",
+ "jobinstanceid": "915653c4-298b-4d74-bdee-4ced282114f1",
+ "created": "2021-10-04T09:53:06+0000",
+ "completed": "2021-10-04T09:53:08+0000",
+ "jobid": "604bc5ed-1b7e-4d63-abc8-a55077a4c2c1"
+ }
+ },
+ "startVirtualMachine": {
+ "startvirtualmachineresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.vm.StartVMCmdByAdmin",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "virtualmachine": {
+ "id": "915653c4-298b-4d74-bdee-4ced282114f1",
+ "name": "testDummyVM",
+ "displayname": "testDummyVM",
+ "account": "admin",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "username": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "created": "2021-10-04T09:24:38+0000",
+ "state": "Running",
+ "haenable": false,
+ "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
+ "zonename": "shouldwork",
+ "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
+ "hostname": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
+ "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
+ "templatename": "CentOS 5.6 (64-bit)",
+ "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
+ "passwordenabled": false,
+ "serviceofferingid": "498ce071-a077-4237-9492-e55c42553327",
+ "serviceofferingname": "Very small instance",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ "memory": 256,
+ "cpuused": "10%",
+ "networkkbsread": 917504,
+ "networkkbswrite": 458752,
+ "diskkbsread": 0,
+ "diskkbswrite": 0,
+ "memorykbs": 0,
+ "memoryintfreekbs": 0,
+ "memorytargetkbs": 0,
+ "diskioread": 0,
+ "diskiowrite": 0,
+ "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "rootdeviceid": 0,
+ "rootdevicetype": "ROOT",
+ "securitygroup": [],
+ "nic": [
+ {
+ "id": "47d79da1-2fe1-4a44-a503-523055714a72",
+ "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
+ "networkname": "test",
+ "netmask": "255.255.255.0",
+ "gateway": "10.1.1.1",
+ "ipaddress": "10.1.1.62",
+ "isolationuri": "vlan://1994",
+ "broadcasturi": "vlan://1994",
+ "traffictype": "Guest",
+ "type": "Isolated",
+ "isdefault": true,
+ "macaddress": "02:00:34:fb:00:01",
+ "secondaryip": [],
+ "extradhcpoption": []
+ }
+ ],
+ "hypervisor": "Simulator",
+ "instancename": "i-2-683-QA",
+ "details": {
+ "Message.ReservedCapacityFreed.Flag": "false"
+ },
+ "affinitygroup": [],
+ "displayvm": true,
+ "isdynamicallyscalable": false,
+ "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "osdisplayname": "CentOS 5.6 (64-bit)",
+ "tags": [],
+ "jobid": "468d69d7-f327-4105-bec2-0e43107ae956",
+ "jobstatus": 0
+ }
+ },
+ "jobinstancetype": "VirtualMachine",
+ "jobinstanceid": "915653c4-298b-4d74-bdee-4ced282114f1",
+ "created": "2021-10-04T09:57:19+0000",
+ "completed": "2021-10-04T09:57:22+0000",
+ "jobid": "468d69d7-f327-4105-bec2-0e43107ae956"
+ }
+ },
+ "listVirtualMachines": {
+ "listVirtualMachines": {
+ "count": 1,
+ "virtualmachine": [
+ {
+ "account": "admin",
+ "affinitygroup": [],
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ "cpuused": "10%",
+ "created": "2021-10-04T09:24:38+0000",
+ "details": {
+ "Message.ReservedCapacityFreed.Flag": "false"
+ },
+ "diskioread": 0,
+ "diskiowrite": 0,
+ "diskkbsread": 0,
+ "diskkbswrite": 0,
+ "displayname": "testDummyVM",
+ "displayvm": true,
+ "domain": "ROOT",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "guestosid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "haenable": false,
+ "hostid": "8e8e68e7-19ea-4a78-bbdb-6e79d27729c9",
+ "hostname": "SimulatedAgent.4234d24b-37fd-42bf-9184-874889001baf",
+ "hypervisor": "Simulator",
+ "id": "915653c4-298b-4d74-bdee-4ced282114f1",
+ "instancename": "i-2-683-QA",
+ "isdynamicallyscalable": false,
+ "memory": 256,
+ "memoryintfreekbs": 0,
+ "memorykbs": 0,
+ "memorytargetkbs": 0,
+ "name": "testDummyVM",
+ "networkkbsread": 1015808,
+ "networkkbswrite": 507904,
+ "nic": [
+ {
+ "broadcasturi": "vlan://1994",
+ "extradhcpoption": [],
+ "gateway": "10.1.1.1",
+ "id": "47d79da1-2fe1-4a44-a503-523055714a72",
+ "ipaddress": "10.1.1.62",
+ "isdefault": true,
+ "isolationuri": "vlan://1994",
+ "macaddress": "02:00:34:fb:00:01",
+ "netmask": "255.255.255.0",
+ "networkid": "87503ba2-d59d-4a5e-8f7f-b3f486cedbd8",
+ "networkname": "test",
+ "secondaryip": [],
+ "traffictype": "Guest",
+ "type": "Isolated"
+ }
+ ],
+ "osdisplayname": "CentOS 5.6 (64-bit)",
+ "ostypeid": "e53f7606-5fdf-11ea-9a56-1e006800018c",
+ "passwordenabled": false,
+ "rootdeviceid": 0,
+ "rootdevicetype": "ROOT",
+ "securitygroup": [],
+ "serviceofferingid": "498ce071-a077-4237-9492-e55c42553327",
+ "serviceofferingname": "Very small instance",
+ "state": "Running",
+ "tags": [],
+ "templatedisplaytext": "CentOS 5.6 (64-bit) no GUI",
+ "templateid": "50459b99-5fe0-11ea-9a56-1e006800018c",
+ "templatename": "CentOS 5.6 (64-bit)",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "username": "admin",
+ "zoneid": "1d8d87d4-1425-459c-8d81-c6f57dca2bd2",
+ "zonename": "shouldwork"
+ }
+ ]
+ }
+ },
+ "scaleVirtualMachine": {
+ "scalevirtualmachineresponse": {
+ "accountid": "27ef5ba2-5fe0-11ea-9a56-1e006800018c",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "cmd": "org.apache.cloudstack.api.command.admin.vm.ScaleVMCmdByAdmin",
+ "jobstatus": 1,
+ "jobprocstatus": 0,
+ "jobresultcode": 0,
+ "jobresulttype": "object",
+ "jobresult": {
+ "virtualmachine": {
+ "id": "88dedd6b-4fc0-44bf-b76f-441a13bc1f99",
+ "name": "QA-88dedd6b-4fc0-44bf-b76f-441a13bc1f99",
+ "displayname": "QA-88dedd6b-4fc0-44bf-b76f-441a13bc1f99",
+ "account": "admin",
+ "userid": "27f2484f-5fe0-11ea-9a56-1e006800018c",
+ "username": "admin",
+ "domainid": "e4874e10-5fdf-11ea-9a56-1e006800018c",
+ "domain": "ROOT",
+ "created": "2020-05-22T19:52:22+0000",
+ "lastupdated": "2021-10-06T09:57:19+0000",
+ "state": "Stopped",
+ "haenable": false,
+ "zoneid": "04ccc336-d730-42fe-8ff6-5ae36e141e81",
+ "zonename": "SimZone1",
+ "templateid": "56217438-4f36-450b-9246-850a10a3e57b",
+ "templatename": "macha-sim1",
+ "templatedisplaytext": "macha-simm",
+ "passwordenabled": true,
+ "isoid": "169fe81d-47e0-4119-b38c-f6ce42dcf451",
+ "isoname": "k8s-1.16.3-Kubernetes-Binaries-ISO",
+ "isodisplaytext": "k8s-1.16.3-Kubernetes-Binaries-IS",
+ "serviceofferingid": "57aba75e-5567-44c9-bfcc-c2c14503a5a6",
+ "serviceofferingname": "Medium Instanc",
+ "backupofferingid": "7c42d74e-c029-4431-9025-6caa8b903472",
+ "backupofferingname": "BackupGoldDummy",
+ "cpunumber": 1,
+ "cpuspeed": 1000,
+ "memory": 1024,
+ "guestosid": "12fea95b-5fe0-11ea-9a56-1e006800018c",
+ "rootdeviceid": 0,
+ "rootdevicetype": "ROOT",
+ "securitygroup": [],
+ "nic": [
+ {
+ "id": "c26193a6-9b41-4149-b836-e48bc46fc5c8",
+ "networkid": "b9bb5ef5-16cd-413c-996e-3671d8a2bc20",
+ "networkname": "test",
+ "netmask": "255.255.255.0",
+ "gateway": "10.1.1.1",
+ "ipaddress": "10.1.1.208",
+ "traffictype": "Guest",
+ "type": "Isolated",
+ "isdefault": false,
+ "macaddress": "02:00:63:59:00:05",
+ "secondaryip": [],
+ "extradhcpoption": [],
+ "deviceid": "1"
+ },
+ {
+ "id": "d9f8203d-e680-438a-86b6-327c69271011",
+ "networkid": "cc39d938-5ea0-4d9c-b89d-421da3274e54",
+ "networkname": "testNet2",
+ "netmask": "255.255.255.0",
+ "gateway": "10.1.1.1",
+ "ipaddress": "10.1.1.177",
+ "traffictype": "Guest",
+ "type": "Isolated",
+ "isdefault": true,
+ "macaddress": "02:00:22:f7:00:08",
+ "secondaryip": [],
+ "extradhcpoption": [],
+ "deviceid": "0"
+ }
+ ],
+ "hypervisor": "Simulator",
+ "instancename": "i-2-101-QA",
+ "details": {
+ "keyboard": "us",
+ "Message.ReservedCapacityFreed.Flag": "true"
+ },
+ "affinitygroup": [],
+ "displayvm": true,
+ "isdynamicallyscalable": false,
+ "ostypeid": "12fea95b-5fe0-11ea-9a56-1e006800018c",
+ "osdisplayname": "CentOS 6 (64-bit)",
+ "pooltype": "NetworkFilesystem",
+ "receivedbytes": 0,
+ "sentbytes": 0,
+ "tags": [],
+ "hasannotations": true
+ }
+ },
+ "created": "2021-10-13T04:54:55+0000",
+ "completed": "2021-10-13T04:54:56+0000",
+ "jobid": "f9a9af61-47ea-4fb7-acc9-93ea50f12042"
+ }
+ }
+}
\ No newline at end of file