remove mapstructure from blockstorage,cdn,compute,db pkgs
diff --git a/openstack/compute/v2/extensions/tenantnetworks/results.go b/openstack/compute/v2/extensions/tenantnetworks/results.go
index f55a27e..5db5cbd 100644
--- a/openstack/compute/v2/extensions/tenantnetworks/results.go
+++ b/openstack/compute/v2/extensions/tenantnetworks/results.go
@@ -1,7 +1,6 @@
package tenantnetworks
import (
- "github.com/mitchellh/mapstructure"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
)
@@ -9,13 +8,13 @@
// A Network represents a nova-network that an instance communicates on
type Network struct {
// CIDR is the IPv4 subnet.
- CIDR string `mapstructure:"cidr"`
+ CIDR string `json:"cidr"`
// ID is the UUID of the network.
- ID string `mapstructure:"id"`
+ ID string `json:"id"`
// Name is the common name that the network has.
- Name string `mapstructure:"label"`
+ Name string `json:"label"`
}
// NetworkPage stores a single, only page of Networks
@@ -32,14 +31,12 @@
// ExtractNetworks interprets a page of results as a slice of Networks
func ExtractNetworks(page pagination.Page) ([]Network, error) {
- networks := page.(NetworkPage).Body
- var res struct {
- Networks []Network `mapstructure:"networks"`
+ r := page.(NetworkPage)
+ var s struct {
+ Networks []Network `json:"networks"`
}
-
- err := mapstructure.WeakDecode(networks, &res)
-
- return res.Networks, err
+ err := r.ExtractInto(&s)
+ return s.Networks, err
}
type NetworkResult struct {
@@ -49,16 +46,11 @@
// Extract is a method that attempts to interpret any Network resource
// response as a Network struct.
func (r NetworkResult) Extract() (*Network, error) {
- if r.Err != nil {
- return nil, r.Err
+ var s struct {
+ Network *Network `json:"network"`
}
-
- var res struct {
- Network *Network `json:"network" mapstructure:"network"`
- }
-
- err := mapstructure.Decode(r.Body, &res)
- return res.Network, err
+ err := r.ExtractInto(&s)
+ return s.Network, err
}
// GetResult is the response from a Get operation. Call its Extract method to interpret it