blob: f1b9c2289c698264dcc8eb71ab8c5ba21b4643ac [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 Wilsonf25ae372014-10-06 14:40:29 -040012 _, res.Err = perigee.Request("GET", ExtensionURL(c, alias), perigee.Options{
Ash Wilson61dcb022014-10-03 08:15:47 -040013 MoreHeaders: c.Provider.AuthenticatedHeaders(),
Ash Wilsond3dc2542014-10-20 10:10:48 -040014 Results: &res.Body,
Ash Wilson61dcb022014-10-03 08:15:47 -040015 OkCodes: []int{200},
16 })
Ash Wilson61dcb022014-10-03 08:15:47 -040017 return res
18}
19
Ash Wilson8e1fc8d2014-10-03 08:35:33 -040020// List returns a Pager which allows you to iterate over the full collection of extensions.
21// It does not accept query parameters.
Ash Wilson61dcb022014-10-03 08:15:47 -040022func List(c *gophercloud.ServiceClient) pagination.Pager {
Ash Wilsonb8b16f82014-10-20 10:19:49 -040023 return pagination.NewPager(c, ListExtensionURL(c), func(r pagination.PageResult) pagination.Page {
Ash Wilson61dcb022014-10-03 08:15:47 -040024 return ExtensionPage{pagination.SinglePageBase(r)}
25 })
26}