Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 920bd13

Browse files
James FisherSamuel Ortiz
authored andcommitted
prefix urls with /images
1 parent 5e7410b commit 920bd13

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

openstack/imageservice/v2/urls.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import "github.com/rackspace/gophercloud"
55
// `listURL` is a pure function. `listURL(c)` is a URL for which a GET
66
// request will respond with a list of images in the service `c`.
77
func listURL(c *gophercloud.ServiceClient) string {
8-
return c.Endpoint
8+
return c.ServiceURL("images")
99
}
1010

1111
func createURL(c *gophercloud.ServiceClient) string {
12-
return c.Endpoint
12+
return c.ServiceURL("images")
1313
}
1414

1515
// `imageURL(c,i)` is the URL for the image identified by ID `i` in
1616
// the service `c`.
1717
func imageURL(c *gophercloud.ServiceClient, imageID string) string {
18-
return c.ServiceURL(imageID)
18+
return c.ServiceURL("images", imageID)
1919
}
2020

2121
// `getURL(c,i)` is a URL for which a GET request will respond with
@@ -30,31 +30,31 @@ var deleteURL = imageURL
3030
// `imageDataURL(c,i)` is the URL for the binary image data for the
3131
// image identified by ID `i` in the service `c`.
3232
func imageDataURL(c *gophercloud.ServiceClient, imageID string) string {
33-
return c.ServiceURL(imageID, "file")
33+
return c.ServiceURL("images", imageID, "file")
3434
}
3535

3636
var getDataURL = imageDataURL
3737

3838
var updateDataURL = imageDataURL
3939

4040
func imageTagURL(c *gophercloud.ServiceClient, imageID string, tag string) string {
41-
return c.ServiceURL(imageID, "tags", tag)
41+
return c.ServiceURL("images", imageID, "tags", tag)
4242
}
4343

4444
var createTagURL = imageTagURL
4545

4646
var deleteTagURL = imageTagURL
4747

4848
func imageMembersURL(c *gophercloud.ServiceClient, imageID string) string {
49-
return c.ServiceURL(imageID, "members")
49+
return c.ServiceURL("images", imageID, "members")
5050
}
5151

5252
var listMembersURL = imageMembersURL
5353

5454
var createMemberURL = imageMembersURL
5555

5656
func imageMemberURL(c *gophercloud.ServiceClient, imageID string, memberID string) string {
57-
return c.ServiceURL(imageID, "members", memberID)
57+
return c.ServiceURL("images", imageID, "members", memberID)
5858
}
5959

6060
var getMemberURL = imageMemberURL
@@ -64,9 +64,9 @@ var updateMemberURL = imageMemberURL
6464
var deleteMemberURL = imageMemberURL
6565

6666
func reactivateImageURL(c *gophercloud.ServiceClient, imageID string) string {
67-
return c.ServiceURL(imageID, "actions", "reactivate")
67+
return c.ServiceURL("images", imageID, "actions", "reactivate")
6868
}
6969

7070
func deactivateImageURL(c *gophercloud.ServiceClient, imageID string) string {
71-
return c.ServiceURL(imageID, "actions", "deactivate")
71+
return c.ServiceURL("images", imageID, "actions", "deactivate")
7272
}

openstack/imageservice/v2/urls_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77
th "github.com/rackspace/gophercloud/testhelper"
88
)
99

10-
const endpoint = "http://localhost:57909/v2"
10+
const endpoint = "http://localhost:57909/v2/"
1111

1212
func endpointClient() *gophercloud.ServiceClient {
1313
return &gophercloud.ServiceClient{Endpoint: endpoint}
1414
}
1515

1616
func TestListURL(t *testing.T) {
17-
th.AssertEquals(t, endpoint, listURL(endpointClient()))
17+
th.AssertEquals(t, endpoint + "images", listURL(endpointClient()))
1818
}

0 commit comments

Comments
 (0)