Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 1 | // +build acceptance db |
| 2 | |
| 3 | package v1 |
| 4 | |
| 5 | import ( |
Jon Perritt | 27249f4 | 2016-02-18 10:35:59 -0600 | [diff] [blame] | 6 | "github.com/gophercloud/gophercloud/openstack/db/v1/flavors" |
| 7 | "github.com/gophercloud/gophercloud/pagination" |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 8 | ) |
| 9 | |
| 10 | func (c context) listFlavors() { |
| 11 | c.Logf("Listing flavors") |
| 12 | |
Jamie Hannaford | 1110840 | 2015-02-23 10:31:41 +0100 | [diff] [blame] | 13 | err := flavors.List(c.client).EachPage(func(page pagination.Page) (bool, error) { |
| 14 | flavorList, err := flavors.ExtractFlavors(page) |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 15 | c.AssertNoErr(err) |
| 16 | |
| 17 | for _, f := range flavorList { |
Jamie Hannaford | 99eced5 | 2015-03-02 15:24:22 +0100 | [diff] [blame] | 18 | 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] | 19 | } |
| 20 | |
| 21 | return true, nil |
| 22 | }) |
| 23 | |
Jamie Hannaford | 1110840 | 2015-02-23 10:31:41 +0100 | [diff] [blame] | 24 | c.AssertNoErr(err) |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | func (c context) getFlavor() { |
Jamie Hannaford | 18b45ed | 2015-02-23 12:54:10 +0100 | [diff] [blame] | 28 | flavor, err := flavors.Get(c.client, "1").Extract() |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 29 | c.Logf("Getting flavor %s", flavor.ID) |
Jamie Hannaford | 1110840 | 2015-02-23 10:31:41 +0100 | [diff] [blame] | 30 | c.AssertNoErr(err) |
Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame] | 31 | } |