github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/lbaas/vips/doc.go (about) 1 /* 2 Package vips provides information and interaction with the Virtual IPs of the 3 Load Balancing as a Service extension for the OpenStack Networking service. 4 5 Example to List Virtual IPs 6 7 listOpts := vips.ListOpts{ 8 SubnetID: "d9bd223b-f1a9-4f98-953b-df977b0f902d", 9 } 10 11 allPages, err := vips.List(networkClient, listOpts).AllPages() 12 if err != nil { 13 panic(err) 14 } 15 16 allVIPs, err := vips.ExtractVIPs(allPages) 17 if err != nil { 18 panic(err) 19 } 20 21 for _, vip := range allVIPs { 22 fmt.Printf("%+v\n", vip) 23 } 24 25 Example to Create a Virtual IP 26 27 createOpts := vips.CreateOpts{ 28 Protocol: "HTTP", 29 Name: "NewVip", 30 AdminStateUp: golangsdk.Enabled, 31 SubnetID: "8032909d-47a1-4715-90af-5153ffe39861", 32 PoolID: "61b1f87a-7a21-4ad3-9dda-7f81d249944f", 33 ProtocolPort: 80, 34 Persistence: &vips.SessionPersistence{Type: "SOURCE_IP"}, 35 } 36 37 vip, err := vips.Create(networkClient, createOpts).Extract() 38 if err != nil { 39 panic(err) 40 } 41 42 Example to Update a Virtual IP 43 44 vipID := "93f1bad4-0423-40a8-afac-3fc541839912" 45 46 i1000 := 1000 47 updateOpts := vips.UpdateOpts{ 48 ConnLimit: &i1000, 49 Persistence: &vips.SessionPersistence{Type: "SOURCE_IP"}, 50 } 51 52 vip, err := vips.Update(networkClient, vipID, updateOpts).Extract() 53 if err != nil { 54 panic(err) 55 } 56 57 Example to Delete a Virtual IP 58 59 vipID := "93f1bad4-0423-40a8-afac-3fc541839912" 60 err := vips.Delete(networkClient, vipID).ExtractErr() 61 if err != nil { 62 panic(err) 63 } 64 */ 65 package vips