remove mapstructure from identity,networking,objectstorage,orchestration,pagination
diff --git a/openstack/objectstorage/v1/accounts/fixtures.go b/openstack/objectstorage/v1/accounts/fixtures.go
index 66589bf..16327e8 100644
--- a/openstack/objectstorage/v1/accounts/fixtures.go
+++ b/openstack/objectstorage/v1/accounts/fixtures.go
@@ -20,6 +20,7 @@
w.Header().Set("X-Account-Container-Count", "2")
w.Header().Set("X-Account-Bytes-Used", "14")
w.Header().Set("X-Account-Meta-Subject", "books")
+ w.Header().Set("Date", "Fri, 17 Jan 2014 16:09:56 GMT")
w.WriteHeader(http.StatusNoContent)
})
@@ -33,6 +34,7 @@
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
th.TestHeader(t, r, "X-Account-Meta-Gophercloud-Test", "accounts")
+ w.Header().Set("Date", "Fri, 17 Jan 2014 16:09:56 GMT")
w.WriteHeader(http.StatusNoContent)
})
}
diff --git a/openstack/objectstorage/v1/accounts/requests_test.go b/openstack/objectstorage/v1/accounts/requests_test.go
index 31ebccc..8aba591 100644
--- a/openstack/objectstorage/v1/accounts/requests_test.go
+++ b/openstack/objectstorage/v1/accounts/requests_test.go
@@ -13,8 +13,8 @@
HandleUpdateAccountSuccessfully(t)
options := &UpdateOpts{Metadata: map[string]string{"gophercloud-test": "accounts"}}
- res := Update(fake.ServiceClient(), options)
- th.AssertNoErr(t, res.Err)
+ _, err := Update(fake.ServiceClient(), options).Extract()
+ th.AssertNoErr(t, err)
}
func TestGetAccount(t *testing.T) {
@@ -27,6 +27,6 @@
th.AssertNoErr(t, res.Err)
actualMetadata, _ := res.ExtractMetadata()
th.CheckDeepEquals(t, expectedMetadata, actualMetadata)
- //headers, err := res.Extract()
- //th.AssertNoErr(t, err)
+ _, err := res.Extract()
+ th.AssertNoErr(t, err)
}
diff --git a/openstack/objectstorage/v1/accounts/results.go b/openstack/objectstorage/v1/accounts/results.go
index 89cd905..50032bd 100644
--- a/openstack/objectstorage/v1/accounts/results.go
+++ b/openstack/objectstorage/v1/accounts/results.go
@@ -2,7 +2,6 @@
import (
"strings"
- "time"
"github.com/gophercloud/gophercloud"
)
@@ -14,46 +13,31 @@
// UpdateHeader represents the headers returned in the response from an Update request.
type UpdateHeader struct {
- ContentLength string `mapstructure:"Content-Length"`
- ContentType string `mapstructure:"Content-Type"`
- Date time.Time `mapstructure:"-"`
- TransID string `mapstructure:"X-Trans-Id"`
+ ContentLength string `json:"Content-Length"`
+ ContentType string `json:"Content-Type"`
+ Date gophercloud.JSONRFC1123 `json:"Date"`
+ TransID string `json:"X-Trans-Id"`
}
// Extract will return a struct of headers returned from a call to Get. To obtain
// a map of headers, call the ExtractHeader method on the GetResult.
-func (ur UpdateResult) Extract() (UpdateHeader, error) {
- var uh UpdateHeader
- if ur.Err != nil {
- return uh, ur.Err
- }
-
- if err := gophercloud.DecodeHeader(ur.Header, &uh); err != nil {
- return uh, err
- }
-
- if date, ok := ur.Header["Date"]; ok && len(date) > 0 {
- t, err := time.Parse(time.RFC1123, ur.Header["Date"][0])
- if err != nil {
- return uh, err
- }
- uh.Date = t
- }
-
- return uh, nil
+func (ur UpdateResult) Extract() (*UpdateHeader, error) {
+ var uh *UpdateHeader
+ err := ur.ExtractInto(&uh)
+ return uh, err
}
// GetHeader represents the headers returned in the response from a Get request.
type GetHeader struct {
- BytesUsed int64 `mapstructure:"X-Account-Bytes-Used"`
- ContainerCount int `mapstructure:"X-Account-Container-Count"`
- ContentLength int64 `mapstructure:"Content-Length"`
- ContentType string `mapstructure:"Content-Type"`
- Date time.Time `mapstructure:"-"`
- ObjectCount int64 `mapstructure:"X-Account-Object-Count"`
- TransID string `mapstructure:"X-Trans-Id"`
- TempURLKey string `mapstructure:"X-Account-Meta-Temp-URL-Key"`
- TempURLKey2 string `mapstructure:"X-Account-Meta-Temp-URL-Key-2"`
+ BytesUsed string `json:"X-Account-Bytes-Used"`
+ ContainerCount string `json:"X-Account-Container-Count"`
+ ContentLength string `json:"Content-Length"`
+ ContentType string `json:"Content-Type"`
+ Date gophercloud.JSONRFC1123 `json:"Date"`
+ ObjectCount string `json:"X-Account-Object-Count"`
+ TransID string `json:"X-Trans-Id"`
+ TempURLKey string `json:"X-Account-Meta-Temp-URL-Key"`
+ TempURLKey2 string `json:"X-Account-Meta-Temp-URL-Key-2"`
}
// GetResult is returned from a call to the Get function.
@@ -63,25 +47,10 @@
// Extract will return a struct of headers returned from a call to Get. To obtain
// a map of headers, call the ExtractHeader method on the GetResult.
-func (gr GetResult) Extract() (GetHeader, error) {
- var gh GetHeader
- if gr.Err != nil {
- return gh, gr.Err
- }
-
- if err := gophercloud.DecodeHeader(gr.Header, &gh); err != nil {
- return gh, err
- }
-
- if date, ok := gr.Header["Date"]; ok && len(date) > 0 {
- t, err := time.Parse(time.RFC1123, gr.Header["Date"][0])
- if err != nil {
- return gh, err
- }
- gh.Date = t
- }
-
- return gh, nil
+func (gr GetResult) Extract() (*GetHeader, error) {
+ var gh *GetHeader
+ err := gr.ExtractInto(&gh)
+ return gh, err
}
// ExtractMetadata is a function that takes a GetResult (of type *http.Response)