Adding DeleteResult for v3.tokens.Delete
diff --git a/openstack/identity/v3/tokens/requests.go b/openstack/identity/v3/tokens/requests.go
index 351d7d6..5ca1031 100644
--- a/openstack/identity/v3/tokens/requests.go
+++ b/openstack/identity/v3/tokens/requests.go
@@ -276,10 +276,11 @@
}
// Revoke immediately makes specified token invalid.
-func Revoke(c *gophercloud.ServiceClient, token string) error {
- _, err := perigee.Request("DELETE", tokenURL(c), perigee.Options{
+func Revoke(c *gophercloud.ServiceClient, token string) RevokeResult {
+ var res RevokeResult
+ _, res.Err = perigee.Request("DELETE", tokenURL(c), perigee.Options{
MoreHeaders: subjectTokenHeaders(c, token),
OkCodes: []int{204},
})
- return err
+ return res
}
diff --git a/openstack/identity/v3/tokens/requests_test.go b/openstack/identity/v3/tokens/requests_test.go
index a61bb2c..2b26e4a 100644
--- a/openstack/identity/v3/tokens/requests_test.go
+++ b/openstack/identity/v3/tokens/requests_test.go
@@ -498,10 +498,8 @@
defer testhelper.TeardownHTTP()
client := prepareAuthTokenHandler(t, "DELETE", http.StatusNoContent)
- err := Revoke(&client, "abcdef12345")
- if err != nil {
- t.Errorf("Unexpected error from Revoke: %v", err)
- }
+ res := Revoke(&client, "abcdef12345")
+ testhelper.AssertNoErr(t, res.Err)
}
func TestRevokeRequestError(t *testing.T) {
@@ -509,8 +507,8 @@
defer testhelper.TeardownHTTP()
client := prepareAuthTokenHandler(t, "DELETE", http.StatusNotFound)
- err := Revoke(&client, "abcdef12345")
- if err == nil {
+ res := Revoke(&client, "abcdef12345")
+ if res.Err == nil {
t.Errorf("Missing expected error from Revoke")
}
}
diff --git a/openstack/identity/v3/tokens/results.go b/openstack/identity/v3/tokens/results.go
index c31c52f..d1fff4c 100644
--- a/openstack/identity/v3/tokens/results.go
+++ b/openstack/identity/v3/tokens/results.go
@@ -57,6 +57,11 @@
commonResult
}
+// RevokeResult is the deferred response from a Revoke call.
+type RevokeResult struct {
+ commonResult
+}
+
// Token is a string that grants a user access to a controlled set of services in an OpenStack provider.
// Each Token is valid for a set length of time.
type Token struct {