github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/lbaas/pools/doc.go (about) 1 /* 2 Package pools provides information and interaction with the Pools of the 3 Load Balancing as a Service extension for the OpenStack Networking service. 4 5 Example to List Pools 6 7 listOpts := pools.ListOpts{ 8 SubnetID: "d9bd223b-f1a9-4f98-953b-df977b0f902d", 9 } 10 11 allPages, err := pools.List(networkClient, listOpts).AllPages() 12 if err != nil { 13 panic(err) 14 } 15 16 allPools, err := pools.ExtractPools(allPages) 17 if err != nil { 18 panic(err) 19 } 20 21 for _, pool := range allPools { 22 fmt.Printf("%+v\n", pool) 23 } 24 25 Example to Create a Pool 26 27 createOpts := pools.CreateOpts{ 28 LBMethod: pools.LBMethodRoundRobin, 29 Protocol: "HTTP", 30 Name: "Example pool", 31 SubnetID: "1981f108-3c48-48d2-b908-30f7d28532c9", 32 Provider: "haproxy", 33 } 34 35 pool, err := pools.Create(networkClient, createOpts).Extract() 36 if err != nil { 37 panic(err) 38 } 39 40 Example to Update a Pool 41 42 poolID := "166db5e6-c72a-4d77-8776-3573e27ae271" 43 44 updateOpts := pools.UpdateOpts{ 45 LBMethod: pools.LBMethodLeastConnections, 46 } 47 48 pool, err := pools.Update(networkClient, poolID, updateOpts).Extract() 49 if err != nil { 50 panic(err) 51 } 52 53 Example to Delete a Pool 54 55 poolID := "166db5e6-c72a-4d77-8776-3573e27ae271" 56 err := pools.Delete(networkClient, poolID).ExtractErr() 57 if err != nil { 58 panic(err) 59 } 60 61 Example to Associate a Monitor to a Pool 62 63 poolID := "166db5e6-c72a-4d77-8776-3573e27ae271" 64 monitorID := "8bbfbe1c-6faa-4d97-abdb-0df6c90df70b" 65 66 pool, err := pools.AssociateMonitor(networkClient, poolID, monitorID).Extract() 67 if err != nil { 68 panic(err) 69 } 70 71 Example to Disassociate a Monitor from a Pool 72 73 poolID := "166db5e6-c72a-4d77-8776-3573e27ae271" 74 monitorID := "8bbfbe1c-6faa-4d97-abdb-0df6c90df70b" 75 76 pool, err := pools.DisassociateMonitor(networkClient, poolID, monitorID).Extract() 77 if err != nil { 78 panic(err) 79 } 80 */ 81 package pools