Jon Perritt | 23e89c3 | 2015-01-19 15:39:45 -0700 | [diff] [blame] | 1 | package flavors |
| 2 | |
| 3 | import ( |
| 4 | "github.com/racker/perigee" |
| 5 | "github.com/rackspace/gophercloud" |
| 6 | "github.com/rackspace/gophercloud/pagination" |
| 7 | ) |
| 8 | |
| 9 | // List returns a single page of CDN flavors. |
| 10 | func List(c *gophercloud.ServiceClient) pagination.Pager { |
| 11 | url := listURL(c) |
| 12 | createPage := func(r pagination.PageResult) pagination.Page { |
| 13 | return FlavorPage{pagination.SinglePageBase(r)} |
| 14 | } |
| 15 | return pagination.NewPager(c, url, createPage) |
| 16 | } |
| 17 | |
| 18 | // Get retrieves a specific flavor based on its unique ID. |
| 19 | func Get(c *gophercloud.ServiceClient, id string) GetResult { |
| 20 | var res GetResult |
| 21 | _, res.Err = perigee.Request("GET", getURL(c, id), perigee.Options{ |
| 22 | MoreHeaders: c.AuthenticatedHeaders(), |
| 23 | Results: &res.Body, |
| 24 | OkCodes: []int{200}, |
| 25 | }) |
| 26 | return res |
| 27 | } |