forked from gophercloud/gophercloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
70 lines (51 loc) · 1.74 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
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, hypervisorID).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", hypervisor)
Example of Show Hypervisor Details with Compute API microversion greater than 2.53
hypervisorID := "c48f6247-abe4-4a24-824e-ea39e108874f"
hypervisor, err := hypervisors.Get(computeClient, hypervisorID).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 Hypervisors 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)
Example of Show Hypervisor Uptime with Compute API microversion greater than 2.53
hypervisorID := "c48f6247-abe4-4a24-824e-ea39e108874f"
hypervisorUptime, err := hypervisors.GetUptime(computeClient, hypervisorID).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", hypervisorUptime)
*/
package hypervisors