Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 1 | package gophercloud |
| 2 | |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame^] | 3 | // ProviderClient stores details that are required to interact with any |
| 4 | // services within a specific provider's API. |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 5 | // |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame^] | 6 | // 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 Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 9 | type ProviderClient struct { |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame^] | 10 | // 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 Wilson | 09694b9 | 2014-09-09 14:08:27 -0400 | [diff] [blame] | 14 | IdentityBase string |
| 15 | |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame^] | 16 | // 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 Wilson | c6372fe | 2014-09-03 11:24:52 -0400 | [diff] [blame] | 19 | IdentityEndpoint string |
| 20 | |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame^] | 21 | // TokenID is the ID of the most recently issued valid token. |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 22 | TokenID string |
Ash Wilson | b8401a7 | 2014-09-08 17:07:49 -0400 | [diff] [blame] | 23 | |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame^] | 24 | // EndpointLocator describes how this provider discovers the endpoints for |
| 25 | // its constituent services. |
Ash Wilson | b8401a7 | 2014-09-08 17:07:49 -0400 | [diff] [blame] | 26 | EndpointLocator EndpointLocator |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 27 | } |
| 28 | |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame^] | 29 | // AuthenticatedHeaders returns a map of HTTP headers that are common for all |
| 30 | // authenticated service requests. |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 31 | func (client *ProviderClient) AuthenticatedHeaders() map[string]string { |
| 32 | return map[string]string{"X-Auth-Token": client.TokenID} |
| 33 | } |