blob: 8b7797f4bc3ca32dc10ff80df74d5dfbfb0e5faa [file] [log] [blame]
Jamie Hannaford5b7acc12015-02-13 09:14:25 +01001package flavors
2
3import (
Jon Perritt27249f42016-02-18 10:35:59 -06004 "github.com/gophercloud/gophercloud"
5 "github.com/gophercloud/gophercloud/pagination"
Jamie Hannaford5b7acc12015-02-13 09:14:25 +01006)
7
Jamie Hannaford9793d942015-02-18 15:13:20 +01008// List will list all available hardware flavors that an instance can use. The
9// operation is identical to the one supported by the Nova API, but without the
10// "disk" property.
Jamie Hannaford5b7acc12015-02-13 09:14:25 +010011func List(client *gophercloud.ServiceClient) pagination.Pager {
Jon Perrittdb0ae142016-03-13 00:33:41 -060012 return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page {
Jamie Hannaford5b7acc12015-02-13 09:14:25 +010013 return FlavorPage{pagination.LinkedPageBase{PageResult: r}}
Jon Perrittdb0ae142016-03-13 00:33:41 -060014 })
Jamie Hannaford5b7acc12015-02-13 09:14:25 +010015}
16
Jamie Hannaford9793d942015-02-18 15:13:20 +010017// Get will retrieve information for a specified hardware flavor.
Jamie Hannaford8803f832015-02-23 10:44:55 +010018func Get(client *gophercloud.ServiceClient, id string) GetResult {
Jon Perrittdb0ae142016-03-13 00:33:41 -060019 var r GetResult
20 _, r.Err = client.Get(getURL(client, id), &r.Body, nil)
21 return r
Jamie Hannaford5b7acc12015-02-13 09:14:25 +010022}