Refactor to use new client.Request
diff --git a/rackspace/db/v1/instances/delegate_test.go b/rackspace/db/v1/instances/delegate_test.go
index 3ba7a5e..d43b1e1 100644
--- a/rackspace/db/v1/instances/delegate_test.go
+++ b/rackspace/db/v1/instances/delegate_test.go
@@ -7,6 +7,7 @@
osDBs "github.com/rackspace/gophercloud/openstack/db/v1/databases"
os "github.com/rackspace/gophercloud/openstack/db/v1/instances"
osUsers "github.com/rackspace/gophercloud/openstack/db/v1/users"
+ "github.com/rackspace/gophercloud/rackspace/db/v1/datastores"
th "github.com/rackspace/gophercloud/testhelper"
fake "github.com/rackspace/gophercloud/testhelper/client"
)
@@ -16,7 +17,7 @@
var expectedInstance = &Instance{
Created: "2014-02-13T21:47:13",
Updated: "2014-02-13T21:47:13",
- Datastore: Datastore{Type: "mysql", Version: "5.6"},
+ Datastore: datastores.DatastorePartial{Type: "mysql", Version: "5.6"},
Flavor: os.Flavor{
ID: "1",
Links: []gophercloud.Link{
diff --git a/rackspace/db/v1/instances/requests.go b/rackspace/db/v1/instances/requests.go
index 66bc872..cfebd5d 100644
--- a/rackspace/db/v1/instances/requests.go
+++ b/rackspace/db/v1/instances/requests.go
@@ -1,7 +1,6 @@
package instances
import (
- "github.com/racker/perigee"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
"github.com/rackspace/gophercloud/rackspace/db/v1/backups"
@@ -10,10 +9,9 @@
func GetDefaultConfig(client *gophercloud.ServiceClient, id string) ConfigResult {
var res ConfigResult
- _, res.Err = perigee.Request("GET", configURL(client, id), perigee.Options{
- MoreHeaders: client.AuthenticatedHeaders(),
- Results: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = client.Request("GET", configURL(client, id), gophercloud.RequestOpts{
+ JSONResponse: &res.Body,
+ OkCodes: []int{200},
})
return res
@@ -26,10 +24,9 @@
var res UpdateResult
- _, res.Err = perigee.Request("PUT", resourceURL(client, instanceID), perigee.Options{
- MoreHeaders: client.AuthenticatedHeaders(),
- ReqBody: map[string]map[string]string{"instance": reqBody},
- OkCodes: []int{202},
+ _, res.Err = client.Request("PUT", resourceURL(client, instanceID), gophercloud.RequestOpts{
+ JSONBody: map[string]map[string]string{"instance": reqBody},
+ OkCodes: []int{202},
})
return res
@@ -45,10 +42,9 @@
func DetachReplica(client *gophercloud.ServiceClient, replicaID string) DetachResult {
var res DetachResult
- _, res.Err = perigee.Request("PATCH", resourceURL(client, replicaID), perigee.Options{
- MoreHeaders: client.AuthenticatedHeaders(),
- ReqBody: map[string]interface{}{"instance": map[string]string{"replica_of": "", "slave_of": ""}},
- OkCodes: []int{202},
+ _, res.Err = client.Request("PATCH", resourceURL(client, replicaID), gophercloud.RequestOpts{
+ JSONBody: map[string]interface{}{"instance": map[string]string{"replica_of": "", "slave_of": ""}},
+ OkCodes: []int{202},
})
return res
diff --git a/rackspace/db/v1/instances/requests_test.go b/rackspace/db/v1/instances/requests_test.go
index 2cafa22..35afe01 100644
--- a/rackspace/db/v1/instances/requests_test.go
+++ b/rackspace/db/v1/instances/requests_test.go
@@ -7,6 +7,7 @@
os "github.com/rackspace/gophercloud/openstack/db/v1/instances"
"github.com/rackspace/gophercloud/pagination"
"github.com/rackspace/gophercloud/rackspace/db/v1/backups"
+ "github.com/rackspace/gophercloud/rackspace/db/v1/datastores"
th "github.com/rackspace/gophercloud/testhelper"
fake "github.com/rackspace/gophercloud/testhelper/client"
)
@@ -23,7 +24,7 @@
ID: "8367c312-7c40-4a66-aab1-5767478914fc",
Volume: os.Volume{Size: 1},
Flavor: os.Flavor{ID: "9"},
- Datastore: Datastore{Version: "5.6", Type: "mysql"},
+ Datastore: datastores.DatastorePartial{Version: "5.6", Type: "mysql"},
ReplicaOf: &Instance{
ID: "6bdca2fc-418e-40bd-a595-62abda61862d",
},
@@ -121,7 +122,7 @@
Size: 0.141026,
Status: "COMPLETED",
Updated: "2014-06-18T21:24:39",
- Datastore: backups.Datastore{Version: "5.1", Type: "MySQL", VersionID: "20000000-0000-0000-0000-000000000002"},
+ Datastore: datastores.DatastorePartial{Version: "5.1", Type: "MySQL", VersionID: "20000000-0000-0000-0000-000000000002"},
},
}
@@ -181,7 +182,7 @@
IP: []string{"10.0.0.3"},
Volume: os.Volume{Size: 1},
Flavor: os.Flavor{ID: "9"},
- Datastore: Datastore{Version: "5.6", Type: "mysql"},
+ Datastore: datastores.DatastorePartial{Version: "5.6", Type: "mysql"},
ReplicaOf: &Instance{
ID: "8b499b45-52d6-402d-b398-f9d8f279c69a",
},
@@ -226,7 +227,7 @@
Size: 1,
},
Flavor: os.Flavor{ID: "9"},
- Datastore: Datastore{
+ Datastore: datastores.DatastorePartial{
Version: "5.6",
Type: "mysql",
},
diff --git a/rackspace/db/v1/instances/results.go b/rackspace/db/v1/instances/results.go
index e0c5aa5..2ce302b 100644
--- a/rackspace/db/v1/instances/results.go
+++ b/rackspace/db/v1/instances/results.go
@@ -17,7 +17,7 @@
Updated string //time.Time
// Indicates how the instance stores data.
- Datastore datastores.Datastore
+ Datastore datastores.DatastorePartial
// Indicates the hardware flavor the instance uses.
Flavor os.Flavor