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