Jamie Hannaford | 80c7067 | 2015-10-06 16:09:33 +0200 | [diff] [blame] | 1 | // +build acceptance db rackspace |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 2 | |
| 3 | package v1 |
| 4 | |
| 5 | import ( |
Jamie Hannaford | 1110840 | 2015-02-23 10:31:41 +0100 | [diff] [blame] | 6 | os "github.com/rackspace/gophercloud/openstack/db/v1/flavors" |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 7 | "github.com/rackspace/gophercloud/pagination" |
| 8 | "github.com/rackspace/gophercloud/rackspace/db/v1/flavors" |
| 9 | ) |
| 10 | |
| 11 | func (c context) listFlavors() { |
| 12 | c.Logf("Listing flavors") |
| 13 | |
Jamie Hannaford | 1110840 | 2015-02-23 10:31:41 +0100 | [diff] [blame] | 14 | err := flavors.List(c.client).EachPage(func(page pagination.Page) (bool, error) { |
| 15 | flavorList, err := os.ExtractFlavors(page) |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 16 | c.AssertNoErr(err) |
| 17 | |
| 18 | for _, f := range flavorList { |
Jamie Hannaford | 99eced5 | 2015-03-02 15:24:22 +0100 | [diff] [blame] | 19 | c.Logf("Flavor: ID [%s] Name [%s] RAM [%d]", f.ID, f.Name, f.RAM) |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | return true, nil |
| 23 | }) |
| 24 | |
Jamie Hannaford | 1110840 | 2015-02-23 10:31:41 +0100 | [diff] [blame] | 25 | c.AssertNoErr(err) |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | func (c context) getFlavor() { |
Jamie Hannaford | 99eced5 | 2015-03-02 15:24:22 +0100 | [diff] [blame] | 29 | flavor, err := flavors.Get(c.client, "1").Extract() |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 30 | c.Logf("Getting flavor %s", flavor.ID) |
Jamie Hannaford | 1110840 | 2015-02-23 10:31:41 +0100 | [diff] [blame] | 31 | c.AssertNoErr(err) |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 32 | } |