Clarify ServiceClient and ProviderClient.
diff --git a/openstack/identity/v3/client.go b/openstack/identity/v3/client.go
index 0647471..8c6e3e4 100644
--- a/openstack/identity/v3/client.go
+++ b/openstack/identity/v3/client.go
@@ -1,29 +1,30 @@
package v3
import (
+ "time"
+
"github.com/rackspace/gophercloud"
- "github.com/rackspace/gophercloud/openstack/identity/v3/tokens"
)
-// Client abstracts the connection information necessary to make API calls to Identity v3
-// resources.
+// Client abstracts the connection information necessary to make API calls to Identity v3 resources.
+// It exists mainly to adhere to the IdentityService interface.
type Client gophercloud.ServiceClient
-var (
- nilClient = Client{}
-)
+// Token models a token acquired from the tokens/ API resource.
+type Token struct {
+ ID string
+ ExpiresAt time.Time
+}
-// NewClient attempts to authenticate to the v3 identity endpoint. Returns a populated
-// IdentityV3Client on success or an error on failure.
-func NewClient(authOptions gophercloud.AuthOptions) (*Client, error) {
- client := Client{Options: authOptions}
-
- result, err := tokens.Create(&client, nil)
- if err != nil {
- return nil, err
+// NewClient creates a new client associated with the v3 identity service of a provider.
+func NewClient(provider *gophercloud.ProviderClient) *Client {
+ return &Client{
+ ProviderClient: *provider,
+ Endpoint: provider.IdentityEndpoint + "v3/",
}
+}
- // Assign the token and return.
- client.TokenID = result.TokenID()
- return &client, nil
+// Authenticate provides the supplied credentials to an identity v3 endpoint and attempts to acquire a token.
+func (c *Client) Authenticate(authOptions gophercloud.AuthOptions) (*Token, error) {
+ return nil, nil
}