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