Jon Perritt | b5c7812 | 2014-10-15 20:44:39 -0500 | [diff] [blame] | 1 | package cdncontainers |
| 2 | |
| 3 | import ( |
| 4 | "github.com/rackspace/gophercloud" |
| 5 | os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers" |
| 6 | "github.com/rackspace/gophercloud/pagination" |
| 7 | ) |
| 8 | |
| 9 | // ExtractNames interprets a page of List results when just the container |
| 10 | // names are requested. |
| 11 | func ExtractNames(page pagination.Page) ([]string, error) { |
| 12 | return os.ExtractNames(page) |
| 13 | } |
| 14 | |
| 15 | // ListOpts are options for listing Rackspace CDN containers. |
| 16 | type ListOpts struct { |
| 17 | EndMarker string `q:"end_marker"` |
| 18 | Format string `q:"format"` |
| 19 | Limit int `q:"limit"` |
| 20 | Marker string `q:"marker"` |
| 21 | } |
| 22 | |
| 23 | // ToContainerListParams formats a ListOpts into a query string and boolean |
| 24 | // representing whether to list complete information for each container. |
| 25 | func (opts ListOpts) ToContainerListParams() (bool, string, error) { |
| 26 | q, err := gophercloud.BuildQueryString(opts) |
| 27 | if err != nil { |
| 28 | return false, "", err |
| 29 | } |
| 30 | return false, q.String(), nil |
| 31 | } |
| 32 | |
| 33 | // List is a function that retrieves containers associated with the account as |
| 34 | // well as account metadata. It returns a pager which can be iterated with the |
| 35 | // EachPage function. |
Jon Perritt | 0ba5a56 | 2014-10-15 23:23:12 -0500 | [diff] [blame] | 36 | func List(c *gophercloud.ServiceClient, opts os.ListOptsBuilder) pagination.Pager { |
Jon Perritt | b5c7812 | 2014-10-15 20:44:39 -0500 | [diff] [blame] | 37 | return os.List(c, opts) |
| 38 | } |