Refactor to use new client.Request
diff --git a/rackspace/db/v1/backups/requests.go b/rackspace/db/v1/backups/requests.go
index 7bc14ff..9bcc25a 100644
--- a/rackspace/db/v1/backups/requests.go
+++ b/rackspace/db/v1/backups/requests.go
@@ -3,7 +3,6 @@
import (
"errors"
- "github.com/racker/perigee"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
)
@@ -49,11 +48,10 @@
return res
}
- _, res.Err = perigee.Request("POST", baseURL(client), perigee.Options{
- MoreHeaders: client.AuthenticatedHeaders(),
- ReqBody: &reqBody,
- Results: &res.Body,
- OkCodes: []int{202},
+ _, res.Err = client.Request("POST", baseURL(client), gophercloud.RequestOpts{
+ JSONBody: &reqBody,
+ JSONResponse: &res.Body,
+ OkCodes: []int{202},
})
return res
@@ -96,10 +94,9 @@
func Get(client *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = perigee.Request("GET", resourceURL(client, id), perigee.Options{
- MoreHeaders: client.AuthenticatedHeaders(),
- Results: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = client.Request("GET", resourceURL(client, id), gophercloud.RequestOpts{
+ JSONResponse: &res.Body,
+ OkCodes: []int{200},
})
return res
@@ -108,9 +105,8 @@
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = perigee.Request("DELETE", resourceURL(client, id), perigee.Options{
- MoreHeaders: client.AuthenticatedHeaders(),
- OkCodes: []int{202},
+ _, res.Err = client.Request("DELETE", resourceURL(client, id), gophercloud.RequestOpts{
+ OkCodes: []int{202},
})
return res
diff --git a/rackspace/db/v1/backups/requests_test.go b/rackspace/db/v1/backups/requests_test.go
index 60fe064..e5d8f7c 100644
--- a/rackspace/db/v1/backups/requests_test.go
+++ b/rackspace/db/v1/backups/requests_test.go
@@ -4,6 +4,7 @@
"testing"
"github.com/rackspace/gophercloud/pagination"
+ "github.com/rackspace/gophercloud/rackspace/db/v1/datastores"
th "github.com/rackspace/gophercloud/testhelper"
fake "github.com/rackspace/gophercloud/testhelper/client"
)
@@ -36,7 +37,7 @@
Size: 100,
Status: "NEW",
Updated: "2014-02-13T21:47:16",
- Datastore: datastores.Datastore{
+ Datastore: datastores.DatastorePartial{
Version: "5.1",
Type: "MySQL",
VersionID: "20000000-0000-0000-0000-000000000002",
@@ -71,7 +72,7 @@
Size: 0.141026,
Status: "COMPLETED",
Updated: "2014-06-18T21:24:39",
- Datastore: datastores.Datastore{
+ Datastore: datastores.DatastorePartial{
Version: "5.1",
Type: "MySQL",
VersionID: "20000000-0000-0000-0000-000000000002",
@@ -109,7 +110,7 @@
Size: 100,
Status: "NEW",
Updated: "2014-02-13T21:47:16",
- Datastore: datastores.Datastore{
+ Datastore: datastores.DatastorePartial{
Version: "5.1",
Type: "MySQL",
VersionID: "20000000-0000-0000-0000-000000000002",
diff --git a/rackspace/db/v1/backups/results.go b/rackspace/db/v1/backups/results.go
index 475a41d..402fc86 100644
--- a/rackspace/db/v1/backups/results.go
+++ b/rackspace/db/v1/backups/results.go
@@ -18,7 +18,7 @@
Status string
Created string
Updated string
- Datastore datastores.Datastore
+ Datastore datastores.DatastorePartial
}
type CreateResult struct {