Jamie Hannaford | b6927c1 | 2014-11-03 10:31:26 +0100 | [diff] [blame] | 1 | package nodes |
Jamie Hannaford | 3cfa00a | 2014-11-03 11:16:35 +0100 | [diff] [blame^] | 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | |
| 6 | "github.com/rackspace/gophercloud" |
| 7 | "github.com/rackspace/gophercloud/pagination" |
| 8 | ) |
| 9 | |
| 10 | func List(client *gophercloud.ServiceClient, loadBalancerID int, limit *int) pagination.Pager { |
| 11 | url := rootURL(client, loadBalancerID) |
| 12 | |
| 13 | if limit != nil { |
| 14 | url += fmt.Sprintf("?limit=%d", limit) |
| 15 | } |
| 16 | |
| 17 | createPageFn := func(r pagination.PageResult) pagination.Page { |
| 18 | return NodePage{pagination.SinglePageBase(r)} |
| 19 | } |
| 20 | return pagination.NewPager(client, url, createPageFn) |
| 21 | } |