change page to MarkerPageBase
diff --git a/openstack/orchestration/v1/stackresources/requests.go b/openstack/orchestration/v1/stackresources/requests.go
index 628cecc..e4cf7cb 100644
--- a/openstack/orchestration/v1/stackresources/requests.go
+++ b/openstack/orchestration/v1/stackresources/requests.go
@@ -60,7 +60,7 @@
}
createPageFn := func(r pagination.PageResult) pagination.Page {
- return ResourcePage{pagination.LinkedPageBase{PageResult: r}}
+ return ResourcePage{pagination.MarkerPageBase{PageResult: r}}
}
return pagination.NewPager(client, url, createPageFn)
diff --git a/openstack/orchestration/v1/stackresources/results.go b/openstack/orchestration/v1/stackresources/results.go
index 15b1988..4a0de8e 100644
--- a/openstack/orchestration/v1/stackresources/results.go
+++ b/openstack/orchestration/v1/stackresources/results.go
@@ -57,31 +57,28 @@
// As OpenStack extensions may freely alter the response bodies of structures returned to the client, you may only safely access the
// data provided through the ExtractResources call.
type ResourcePage struct {
- pagination.LinkedPageBase
+ pagination.MarkerPageBase
}
// IsEmpty returns true if a page contains no Server results.
-func (page ResourcePage) IsEmpty() (bool, error) {
- resources, err := ExtractResources(page)
+func (r ResourcePage) IsEmpty() (bool, error) {
+ resources, err := ExtractResources(r)
if err != nil {
return true, err
}
return len(resources) == 0, nil
}
-// NextPageURL uses the response's embedded link reference to navigate to the next page of results.
-func (page ResourcePage) NextPageURL() (string, error) {
- type resp struct {
- Links []gophercloud.Link `mapstructure:"servers_links"`
- }
-
- var r resp
- err := mapstructure.Decode(page.Body, &r)
+// LastMarker returns the last container name in a ListResult.
+func (r ResourcePage) LastMarker() (string, error) {
+ resources, err := ExtractResources(r)
if err != nil {
return "", err
}
-
- return gophercloud.ExtractNextURL(r.Links)
+ if len(resources) == 0 {
+ return "", nil
+ }
+ return resources[len(resources)-1].PhysicalID, nil
}
// ExtractResources interprets the results of a single page from a List() call, producing a slice of Resource entities.