blob: 7754c2081216d8e5691f6fcbe7f2fb25143378e5 [file] [log] [blame]
Ash Wilson89466cc2014-08-29 11:27:39 -04001package gophercloud
2
Jamie Hannafordb280dea2014-10-24 15:14:06 +02003// ProviderClient stores details that are required to interact with any
4// services within a specific provider's API.
Ash Wilson89466cc2014-08-29 11:27:39 -04005//
Jamie Hannafordb280dea2014-10-24 15:14:06 +02006// Generally, you acquire a ProviderClient by calling the NewClient method in
7// the appropriate provider's child package, providing whatever authentication
8// credentials are required.
Ash Wilson89466cc2014-08-29 11:27:39 -04009type ProviderClient struct {
Jamie Hannafordb280dea2014-10-24 15:14:06 +020010 // IdentityBase is the base URL used for a particular provider's identity
11 // service - it will be used when issuing authenticatation requests. It
12 // should point to the root resource of the identity service, not a specific
13 // identity version.
Ash Wilson09694b92014-09-09 14:08:27 -040014 IdentityBase string
15
Jamie Hannafordb280dea2014-10-24 15:14:06 +020016 // IdentityEndpoint is the identity endpoint. This may be a specific version
17 // of the identity service. If this is the case, this endpoint is used rather
18 // than querying versions first.
Ash Wilsonc6372fe2014-09-03 11:24:52 -040019 IdentityEndpoint string
20
Jamie Hannafordb280dea2014-10-24 15:14:06 +020021 // TokenID is the ID of the most recently issued valid token.
Ash Wilson89466cc2014-08-29 11:27:39 -040022 TokenID string
Ash Wilsonb8401a72014-09-08 17:07:49 -040023
Jamie Hannafordb280dea2014-10-24 15:14:06 +020024 // EndpointLocator describes how this provider discovers the endpoints for
25 // its constituent services.
Ash Wilsonb8401a72014-09-08 17:07:49 -040026 EndpointLocator EndpointLocator
Ash Wilson89466cc2014-08-29 11:27:39 -040027}
28
Jamie Hannafordb280dea2014-10-24 15:14:06 +020029// AuthenticatedHeaders returns a map of HTTP headers that are common for all
30// authenticated service requests.
Ash Wilson89466cc2014-08-29 11:27:39 -040031func (client *ProviderClient) AuthenticatedHeaders() map[string]string {
32 return map[string]string{"X-Auth-Token": client.TokenID}
33}