more consistent naming
diff --git a/openstack/cdn/v1/flavors/results.go b/openstack/cdn/v1/flavors/results.go
index 1b15dbc..02c2851 100644
--- a/openstack/cdn/v1/flavors/results.go
+++ b/openstack/cdn/v1/flavors/results.go
@@ -34,20 +34,16 @@
// IsEmpty returns true if a FlavorPage contains no Flavors.
func (r FlavorPage) IsEmpty() (bool, error) {
flavors, err := ExtractFlavors(r)
- if err != nil {
- return true, err
- }
- return len(flavors) == 0, nil
+ return len(flavors) == 0, err
}
// ExtractFlavors extracts and returns Flavors. It is used while iterating over
// a flavors.List call.
-func ExtractFlavors(page pagination.Page) ([]Flavor, error) {
- r := page.(FlavorPage)
+func ExtractFlavors(r pagination.Page) ([]Flavor, error) {
var s struct {
Flavors []Flavor `json:"flavors"`
}
- err := r.ExtractInto(&s)
+ err := (r.(FlavorPage)).ExtractInto(&s)
return s.Flavors, err
}
@@ -58,7 +54,7 @@
// Extract is a function that extracts a flavor from a GetResult.
func (r GetResult) Extract() (*Flavor, error) {
- var s Flavor
+ var s *Flavor
err := r.ExtractInto(&s)
- return &s, err
+ return s, err
}
diff --git a/openstack/cdn/v1/services/results.go b/openstack/cdn/v1/services/results.go
index e37fafa..6de3497 100644
--- a/openstack/cdn/v1/services/results.go
+++ b/openstack/cdn/v1/services/results.go
@@ -230,10 +230,7 @@
// IsEmpty returns true if a ListResult contains no services.
func (r ServicePage) IsEmpty() (bool, error) {
services, err := ExtractServices(r)
- if err != nil {
- return true, err
- }
- return len(services) == 0, nil
+ return len(services) == 0, err
}
// LastMarker returns the last service in a ListResult.
@@ -249,12 +246,11 @@
}
// ExtractServices is a function that takes a ListResult and returns the services' information.
-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
}