blob: 0e2d7c2b95e01158dc0bdf93e23b0511e837ceb5 [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
11func getListURL(client *gophercloud.ServiceClient, lfo ListFilterOptions) string {
12 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
35func getFlavorURL(client *gophercloud.ServiceClient, id string) string {
36 return client.ServiceURL("flavors", id)
37}