// List is a function that retrieves all objects in a container. It also returns the details // for the container. To extract only the object information or names, pass the ListResult // response to the ExtractInfo or ExtractNames function, respectively. func List(c *gophercloud.ServiceClient, containerName string, opts ListOptsBuilder) pagination.Pager { headers := map[string]string{"Accept": "text/plain", "Content-Type": "text/plain"} url := listURL(c, containerName) if opts != nil { full, query, err := opts.ToObjectListParams() if err != nil { return pagination.Pager{Err: err} } url += query if full { headers = map[string]string{"Accept": "application/json", "Content-Type": "application/json"} } } createPage := func(r pagination.PageResult) pagination.Page { p := ObjectPage{pagination.MarkerPageBase{PageResult: r}} p.MarkerPageBase.Owner = p return p } pager := pagination.NewPager(c, url, createPage) pager.Headers = headers return pager }
// List returns a Pager which allows you to iterate over a collection of // security group rules. It accepts a ListOpts struct, which allows you to filter // and sort the returned collection for greater efficiency. func List(c *gophercloud.ServiceClient, opts ListOpts) pagination.Pager { q, err := gophercloud.BuildQueryString(&opts) if err != nil { return pagination.Pager{Err: err} } u := rootURL(c) + q.String() return pagination.NewPager(c, u, func(r pagination.PageResult) pagination.Page { return SecGroupRulePage{pagination.LinkedPageBase{PageResult: r}} }) }
// List returns a Pager which allows you to iterate over a collection of // ports. It accepts a ListOpts struct, which allows you to filter and sort // the returned collection for greater efficiency. // // Default policy settings return only those ports that are owned by the tenant // who submits the request, unless the request is submitted by a user with // administrative rights. func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager { url := listURL(c) if opts != nil { query, err := opts.ToPortListQuery() if err != nil { return pagination.Pager{Err: err} } url += query } return pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page { return PortPage{pagination.LinkedPageBase{PageResult: r}} }) }
// ListDetail instructs OpenStack to provide a list of flavors. // You may provide criteria by which List curtails its results for easier processing. // See ListOpts for more details. func ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager { url := listURL(client) if opts != nil { query, err := opts.ToFlavorListQuery() if err != nil { return pagination.Pager{Err: err} } url += query } createPage := func(r pagination.PageResult) pagination.Page { return FlavorPage{pagination.LinkedPageBase{PageResult: r}} } return pagination.NewPager(client, url, createPage) }
// List returns Volumes optionally limited by the conditions provided in ListOpts. func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager { url := listURL(client) if opts != nil { query, err := opts.ToVolumeListQuery() if err != nil { return pagination.Pager{Err: err} } url += query } createPage := func(r pagination.PageResult) pagination.Page { return ListResult{pagination.SinglePageBase(r)} } return pagination.NewPager(client, url, createPage) }
// ListAddressesByNetwork makes a request against the API to list the servers IP addresses // for the given network. func ListAddressesByNetwork(client *gophercloud.ServiceClient, id, network string) pagination.Pager { createPageFn := func(r pagination.PageResult) pagination.Page { return NetworkAddressPage{pagination.SinglePageBase(r)} } return pagination.NewPager(client, listAddressesByNetworkURL(client, id, network), createPageFn) }
// List returns a Pager that allows you to iterate over a collection of VolumeAttachments. func List(client *gophercloud.ServiceClient, serverId string) pagination.Pager { return pagination.NewPager(client, listURL(client, serverId), func(r pagination.PageResult) pagination.Page { return VolumeAttachmentsPage{pagination.SinglePageBase(r)} }) }
// List returns a Pager that allows you to iterate over a collection of KeyPairs. func List(client *gophercloud.ServiceClient) pagination.Pager { return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page { return KeyPairPage{pagination.SinglePageBase(r)} }) }