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 |
| 12 | _, err := perigee.Request("GET", extensionURL(c, alias), perigee.Options{ |
| 13 | MoreHeaders: c.Provider.AuthenticatedHeaders(), |
| 14 | Results: &res.Resp, |
| 15 | OkCodes: []int{200}, |
| 16 | }) |
| 17 | res.Err = err |
| 18 | return res |
| 19 | } |
| 20 | |
| 21 | // List returns a Pager which allows you to iterate over the full collection of |
| 22 | // extensions. It does not accept query parameters. |
| 23 | func List(c *gophercloud.ServiceClient) pagination.Pager { |
| 24 | return pagination.NewPager(c, listExtensionURL(c), func(r pagination.LastHTTPResponse) pagination.Page { |
| 25 | return ExtensionPage{pagination.SinglePageBase(r)} |
| 26 | }) |
| 27 | } |