github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/identity/v3/endpoints/doc.go (about) 1 /* 2 Package endpoints provides information and interaction with the service 3 endpoints API resource in the OpenStack Identity service. 4 5 For more information, see: 6 http://developer.openstack.org/api-ref-identity-v3.html#endpoints-v3 7 8 Example to List Endpoints 9 10 serviceID := "e629d6e599d9489fb3ae5d9cc12eaea3" 11 12 listOpts := endpoints.ListOpts{ 13 ServiceID: serviceID, 14 } 15 16 allPages, err := endpoints.List(identityClient, listOpts).AllPages() 17 if err != nil { 18 panic(err) 19 } 20 21 allEndpoints, err := endpoints.ExtractEndpoints(allPages) 22 if err != nil { 23 panic(err) 24 } 25 26 for _, endpoint := range allEndpoints { 27 fmt.Printf("%+v\n", endpoint) 28 } 29 30 Example to Create an Endpoint 31 32 serviceID := "e629d6e599d9489fb3ae5d9cc12eaea3" 33 34 createOpts := endpoints.CreateOpts{ 35 Availability: golangsdk.AvailabilityPublic, 36 Name: "neutron", 37 Region: "RegionOne", 38 URL: "https://localhost:9696", 39 ServiceID: serviceID, 40 } 41 42 endpoint, err := endpoints.Create(identityClient, createOpts).Extract() 43 if err != nil { 44 panic(err) 45 } 46 47 48 Example to Update an Endpoint 49 50 endpointID := "ad59deeec5154d1fa0dcff518596f499" 51 52 updateOpts := endpoints.UpdateOpts{ 53 Region: "RegionTwo", 54 } 55 56 endpoint, err := endpoints.Update(identityClient, endpointID, updateOpts).Extract() 57 if err != nil { 58 panic(err) 59 } 60 61 Example to Delete an Endpoint 62 63 endpointID := "ad59deeec5154d1fa0dcff518596f499" 64 err := endpoints.Delete(identityClient, endpointID).ExtractErr() 65 if err != nil { 66 panic(err) 67 } 68 */ 69 package endpoints