move 'NewClient' function to 'utils' directory
diff --git a/openstack/identity/v2/client.go b/openstack/utils/client.go
similarity index 87%
rename from openstack/identity/v2/client.go
rename to openstack/utils/client.go
index b074be3..d1f0359 100644
--- a/openstack/identity/v2/client.go
+++ b/openstack/utils/client.go
@@ -1,7 +1,8 @@
-package identity
+package utils
import (
"fmt"
+ identity "github.com/rackspace/gophercloud/openstack/identity/v2"
)
// Client contains information that defines a generic Openstack Client.
@@ -9,9 +10,9 @@
// Endpoint is the URL against which to authenticate.
Endpoint string
// Authority holds the results of authenticating against the Endpoint.
- Authority AuthResults
+ Authority identity.AuthResults
// Options holds the authentication options. Useful for auto-reauthentication.
- Options AuthOptions
+ Options identity.AuthOptions
}
// EndpointOpts contains options for finding an endpoint for an Openstack Client.
@@ -39,19 +40,19 @@
// Name: "nova",
// })
// serversClient := servers.NewClient(c.Endpoint, c.Authority, c.Options)
-func NewClient(ao AuthOptions, eo EndpointOpts) (Client, error) {
+func NewClient(ao identity.AuthOptions, eo EndpointOpts) (Client, error) {
client := Client{
Options: ao,
}
- ar, err := Authenticate(ao)
+ ar, err := identity.Authenticate(ao)
if err != nil {
return client, err
}
client.Authority = ar
- sc, err := GetServiceCatalog(ar)
+ sc, err := identity.GetServiceCatalog(ar)
if err != nil {
return client, err
}
@@ -61,7 +62,7 @@
return client, err
}
- var eps []Endpoint
+ var eps []identity.Endpoint
if eo.Name != "" {
for _, ce := range ces {