blob: 4c55d3487d063935330815a9c9110ffce1074414 [file] [log] [blame]
jrperrittc5c590a2016-11-04 14:41:15 -05001package images
2
3import (
4 "strings"
5
Krzysztof Szukiełojć3f41d082017-05-07 14:43:06 +02006 "gerrit.mcp.mirantis.net/debian/gophercloud.git"
jrperrittc5c590a2016-11-04 14:41:15 -05007)
8
9// `listURL` is a pure function. `listURL(c)` is a URL for which a GET
10// request will respond with a list of images in the service `c`.
11func listURL(c *gophercloud.ServiceClient) string {
12 return c.ServiceURL("images")
13}
14
15func createURL(c *gophercloud.ServiceClient) string {
16 return c.ServiceURL("images")
17}
18
19// `imageURL(c,i)` is the URL for the image identified by ID `i` in
20// the service `c`.
21func imageURL(c *gophercloud.ServiceClient, imageID string) string {
22 return c.ServiceURL("images", imageID)
23}
24
25// `getURL(c,i)` is a URL for which a GET request will respond with
26// information about the image identified by ID `i` in the service
27// `c`.
28func getURL(c *gophercloud.ServiceClient, imageID string) string {
29 return imageURL(c, imageID)
30}
31
32func updateURL(c *gophercloud.ServiceClient, imageID string) string {
33 return imageURL(c, imageID)
34}
35
36func deleteURL(c *gophercloud.ServiceClient, imageID string) string {
37 return imageURL(c, imageID)
38}
39
40// builds next page full url based on current url
41func nextPageURL(currentURL string, next string) string {
42 base := currentURL[:strings.Index(currentURL, "/images")]
43 return base + next
44}