blob: a56f249501e31cb1315b8e6430da597c38952417 [file] [log] [blame]
Jon Perrittfd53bba2014-10-03 00:41:22 -05001package apiversions
2
3import (
4 "github.com/rackspace/gophercloud"
5 "github.com/rackspace/gophercloud/pagination"
6
7 "github.com/racker/perigee"
8)
9
Jamie Hannafordd8275bb2014-10-06 16:12:23 +020010// List lists all the Cinder API versions available to end-users.
Jon Perrittfd53bba2014-10-03 00:41:22 -050011func List(c *gophercloud.ServiceClient) pagination.Pager {
Ash Wilsonb8b16f82014-10-20 10:19:49 -040012 return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page {
Jon Perrittfd53bba2014-10-03 00:41:22 -050013 return APIVersionPage{pagination.SinglePageBase(r)}
14 })
15}
16
17// Get will retrieve the volume type with the provided ID. To extract the volume
18// type from the result, call the Extract method on the GetResult.
19func Get(client *gophercloud.ServiceClient, v string) GetResult {
20 var res GetResult
21 _, err := perigee.Request("GET", getURL(client, v), perigee.Options{
22 MoreHeaders: client.Provider.AuthenticatedHeaders(),
23 OkCodes: []int{200},
Ash Wilsond3dc2542014-10-20 10:10:48 -040024 Results: &res.Body,
Jon Perrittfd53bba2014-10-03 00:41:22 -050025 })
26 res.Err = err
27 return res
28}