File: doc.go

package info (click to toggle)
golang-github-gophercloud-gophercloud 0.0~git20180917.45f1c769-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,768 kB
  • sloc: sh: 98; makefile: 14
file content (74 lines) | stat: -rw-r--r-- 1,407 bytes parent folder | download
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