Add support for keypairs
Adds support for the following keypair operations:
- ListKeyPairs yields the list of available keypairs.
- CreateKeyPairs will create or generate a new keypair.
- DeleteKeyPair wil delete a keypair.
- ShowKeyPair will yield the named keypair.
diff --git a/acceptance/15-list-keypairs.go b/acceptance/15-list-keypairs.go
new file mode 100644
index 0000000..9b137f4
--- /dev/null
+++ b/acceptance/15-list-keypairs.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "github.com/rackspace/gophercloud"
+)
+
+var quiet = flag.Bool("quiet", false, "Quiet mode for acceptance testing. $? non-zero on error though.")
+var rgn = flag.String("r", "DFW", "Datacenter region to interrogate.")
+
+func main() {
+ flag.Parse()
+
+ withIdentity(false, func(auth gophercloud.AccessProvider) {
+ withServerApi(auth, func(servers gophercloud.CloudServersProvider) {
+ keypairs, err := servers.ListKeyPairs()
+ if err != nil {
+ panic(err)
+ }
+
+ if !*quiet {
+ fmt.Println("name,fingerprint,publickey")
+ for _, key := range keypairs {
+ fmt.Printf("%s,%s,%s\n", key.Name, key.FingerPrint, key.PublicKey)
+ }
+ }
+ })
+ })
+}