| Jon Perritt | fd53bba | 2014-10-03 00:41:22 -0500 | [diff] [blame] | 1 | package apiversions | 
|  | 2 |  | 
|  | 3 | import ( | 
|  | 4 | "github.com/rackspace/gophercloud" | 
|  | 5 | "github.com/rackspace/gophercloud/pagination" | 
|  | 6 |  | 
|  | 7 | "github.com/racker/perigee" | 
|  | 8 | ) | 
|  | 9 |  | 
| Jamie Hannaford | d8275bb | 2014-10-06 16:12:23 +0200 | [diff] [blame] | 10 | // List lists all the Cinder API versions available to end-users. | 
| Jon Perritt | fd53bba | 2014-10-03 00:41:22 -0500 | [diff] [blame] | 11 | func List(c *gophercloud.ServiceClient) pagination.Pager { | 
|  | 12 | return pagination.NewPager(c, listURL(c), func(r pagination.LastHTTPResponse) pagination.Page { | 
|  | 13 | 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. | 
|  | 19 | func 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}, | 
|  | 24 | Results:     &res.Resp, | 
|  | 25 | }) | 
|  | 26 | res.Err = err | 
|  | 27 | return res | 
|  | 28 | } |