blob: 2d3dc6509f3bb12dd414d0840f0d6ff01da26760 [file] [log] [blame]
Jamie Hannaford4721abc2014-09-16 16:29:04 +02001package extensions
Jamie Hannaford1ce30f22014-09-16 11:23:34 +02002
3import (
4 "github.com/racker/perigee"
5 "github.com/rackspace/gophercloud"
Jamie Hannafordf0c615b2014-09-17 10:56:52 +02006 "github.com/rackspace/gophercloud/pagination"
Jamie Hannaford1ce30f22014-09-16 11:23:34 +02007)
8
Jamie Hannafordd9036422014-09-23 17:50:24 +02009// Get retrieves information for a specific extension using its alias.
10func Get(c *gophercloud.ServiceClient, alias string) GetResult {
11 var res GetResult
Jamie Hannaford6f57e9e2014-10-02 10:27:28 +020012 _, res.Err = perigee.Request("GET", extensionURL(c, alias), perigee.Options{
Jamie Hannaford1ce30f22014-09-16 11:23:34 +020013 MoreHeaders: c.Provider.AuthenticatedHeaders(),
Jamie Hannafordd9036422014-09-23 17:50:24 +020014 Results: &res.Resp,
15 OkCodes: []int{200},
Jamie Hannaford1ce30f22014-09-16 11:23:34 +020016 })
Jamie Hannafordd9036422014-09-23 17:50:24 +020017 return res
Jamie Hannaford1ce30f22014-09-16 11:23:34 +020018}
Jamie Hannaford4721abc2014-09-16 16:29:04 +020019
Jamie Hannafordc65e1922014-09-22 13:20:58 +020020// List returns a Pager which allows you to iterate over the full collection of
21// extensions. It does not accept query parameters.
Jamie Hannafordf0c615b2014-09-17 10:56:52 +020022func List(c *gophercloud.ServiceClient) pagination.Pager {
Jamie Hannafordc65e1922014-09-22 13:20:58 +020023 return pagination.NewPager(c, listExtensionURL(c), func(r pagination.LastHTTPResponse) pagination.Page {
Jamie Hannafordf0c615b2014-09-17 10:56:52 +020024 return ExtensionPage{pagination.SinglePageBase(r)}
25 })
Jamie Hannaford4721abc2014-09-16 16:29:04 +020026}