forked from huaweicloud/huaweicloud-sdk-go
/
doc.go
51 lines (37 loc) · 1.12 KB
/
doc.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
/*
Package hypervisors returns details about list of hypervisors, shows details for a hypervisor
and shows summary statistics for all hypervisors over all compute nodes in the OpenStack cloud.
Example of Show Hypervisor Details
hypervisorID := 42
hypervisor, err := hypervisors.Get(computeClient, 42).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", hypervisor)
Example of Retrieving Details of All Hypervisors
allPages, err := hypervisors.List(computeClient).AllPages()
if err != nil {
panic(err)
}
allHypervisors, err := hypervisors.ExtractHypervisors(allPages)
if err != nil {
panic(err)
}
for _, hypervisor := range allHypervisors {
fmt.Printf("%+v\n", hypervisor)
}
Example of Show Hypervisor Statistics
hypervisorsStatistics, err := hypervisors.GetStatistics(computeClient).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", hypervisorsStatistics)
Example of Show Hypervisor Uptime
hypervisorID := 42
hypervisorUptime, err := hypervisors.GetUptime(computeClient, hypervisorID).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", hypervisorUptime)
*/
package hypervisors