Jamie Hannaford | 5b7acc1 | 2015-02-13 09:14:25 +0100 | [diff] [blame] | 1 | package flavors |
| 2 | |
| 3 | import ( |
Jamie Hannaford | 5b7acc1 | 2015-02-13 09:14:25 +0100 | [diff] [blame] | 4 | "github.com/rackspace/gophercloud" |
| 5 | "github.com/rackspace/gophercloud/pagination" |
| 6 | ) |
| 7 | |
| 8 | func List(client *gophercloud.ServiceClient) pagination.Pager { |
| 9 | createPage := func(r pagination.PageResult) pagination.Page { |
| 10 | return FlavorPage{pagination.LinkedPageBase{PageResult: r}} |
| 11 | } |
| 12 | |
| 13 | return pagination.NewPager(client, listURL(client), createPage) |
| 14 | } |
| 15 | |
| 16 | func Get(client *gophercloud.ServiceClient, id string) GetResult { |
| 17 | var gr GetResult |
Jamie Hannaford | a50d135 | 2015-02-18 11:38:38 +0100 | [diff] [blame] | 18 | |
| 19 | _, gr.Err = client.Request("GET", getURL(client, id), gophercloud.RequestOpts{ |
| 20 | JSONResponse: &gr.Body, |
| 21 | OkCodes: []int{200}, |
Jamie Hannaford | 5b7acc1 | 2015-02-13 09:14:25 +0100 | [diff] [blame] | 22 | }) |
Jamie Hannaford | a50d135 | 2015-02-18 11:38:38 +0100 | [diff] [blame] | 23 | |
Jamie Hannaford | 5b7acc1 | 2015-02-13 09:14:25 +0100 | [diff] [blame] | 24 | return gr |
| 25 | } |