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