Ash Wilson | 16e75ef | 2014-09-17 09:54:57 -0400 | [diff] [blame] | 1 | package flavors |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "net/url" |
| 6 | "strconv" |
| 7 | |
| 8 | "github.com/rackspace/gophercloud" |
| 9 | ) |
| 10 | |
| 11 | func 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 | |
| 35 | func getFlavorURL(client *gophercloud.ServiceClient, id string) string { |
| 36 | return client.ServiceURL("flavors", id) |
| 37 | } |