forked from mindjiver/gopherstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvolume.go
54 lines (48 loc) · 2.03 KB
/
volume.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package gopherstack
import (
"net/url"
)
// List volumes for Virtual Machine by it's ID
func (c CloudstackClient) ListVolumes(vmid string) (ListVolumesResponse, error) {
var resp ListVolumesResponse
params := url.Values{}
params.Set("virtualmachineid", vmid)
response, err := NewRequest(c, "listVolumes", params)
if err != nil {
return resp, err
}
resp = response.(ListVolumesResponse)
return resp, err
}
type Volume struct {
Account string `json:"account"`
Created string `json:"created"`
Destroyed bool `json:"destroyed"`
Deviceid float64 `json:"deviceid"`
Domain string `json:"domain"`
Domainid string `json:"domainid"`
ID string `json:"id"`
Isextractable bool `json:"isextractable"`
Name string `json:"name"`
Serviceofferingdisplaytext string `json:"serviceofferingdisplaytext"`
Serviceofferingid string `json:"serviceofferingid"`
Serviceofferingname string `json:"serviceofferingname"`
Size float64 `json:"size"`
State string `json:"state"`
Storage string `json:"storage"`
Storagetype string `json:"storagetype"`
Tags []interface{} `json:"tags"`
Type string `json:"type"`
Virtualmachineid string `json:"virtualmachineid"`
Vmdisplayname string `json:"vmdisplayname"`
Vmname string `json:"vmname"`
Vmstate string `json:"vmstate"`
Zoneid string `json:"zoneid"`
Zonename string `json:"zonename"`
}
type ListVolumesResponse struct {
Listvolumesresponse struct {
Count float64 `json:"count"`
Volume []Volume `json:"volume"`
} `json:"listvolumesresponse"`
}