blob: 5a359f5c9e27519aa557a7112924b457b3f34f74 [file] [log] [blame]
Ash Wilson1f110512014-10-02 15:43:47 -04001package tenants
2
3import (
4 "github.com/rackspace/gophercloud"
5 "github.com/rackspace/gophercloud/pagination"
6)
7
8// ListOpts filters the Tenants that are returned by the List call.
9type ListOpts struct {
10 // Marker is the ID of the last Tenant on the previous page.
11 Marker string `q:"marker"`
12
13 // Limit specifies the page size.
14 Limit int `q:"limit"`
15}
16
17// List enumerates the Tenants to which the current token has access.
18func List(client *gophercloud.ServiceClient, opts *ListOpts) pagination.Pager {
Ash Wilsonb8b16f82014-10-20 10:19:49 -040019 createPage := func(r pagination.PageResult) pagination.Page {
20 return TenantPage{pagination.LinkedPageBase{PageResult: r}}
Ash Wilson1f110512014-10-02 15:43:47 -040021 }
22
23 url := listURL(client)
24 if opts != nil {
25 q, err := gophercloud.BuildQueryString(opts)
26 if err != nil {
27 return pagination.Pager{Err: err}
28 }
29 url += q.String()
30 }
31
32 return pagination.NewPager(client, url, createPage)
33}