blob: 9e5b562517f2adc0a94032d7b59210a994e9e1bd [file] [log] [blame]
Ash Wilson16e75ef2014-09-17 09:54:57 -04001package flavors
2
3import (
4 "fmt"
5 "net/url"
6 "strconv"
7
8 "github.com/rackspace/gophercloud"
9)
10
Ash Wilson31f6bde2014-09-25 14:52:12 -040011func listURL(client *gophercloud.ServiceClient, lfo ListFilterOptions) string {
Ash Wilson16e75ef2014-09-17 09:54:57 -040012 v := url.Values{}
13 if lfo.ChangesSince != "" {
14 v.Set("changes-since", lfo.ChangesSince)
15 }
16 if lfo.MinDisk != 0 {
17 v.Set("minDisk", strconv.Itoa(lfo.MinDisk))
18 }
19 if lfo.MinRAM != 0 {
20 v.Set("minRam", strconv.Itoa(lfo.MinRAM))
21 }
22 if lfo.Marker != "" {
23 v.Set("marker", lfo.Marker)
24 }
25 if lfo.Limit != 0 {
26 v.Set("limit", strconv.Itoa(lfo.Limit))
27 }
28 tail := ""
29 if len(v) > 0 {
30 tail = fmt.Sprintf("?%s", v.Encode())
31 }
32 return client.ServiceURL("flavors", "detail") + tail
33}
34
Ash Wilson31f6bde2014-09-25 14:52:12 -040035func flavorURL(client *gophercloud.ServiceClient, id string) string {
Ash Wilson16e75ef2014-09-17 09:54:57 -040036 return client.ServiceURL("flavors", id)
37}