blob: 5b213db72c63c9c8342321cf601583b93dbbac87 [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"
Jon Perrittfd53bba2014-10-03 00:41:22 -05006)
7
Jamie Hannafordd8275bb2014-10-06 16:12:23 +02008// List lists all the Cinder API versions available to end-users.
Jon Perrittfd53bba2014-10-03 00:41:22 -05009func List(c *gophercloud.ServiceClient) pagination.Pager {
Ash Wilsonb8b16f82014-10-20 10:19:49 -040010 return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page {
Jon Perrittfd53bba2014-10-03 00:41:22 -050011 return APIVersionPage{pagination.SinglePageBase(r)}
12 })
13}
14
15// Get will retrieve the volume type with the provided ID. To extract the volume
16// type from the result, call the Extract method on the GetResult.
17func Get(client *gophercloud.ServiceClient, v string) GetResult {
18 var res GetResult
Ash Wilsonacb1b902015-02-12 14:29:31 -050019 _, res.Err = client.Request("GET", getURL(client, v), gophercloud.RequestOpts{
Ash Wilsonacb1b902015-02-12 14:29:31 -050020 JSONResponse: &res.Body,
Jon Perrittfd53bba2014-10-03 00:41:22 -050021 })
Jon Perrittfd53bba2014-10-03 00:41:22 -050022 return res
23}