Ash Wilson | 0482daf | 2014-10-22 11:24:40 -0400 | [diff] [blame] | 1 | package keypairs |
Ash Wilson | ad612f6 | 2014-10-22 14:04:37 -0400 | [diff] [blame] | 2 | |
| 3 | import ( |
Ash Wilson | 4aaaa1e | 2014-10-22 14:38:02 -0400 | [diff] [blame^] | 4 | "github.com/racker/perigee" |
Ash Wilson | ad612f6 | 2014-10-22 14:04:37 -0400 | [diff] [blame] | 5 | "github.com/rackspace/gophercloud" |
| 6 | "github.com/rackspace/gophercloud/pagination" |
| 7 | ) |
| 8 | |
| 9 | // List returns a Pager that allows you to iterate over a collection of KeyPairs. |
| 10 | func List(client *gophercloud.ServiceClient) pagination.Pager { |
| 11 | return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page { |
| 12 | return KeyPairPage{pagination.SinglePageBase(r)} |
| 13 | }) |
| 14 | } |
Ash Wilson | 4aaaa1e | 2014-10-22 14:38:02 -0400 | [diff] [blame^] | 15 | |
| 16 | // Get returns public data about a previously uploaded KeyPair. |
| 17 | func Get(client *gophercloud.ServiceClient, name string) GetResult { |
| 18 | var res GetResult |
| 19 | _, res.Err = perigee.Request("GET", getURL(client, name), perigee.Options{ |
| 20 | MoreHeaders: client.AuthenticatedHeaders(), |
| 21 | Results: &res.Body, |
| 22 | OkCodes: []int{200}, |
| 23 | }) |
| 24 | return res |
| 25 | } |