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 (71 lines) | stat: -rw-r--r-- 1,591 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
/*
Package loadbalancers provides information and interaction with Load Balancers
of the LBaaS v2 extension for the OpenStack Networking service.

Example to List Load Balancers

	listOpts := loadbalancers.ListOpts{
		Provider: "haproxy",
	}

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

	allLoadbalancers, err := loadbalancers.ExtractLoadBalancers(allPages)
	if err != nil {
		panic(err)
	}

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

Example to Create a Load Balancer

	createOpts := loadbalancers.CreateOpts{
		Name:         "db_lb",
		AdminStateUp: gophercloud.Enabled,
		VipSubnetID:  "9cedb85d-0759-4898-8a4b-fa5a5ea10086",
		VipAddress:   "10.30.176.48",
		Flavor:       "medium",
		Provider:     "haproxy",
	}

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

Example to Update a Load Balancer

	lbID := "d67d56a6-4a86-4688-a282-f46444705c64"

	i1001 := 1001
	updateOpts := loadbalancers.UpdateOpts{
		Name: "new-name",
	}

	lb, err := loadbalancers.Update(networkClient, lbID, updateOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Delete a Load Balancers

	lbID := "d67d56a6-4a86-4688-a282-f46444705c64"
	err := loadbalancers.Delete(networkClient, lbID).ExtractErr()
	if err != nil {
		panic(err)
	}

Example to Get the Status of a Load Balancer

	lbID := "d67d56a6-4a86-4688-a282-f46444705c64"
	status, err := loadbalancers.GetStatuses(networkClient, LBID).Extract()
	if err != nil {
		panic(err)
	}
*/
package loadbalancers