more consistent naming
diff --git a/openstack/identity/v2/extensions/admin/roles/results.go b/openstack/identity/v2/extensions/admin/roles/results.go
index 608f206..28de6bb 100644
--- a/openstack/identity/v2/extensions/admin/roles/results.go
+++ b/openstack/identity/v2/extensions/admin/roles/results.go
@@ -26,18 +26,17 @@
}
// IsEmpty determines whether or not a page of Tenants contains any results.
-func (page RolePage) IsEmpty() (bool, error) {
- users, err := ExtractRoles(page)
+func (r RolePage) IsEmpty() (bool, error) {
+ users, err := ExtractRoles(r)
return len(users) == 0, err
}
// ExtractRoles returns a slice of roles contained in a single page of results.
-func ExtractRoles(page pagination.Page) ([]Role, error) {
- r := page.(RolePage)
+func ExtractRoles(r pagination.Page) ([]Role, error) {
var s struct {
Roles []Role `json:"roles"`
}
- err := r.ExtractInto(&s)
+ err := (r.(RolePage)).ExtractInto(&s)
return s.Roles, err
}
diff --git a/openstack/identity/v2/tenants/results.go b/openstack/identity/v2/tenants/results.go
index bf52554..3ce1e67 100644
--- a/openstack/identity/v2/tenants/results.go
+++ b/openstack/identity/v2/tenants/results.go
@@ -26,17 +26,17 @@
}
// IsEmpty determines whether or not a page of Tenants contains any results.
-func (page TenantPage) IsEmpty() (bool, error) {
- tenants, err := ExtractTenants(page)
+func (r TenantPage) IsEmpty() (bool, error) {
+ tenants, err := ExtractTenants(r)
return len(tenants) == 0, err
}
// NextPageURL extracts the "next" link from the tenants_links section of the result.
-func (page TenantPage) NextPageURL() (string, error) {
+func (r TenantPage) NextPageURL() (string, error) {
var s struct {
Links []gophercloud.Link `json:"tenants_links"`
}
- err := page.ExtractInto(&s)
+ err := r.ExtractInto(&s)
if err != nil {
return "", err
}
@@ -44,11 +44,10 @@
}
// ExtractTenants returns a slice of Tenants contained in a single page of results.
-func ExtractTenants(page pagination.Page) ([]Tenant, error) {
- r := page.(TenantPage)
+func ExtractTenants(r pagination.Page) ([]Tenant, error) {
var s struct {
Tenants []Tenant `json:"tenants"`
}
- err := r.ExtractInto(&s)
+ err := (r.(TenantPage)).ExtractInto(&s)
return s.Tenants, err
}
diff --git a/openstack/identity/v2/users/results.go b/openstack/identity/v2/users/results.go
index c353c61..c493383 100644
--- a/openstack/identity/v2/users/results.go
+++ b/openstack/identity/v2/users/results.go
@@ -47,34 +47,32 @@
}
// IsEmpty determines whether or not a page of Tenants contains any results.
-func (page UserPage) IsEmpty() (bool, error) {
- users, err := ExtractUsers(page)
+func (r UserPage) IsEmpty() (bool, error) {
+ users, err := ExtractUsers(r)
return len(users) == 0, err
}
// ExtractUsers returns a slice of Tenants contained in a single page of results.
-func ExtractUsers(page pagination.Page) ([]User, error) {
- r := page.(UserPage)
+func ExtractUsers(r pagination.Page) ([]User, error) {
var s struct {
Users []User `json:"users"`
}
- err := r.ExtractInto(&s)
+ err := (r.(UserPage)).ExtractInto(&s)
return s.Users, err
}
// IsEmpty determines whether or not a page of Tenants contains any results.
-func (page RolePage) IsEmpty() (bool, error) {
- users, err := ExtractRoles(page)
+func (r RolePage) IsEmpty() (bool, error) {
+ users, err := ExtractRoles(r)
return len(users) == 0, err
}
// ExtractRoles returns a slice of Roles contained in a single page of results.
-func ExtractRoles(page pagination.Page) ([]Role, error) {
- r := page.(RolePage)
+func ExtractRoles(r pagination.Page) ([]Role, error) {
var s struct {
Roles []Role `json:"roles"`
}
- err := r.ExtractInto(&s)
+ err := (r.(RolePage)).ExtractInto(&s)
return s.Roles, err
}
diff --git a/openstack/identity/v3/endpoints/results.go b/openstack/identity/v3/endpoints/results.go
index 09e58e5..2788f16 100644
--- a/openstack/identity/v3/endpoints/results.go
+++ b/openstack/identity/v3/endpoints/results.go
@@ -55,17 +55,16 @@
}
// IsEmpty returns true if no Endpoints were returned.
-func (p EndpointPage) IsEmpty() (bool, error) {
- es, err := ExtractEndpoints(p)
+func (r EndpointPage) IsEmpty() (bool, error) {
+ es, err := ExtractEndpoints(r)
return len(es) == 0, err
}
// ExtractEndpoints extracts an Endpoint slice from a Page.
-func ExtractEndpoints(page pagination.Page) ([]Endpoint, error) {
- r := page.(EndpointPage)
+func ExtractEndpoints(r pagination.Page) ([]Endpoint, error) {
var s struct {
Endpoints []Endpoint `json:"endpoints"`
}
- err := r.ExtractInto(&s)
+ err := (r.(EndpointPage)).ExtractInto(&s)
return s.Endpoints, err
}
diff --git a/openstack/identity/v3/roles/requests.go b/openstack/identity/v3/roles/requests.go
index f825627..0264347 100644
--- a/openstack/identity/v3/roles/requests.go
+++ b/openstack/identity/v3/roles/requests.go
@@ -43,7 +43,7 @@
}
url += query
createPage := func(r pagination.PageResult) pagination.Page {
- return RoleAssignmentsPage{pagination.LinkedPageBase{PageResult: r}}
+ return RoleAssignmentPage{pagination.LinkedPageBase{PageResult: r}}
}
return pagination.NewPager(client, url, createPage)
diff --git a/openstack/identity/v3/roles/results.go b/openstack/identity/v3/roles/results.go
index 86f21a0..e8a3aa9 100644
--- a/openstack/identity/v3/roles/results.go
+++ b/openstack/identity/v3/roles/results.go
@@ -35,34 +35,33 @@
ID string `json:"id,omitempty"`
}
-// RoleAssignmentsPage is a single page of RoleAssignments results.
-type RoleAssignmentsPage struct {
+// RoleAssignmentPage is a single page of RoleAssignments results.
+type RoleAssignmentPage struct {
pagination.LinkedPageBase
}
// IsEmpty returns true if the page contains no results.
-func (p RoleAssignmentsPage) IsEmpty() (bool, error) {
- roleAssignments, err := ExtractRoleAssignments(p)
+func (r RoleAssignmentPage) IsEmpty() (bool, error) {
+ roleAssignments, err := ExtractRoleAssignments(r)
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) {
+func (r RoleAssignmentPage) NextPageURL() (string, error) {
var s struct {
Links struct {
Next string `json:"next"`
} `json:"links"`
}
- err := page.ExtractInto(&s)
+ err := r.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) {
- r := page.(RoleAssignmentsPage)
+func ExtractRoleAssignments(r pagination.Page) ([]RoleAssignment, error) {
var s struct {
RoleAssignments []RoleAssignment `json:"role_assignments"`
}
- err := r.ExtractInto(&s)
+ err := (r.(RoleAssignmentPage)).ExtractInto(&s)
return s.RoleAssignments, err
}
diff --git a/openstack/identity/v3/services/results.go b/openstack/identity/v3/services/results.go
index 45040c6..b0d36fb 100644
--- a/openstack/identity/v3/services/results.go
+++ b/openstack/identity/v3/services/results.go
@@ -59,11 +59,10 @@
}
// ExtractServices extracts a slice of Services from a Collection acquired from List.
-func ExtractServices(page pagination.Page) ([]Service, error) {
- r := page.(ServicePage)
+func ExtractServices(r pagination.Page) ([]Service, error) {
var s struct {
Services []Service `json:"services"`
}
- err := r.ExtractInto(&s)
+ err := (r.(ServicePage)).ExtractInto(&s)
return s.Services, err
}