forked from gophercloud/gophercloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
105 lines (81 loc) · 2.07 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
Package aggregates manages information about the host aggregates in the
OpenStack cloud.
Example of Create Aggregate
opts := aggregates.CreateOpts{
Name: "name",
AvailabilityZone: "london",
}
aggregate, err := aggregates.Create(computeClient, opts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", aggregate)
Example of Show Aggregate Details
aggregateID := 42
aggregate, err := aggregates.Get(computeClient, aggregateID).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", aggregate)
Example of Delete Aggregate
aggregateID := 32
err := aggregates.Delete(computeClient, aggregateID).ExtractErr()
if err != nil {
panic(err)
}
Example of Update Aggregate
aggregateID := 42
opts := aggregates.UpdateOpts{
Name: "new_name",
AvailabilityZone: "nova2",
}
aggregate, err := aggregates.Update(computeClient, aggregateID, opts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", aggregate)
Example of Retrieving list of all aggregates
allPages, err := aggregates.List(computeClient).AllPages()
if err != nil {
panic(err)
}
allAggregates, err := aggregates.ExtractAggregates(allPages)
if err != nil {
panic(err)
}
for _, aggregate := range allAggregates {
fmt.Printf("%+v\n", aggregate)
}
Example of Add Host
aggregateID := 22
opts := aggregates.AddHostOpts{
Host: "newhost-cmp1",
}
aggregate, err := aggregates.AddHost(computeClient, aggregateID, opts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", aggregate)
Example of Remove Host
aggregateID := 22
opts := aggregates.RemoveHostOpts{
Host: "newhost-cmp1",
}
aggregate, err := aggregates.RemoveHost(computeClient, aggregateID, opts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", aggregate)
Example of Create or Update Metadata
aggregateID := 22
opts := aggregates.SetMetadata{
Metadata: map[string]string{"key": "value"},
}
aggregate, err := aggregates.SetMetadata(computeClient, aggregateID, opts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", aggregate)
*/
package aggregates