blob: 8c6e3e4c8952a9ba0506d08ec315dcabe6f8bdad [file] [log] [blame]
Ash Wilson85d82652014-08-28 13:57:46 -04001package v3
2
Ash Wilson8a85a912014-08-28 15:09:58 -04003import (
Ash Wilson6425a412014-08-29 12:30:35 -04004 "time"
5
Ash Wilson8a85a912014-08-28 15:09:58 -04006 "github.com/rackspace/gophercloud"
Ash Wilson8a85a912014-08-28 15:09:58 -04007)
Ash Wilson85d82652014-08-28 13:57:46 -04008
Ash Wilson6425a412014-08-29 12:30:35 -04009// Client abstracts the connection information necessary to make API calls to Identity v3 resources.
10// It exists mainly to adhere to the IdentityService interface.
Ash Wilson8a85a912014-08-28 15:09:58 -040011type Client gophercloud.ServiceClient
Ash Wilson85d82652014-08-28 13:57:46 -040012
Ash Wilson6425a412014-08-29 12:30:35 -040013// Token models a token acquired from the tokens/ API resource.
14type Token struct {
15 ID string
16 ExpiresAt time.Time
17}
Ash Wilson85d82652014-08-28 13:57:46 -040018
Ash Wilson6425a412014-08-29 12:30:35 -040019// NewClient creates a new client associated with the v3 identity service of a provider.
20func NewClient(provider *gophercloud.ProviderClient) *Client {
21 return &Client{
22 ProviderClient: *provider,
23 Endpoint: provider.IdentityEndpoint + "v3/",
Ash Wilson8a85a912014-08-28 15:09:58 -040024 }
Ash Wilson6425a412014-08-29 12:30:35 -040025}
Ash Wilson8a85a912014-08-28 15:09:58 -040026
Ash Wilson6425a412014-08-29 12:30:35 -040027// Authenticate provides the supplied credentials to an identity v3 endpoint and attempts to acquire a token.
28func (c *Client) Authenticate(authOptions gophercloud.AuthOptions) (*Token, error) {
29 return nil, nil
Ash Wilson85d82652014-08-28 13:57:46 -040030}