blob: 1ef7b6d9052a96384a238d78b640194684bc48e6 [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"
6)
7
8func 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 Hannaford4721abc2014-09-16 16:29:04 +020023
24func List(c *gophercloud.ServiceClient) gophercloud.Pager {
25 return gophercloud.NewLinkedPager(c, ListExtensionURL(c))
26}