blob: 0d6e6df61750f9b82c0d431d25631a2a61bc477a [file] [log] [blame]
Jamie Hannaford80c70672015-10-06 16:09:33 +02001// +build acceptance db rackspace
Jamie Hannaford05d200d2015-02-20 14:49:05 +01002
3package v1
4
5import (
Jamie Hannaford11108402015-02-23 10:31:41 +01006 os "github.com/rackspace/gophercloud/openstack/db/v1/flavors"
Jamie Hannaford05d200d2015-02-20 14:49:05 +01007 "github.com/rackspace/gophercloud/pagination"
8 "github.com/rackspace/gophercloud/rackspace/db/v1/flavors"
9)
10
11func (c context) listFlavors() {
12 c.Logf("Listing flavors")
13
Jamie Hannaford11108402015-02-23 10:31:41 +010014 err := flavors.List(c.client).EachPage(func(page pagination.Page) (bool, error) {
15 flavorList, err := os.ExtractFlavors(page)
Jamie Hannaford05d200d2015-02-20 14:49:05 +010016 c.AssertNoErr(err)
17
18 for _, f := range flavorList {
Jamie Hannaford99eced52015-03-02 15:24:22 +010019 c.Logf("Flavor: ID [%s] Name [%s] RAM [%d]", f.ID, f.Name, f.RAM)
Jamie Hannaford05d200d2015-02-20 14:49:05 +010020 }
21
22 return true, nil
23 })
24
Jamie Hannaford11108402015-02-23 10:31:41 +010025 c.AssertNoErr(err)
Jamie Hannaford05d200d2015-02-20 14:49:05 +010026}
27
28func (c context) getFlavor() {
Jamie Hannaford99eced52015-03-02 15:24:22 +010029 flavor, err := flavors.Get(c.client, "1").Extract()
Jamie Hannaford05d200d2015-02-20 14:49:05 +010030 c.Logf("Getting flavor %s", flavor.ID)
Jamie Hannaford11108402015-02-23 10:31:41 +010031 c.AssertNoErr(err)
Jamie Hannaford05d200d2015-02-20 14:49:05 +010032}