remove mapstructure from identity,networking,objectstorage,orchestration,pagination
diff --git a/openstack/identity/v3/roles/results.go b/openstack/identity/v3/roles/results.go
index 75549d3..86f21a0 100644
--- a/openstack/identity/v3/roles/results.go
+++ b/openstack/identity/v3/roles/results.go
@@ -1,10 +1,6 @@
package roles
-import (
- "github.com/gophercloud/gophercloud/pagination"
-
- "github.com/mitchellh/mapstructure"
-)
+import "github.com/gophercloud/gophercloud/pagination"
// RoleAssignment is the result of a role assignments query.
type RoleAssignment struct {
@@ -20,7 +16,7 @@
type Scope struct {
Domain Domain `json:"domain,omitempty"`
- Project Project `json:"domain,omitempty"`
+ Project Project `json:"project,omitempty"`
}
type Domain struct {
@@ -47,35 +43,26 @@
// IsEmpty returns true if the page contains no results.
func (p RoleAssignmentsPage) IsEmpty() (bool, error) {
roleAssignments, err := ExtractRoleAssignments(p)
- if err != nil {
- return true, err
- }
- return len(roleAssignments) == 0, nil
+ return len(roleAssignments) == 0, err
}
// NextPageURL uses the response's embedded link reference to navigate to the next page of results.
func (page RoleAssignmentsPage) NextPageURL() (string, error) {
- type resp struct {
+ var s struct {
Links struct {
- Next string `mapstructure:"next"`
- } `mapstructure:"links"`
+ Next string `json:"next"`
+ } `json:"links"`
}
-
- var r resp
- err := mapstructure.Decode(page.Body, &r)
- if err != nil {
- return "", err
- }
-
- return r.Links.Next, nil
+ err := page.ExtractInto(&s)
+ return s.Links.Next, err
}
// ExtractRoleAssignments extracts a slice of RoleAssignments from a Collection acquired from List.
func ExtractRoleAssignments(page pagination.Page) ([]RoleAssignment, error) {
- var response struct {
- RoleAssignments []RoleAssignment `mapstructure:"role_assignments"`
+ r := page.(RoleAssignmentsPage)
+ var s struct {
+ RoleAssignments []RoleAssignment `json:"role_assignments"`
}
-
- err := mapstructure.Decode(page.(RoleAssignmentsPage).Body, &response)
- return response.RoleAssignments, err
+ err := r.ExtractInto(&s)
+ return s.RoleAssignments, err
}