github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/vpnaas/endpointgroups/doc.go (about) 1 /* 2 Package endpointgroups allows management of endpoint groups in the Openstack Network Service 3 4 Example to create an Endpoint Group 5 6 createOpts := endpointgroups.CreateOpts{ 7 Name: groupName, 8 Type: endpointgroups.TypeCIDR, 9 Endpoints: []string{ 10 "10.2.0.0/24", 11 "10.3.0.0/24", 12 }, 13 } 14 group, err := endpointgroups.Create(client, createOpts).Extract() 15 if err != nil { 16 return group, err 17 } 18 19 Example to retrieve an Endpoint Group 20 21 group, err := endpointgroups.Get(client, "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a").Extract() 22 if err != nil { 23 panic(err) 24 } 25 26 Example to Delete an Endpoint Group 27 28 err := endpointgroups.Delete(client, "5291b189-fd84-46e5-84bd-78f40c05d69c").ExtractErr() 29 if err != nil { 30 panic(err) 31 } 32 33 Example to List Endpoint groups 34 35 allPages, err := endpointgroups.List(client, nil).AllPages() 36 if err != nil { 37 panic(err) 38 } 39 40 allGroups, err := endpointgroups.ExtractEndpointGroups(allPages) 41 if err != nil { 42 panic(err) 43 } 44 45 Example to Update an endpoint group 46 47 name := "updatedname" 48 description := "updated description" 49 updateOpts := endpointgroups.UpdateOpts{ 50 Name: &name, 51 Description: &description, 52 } 53 updatedPolicy, err := endpointgroups.Update(client, "5c561d9d-eaea-45f6-ae3e-08d1a7080828", updateOpts).Extract() 54 if err != nil { 55 panic(err) 56 } 57 */ 58 package endpointgroups