create trusts.TokenExt response object (#29)
* create trusts.TokenExt response object
* add redelegationcount, redelegatedtrustid fields
diff --git a/openstack/identity/v3/tokens/results.go b/openstack/identity/v3/tokens/results.go
index d6917f9..4b362cc 100644
--- a/openstack/identity/v3/tokens/results.go
+++ b/openstack/identity/v3/tokens/results.go
@@ -1,10 +1,6 @@
package tokens
-import (
- "time"
-
- "github.com/gophercloud/gophercloud"
-)
+import "github.com/gophercloud/gophercloud"
// Endpoint represents a single API endpoint offered by a service.
// It matches either a public, internal or admin URL.
@@ -55,24 +51,18 @@
// ExtractToken interprets a commonResult as a Token.
func (r commonResult) ExtractToken() (*Token, error) {
var s struct {
- Token struct {
- ExpiresAt gophercloud.JSONRFC3339Milli `json:"expires_at"`
- } `json:"token"`
+ Token *Token `json:"token"`
}
- var token Token
-
- // Parse the token itself from the stored headers.
- token.ID = r.Header.Get("X-Subject-Token")
-
err := r.ExtractInto(&s)
if err != nil {
return nil, err
}
- token.ExpiresAt = time.Time(s.Token.ExpiresAt)
+ // Parse the token itself from the stored headers.
+ s.Token.ID = r.Header.Get("X-Subject-Token")
- return &token, err
+ return s.Token, err
}
// ExtractServiceCatalog returns the ServiceCatalog that was generated along with the user's Token.
@@ -113,8 +103,7 @@
// Each Token is valid for a set length of time.
type Token struct {
// ID is the issued token.
- ID string
-
+ ID string `json:"id"`
// ExpiresAt is the timestamp at which this token will no longer be accepted.
- ExpiresAt time.Time
+ ExpiresAt gophercloud.JSONRFC3339Milli `json:"expires_at"`
}