github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/lbaas/members/doc.go (about) 1 /* 2 Package members provides information and interaction with Members of the 3 Load Balancer as a Service extension for the OpenStack Networking service. 4 5 Example to List Members 6 7 listOpts := members.ListOpts{ 8 ProtocolPort: 80, 9 } 10 11 allPages, err := members.List(networkClient, listOpts).AllPages() 12 if err != nil { 13 panic(err) 14 } 15 16 allMembers, err := members.ExtractMembers(allPages) 17 if err != nil { 18 panic(err) 19 } 20 21 for _, member := range allMembers { 22 fmt.Printf("%+v\n", member) 23 } 24 25 Example to Create a Member 26 27 createOpts := members.CreateOpts{ 28 Address: "192.168.2.14", 29 ProtocolPort: 80, 30 PoolID: "0b266a12-0fdf-4434-bd11-649d84e54bd5" 31 } 32 33 member, err := members.Create(networkClient, createOpts).Extract() 34 if err != nil { 35 panic(err) 36 } 37 38 Example to Update a Member 39 40 memberID := "46592c54-03f7-40ef-9cdf-b1fcf2775ddf" 41 42 updateOpts := members.UpdateOpts{ 43 AdminStateUp: golangsdk.Disabled, 44 } 45 46 member, err := members.Update(networkClient, memberID, updateOpts).Extract() 47 if err != nil { 48 panic(err) 49 } 50 51 Example to Delete a Member 52 53 memberID := "46592c54-03f7-40ef-9cdf-b1fcf2775ddf" 54 err := members.Delete(networkClient, memberID).ExtractErr() 55 if err != nil { 56 panic(err) 57 } 58 */ 59 package members