Skip to content

Commit f452638

Browse files
author
hailun.huang
committedAug 13, 2024
Add lb list extract
1 parent 82cb486 commit f452638

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
 

Diff for: ‎openstack/loadbalancer/v2/quotas/results.go

+21
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ type QuotaPage struct {
2424
pagination.LinkedPageBase
2525
}
2626

27+
func (r QuotaPage) NextPageURL() (string, error) {
28+
var s struct {
29+
Links []gophercloud.Link `json:"quota_links"`
30+
}
31+
err := r.ExtractInto(&s)
32+
if err != nil {
33+
return "", err
34+
}
35+
return gophercloud.ExtractNextURL(s.Links)
36+
}
37+
38+
// IsEmpty checks whether a FlavorPage struct is empty.
39+
func (r QuotaPage) IsEmpty() (bool, error) {
40+
if r.StatusCode == 204 {
41+
return true, nil
42+
}
43+
44+
is, err := ExtractQuotas(r)
45+
return len(is) == 0, err
46+
}
47+
2748
func ExtractQuotas(r pagination.Page) ([]Quota, error) {
2849
var s struct {
2950
Quotas []Quota `json:"quotas"`

0 commit comments

Comments
 (0)