blob: ed5ea4b46cbc25d32c638f465a551a4f965f65ba [file] [log] [blame]
Ash Wilson61dcb022014-10-03 08:15:47 -04001package extensions
2
3import (
4 "github.com/racker/perigee"
5 "github.com/rackspace/gophercloud"
6 "github.com/rackspace/gophercloud/pagination"
7)
8
9// Get retrieves information for a specific extension using its alias.
10func Get(c *gophercloud.ServiceClient, alias string) GetResult {
11 var res GetResult
Ash Wilson05e41072014-10-03 16:33:42 -040012 _, err := perigee.Request("GET", ExtensionURL(c, alias), perigee.Options{
Ash Wilson61dcb022014-10-03 08:15:47 -040013 MoreHeaders: c.Provider.AuthenticatedHeaders(),
14 Results: &res.Resp,
15 OkCodes: []int{200},
16 })
17 res.Err = err
18 return res
19}
20
Ash Wilson8e1fc8d2014-10-03 08:35:33 -040021// List returns a Pager which allows you to iterate over the full collection of extensions.
22// It does not accept query parameters.
Ash Wilson61dcb022014-10-03 08:15:47 -040023func List(c *gophercloud.ServiceClient) pagination.Pager {
Ash Wilson05e41072014-10-03 16:33:42 -040024 return pagination.NewPager(c, ListExtensionURL(c), func(r pagination.LastHTTPResponse) pagination.Page {
Ash Wilson61dcb022014-10-03 08:15:47 -040025 return ExtensionPage{pagination.SinglePageBase(r)}
26 })
27}