remove mapstructure from blockstorage,cdn,compute,db pkgs
diff --git a/openstack/blockstorage/v1/apiversions/results.go b/openstack/blockstorage/v1/apiversions/results.go
index 854f8dd..79a89de 100644
--- a/openstack/blockstorage/v1/apiversions/results.go
+++ b/openstack/blockstorage/v1/apiversions/results.go
@@ -3,15 +3,13 @@
import (
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
-
- "github.com/mitchellh/mapstructure"
)
// APIVersion represents an API version for Cinder.
type APIVersion struct {
- ID string `json:"id" mapstructure:"id"` // unique identifier
- Status string `json:"status" mapstructure:"status"` // current status
- Updated string `json:"updated" mapstructure:"updated"` // date last updated
+ ID string `json:"id"` // unique identifier
+ Status string `json:"status"` // current status
+ Updated string `json:"updated"` // date last updated
}
// APIVersionPage is the page returned by a pager when traversing over a
@@ -23,22 +21,18 @@
// IsEmpty checks whether an APIVersionPage struct is empty.
func (r APIVersionPage) IsEmpty() (bool, error) {
is, err := ExtractAPIVersions(r)
- if err != nil {
- return true, err
- }
- return len(is) == 0, nil
+ return len(is) == 0, err
}
// ExtractAPIVersions takes a collection page, extracts all of the elements,
// and returns them a slice of APIVersion structs. It is effectively a cast.
func ExtractAPIVersions(page pagination.Page) ([]APIVersion, error) {
- var resp struct {
- Versions []APIVersion `mapstructure:"versions"`
+ r := page.(APIVersionPage)
+ var s struct {
+ Versions []APIVersion `json:"versions"`
}
-
- err := mapstructure.Decode(page.(APIVersionPage).Body, &resp)
-
- return resp.Versions, err
+ err := r.ExtractInto(&s)
+ return s.Versions, err
}
// GetResult represents the result of a get operation.
@@ -48,11 +42,9 @@
// Extract is a function that accepts a result and extracts an API version resource.
func (r GetResult) Extract() (*APIVersion, error) {
- var resp struct {
- Version *APIVersion `mapstructure:"version"`
+ var s struct {
+ Version *APIVersion `json:"version"`
}
-
- err := mapstructure.Decode(r.Body, &resp)
-
- return resp.Version, err
+ err := r.ExtractInto(&s)
+ return s.Version, err
}