Ash Wilson | b8401a7 | 2014-09-08 17:07:49 -0400 | [diff] [blame^] | 1 | package gophercloud |
| 2 | |
| 3 | import "errors" |
| 4 | |
| 5 | var ( |
| 6 | // ErrEndpointNotFound is returned when no available endpoints match the provided EndpointOpts. |
| 7 | ErrEndpointNotFound = errors.New("No suitable endpoint could be found in the service catalog.") |
| 8 | ) |
| 9 | |
| 10 | // EndpointOpts contains options for finding an endpoint for an Openstack client. |
| 11 | type EndpointOpts struct { |
| 12 | |
| 13 | // Type is the service type for the client (e.g., "compute", "object-store"). |
| 14 | // Type is a required field. |
| 15 | Type string |
| 16 | |
| 17 | // Name is the service name for the client (e.g., "nova"). |
| 18 | // Name is not a required field, but it is used if present. |
| 19 | // Services can have the same Type but a different Name, which is one example of when both Type and Name are needed. |
| 20 | Name string |
| 21 | |
| 22 | // Region is the region in which the service resides. |
| 23 | Region string |
| 24 | |
| 25 | // URLType is they type of endpoint to be returned (e.g., "public", "private"). |
| 26 | // URLType is not required, and defaults to "public". |
| 27 | URLType string |
| 28 | } |
| 29 | |
| 30 | // EndpointLocator is a function that describes how to locate a single endpoint from a service catalog for a specific ProviderClient. |
| 31 | // It should be set during ProviderClient initialization and used to discover related ServiceClients. |
| 32 | type EndpointLocator func(EndpointOpts) (string, error) |