Ash Wilson | 1f11051 | 2014-10-02 15:43:47 -0400 | [diff] [blame] | 1 | package tenants |
| 2 | |
| 3 | import ( |
Jon Perritt | 27249f4 | 2016-02-18 10:35:59 -0600 | [diff] [blame] | 4 | "github.com/gophercloud/gophercloud" |
| 5 | "github.com/gophercloud/gophercloud/pagination" |
Ash Wilson | 1f11051 | 2014-10-02 15:43:47 -0400 | [diff] [blame] | 6 | ) |
| 7 | |
| 8 | // ListOpts filters the Tenants that are returned by the List call. |
| 9 | type ListOpts struct { |
| 10 | // Marker is the ID of the last Tenant on the previous page. |
| 11 | Marker string `q:"marker"` |
Ash Wilson | 1f11051 | 2014-10-02 15:43:47 -0400 | [diff] [blame] | 12 | // Limit specifies the page size. |
| 13 | Limit int `q:"limit"` |
| 14 | } |
| 15 | |
| 16 | // List enumerates the Tenants to which the current token has access. |
| 17 | func List(client *gophercloud.ServiceClient, opts *ListOpts) pagination.Pager { |
Ash Wilson | 1f11051 | 2014-10-02 15:43:47 -0400 | [diff] [blame] | 18 | url := listURL(client) |
| 19 | if opts != nil { |
| 20 | q, err := gophercloud.BuildQueryString(opts) |
| 21 | if err != nil { |
| 22 | return pagination.Pager{Err: err} |
| 23 | } |
| 24 | url += q.String() |
| 25 | } |
Jon Perritt | db0ae14 | 2016-03-13 00:33:41 -0600 | [diff] [blame^] | 26 | return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page { |
| 27 | return TenantPage{pagination.LinkedPageBase{PageResult: r}} |
| 28 | }) |
Ash Wilson | 1f11051 | 2014-10-02 15:43:47 -0400 | [diff] [blame] | 29 | } |