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 { |
Ash Wilson | b8b16f8 | 2014-10-20 10:19:49 -0400 | [diff] [blame^] | 12 | return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page { |
Jon Perritt | fd53bba | 2014-10-03 00:41:22 -0500 | [diff] [blame] | 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}, |
Ash Wilson | d3dc254 | 2014-10-20 10:10:48 -0400 | [diff] [blame] | 24 | Results: &res.Body, |
Jon Perritt | fd53bba | 2014-10-03 00:41:22 -0500 | [diff] [blame] | 25 | }) |
| 26 | res.Err = err |
| 27 | return res |
| 28 | } |