Rename ServiceClient to ProviderClient.
Rather than store state within service-level Clients, we really want that
at the provider level. Service-level clients should be stateless.
diff --git a/openstack/identity/v3/tokens/requests.go b/openstack/identity/v3/tokens/requests.go
index ab84d81..115737e 100644
--- a/openstack/identity/v3/tokens/requests.go
+++ b/openstack/identity/v3/tokens/requests.go
@@ -13,14 +13,14 @@
DomainName string
}
-func subjectTokenHeaders(c *gophercloud.ServiceClient, subjectToken string) map[string]string {
+func subjectTokenHeaders(c *gophercloud.ProviderClient, subjectToken string) map[string]string {
h := c.AuthenticatedHeaders()
h["X-Subject-Token"] = subjectToken
return h
}
// Create authenticates and either generates a new token, or changes the Scope of an existing token.
-func Create(c *gophercloud.ServiceClient, scope *Scope) (gophercloud.AuthResults, error) {
+func Create(c *gophercloud.ProviderClient, scope *Scope) (gophercloud.AuthResults, error) {
type domainReq struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
@@ -251,7 +251,7 @@
}
// Info validates and retrieves information about another token.
-func Info(c *gophercloud.ServiceClient, token string) (*TokenCreateResult, error) {
+func Info(c *gophercloud.ProviderClient, token string) (*TokenCreateResult, error) {
var result TokenCreateResult
response, err := perigee.Request("GET", getTokenURL(c), perigee.Options{
@@ -271,7 +271,7 @@
}
// Validate determines if a specified token is valid or not.
-func Validate(c *gophercloud.ServiceClient, token string) (bool, error) {
+func Validate(c *gophercloud.ProviderClient, token string) (bool, error) {
response, err := perigee.Request("HEAD", getTokenURL(c), perigee.Options{
MoreHeaders: subjectTokenHeaders(c, token),
OkCodes: []int{204, 404},
@@ -284,7 +284,7 @@
}
// Revoke immediately makes specified token invalid.
-func Revoke(c *gophercloud.ServiceClient, token string) error {
+func Revoke(c *gophercloud.ProviderClient, token string) error {
_, err := perigee.Request("DELETE", getTokenURL(c), perigee.Options{
MoreHeaders: subjectTokenHeaders(c, token),
OkCodes: []int{204},
diff --git a/openstack/identity/v3/tokens/requests_test.go b/openstack/identity/v3/tokens/requests_test.go
index 77b49f3..e1b845f 100644
--- a/openstack/identity/v3/tokens/requests_test.go
+++ b/openstack/identity/v3/tokens/requests_test.go
@@ -15,7 +15,7 @@
testhelper.SetupHTTP()
defer testhelper.TeardownHTTP()
- client := gophercloud.ServiceClient{
+ client := gophercloud.ProviderClient{
Endpoint: testhelper.Endpoint(),
Options: options,
TokenID: "12345abcdef",
@@ -41,7 +41,7 @@
testhelper.SetupHTTP()
defer testhelper.TeardownHTTP()
- client := gophercloud.ServiceClient{
+ client := gophercloud.ProviderClient{
Endpoint: testhelper.Endpoint(),
Options: options,
}
@@ -240,7 +240,7 @@
testhelper.SetupHTTP()
defer testhelper.TeardownHTTP()
- client := gophercloud.ServiceClient{
+ client := gophercloud.ProviderClient{
Endpoint: testhelper.Endpoint(),
Options: gophercloud.AuthOptions{UserID: "me", Password: "shhh"},
}
@@ -391,7 +391,7 @@
testhelper.SetupHTTP()
defer testhelper.TeardownHTTP()
- client := gophercloud.ServiceClient{
+ client := gophercloud.ProviderClient{
Endpoint: testhelper.Endpoint(),
TokenID: "12345abcdef",
}
@@ -425,8 +425,8 @@
}
}
-func prepareAuthTokenHandler(t *testing.T, expectedMethod string, status int) gophercloud.ServiceClient {
- client := gophercloud.ServiceClient{
+func prepareAuthTokenHandler(t *testing.T, expectedMethod string, status int) gophercloud.ProviderClient {
+ client := gophercloud.ProviderClient{
Endpoint: testhelper.Endpoint(),
TokenID: "12345abcdef",
}
diff --git a/openstack/identity/v3/tokens/urls.go b/openstack/identity/v3/tokens/urls.go
index 5b47c02..ac5a19f 100644
--- a/openstack/identity/v3/tokens/urls.go
+++ b/openstack/identity/v3/tokens/urls.go
@@ -2,6 +2,6 @@
import "github.com/rackspace/gophercloud"
-func getTokenURL(c *gophercloud.ServiceClient) string {
+func getTokenURL(c *gophercloud.ProviderClient) string {
return c.ServiceURL("auth", "tokens")
}
diff --git a/openstack/identity/v3/tokens/urls_test.go b/openstack/identity/v3/tokens/urls_test.go
index 5ff8bc6..5007b3d 100644
--- a/openstack/identity/v3/tokens/urls_test.go
+++ b/openstack/identity/v3/tokens/urls_test.go
@@ -11,7 +11,7 @@
testhelper.SetupHTTP()
defer testhelper.TeardownHTTP()
- client := gophercloud.ServiceClient{Endpoint: testhelper.Endpoint()}
+ client := gophercloud.ProviderClient{Endpoint: testhelper.Endpoint()}
expected := testhelper.Endpoint() + "auth/tokens"
actual := getTokenURL(&client)