v1.16.5
This commit is contained in:
@@ -87,8 +87,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
|
||||
getResult("Account list", bytes, account.ListAccounts{}, t)
|
||||
// Get
|
||||
listAcc, _ := client.CloudAPI().Account().List(context.Background(), account.ListRequest{})
|
||||
if len(listAcc.Data) > 0 {
|
||||
listAcc, err := client.CloudAPI().Account().List(context.Background(), account.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.Account.List failed: %v", err)
|
||||
} else if len(listAcc.Data) > 0 {
|
||||
id := listAcc.Data[0].ID
|
||||
bytes, err = client.CloudAPI().Account().GetRaw(context.Background(), account.GetRequest{AccountID: id})
|
||||
if err != nil {
|
||||
@@ -107,8 +109,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Audit list", bytes, audit.ListAudits{}, t)
|
||||
// Get
|
||||
listAudits, _ := client.CloudAPI().Audit().List(context.Background(), audit.ListRequest{})
|
||||
if len(listAudits.Data) > 0 {
|
||||
listAudits, err := client.CloudAPI().Audit().List(context.Background(), audit.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.Audit.List failed: %v", err)
|
||||
} else if len(listAudits.Data) > 0 {
|
||||
id := listAudits.Data[0].GUID
|
||||
bytes, err = client.CloudAPI().Audit().GetRaw(context.Background(), audit.GetRequest{AuditGuid: id})
|
||||
if err != nil {
|
||||
@@ -127,8 +131,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Bservice list", bytes, bservice.ListBasicServices{}, t)
|
||||
// Get
|
||||
listBServ, _ := client.CloudAPI().BService().List(context.Background(), bservice.ListRequest{})
|
||||
if len(listBServ.Data) > 0 {
|
||||
listBServ, err := client.CloudAPI().BService().List(context.Background(), bservice.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.BService.List failed: %v", err)
|
||||
} else if len(listBServ.Data) > 0 {
|
||||
id := listBServ.Data[0].ID
|
||||
bytes, err = client.CloudAPI().BService().GetRaw(context.Background(), bservice.GetRequest{ServiceID: id})
|
||||
if err != nil {
|
||||
@@ -147,8 +153,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Compute list", bytes, compute.ListComputes{}, t)
|
||||
// Get
|
||||
listComp, _ := client.CloudAPI().Compute().List(context.Background(), compute.ListRequest{})
|
||||
if listComp != nil && len(listComp.Data) > 0 {
|
||||
listComp, err := client.CloudAPI().Compute().List(context.Background(), compute.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.Compute.List failed: %v", err)
|
||||
} else if listComp != nil && len(listComp.Data) > 0 {
|
||||
id := listComp.Data[0].ID
|
||||
bytes, err = client.CloudAPI().Compute().GetRaw(context.Background(), compute.GetRequest{ComputeID: id})
|
||||
if err != nil {
|
||||
@@ -173,8 +181,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Disk list", bytes, disks.ListDisks{}, t)
|
||||
// Get
|
||||
listDisk, _ := client.CloudAPI().Disks().List(context.Background(), disks.ListRequest{})
|
||||
if len(listDisk.Data) > 0 {
|
||||
listDisk, err := client.CloudAPI().Disks().List(context.Background(), disks.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.Disks.List failed: %v", err)
|
||||
} else if len(listDisk.Data) > 0 {
|
||||
id := listDisk.Data[0].ID
|
||||
bytes, err = client.CloudAPI().Disks().GetRaw(context.Background(), disks.GetRequest{DiskID: id})
|
||||
if err != nil {
|
||||
@@ -193,8 +203,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("ExtNet list", bytes, extnet.ListExtNets{}, t)
|
||||
// Get
|
||||
listExtNet, _ := client.CloudAPI().ExtNet().List(context.Background(), extnet.ListRequest{})
|
||||
if len(listExtNet.Data) > 0 {
|
||||
listExtNet, err := client.CloudAPI().ExtNet().List(context.Background(), extnet.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.ExtNet.List failed: %v", err)
|
||||
} else if len(listExtNet.Data) > 0 {
|
||||
id := listExtNet.Data[0].ID
|
||||
bytes, err = client.CloudAPI().ExtNet().GetRaw(context.Background(), extnet.GetRequest{NetID: id})
|
||||
if err != nil {
|
||||
@@ -213,8 +225,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("FLIPGroup list", bytes, flipgroup.ListFLIPGroups{}, t)
|
||||
// Get
|
||||
listFG, _ := client.CloudAPI().FLIPGroup().List(context.Background(), flipgroup.ListRequest{})
|
||||
if len(listFG.Data) > 0 {
|
||||
listFG, err := client.CloudAPI().FLIPGroup().List(context.Background(), flipgroup.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.FLIPGroup.List failed: %v", err)
|
||||
} else if len(listFG.Data) > 0 {
|
||||
id := listFG.Data[0].ID
|
||||
bytes, err = client.CloudAPI().FLIPGroup().GetRaw(context.Background(), flipgroup.GetRequest{FLIPGroupID: id})
|
||||
if err != nil {
|
||||
@@ -233,8 +247,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Image list", bytes, image.ListImages{}, t)
|
||||
// Get
|
||||
listImg, _ := client.CloudAPI().Image().List(context.Background(), image.ListRequest{})
|
||||
if len(listImg.Data) > 0 {
|
||||
listImg, err := client.CloudAPI().Image().List(context.Background(), image.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.Image.List failed: %v", err)
|
||||
} else if len(listImg.Data) > 0 {
|
||||
id := listImg.Data[0].ID
|
||||
bytes, err = client.CloudAPI().Image().GetRaw(context.Background(), image.GetRequest{ImageID: id})
|
||||
if err != nil {
|
||||
@@ -253,8 +269,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("K8CI list", bytes, k8ci.ListK8CI{}, t)
|
||||
// Get
|
||||
listk8ci, _ := client.CloudAPI().K8CI().List(context.Background(), k8ci.ListRequest{})
|
||||
if len(listk8ci.Data) > 0 {
|
||||
listk8ci, err := client.CloudAPI().K8CI().List(context.Background(), k8ci.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.K8CI.List failed: %v", err)
|
||||
} else if len(listk8ci.Data) > 0 {
|
||||
id := listk8ci.Data[0].ID
|
||||
bytes, err = client.CloudAPI().K8CI().GetRaw(context.Background(), k8ci.GetRequest{K8CIID: id})
|
||||
if err != nil {
|
||||
@@ -273,8 +291,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("K8S list", bytes, k8s.ListK8SClusters{}, t)
|
||||
// Get
|
||||
listk8s, _ := client.CloudAPI().K8S().List(context.Background(), k8s.ListRequest{})
|
||||
if len(listk8s.Data) > 0 {
|
||||
listk8s, err := client.CloudAPI().K8S().List(context.Background(), k8s.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.K8S.List failed: %v", err)
|
||||
} else if len(listk8s.Data) > 0 {
|
||||
id := listk8s.Data[0].ID
|
||||
bytes, err = client.CloudAPI().K8S().GetRaw(context.Background(), k8s.GetRequest{K8SID: id})
|
||||
if err != nil {
|
||||
@@ -293,8 +313,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("LB list", bytes, lb.ListLB{}, t)
|
||||
// Get
|
||||
listLB, _ := client.CloudAPI().LB().List(context.Background(), lb.ListRequest{})
|
||||
if len(listLB.Data) > 0 {
|
||||
listLB, err := client.CloudAPI().LB().List(context.Background(), lb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.LB.List failed: %v", err)
|
||||
} else if len(listLB.Data) > 0 {
|
||||
id := listLB.Data[0].ID
|
||||
bytes, err = client.CloudAPI().LB().GetRaw(context.Background(), lb.GetRequest{LBID: id})
|
||||
if err != nil {
|
||||
@@ -321,8 +343,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("QoS policy list", bytes, qospolicy.ListQoSPolicies{}, t)
|
||||
// Get
|
||||
listQosPolicies, _ := client.CloudAPI().QoSPolicy().List(context.Background(), qospolicy.ListRequest{})
|
||||
if len(listQosPolicies.Data) > 0 {
|
||||
listQosPolicies, err := client.CloudAPI().QoSPolicy().List(context.Background(), qospolicy.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.QoSPolicy.List failed: %v", err)
|
||||
} else if len(listQosPolicies.Data) > 0 {
|
||||
id := listQosPolicies.Data[0].ID
|
||||
bytes, err = client.CloudAPI().QoSPolicy().GetRaw(context.Background(), qospolicy.GetRequest{QoSPolicyID: id})
|
||||
if err != nil {
|
||||
@@ -341,8 +365,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("RG list", bytes, rg.ListResourceGroups{}, t)
|
||||
// Get
|
||||
listRG, _ := client.CloudAPI().RG().List(context.Background(), rg.ListRequest{})
|
||||
if len(listRG.Data) > 0 {
|
||||
listRG, err := client.CloudAPI().RG().List(context.Background(), rg.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.RG.List failed: %v", err)
|
||||
} else if len(listRG.Data) > 0 {
|
||||
id := listRG.Data[0].ID
|
||||
bytes, err = client.CloudAPI().RG().GetRaw(context.Background(), rg.GetRequest{RGID: id})
|
||||
if err != nil {
|
||||
@@ -369,8 +395,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Storage policy list", bytes, stpolicy.ListStoragePolicies{}, t)
|
||||
// Get
|
||||
listStoragePolicies, _ := client.CloudAPI().StPolicy().List(context.Background(), stpolicy.ListRequest{})
|
||||
if len(listStoragePolicies.Data) > 0 {
|
||||
listStoragePolicies, err := client.CloudAPI().StPolicy().List(context.Background(), stpolicy.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.StPolicy.List failed: %v", err)
|
||||
} else if len(listStoragePolicies.Data) > 0 {
|
||||
id := listStoragePolicies.Data[0].ID
|
||||
bytes, err = client.CloudAPI().StPolicy().GetRaw(context.Background(), stpolicy.GetRequest{StoragePolicyID: id})
|
||||
if err != nil {
|
||||
@@ -389,8 +417,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Replication profile list", bytes, stpolicy.ListReplicationProfiles{}, t)
|
||||
// Get
|
||||
listReplicationProfiles, _ := client.CloudAPI().StPolicy().ListReplicationProfile(context.Background(), stpolicy.ListReplicationProfileRequest{})
|
||||
if len(listReplicationProfiles.Data) > 0 {
|
||||
listReplicationProfiles, err := client.CloudAPI().StPolicy().ListReplicationProfile(context.Background(), stpolicy.ListReplicationProfileRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.StPolicy.ListReplicationProfile failed: %v", err)
|
||||
} else if len(listReplicationProfiles.Data) > 0 {
|
||||
id := listReplicationProfiles.Data[0].ID
|
||||
bytes, err = client.CloudAPI().StPolicy().GetReplicationProfileRaw(context.Background(), stpolicy.GetReplicationProfileRequest{ProfileID: id})
|
||||
if err != nil {
|
||||
@@ -409,8 +439,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Security group list", bytes, secgroup.ListSecurityGroups{}, t)
|
||||
// Get
|
||||
listSecurityGroups, _ := client.CloudAPI().SecurityGroup().List(context.Background(), secgroup.ListRequest{})
|
||||
if len(listSecurityGroups.Data) > 0 {
|
||||
listSecurityGroups, err := client.CloudAPI().SecurityGroup().List(context.Background(), secgroup.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.SecurityGroup.List failed: %v", err)
|
||||
} else if len(listSecurityGroups.Data) > 0 {
|
||||
id := listSecurityGroups.Data[0].ID
|
||||
bytes, err = client.CloudAPI().SecurityGroup().GetRaw(context.Background(), secgroup.GetRequest{SecurityGroupID: id})
|
||||
if err != nil {
|
||||
@@ -429,8 +461,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Tasks list", bytes, tasks.ListTasks{}, t)
|
||||
// Get
|
||||
listTasks, _ := client.CloudAPI().Tasks().List(context.Background(), tasks.ListRequest{})
|
||||
if len(listTasks.Data) > 0 {
|
||||
listTasks, err := client.CloudAPI().Tasks().List(context.Background(), tasks.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.Tasks.List failed: %v", err)
|
||||
} else if len(listTasks.Data) > 0 {
|
||||
id := listTasks.Data[0].AuditID
|
||||
bytes, err = client.CloudAPI().Tasks().GetRaw(context.Background(), tasks.GetRequest{AuditID: id})
|
||||
if err != nil {
|
||||
@@ -449,8 +483,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Trunk list", bytes, trunk.ListTrunks{}, t)
|
||||
// Get
|
||||
listTrunk, _ := client.CloudAPI().Trunk().List(context.Background(), trunk.ListRequest{})
|
||||
if len(listTrunk.Data) > 0 {
|
||||
listTrunk, err := client.CloudAPI().Trunk().List(context.Background(), trunk.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.Trunk.List failed: %v", err)
|
||||
} else if len(listTrunk.Data) > 0 {
|
||||
id := listTrunk.Data[0].ID
|
||||
bytes, err = client.CloudAPI().Trunk().GetRaw(context.Background(), trunk.GetRequest{TrunkID: id})
|
||||
if err != nil {
|
||||
@@ -469,8 +505,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("VINS list", bytes, vins.ListVINS{}, t)
|
||||
// Get
|
||||
listVINS, _ := client.CloudAPI().VINS().List(context.Background(), vins.ListRequest{})
|
||||
if len(listVINS.Data) > 0 {
|
||||
listVINS, err := client.CloudAPI().VINS().List(context.Background(), vins.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.VINS.List failed: %v", err)
|
||||
} else if len(listVINS.Data) > 0 {
|
||||
id := listVINS.Data[0].ID
|
||||
bytes, err = client.CloudAPI().VINS().GetRaw(context.Background(), vins.GetRequest{VINSID: id})
|
||||
if err != nil {
|
||||
@@ -481,24 +519,31 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
t.Errorf("Can not test VINS get because VINS list is empty")
|
||||
}
|
||||
|
||||
// VM folder
|
||||
// List
|
||||
bytes, err = client.CloudAPI().VMFolder().ListRaw(context.Background(), vmfolder.ListRequest{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getResult("VM folder list", bytes, vmfolder.ListVMFolder{}, t)
|
||||
// Get
|
||||
listVMFolders, _ := client.CloudAPI().VMFolder().List(context.Background(), vmfolder.ListRequest{})
|
||||
if len(listVMFolders.Data) > 0 {
|
||||
id := listVMFolders.Data[0].ID
|
||||
bytes, err = client.CloudAPI().VMFolder().GetRaw(context.Background(), vmfolder.GetRequest{FolderID: id})
|
||||
// VM folder (list requires rg_id)
|
||||
if listRG == nil || len(listRG.Data) == 0 {
|
||||
t.Errorf("Can not test VM folder because VM folder list is empty")
|
||||
} else {
|
||||
rgID := listRG.Data[0].ID
|
||||
// List
|
||||
bytes, err = client.CloudAPI().VMFolder().ListRaw(context.Background(), vmfolder.ListRequest{RGID: rgID})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getResult("VM folder get", bytes, vmfolder.RecordVMFolder{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test VM folder get because VM folder list is empty")
|
||||
getResult("VM folder list", bytes, vmfolder.ListVMFolder{}, t)
|
||||
// Get
|
||||
listVMFolders, err := client.CloudAPI().VMFolder().List(context.Background(), vmfolder.ListRequest{RGID: rgID})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.VMFolder.List failed: %v", err)
|
||||
} else if len(listVMFolders.Data) > 0 {
|
||||
id := listVMFolders.Data[0].ID
|
||||
bytes, err = client.CloudAPI().VMFolder().GetRaw(context.Background(), vmfolder.GetRequest{FolderID: id})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getResult("VM folder get", bytes, vmfolder.RecordVMFolder{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test VM folder get because VM folder list is empty")
|
||||
}
|
||||
}
|
||||
|
||||
// VGPU
|
||||
@@ -517,8 +562,10 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Zone list", bytes, zone.ListZones{}, t)
|
||||
// Get
|
||||
ListZones, _ := client.CloudAPI().Zone().List(context.Background(), zone.ListRequest{})
|
||||
if len(ListZones.Data) > 0 {
|
||||
ListZones, err := client.CloudAPI().Zone().List(context.Background(), zone.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudAPI.Zone.List failed: %v", err)
|
||||
} else if len(ListZones.Data) > 0 {
|
||||
id := ListZones.Data[0].ID
|
||||
bytes, err = client.CloudAPI().Zone().GetRaw(context.Background(), zone.GetRequest{ID: id})
|
||||
if err != nil {
|
||||
@@ -549,8 +596,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Account list", bytes, account_cb.ListAccounts{}, t)
|
||||
// Get
|
||||
listAcc, _ := client.CloudBroker().Account().List(context.Background(), account_cb.ListRequest{})
|
||||
if len(listAcc.Data) > 0 {
|
||||
listAcc, err := client.CloudBroker().Account().List(context.Background(), account_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Account.List failed: %v", err)
|
||||
} else if len(listAcc.Data) > 0 {
|
||||
id := listAcc.Data[0].ID
|
||||
bytes, err = client.CloudBroker().Account().GetRaw(context.Background(), account_cb.GetRequest{AccountID: id})
|
||||
if err != nil {
|
||||
@@ -569,8 +618,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Audit list", bytes, audit_cb.ListAudits{}, t)
|
||||
// Get
|
||||
listAudits, _ := client.CloudBroker().Audit().List(context.Background(), audit_cb.ListRequest{})
|
||||
if len(listAudits.Data) > 0 {
|
||||
listAudits, err := client.CloudBroker().Audit().List(context.Background(), audit_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Audit.List failed: %v", err)
|
||||
} else if len(listAudits.Data) > 0 {
|
||||
id := listAudits.Data[0].GUID
|
||||
bytes, err = client.CloudBroker().Audit().GetRaw(context.Background(), audit_cb.GetRequest{AuditGuid: id})
|
||||
if err != nil {
|
||||
@@ -589,8 +640,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Bservice list", bytes, bservice_cb.ListBasicServices{}, t)
|
||||
// Get
|
||||
listBServ, _ := client.CloudBroker().BService().List(context.Background(), bservice_cb.ListRequest{})
|
||||
if len(listBServ.Data) > 0 {
|
||||
listBServ, err := client.CloudBroker().BService().List(context.Background(), bservice_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.BService.List failed: %v", err)
|
||||
} else if len(listBServ.Data) > 0 {
|
||||
id := listBServ.Data[0].ID
|
||||
bytes, err = client.CloudBroker().BService().GetRaw(context.Background(), bservice_cb.GetRequest{ServiceID: id})
|
||||
if err != nil {
|
||||
@@ -609,8 +662,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Compute list", bytes, compute_cb.ListComputes{}, t)
|
||||
// Get
|
||||
listComp, _ := client.CloudBroker().Compute().List(context.Background(), compute_cb.ListRequest{})
|
||||
if len(listComp.Data) > 0 {
|
||||
listComp, err := client.CloudBroker().Compute().List(context.Background(), compute_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Compute.List failed: %v", err)
|
||||
} else if len(listComp.Data) > 0 {
|
||||
id := listComp.Data[0].ID
|
||||
bytes, err = client.CloudBroker().Compute().GetRaw(context.Background(), compute_cb.GetRequest{ComputeID: id})
|
||||
if err != nil {
|
||||
@@ -635,8 +690,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Disk list", bytes, disks_cb.ListDisks{}, t)
|
||||
// Get
|
||||
listDisk, _ := client.CloudBroker().Disks().List(context.Background(), disks_cb.ListRequest{})
|
||||
if len(listDisk.Data) > 0 {
|
||||
listDisk, err := client.CloudBroker().Disks().List(context.Background(), disks_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Disks.List failed: %v", err)
|
||||
} else if len(listDisk.Data) > 0 {
|
||||
id := listDisk.Data[0].ID
|
||||
bytes, err = client.CloudBroker().Disks().GetRaw(context.Background(), disks_cb.GetRequest{DiskID: id})
|
||||
if err != nil {
|
||||
@@ -655,8 +712,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("ExtNet list", bytes, extnet_cb.ListExtNet{}, t)
|
||||
// Get
|
||||
listExtNet, _ := client.CloudBroker().ExtNet().List(context.Background(), extnet_cb.ListRequest{})
|
||||
if len(listExtNet.Data) > 0 {
|
||||
listExtNet, err := client.CloudBroker().ExtNet().List(context.Background(), extnet_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.ExtNet.List failed: %v", err)
|
||||
} else if len(listExtNet.Data) > 0 {
|
||||
id := listExtNet.Data[0].ID
|
||||
bytes, err = client.CloudBroker().ExtNet().GetRaw(context.Background(), extnet_cb.GetRequest{NetID: id})
|
||||
if err != nil {
|
||||
@@ -675,8 +734,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("FLIPGroup list", bytes, flipgroup_cb.ListFLIPGroups{}, t)
|
||||
// Get
|
||||
listFG, _ := client.CloudBroker().FLIPGroup().List(context.Background(), flipgroup_cb.ListRequest{})
|
||||
if len(listFG.Data) > 0 {
|
||||
listFG, err := client.CloudBroker().FLIPGroup().List(context.Background(), flipgroup_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.FLIPGroup.List failed: %v", err)
|
||||
} else if len(listFG.Data) > 0 {
|
||||
id := listFG.Data[0].ID
|
||||
bytes, err = client.CloudBroker().FLIPGroup().GetRaw(context.Background(), flipgroup_cb.GetRequest{FLIPGroupID: id})
|
||||
if err != nil {
|
||||
@@ -695,8 +756,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Grid list", bytes, grid_cb.ListGrids{}, t)
|
||||
// Get
|
||||
listGrid, _ := client.CloudBroker().Grid().List(context.Background(), grid_cb.ListRequest{})
|
||||
if len(listGrid.Data) > 0 {
|
||||
listGrid, err := client.CloudBroker().Grid().List(context.Background(), grid_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Grid.List failed: %v", err)
|
||||
} else if len(listGrid.Data) > 0 {
|
||||
id := listGrid.Data[0].ID
|
||||
bytes, err = client.CloudBroker().Grid().GetRaw(context.Background(), grid_cb.GetRequest{GID: id})
|
||||
if err != nil {
|
||||
@@ -715,8 +778,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Image list", bytes, image_cb.ListImages{}, t)
|
||||
// Get
|
||||
listImg, _ := client.CloudBroker().Image().List(context.Background(), image_cb.ListRequest{})
|
||||
if len(listImg.Data) > 0 {
|
||||
listImg, err := client.CloudBroker().Image().List(context.Background(), image_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Image.List failed: %v", err)
|
||||
} else if len(listImg.Data) > 0 {
|
||||
id := listImg.Data[0].ID
|
||||
bytes, err = client.CloudBroker().Image().GetRaw(context.Background(), image_cb.GetRequest{ImageID: id})
|
||||
if err != nil {
|
||||
@@ -735,8 +800,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("K8CI list", bytes, k8ci_cb.ListK8CI{}, t)
|
||||
// Get
|
||||
listk8ci, _ := client.CloudBroker().K8CI().List(context.Background(), k8ci_cb.ListRequest{})
|
||||
if len(listk8ci.Data) > 0 {
|
||||
listk8ci, err := client.CloudBroker().K8CI().List(context.Background(), k8ci_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.K8CI.List failed: %v", err)
|
||||
} else if len(listk8ci.Data) > 0 {
|
||||
id := listk8ci.Data[0].ID
|
||||
bytes, err = client.CloudBroker().K8CI().GetRaw(context.Background(), k8ci_cb.GetRequest{K8CIID: id})
|
||||
if err != nil {
|
||||
@@ -755,8 +822,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("K8S list", bytes, k8s_cb.ListK8S{}, t)
|
||||
// Get
|
||||
listk8s, _ := client.CloudBroker().K8S().List(context.Background(), k8s_cb.ListRequest{})
|
||||
if len(listk8s.Data) > 0 {
|
||||
listk8s, err := client.CloudBroker().K8S().List(context.Background(), k8s_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.K8S.List failed: %v", err)
|
||||
} else if len(listk8s.Data) > 0 {
|
||||
id := listk8s.Data[0].ID
|
||||
bytes, err = client.CloudBroker().K8S().GetRaw(context.Background(), k8s_cb.GetRequest{K8SID: id})
|
||||
if err != nil {
|
||||
@@ -775,8 +844,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("LB list", bytes, lb_cb.ListLB{}, t)
|
||||
// Get
|
||||
listLB, _ := client.CloudBroker().LB().List(context.Background(), lb_cb.ListRequest{})
|
||||
if len(listLB.Data) > 0 {
|
||||
listLB, err := client.CloudBroker().LB().List(context.Background(), lb_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.LB.List failed: %v", err)
|
||||
} else if len(listLB.Data) > 0 {
|
||||
id := listLB.Data[0].ID
|
||||
bytes, err = client.CloudBroker().LB().GetRaw(context.Background(), lb_cb.GetRequest{LBID: id})
|
||||
if err != nil {
|
||||
@@ -795,8 +866,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Node list", bytes, node_cb.ListNodes{}, t)
|
||||
// Get
|
||||
listNode, _ := client.CloudBroker().Node().List(context.Background(), node_cb.ListRequest{})
|
||||
if listNode != nil && len(listNode.Data) > 0 {
|
||||
listNode, err := client.CloudBroker().Node().List(context.Background(), node_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Node.List failed: %v", err)
|
||||
} else if listNode != nil && len(listNode.Data) > 0 {
|
||||
id := listNode.Data[0].ID
|
||||
bytes, err = client.CloudBroker().Node().GetRaw(context.Background(), node_cb.GetRequest{NID: id})
|
||||
if err != nil {
|
||||
@@ -841,8 +914,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("QoS policy list", bytes, qospolicy_cb.ListQoSPolicies{}, t)
|
||||
// Get
|
||||
listQosPolicies, _ := client.CloudBroker().QoSPolicy().List(context.Background(), qospolicy_cb.ListRequest{})
|
||||
if len(listQosPolicies.Data) > 0 {
|
||||
listQosPolicies, err := client.CloudBroker().QoSPolicy().List(context.Background(), qospolicy_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.QoSPolicy.List failed: %v", err)
|
||||
} else if len(listQosPolicies.Data) > 0 {
|
||||
id := listQosPolicies.Data[0].ID
|
||||
bytes, err = client.CloudBroker().QoSPolicy().GetRaw(context.Background(), qospolicy_cb.GetRequest{QoSPolicyID: id})
|
||||
if err != nil {
|
||||
@@ -861,8 +936,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("RG list", bytes, rg_cb.ListRG{}, t)
|
||||
// Get
|
||||
listRG, _ := client.CloudBroker().RG().List(context.Background(), rg_cb.ListRequest{})
|
||||
if len(listRG.Data) > 0 {
|
||||
listRG, err := client.CloudBroker().RG().List(context.Background(), rg_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.RG.List failed: %v", err)
|
||||
} else if len(listRG.Data) > 0 {
|
||||
id := listRG.Data[0].ID
|
||||
bytes, err = client.CloudBroker().RG().GetRaw(context.Background(), rg_cb.GetRequest{RGID: id})
|
||||
if err != nil {
|
||||
@@ -881,8 +958,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Security group list", bytes, secgroup_cb.ListSecurityGroups{}, t)
|
||||
// Get
|
||||
listSecurityGroups, _ := client.CloudBroker().SecurityGroup().List(context.Background(), secgroup_cb.ListRequest{})
|
||||
if len(listSecurityGroups.Data) > 0 {
|
||||
listSecurityGroups, err := client.CloudBroker().SecurityGroup().List(context.Background(), secgroup_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.SecurityGroup.List failed: %v", err)
|
||||
} else if len(listSecurityGroups.Data) > 0 {
|
||||
id := listSecurityGroups.Data[0].ID
|
||||
bytes, err = client.CloudBroker().SecurityGroup().GetRaw(context.Background(), secgroup_cb.GetRequest{SecurityGroupID: id})
|
||||
if err != nil {
|
||||
@@ -901,8 +980,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("SEP list", bytes, sep_cb.ListSEP{}, t)
|
||||
// Get
|
||||
listSEP, _ := client.CloudBroker().SEP().List(context.Background(), sep_cb.ListRequest{})
|
||||
if len(listSEP.Data) > 0 {
|
||||
listSEP, err := client.CloudBroker().SEP().List(context.Background(), sep_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.SEP.List failed: %v", err)
|
||||
} else if len(listSEP.Data) > 0 {
|
||||
id := listSEP.Data[0].ID
|
||||
bytes, err = client.CloudBroker().SEP().GetRaw(context.Background(), sep_cb.GetRequest{SEPID: id})
|
||||
if err != nil {
|
||||
@@ -927,8 +1008,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Storage policy list", bytes, stpolicy_cb.ListStoragePolicies{}, t)
|
||||
// Get
|
||||
listStoragePolicies, _ := client.CloudBroker().StPolicy().List(context.Background(), stpolicy_cb.ListRequest{})
|
||||
if len(listStoragePolicies.Data) > 0 {
|
||||
listStoragePolicies, err := client.CloudBroker().StPolicy().List(context.Background(), stpolicy_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.StPolicy.List failed: %v", err)
|
||||
} else if len(listStoragePolicies.Data) > 0 {
|
||||
id := listStoragePolicies.Data[0].ID
|
||||
bytes, err = client.CloudBroker().StPolicy().GetRaw(context.Background(), stpolicy_cb.GetRequest{StoragePolicyID: id})
|
||||
if err != nil {
|
||||
@@ -947,8 +1030,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Replication profile list", bytes, stpolicy_cb.ListReplicationProfiles{}, t)
|
||||
// Get
|
||||
listReplicationProfiles, _ := client.CloudBroker().StPolicy().ListReplicationProfile(context.Background(), stpolicy_cb.ListReplicationProfileRequest{})
|
||||
if len(listReplicationProfiles.Data) > 0 {
|
||||
listReplicationProfiles, err := client.CloudBroker().StPolicy().ListReplicationProfile(context.Background(), stpolicy_cb.ListReplicationProfileRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.StPolicy.ListReplicationProfile failed: %v", err)
|
||||
} else if len(listReplicationProfiles.Data) > 0 {
|
||||
id := listReplicationProfiles.Data[0].ID
|
||||
bytes, err = client.CloudBroker().StPolicy().GetReplicationProfileRaw(context.Background(), stpolicy_cb.GetReplicationProfileRequest{ProfileID: id})
|
||||
if err != nil {
|
||||
@@ -975,8 +1060,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Trunk list", bytes, trunk_cb.ListTrunks{}, t)
|
||||
// Get
|
||||
listTrunks, _ := client.CloudBroker().Trunk().List(context.Background(), trunk_cb.ListRequest{})
|
||||
if len(listTrunks.Data) > 0 {
|
||||
listTrunks, err := client.CloudBroker().Trunk().List(context.Background(), trunk_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Trunk.List failed: %v", err)
|
||||
} else if len(listTrunks.Data) > 0 {
|
||||
id := listTrunks.Data[0].ID
|
||||
bytes, err = client.CloudBroker().Trunk().GetRaw(context.Background(), trunk_cb.GetRequest{TrunkID: id})
|
||||
if err != nil {
|
||||
@@ -995,8 +1082,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("VINS list", bytes, vins_cb.ListVINS{}, t)
|
||||
// Get
|
||||
listVINS, _ := client.CloudBroker().VINS().List(context.Background(), vins_cb.ListRequest{})
|
||||
if len(listVINS.Data) > 0 {
|
||||
listVINS, err := client.CloudBroker().VINS().List(context.Background(), vins_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.VINS.List failed: %v", err)
|
||||
} else if len(listVINS.Data) > 0 {
|
||||
id := listVINS.Data[0].ID
|
||||
bytes, err = client.CloudBroker().VINS().GetRaw(context.Background(), vins_cb.GetRequest{VINSID: id})
|
||||
if err != nil {
|
||||
@@ -1007,24 +1096,31 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
t.Errorf("Can not test VINS get because VINS list is empty")
|
||||
}
|
||||
|
||||
// VM folder
|
||||
// List
|
||||
bytes, err = client.CloudBroker().VMFolder().ListRaw(context.Background(), vmfolder_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getResult("VM folder list", bytes, vmfolder_cb.ListVMFolder{}, t)
|
||||
// Get
|
||||
listVMFolders, _ := client.CloudBroker().VMFolder().List(context.Background(), vmfolder_cb.ListRequest{})
|
||||
if len(listVMFolders.Data) > 0 {
|
||||
id := listVMFolders.Data[0].ID
|
||||
bytes, err = client.CloudBroker().VMFolder().GetRaw(context.Background(), vmfolder_cb.GetRequest{FolderID: id})
|
||||
// VM folder (list requires rg_id)
|
||||
if listRG == nil || len(listRG.Data) == 0 {
|
||||
t.Errorf("Can not test VM folder because VM folder list is empty")
|
||||
} else {
|
||||
rgID := listRG.Data[0].ID
|
||||
// List
|
||||
bytes, err = client.CloudBroker().VMFolder().ListRaw(context.Background(), vmfolder_cb.ListRequest{RGID: rgID})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getResult("VM folder get", bytes, vmfolder_cb.RecordVMFolder{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test VM folder get because VM folder list is empty")
|
||||
getResult("VM folder list", bytes, vmfolder_cb.ListVMFolder{}, t)
|
||||
// Get
|
||||
listVMFolders, err := client.CloudBroker().VMFolder().List(context.Background(), vmfolder_cb.ListRequest{RGID: rgID})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.VMFolder.List failed: %v", err)
|
||||
} else if len(listVMFolders.Data) > 0 {
|
||||
id := listVMFolders.Data[0].ID
|
||||
bytes, err = client.CloudBroker().VMFolder().GetRaw(context.Background(), vmfolder_cb.GetRequest{FolderID: id})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getResult("VM folder get", bytes, vmfolder_cb.RecordVMFolder{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test VM folder get because VM folder list is empty")
|
||||
}
|
||||
}
|
||||
|
||||
// Zone
|
||||
@@ -1035,8 +1131,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
}
|
||||
getResult("Zone list", bytes, zone.ListZones{}, t)
|
||||
// Get
|
||||
ListZones, _ := client.CloudBroker().Zone().List(context.Background(), zone_cb.ListRequest{})
|
||||
if len(ListZones.Data) > 0 {
|
||||
ListZones, err := client.CloudBroker().Zone().List(context.Background(), zone_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because CloudBroker.Zone.List failed: %v", err)
|
||||
} else if len(ListZones.Data) > 0 {
|
||||
id := ListZones.Data[0].ID
|
||||
bytes, err = client.CloudBroker().Zone().GetRaw(context.Background(), zone_cb.GetRequest{ID: id})
|
||||
if err != nil {
|
||||
@@ -1082,8 +1180,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
|
||||
// Users AccessGroups
|
||||
// list
|
||||
listGroups, _ := client.SDN().AccessGroups().List(context.Background(), acsgroups.ListGroupsRequest{})
|
||||
if len(listGroups.AccessGroups) > 0 {
|
||||
listGroups, err := client.SDN().AccessGroups().List(context.Background(), acsgroups.ListGroupsRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.AccessGroups.List failed: %v", err)
|
||||
} else if len(listGroups.AccessGroups) > 0 {
|
||||
id := listGroups.AccessGroups[0].ID
|
||||
bytes, err = client.SDN().AccessGroups().UserListRaw(context.Background(), acsgroups.UsersListRequest{AccessGroupID: id})
|
||||
if err != nil {
|
||||
@@ -1111,8 +1211,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Address pools list", bytes, adrspools.AddressPoolsList{}, t)
|
||||
// Get
|
||||
listStoragePolicies, _ := client.SDN().AddressPools().List(context.Background(), adrspools.ListAddressPoolsRequest{})
|
||||
if len(listStoragePolicies.Pools) > 0 {
|
||||
listStoragePolicies, err := client.SDN().AddressPools().List(context.Background(), adrspools.ListAddressPoolsRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.AddressPools.List failed: %v", err)
|
||||
} else if len(listStoragePolicies.Pools) > 0 {
|
||||
id := listStoragePolicies.Pools[0].ID
|
||||
bytes, err = client.SDN().AddressPools().GetRaw(context.Background(), adrspools.GetRequest{ID: id})
|
||||
if err != nil {
|
||||
@@ -1131,8 +1233,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Security policies list", bytes, secpolicies.SecurityPolicyList{}, t)
|
||||
// Get
|
||||
listPolicies, _ := client.SDN().SecurityPolicies().List(context.Background(), secpolicies.ListRequest{})
|
||||
if len(listPolicies) > 0 {
|
||||
listPolicies, err := client.SDN().SecurityPolicies().List(context.Background(), secpolicies.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.SecurityPolicies.List failed: %v", err)
|
||||
} else if len(listPolicies) > 0 {
|
||||
id := listPolicies[0].ID
|
||||
bytes, err = client.SDN().SecurityPolicies().GetRaw(context.Background(), secpolicies.GetRequest{ID: id})
|
||||
if err != nil {
|
||||
@@ -1150,8 +1254,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Security policy rule list", bytes, rule.SecurityRulesList{}, t)
|
||||
// Get
|
||||
listRules, _ := client.SDN().SecurityPolicies().Rule().List(context.Background(), rule.ListRequest{})
|
||||
if len(listRules) > 0 {
|
||||
listRules, err := client.SDN().SecurityPolicies().Rule().List(context.Background(), rule.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.SecurityPolicies.Rule.List failed: %v", err)
|
||||
} else if len(listRules) > 0 {
|
||||
id := listRules[0].ID
|
||||
securityPolicyID := listRules[0].SecurityPolicyID
|
||||
bytes, err = client.SDN().SecurityPolicies().Rule().GetRaw(context.Background(), rule.GetRequest{
|
||||
@@ -1173,8 +1279,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("ExtNet list", bytes, extnet_sdn.ListExtNet{}, t)
|
||||
// Get
|
||||
listExtNet, _ := client.SDN().ExtNet().List(context.Background(), extnet_sdn.ListRequest{})
|
||||
if len(listExtNet) > 0 {
|
||||
listExtNet, err := client.SDN().ExtNet().List(context.Background(), extnet_sdn.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.ExtNet.List failed: %v", err)
|
||||
} else if len(listExtNet) > 0 {
|
||||
id := listExtNet[0].ID
|
||||
bytes, err = client.SDN().ExtNet().GetRaw(context.Background(), extnet_sdn.GetRequest{ExtNetID: id})
|
||||
if err != nil {
|
||||
@@ -1193,8 +1301,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("NetObjGroup list", bytes, netobjgroups.NetObjGroupList{}, t)
|
||||
// Get
|
||||
listNetObjGroups, _ := client.SDN().NetworkObjectGroups().List(context.Background(), netobjgroups.ListRequest{})
|
||||
if len(listNetObjGroups.Objects) > 0 {
|
||||
listNetObjGroups, err := client.SDN().NetworkObjectGroups().List(context.Background(), netobjgroups.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.NetworkObjectGroups.List failed: %v", err)
|
||||
} else if len(listNetObjGroups.Objects) > 0 {
|
||||
id := listNetObjGroups.Objects[0].ID
|
||||
bytes, err = client.SDN().NetworkObjectGroups().GetRaw(context.Background(), netobjgroups.GetRequest{NetObjGroupID: id})
|
||||
if err != nil {
|
||||
@@ -1213,8 +1323,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Segments list", bytes, segments.ListSegment{}, t)
|
||||
// Get
|
||||
listSegments, _ := client.SDN().Segments().List(context.Background(), segments.ListRequest{})
|
||||
if len(listSegments) > 0 {
|
||||
listSegments, err := client.SDN().Segments().List(context.Background(), segments.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.Segments.List failed: %v", err)
|
||||
} else if len(listSegments) > 0 {
|
||||
id := listSegments[0].ID
|
||||
bytes, err = client.SDN().Segments().GetRaw(context.Background(), segments.GetRequest{SegmentID: id})
|
||||
if err != nil {
|
||||
@@ -1233,8 +1345,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Hypervisors list", bytes, hypervisors.HypervisorsList{}, t)
|
||||
// Get
|
||||
listHypervisors, _ := client.SDN().Hypervisors().List(context.Background(), hypervisors.ListRequest{})
|
||||
if len(listHypervisors) > 0 {
|
||||
listHypervisors, err := client.SDN().Hypervisors().List(context.Background(), hypervisors.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.Hypervisors.List failed: %v", err)
|
||||
} else if len(listHypervisors) > 0 {
|
||||
id := listHypervisors[0].Name
|
||||
bytes, err = client.SDN().Hypervisors().GetRaw(context.Background(), hypervisors.GetRequest{Name: id})
|
||||
if err != nil {
|
||||
@@ -1253,8 +1367,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("FloatingIPs list", bytes, flips.FloatingIPsList{}, t)
|
||||
// Get
|
||||
listFloatingIPs, _ := client.SDN().FloatingIPs().List(context.Background(), flips.ListRequest{})
|
||||
if len(listFloatingIPs.Objects) > 0 {
|
||||
listFloatingIPs, err := client.SDN().FloatingIPs().List(context.Background(), flips.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.FloatingIPs.List failed: %v", err)
|
||||
} else if len(listFloatingIPs.Objects) > 0 {
|
||||
id := listFloatingIPs.Objects[0].ID
|
||||
bytes, err = client.SDN().FloatingIPs().GetRaw(context.Background(), flips.GetRequest{FloatingIPID: id})
|
||||
if err != nil {
|
||||
@@ -1273,8 +1389,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Logical ports list", bytes, logicalports.LogicalPortsList{}, t)
|
||||
// Get
|
||||
listLP, _ := client.SDN().LogicalPorts().List(context.Background(), logicalports.ListRequest{})
|
||||
if len(listLP.Ports) > 0 {
|
||||
listLP, err := client.SDN().LogicalPorts().List(context.Background(), logicalports.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.LogicalPorts.List failed: %v", err)
|
||||
} else if len(listLP.Ports) > 0 {
|
||||
id := listStoragePolicies.Pools[0].ID
|
||||
bytes, err = client.SDN().LogicalPorts().GetRaw(context.Background(), logicalports.GetRequest{ID: id})
|
||||
if err != nil {
|
||||
@@ -1293,8 +1411,10 @@ func TestGetListSDNAPI(t *testing.T) {
|
||||
}
|
||||
getResult("Routers list", bytes, routers.RoutersList{}, t)
|
||||
// Get
|
||||
routerList, _ := client.SDN().Routers().List(context.Background(), routers.ListRequest{})
|
||||
if len(routerList) > 0 {
|
||||
routerList, err := client.SDN().Routers().List(context.Background(), routers.ListRequest{})
|
||||
if err != nil {
|
||||
t.Errorf("Can not test get because SDN.Routers.List failed: %v", err)
|
||||
} else if len(routerList) > 0 {
|
||||
id := routerList[0].ID
|
||||
bytes, err = client.SDN().Routers().GetRaw(context.Background(), routers.GetRequest{ID: id})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user