blob: b9d7de65fac1b1f04dc354e46577ea5deeab22f7 [file] [log] [blame]
Ash Wilson1f110512014-10-02 15:43:47 -04001package tenants
2
3import (
Jon Perritt27249f42016-02-18 10:35:59 -06004 "github.com/gophercloud/gophercloud"
5 "github.com/gophercloud/gophercloud/pagination"
Ash Wilson1f110512014-10-02 15:43:47 -04006)
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"`
Ash Wilson1f110512014-10-02 15:43:47 -040012 // Limit specifies the page size.
13 Limit int `q:"limit"`
14}
15
16// List enumerates the Tenants to which the current token has access.
17func List(client *gophercloud.ServiceClient, opts *ListOpts) pagination.Pager {
Ash Wilson1f110512014-10-02 15:43:47 -040018 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 Perrittdb0ae142016-03-13 00:33:41 -060026 return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {
27 return TenantPage{pagination.LinkedPageBase{PageResult: r}}
28 })
Ash Wilson1f110512014-10-02 15:43:47 -040029}