Jamie Hannaford | 4721abc | 2014-09-16 16:29:04 +0200 | [diff] [blame] | 1 | package extensions |
Jamie Hannaford | 1ce30f2 | 2014-09-16 11:23:34 +0200 | [diff] [blame] | 2 | |
| 3 | import ( |
| 4 | "github.com/racker/perigee" |
| 5 | "github.com/rackspace/gophercloud" |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 6 | "github.com/rackspace/gophercloud/pagination" |
Jamie Hannaford | 1ce30f2 | 2014-09-16 11:23:34 +0200 | [diff] [blame] | 7 | ) |
| 8 | |
Jamie Hannaford | d903642 | 2014-09-23 17:50:24 +0200 | [diff] [blame] | 9 | // Get retrieves information for a specific extension using its alias. |
| 10 | func Get(c *gophercloud.ServiceClient, alias string) GetResult { |
| 11 | var res GetResult |
Jamie Hannaford | 6f57e9e | 2014-10-02 10:27:28 +0200 | [diff] [blame^] | 12 | _, res.Err = perigee.Request("GET", extensionURL(c, alias), perigee.Options{ |
Jamie Hannaford | 1ce30f2 | 2014-09-16 11:23:34 +0200 | [diff] [blame] | 13 | MoreHeaders: c.Provider.AuthenticatedHeaders(), |
Jamie Hannaford | d903642 | 2014-09-23 17:50:24 +0200 | [diff] [blame] | 14 | Results: &res.Resp, |
| 15 | OkCodes: []int{200}, |
Jamie Hannaford | 1ce30f2 | 2014-09-16 11:23:34 +0200 | [diff] [blame] | 16 | }) |
Jamie Hannaford | d903642 | 2014-09-23 17:50:24 +0200 | [diff] [blame] | 17 | return res |
Jamie Hannaford | 1ce30f2 | 2014-09-16 11:23:34 +0200 | [diff] [blame] | 18 | } |
Jamie Hannaford | 4721abc | 2014-09-16 16:29:04 +0200 | [diff] [blame] | 19 | |
Jamie Hannaford | c65e192 | 2014-09-22 13:20:58 +0200 | [diff] [blame] | 20 | // List returns a Pager which allows you to iterate over the full collection of |
| 21 | // extensions. It does not accept query parameters. |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 22 | func List(c *gophercloud.ServiceClient) pagination.Pager { |
Jamie Hannaford | c65e192 | 2014-09-22 13:20:58 +0200 | [diff] [blame] | 23 | return pagination.NewPager(c, listExtensionURL(c), func(r pagination.LastHTTPResponse) pagination.Page { |
Jamie Hannaford | f0c615b | 2014-09-17 10:56:52 +0200 | [diff] [blame] | 24 | return ExtensionPage{pagination.SinglePageBase(r)} |
| 25 | }) |
Jamie Hannaford | 4721abc | 2014-09-16 16:29:04 +0200 | [diff] [blame] | 26 | } |