blob: 9b137f43d3563b87498a5054165e8a61ef3c0474 [file] [log] [blame]
Mark Peek5a9151f2013-08-17 18:59:59 -07001package main
2
3import (
4 "flag"
5 "fmt"
6 "github.com/rackspace/gophercloud"
7)
8
9var quiet = flag.Bool("quiet", false, "Quiet mode for acceptance testing. $? non-zero on error though.")
10var rgn = flag.String("r", "DFW", "Datacenter region to interrogate.")
11
12func main() {
13 flag.Parse()
14
15 withIdentity(false, func(auth gophercloud.AccessProvider) {
16 withServerApi(auth, func(servers gophercloud.CloudServersProvider) {
17 keypairs, err := servers.ListKeyPairs()
18 if err != nil {
19 panic(err)
20 }
21
22 if !*quiet {
23 fmt.Println("name,fingerprint,publickey")
24 for _, key := range keypairs {
25 fmt.Printf("%s,%s,%s\n", key.Name, key.FingerPrint, key.PublicKey)
26 }
27 }
28 })
29 })
30}