blob: 6440cc9278d703a298b3916ec270ef76314eaab4 [file] [log] [blame]
Jamie Hannaford05d200d2015-02-20 14:49:05 +01001// +build acceptance db
2
3package v1
4
5import (
Jon Perritt27249f42016-02-18 10:35:59 -06006 "github.com/gophercloud/gophercloud/openstack/db/v1/flavors"
7 "github.com/gophercloud/gophercloud/pagination"
Jamie Hannaford05d200d2015-02-20 14:49:05 +01008)
9
10func (c context) listFlavors() {
11 c.Logf("Listing flavors")
12
Jamie Hannaford11108402015-02-23 10:31:41 +010013 err := flavors.List(c.client).EachPage(func(page pagination.Page) (bool, error) {
14 flavorList, err := flavors.ExtractFlavors(page)
Jamie Hannaford05d200d2015-02-20 14:49:05 +010015 c.AssertNoErr(err)
16
17 for _, f := range flavorList {
Jamie Hannaford99eced52015-03-02 15:24:22 +010018 c.Logf("Flavor: ID [%s] Name [%s] RAM [%d]", f.ID, f.Name, f.RAM)
Jamie Hannaford05d200d2015-02-20 14:49:05 +010019 }
20
21 return true, nil
22 })
23
Jamie Hannaford11108402015-02-23 10:31:41 +010024 c.AssertNoErr(err)
Jamie Hannaford05d200d2015-02-20 14:49:05 +010025}
26
27func (c context) getFlavor() {
Jamie Hannaford18b45ed2015-02-23 12:54:10 +010028 flavor, err := flavors.Get(c.client, "1").Extract()
Jamie Hannaford05d200d2015-02-20 14:49:05 +010029 c.Logf("Getting flavor %s", flavor.ID)
Jamie Hannaford11108402015-02-23 10:31:41 +010030 c.AssertNoErr(err)
Jamie Hannaford05d200d2015-02-20 14:49:05 +010031}