Ash Wilson | 61dcb02 | 2014-10-03 08:15:47 -0400 | [diff] [blame] | 1 | package extensions |
| 2 | |
| 3 | import ( |
| 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. |
| 10 | func Get(c *gophercloud.ServiceClient, alias string) GetResult { |
| 11 | var res GetResult |
Ash Wilson | f25ae37 | 2014-10-06 14:40:29 -0400 | [diff] [blame] | 12 | _, res.Err = perigee.Request("GET", ExtensionURL(c, alias), perigee.Options{ |
Ash Wilson | 61dcb02 | 2014-10-03 08:15:47 -0400 | [diff] [blame] | 13 | MoreHeaders: c.Provider.AuthenticatedHeaders(), |
Ash Wilson | d3dc254 | 2014-10-20 10:10:48 -0400 | [diff] [blame] | 14 | Results: &res.Body, |
Ash Wilson | 61dcb02 | 2014-10-03 08:15:47 -0400 | [diff] [blame] | 15 | OkCodes: []int{200}, |
| 16 | }) |
Ash Wilson | 61dcb02 | 2014-10-03 08:15:47 -0400 | [diff] [blame] | 17 | return res |
| 18 | } |
| 19 | |
Ash Wilson | 8e1fc8d | 2014-10-03 08:35:33 -0400 | [diff] [blame] | 20 | // List returns a Pager which allows you to iterate over the full collection of extensions. |
| 21 | // It does not accept query parameters. |
Ash Wilson | 61dcb02 | 2014-10-03 08:15:47 -0400 | [diff] [blame] | 22 | func List(c *gophercloud.ServiceClient) pagination.Pager { |
Ash Wilson | b8b16f8 | 2014-10-20 10:19:49 -0400 | [diff] [blame^] | 23 | return pagination.NewPager(c, ListExtensionURL(c), func(r pagination.PageResult) pagination.Page { |
Ash Wilson | 61dcb02 | 2014-10-03 08:15:47 -0400 | [diff] [blame] | 24 | return ExtensionPage{pagination.SinglePageBase(r)} |
| 25 | }) |
| 26 | } |