forked from gophercloud/gophercloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
74 lines (56 loc) · 1.37 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
/*
Package nodes provides information and interaction with the nodes through
the OpenStack Clustering service.
Example to Create a Node
opts := nodes.CreateOpts{
ClusterID: "e395be1e-8d8e-43bb-bd6c-943eccf76a6d",
Metadata: map[string]interface{}{},
Name: "node-e395be1e-002",
ProfileID: "d8a48377-f6a3-4af4-bbbb-6e8bcaa0cbc0",
Role: "",
}
node, err := nodes.Create(serviceClient, opts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("node", node)
Example to List Nodes
listOpts := nodes.ListOpts{
Name: "testnode",
}
allPages, err := nodes.List(serviceClient, listOpts).AllPages()
if err != nil {
panic(err)
}
allNodes, err := nodes.ExtractNodes(allPages)
if err != nil {
panic(err)
}
for _, node := range allNodes {
fmt.Printf("%+v\n", node)
}
Example to Update a Node
opts := nodes.UpdateOpts{
Name: "new-node-name",
}
nodeID := "82fe28e0-9fcb-42ca-a2fa-6eb7dddd75a1"
node, err := nodes.Update(serviceClient, nodeID, opts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", node)
Example to Delete a Node
nodeID := "6dc6d336e3fc4c0a951b5698cd1236ee"
err := nodes.Delete(serviceClient, nodeID).ExtractErr()
if err != nil {
panic(err)
}
Example to Get a Node
nodeID := "node123"
node, err := nodes.Get(serviceClient, nodeID).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", node)
*/
package nodes