blob: 2e35a402598892981732cf1b82c8dbfcce324e46 [file] [log] [blame]
Ash Wilson0482daf2014-10-22 11:24:40 -04001package keypairs
Ash Wilsonad612f62014-10-22 14:04:37 -04002
3import (
Ash Wilson4aaaa1e2014-10-22 14:38:02 -04004 "github.com/racker/perigee"
Ash Wilsonad612f62014-10-22 14:04:37 -04005 "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.
10func 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 Wilson4aaaa1e2014-10-22 14:38:02 -040015
16// Get returns public data about a previously uploaded KeyPair.
17func 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}