blob: 89adb83965d944693821f517937d8541124ba767 [file] [log] [blame]
Jon Perrittb5c78122014-10-15 20:44:39 -05001package cdncontainers
2
3import (
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.
11func ExtractNames(page pagination.Page) ([]string, error) {
12 return os.ExtractNames(page)
13}
14
15// ListOpts are options for listing Rackspace CDN containers.
16type 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.
25func (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 Perritt0ba5a562014-10-15 23:23:12 -050036func List(c *gophercloud.ServiceClient, opts os.ListOptsBuilder) pagination.Pager {
Jon Perrittb5c78122014-10-15 20:44:39 -050037 return os.List(c, opts)
38}