Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 1 | package gophercloud |
| 2 | |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 3 | // ProviderClient stores details that are required to interact with any services within a specific provider's API. |
| 4 | // |
| 5 | // Generally, you acquire a ProviderClient by calling the `NewClient()` method in the appropriate provider's child package, |
| 6 | // providing whatever authentication credentials are required. |
| 7 | type ProviderClient struct { |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 8 | |
Ash Wilson | 09694b9 | 2014-09-09 14:08:27 -0400 | [diff] [blame^] | 9 | // IdentityBase is the front door to an openstack provider. |
Ash Wilson | c6372fe | 2014-09-03 11:24:52 -0400 | [diff] [blame] | 10 | // Generally this will be populated when you authenticate. |
| 11 | // It should be the *root* resource of the identity service, not of a specific identity version. |
Ash Wilson | 09694b9 | 2014-09-09 14:08:27 -0400 | [diff] [blame^] | 12 | IdentityBase string |
| 13 | |
| 14 | // IdentityEndpoint is the originally requested identity endpoint. |
| 15 | // This may be a specific version of the identity service, in which case that endpoint is used rather than querying the |
| 16 | // version-negotiation endpoint. |
Ash Wilson | c6372fe | 2014-09-03 11:24:52 -0400 | [diff] [blame] | 17 | IdentityEndpoint string |
| 18 | |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 19 | // TokenID is the most recently valid token issued. |
| 20 | TokenID string |
Ash Wilson | b8401a7 | 2014-09-08 17:07:49 -0400 | [diff] [blame] | 21 | |
| 22 | // EndpointLocator describes how this provider discovers the endpoints for its constituent services. |
| 23 | EndpointLocator EndpointLocator |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 24 | } |
| 25 | |
Ash Wilson | c6372fe | 2014-09-03 11:24:52 -0400 | [diff] [blame] | 26 | // AuthenticatedHeaders returns a map of HTTP headers that are common for all authenticated service requests. |
Ash Wilson | 89466cc | 2014-08-29 11:27:39 -0400 | [diff] [blame] | 27 | func (client *ProviderClient) AuthenticatedHeaders() map[string]string { |
| 28 | return map[string]string{"X-Auth-Token": client.TokenID} |
| 29 | } |