blob: 8cdd6c4f04c182d789d6088170add65ea9244d8d [file] [log] [blame]
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -07001package main
2
3import (
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -07004 "flag"
Jon Perritt2be65d12013-12-13 17:21:09 -06005 "fmt"
Max Lincoln28b49562013-12-13 13:23:44 -03006 "github.com/rackspace/gophercloud"
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -07007)
8
9var quiet = flag.Bool("quiet", false, "Quiet mode for acceptance testing. $? non-zero on error though.")
Samuel A. Falvo IIe4a3e422013-09-13 12:36:37 -070010var rgn = flag.String("r", "", "Datacenter region to interrogate. Leave blank for provider-default region.")
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070011
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 {
Samuel A. Falvo II9b23b342013-07-30 11:58:16 -070025 fmt.Printf("%s,\"%s\",%d,%d\n", image.Id, image.Name, image.MinRam, image.MinDisk)
Samuel A. Falvo II887d7802013-07-29 17:55:37 -070026 }
27 }
28 })
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070029 })
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070030}