blob: 109d0180894c72268e7f30e31e63472db7f04ba1 [file] [log] [blame]
Samuel A. Falvo IIbc3f10f2013-07-11 17:13:24 -07001package main
2
3import (
Samuel A. Falvo IIbc3f10f2013-07-11 17:13:24 -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 IIbc3f10f2013-07-11 17:13:24 -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 IIbc3f10f2013-07-11 17:13:24 -070011
12func main() {
Samuel A. Falvo IIbc3f10f2013-07-11 17:13:24 -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 flavors, err := servers.ListFlavors()
18 if err != nil {
19 panic(err)
20 }
Samuel A. Falvo IIbc3f10f2013-07-11 17:13:24 -070021
Samuel A. Falvo II887d7802013-07-29 17:55:37 -070022 if !*quiet {
23 fmt.Println("ID,Name,MinRam,MinDisk")
24 for _, f := range flavors {
25 fmt.Printf("%s,\"%s\",%d,%d\n", f.Id, f.Name, f.Ram, f.Disk)
26 }
27 }
28 })
Samuel A. Falvo IIbc3f10f2013-07-11 17:13:24 -070029 })
Samuel A. Falvo IIbc3f10f2013-07-11 17:13:24 -070030}