Use a ServiceClient in identity v2, as well.
diff --git a/openstack/identity/v2/requests.go b/openstack/identity/v2/requests.go
index afb92d5..4edbfef 100644
--- a/openstack/identity/v2/requests.go
+++ b/openstack/identity/v2/requests.go
@@ -15,14 +15,14 @@
// Authenticate passes the supplied credentials to the OpenStack provider for authentication.
// If successful, the caller may use Token() to retrieve the authentication token,
// and ServiceCatalog() to retrieve the set of services available to the API user.
-func Authenticate(options gophercloud.AuthOptions) (AuthResults, error) {
+func Authenticate(c *gophercloud.ServiceClient, options gophercloud.AuthOptions) (AuthResults, error) {
type AuthContainer struct {
Auth auth `json:"auth"`
}
var ar AuthResults
- if options.IdentityEndpoint == "" {
+ if c.Endpoint == "" {
return nil, ErrEndpoint
}
@@ -30,7 +30,7 @@
return nil, ErrCredentials
}
- url := options.IdentityEndpoint + "/tokens"
+ url := c.Endpoint + "/tokens"
err := perigee.Post(url, perigee.Options{
ReqBody: &AuthContainer{
Auth: getAuthCredentials(options),
@@ -75,10 +75,10 @@
}
// GetExtensions returns the OpenStack extensions available from this service.
-func GetExtensions(options gophercloud.AuthOptions) (ExtensionsResult, error) {
+func GetExtensions(c *gophercloud.ServiceClient, options gophercloud.AuthOptions) (ExtensionsResult, error) {
var exts ExtensionsResult
- url := options.IdentityEndpoint + "/extensions"
+ url := c.Endpoint + "/extensions"
err := perigee.Get(url, perigee.Options{
Results: &exts,
})
diff --git a/openstack/utils/client.go b/openstack/utils/client.go
index 6dda38f..7e3aa12 100644
--- a/openstack/utils/client.go
+++ b/openstack/utils/client.go
@@ -47,7 +47,8 @@
Options: ao,
}
- ar, err := identity.Authenticate(ao)
+ c := &gophercloud.ServiceClient{Endpoint: ao.IdentityEndpoint}
+ ar, err := identity.Authenticate(c, ao)
if err != nil {
return client, err
}