Complete Flavors sub-API.
diff --git a/openstack/compute/flavors/client.go b/openstack/compute/flavors/client.go
index 60c7cd1..2c64908 100644
--- a/openstack/compute/flavors/client.go
+++ b/openstack/compute/flavors/client.go
@@ -1,7 +1,10 @@
package flavors
import (
+ "fmt"
+ "net/url"
"github.com/rackspace/gophercloud/openstack/identity"
+ "strconv"
)
type Client struct {
@@ -18,8 +21,32 @@
}
}
-func (c *Client) getListUrl() string {
- return c.endpoint + "/flavors/detail"
+func (c *Client) getListUrl(lfo ListFilterOptions) string {
+ v := url.Values{}
+ if lfo.ChangesSince != "" {
+ v.Set("changes-since", lfo.ChangesSince)
+ }
+ if lfo.MinDisk != 0 {
+ v.Set("minDisk", strconv.Itoa(lfo.MinDisk))
+ }
+ if lfo.MinRam != 0 {
+ v.Set("minRam", strconv.Itoa(lfo.MinRam))
+ }
+ if lfo.Marker != "" {
+ v.Set("marker", lfo.Marker)
+ }
+ if lfo.Limit != 0 {
+ v.Set("limit", strconv.Itoa(lfo.Limit))
+ }
+ tail := ""
+ if len(v) > 0 {
+ tail = fmt.Sprintf("?%s", v.Encode())
+ }
+ return fmt.Sprintf("%s/flavors/detail%s", c.endpoint, tail)
+}
+
+func (c *Client) getGetUrl(id string) string {
+ return fmt.Sprintf("%s/flavors/%s", c.endpoint, id)
}
func (c *Client) getListHeaders() (map[string]string, error) {