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

Commit 52dbcee

Browse files
author
Jamie Hannaford
committed
fix general issues
1 parent 80c7067 commit 52dbcee

27 files changed

+239
-129
lines changed

rackspace/db/v1/configurations/requests.go renamed to openstack/db/v1/configurations/requests.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ func Update(client *gophercloud.ServiceClient, configID string, opts UpdateOptsB
187187
}
188188

189189
_, res.Err = client.Request("PATCH", resourceURL(client, configID), gophercloud.RequestOpts{
190-
OkCodes: []int{200},
191-
JSONBody: &reqBody,
192-
JSONResponse: &res.Body,
190+
OkCodes: []int{200},
191+
JSONBody: &reqBody,
193192
})
194193

195194
return res
@@ -208,9 +207,8 @@ func Replace(client *gophercloud.ServiceClient, configID string, opts UpdateOpts
208207
}
209208

210209
_, res.Err = client.Request("PUT", resourceURL(client, configID), gophercloud.RequestOpts{
211-
OkCodes: []int{202},
212-
JSONBody: &reqBody,
213-
JSONResponse: &res.Body,
210+
OkCodes: []int{202},
211+
JSONBody: &reqBody,
214212
})
215213

216214
return res

rackspace/db/v1/configurations/requests_test.go renamed to openstack/db/v1/configurations/requests_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestGet(t *testing.T) {
5858
func TestCreate(t *testing.T) {
5959
th.SetupHTTP()
6060
defer th.TeardownHTTP()
61-
fixture.SetupHandler(t, _baseURL, "POST", createReq, createConfigJSON, 201)
61+
fixture.SetupHandler(t, _baseURL, "POST", createReq, createConfigJSON, 200)
6262

6363
opts := CreateOpts{
6464
Datastore: &DatastoreOpts{

openstack/db/v1/databases/requests.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ func Create(client *gophercloud.ServiceClient, instanceID string, opts CreateOpt
8484
}
8585

8686
_, res.Err = client.Request("POST", baseURL(client, instanceID), gophercloud.RequestOpts{
87-
JSONBody: &reqBody,
88-
JSONResponse: &res.Body,
89-
OkCodes: []int{202},
87+
JSONBody: &reqBody,
88+
OkCodes: []int{202},
9089
})
9190

9291
return res

openstack/db/v1/datastores/doc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package datastores provides information and interaction with the datastore
2+
// API resource in the Rackspace Database service.
3+
package datastores
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package datastores
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/rackspace/gophercloud"
7+
)
8+
9+
const version1JSON = `
10+
{
11+
"id": "b00000b0-00b0-0b00-00b0-000b000000bb",
12+
"links": [
13+
{
14+
"href": "https://10.240.28.38:8779/v1.0/1234/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb",
15+
"rel": "self"
16+
},
17+
{
18+
"href": "https://10.240.28.38:8779/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb",
19+
"rel": "bookmark"
20+
}
21+
],
22+
"name": "5.1"
23+
}
24+
`
25+
26+
const version2JSON = `
27+
{
28+
"id": "c00000b0-00c0-0c00-00c0-000b000000cc",
29+
"links": [
30+
{
31+
"href": "https://10.240.28.38:8779/v1.0/1234/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc",
32+
"rel": "self"
33+
},
34+
{
35+
"href": "https://10.240.28.38:8779/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc",
36+
"rel": "bookmark"
37+
}
38+
],
39+
"name": "5.2"
40+
}
41+
`
42+
43+
var versionsJSON = fmt.Sprintf(`"versions": [%s, %s]`, version1JSON, version2JSON)
44+
45+
var singleDSJSON = fmt.Sprintf(`
46+
{
47+
"default_version": "c00000b0-00c0-0c00-00c0-000b000000cc",
48+
"id": "10000000-0000-0000-0000-000000000001",
49+
"links": [
50+
{
51+
"href": "https://10.240.28.38:8779/v1.0/1234/datastores/10000000-0000-0000-0000-000000000001",
52+
"rel": "self"
53+
},
54+
{
55+
"href": "https://10.240.28.38:8779/datastores/10000000-0000-0000-0000-000000000001",
56+
"rel": "bookmark"
57+
}
58+
],
59+
"name": "mysql",
60+
%s
61+
}
62+
`, versionsJSON)
63+
64+
var (
65+
ListDSResp = fmt.Sprintf(`{"datastores":[%s]}`, singleDSJSON)
66+
GetDSResp = fmt.Sprintf(`{"datastore":%s}`, singleDSJSON)
67+
ListVersionsResp = fmt.Sprintf(`{%s}`, versionsJSON)
68+
GetVersionResp = fmt.Sprintf(`{"version":%s}`, version1JSON)
69+
)
70+
71+
var ExampleVersion1 = Version{
72+
ID: "b00000b0-00b0-0b00-00b0-000b000000bb",
73+
Links: []gophercloud.Link{
74+
gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb"},
75+
gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb"},
76+
},
77+
Name: "5.1",
78+
}
79+
80+
var exampleVersion2 = Version{
81+
ID: "c00000b0-00c0-0c00-00c0-000b000000cc",
82+
Links: []gophercloud.Link{
83+
gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc"},
84+
gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc"},
85+
},
86+
Name: "5.2",
87+
}
88+
89+
var ExampleVersions = []Version{ExampleVersion1, exampleVersion2}
90+
91+
var ExampleDatastore = Datastore{
92+
DefaultVersion: "c00000b0-00c0-0c00-00c0-000b000000cc",
93+
ID: "10000000-0000-0000-0000-000000000001",
94+
Links: []gophercloud.Link{
95+
gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/10000000-0000-0000-0000-000000000001"},
96+
gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/10000000-0000-0000-0000-000000000001"},
97+
},
98+
Name: "mysql",
99+
Versions: ExampleVersions,
100+
}

0 commit comments

Comments
 (0)