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 (81 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download | duplicates (3)
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
/*
Package pools provides information and interaction with the Pools of the
Load Balancing as a Service extension for the OpenStack Networking service.

Example to List Pools

	listOpts := pools.ListOpts{
		SubnetID: "d9bd223b-f1a9-4f98-953b-df977b0f902d",
	}

	allPages, err := pools.List(networkClient, listOpts).AllPages()
	if err != nil {
		panic(err)
	}

	allPools, err := pools.ExtractPools(allPages)
	if err != nil {
		panic(err)
	}

	for _, pool := range allPools {
		fmt.Printf("%+v\n", pool)
	}

Example to Create a Pool

	createOpts := pools.CreateOpts{
		LBMethod: pools.LBMethodRoundRobin,
		Protocol: "HTTP",
		Name:     "Example pool",
		SubnetID: "1981f108-3c48-48d2-b908-30f7d28532c9",
		Provider: "haproxy",
	}

	pool, err := pools.Create(networkClient, createOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Update a Pool

	poolID := "166db5e6-c72a-4d77-8776-3573e27ae271"

	updateOpts := pools.UpdateOpts{
		LBMethod: pools.LBMethodLeastConnections,
	}

	pool, err := pools.Update(networkClient, poolID, updateOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Delete a Pool

	poolID := "166db5e6-c72a-4d77-8776-3573e27ae271"
	err := pools.Delete(networkClient, poolID).ExtractErr()
	if err != nil {
		panic(err)
	}

Example to Associate a Monitor to a Pool

	poolID := "166db5e6-c72a-4d77-8776-3573e27ae271"
	monitorID := "8bbfbe1c-6faa-4d97-abdb-0df6c90df70b"

	pool, err := pools.AssociateMonitor(networkClient, poolID, monitorID).Extract()
	if err != nil {
		panic(err)
	}

Example to Disassociate a Monitor from a Pool

	poolID := "166db5e6-c72a-4d77-8776-3573e27ae271"
	monitorID := "8bbfbe1c-6faa-4d97-abdb-0df6c90df70b"

	pool, err := pools.DisassociateMonitor(networkClient, poolID, monitorID).Extract()
	if err != nil {
		panic(err)
	}
*/
package pools