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" |
| 6 | ) |
| 7 | |
| 8 | func Get(c *gophercloud.ServiceClient, name string) (*Extension, error) { |
| 9 | var ext Extension |
| 10 | _, err := perigee.Request("GET", ExtensionURL(c, name), perigee.Options{ |
| 11 | MoreHeaders: c.Provider.AuthenticatedHeaders(), |
| 12 | Results: &struct { |
| 13 | Extension *Extension `json:"extension"` |
| 14 | }{&ext}, |
| 15 | OkCodes: []int{200}, |
| 16 | }) |
| 17 | |
| 18 | if err != nil { |
| 19 | return nil, err |
| 20 | } |
| 21 | return &ext, nil |
| 22 | } |
Jamie Hannaford | 4721abc | 2014-09-16 16:29:04 +0200 | [diff] [blame^] | 23 | |
| 24 | func List(c *gophercloud.ServiceClient) gophercloud.Pager { |
| 25 | return gophercloud.NewLinkedPager(c, ListExtensionURL(c)) |
| 26 | } |