blob: b28b3f5586fa75735986bb13ba21d6199055e112 [file] [log] [blame]
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -07001package main
2
3import (
4 "fmt"
5 "flag"
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() {
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070013 flag.Parse()
14
Samuel A. Falvo II887d7802013-07-29 17:55:37 -070015 withIdentity(false, func(auth gophercloud.AccessProvider) {
16 withServerApi(auth, func(servers gophercloud.CloudServersProvider) {
17 images, err := servers.ListImages()
18 if err != nil {
19 panic(err)
20 }
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070021
Samuel A. Falvo II887d7802013-07-29 17:55:37 -070022 if !*quiet {
23 fmt.Println("ID,Name,MinRam,MinDisk")
24 for _, image := range images {
25 fmt.Printf("%s,\"%s\",%d,%d\n", image.Id, image.Name, image.MinRam, image.MinRam)
26 }
27 }
28 })
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070029 })
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070030}