remove mapstructure from blockstorage,cdn,compute,db pkgs
diff --git a/openstack/compute/v2/extensions/servergroups/requests.go b/openstack/compute/v2/extensions/servergroups/requests.go
index 02e6de2..e3b2493 100644
--- a/openstack/compute/v2/extensions/servergroups/requests.go
+++ b/openstack/compute/v2/extensions/servergroups/requests.go
@@ -10,7 +10,7 @@
// List returns a Pager that allows you to iterate over a collection of ServerGroups.
func List(client *gophercloud.ServiceClient) pagination.Pager {
return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page {
- return ServerGroupsPage{pagination.SinglePageBase(r)}
+ return ServerGroupPage{pagination.SinglePageBase(r)}
})
}
diff --git a/openstack/compute/v2/extensions/servergroups/results.go b/openstack/compute/v2/extensions/servergroups/results.go
index 2b59551..ff64a7e 100644
--- a/openstack/compute/v2/extensions/servergroups/results.go
+++ b/openstack/compute/v2/extensions/servergroups/results.go
@@ -1,7 +1,6 @@
package servergroups
import (
- "github.com/mitchellh/mapstructure"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
)
@@ -9,29 +8,29 @@
// A ServerGroup creates a policy for instance placement in the cloud
type ServerGroup struct {
// ID is the unique ID of the Server Group.
- ID string `mapstructure:"id"`
+ ID string `json:"id"`
// Name is the common name of the server group.
- Name string `mapstructure:"name"`
+ Name string `json:"name"`
// Polices are the group policies.
- Policies []string `mapstructure:"policies"`
+ Policies []string `json:"policies"`
// Members are the members of the server group.
- Members []string `mapstructure:"members"`
+ Members []string `json:"members"`
// Metadata includes a list of all user-specified key-value pairs attached to the Server Group.
Metadata map[string]interface{}
}
-// ServerGroupsPage stores a single, only page of ServerGroups
+// ServerGroupPage stores a single, only page of ServerGroups
// results from a List call.
-type ServerGroupsPage struct {
+type ServerGroupPage struct {
pagination.SinglePageBase
}
// IsEmpty determines whether or not a ServerGroupsPage is empty.
-func (page ServerGroupsPage) IsEmpty() (bool, error) {
+func (page ServerGroupPage) IsEmpty() (bool, error) {
va, err := ExtractServerGroups(page)
return len(va) == 0, err
}
@@ -39,14 +38,12 @@
// ExtractServerGroups interprets a page of results as a slice of
// ServerGroups.
func ExtractServerGroups(page pagination.Page) ([]ServerGroup, error) {
- casted := page.(ServerGroupsPage).Body
- var response struct {
- ServerGroups []ServerGroup `mapstructure:"server_groups"`
+ r := page.(ServerGroupPage)
+ var s struct {
+ ServerGroups []ServerGroup `json:"server_groups"`
}
-
- err := mapstructure.WeakDecode(casted, &response)
-
- return response.ServerGroups, err
+ err := r.ExtractInto(&s)
+ return s.ServerGroups, err
}
type ServerGroupResult struct {
@@ -56,16 +53,11 @@
// Extract is a method that attempts to interpret any Server Group resource
// response as a ServerGroup struct.
func (r ServerGroupResult) Extract() (*ServerGroup, error) {
- if r.Err != nil {
- return nil, r.Err
+ var s struct {
+ ServerGroup *ServerGroup `json:"server_group"`
}
-
- var res struct {
- ServerGroup *ServerGroup `json:"server_group" mapstructure:"server_group"`
- }
-
- err := mapstructure.WeakDecode(r.Body, &res)
- return res.ServerGroup, err
+ err := r.ExtractInto(&s)
+ return s.ServerGroup, err
}
// CreateResult is the response from a Create operation. Call its Extract method to interpret it