blob: 8f7fd675b1f8612b94f5acb19615880721fe6b57 [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 Hannafordc65e1922014-09-22 13:20:58 +020012 _, 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 res.Err = err
18 return res
Jamie Hannaford1ce30f22014-09-16 11:23:34 +020019}
Jamie Hannaford4721abc2014-09-16 16:29:04 +020020
Jamie Hannafordc65e1922014-09-22 13:20:58 +020021// List returns a Pager which allows you to iterate over the full collection of
22// extensions. It does not accept query parameters.
Jamie Hannafordf0c615b2014-09-17 10:56:52 +020023func List(c *gophercloud.ServiceClient) pagination.Pager {
Jamie Hannafordc65e1922014-09-22 13:20:58 +020024 return pagination.NewPager(c, listExtensionURL(c), func(r pagination.LastHTTPResponse) pagination.Page {
Jamie Hannafordf0c615b2014-09-17 10:56:52 +020025 return ExtensionPage{pagination.SinglePageBase(r)}
26 })
Jamie Hannaford4721abc2014-09-16 16:29:04 +020027}