Converting Rackspace services to new HTTP methods
diff --git a/rackspace/compute/v2/networks/requests.go b/rackspace/compute/v2/networks/requests.go
index 3aefb0c..cebbffd 100644
--- a/rackspace/compute/v2/networks/requests.go
+++ b/rackspace/compute/v2/networks/requests.go
@@ -21,10 +21,7 @@
// Get retrieves a specific network based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", getURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
+ _, res.Err = c.Get(getURL(c, id), &res.Body, nil)
return res
}
@@ -78,10 +75,8 @@
}
// Send request to API
- _, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200, 201, 202},
+ _, res.Err = c.Post(createURL(c), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200, 201, 202},
})
return res
}
@@ -89,8 +84,6 @@
// Delete accepts a unique ID and deletes the network associated with it.
func Delete(c *gophercloud.ServiceClient, networkID string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", deleteURL(c, networkID), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Delete(deleteURL(c, networkID), nil)
return res
}
diff --git a/rackspace/compute/v2/virtualinterfaces/requests.go b/rackspace/compute/v2/virtualinterfaces/requests.go
index 3c81ef8..1ff7c5a 100644
--- a/rackspace/compute/v2/virtualinterfaces/requests.go
+++ b/rackspace/compute/v2/virtualinterfaces/requests.go
@@ -28,10 +28,8 @@
}
// Send request to API
- _, res.Err = c.Request("POST", createURL(c, instanceID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200, 201, 202},
+ _, res.Err = c.Post(createURL(c, instanceID), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200, 201, 202},
})
return res
}
@@ -40,7 +38,7 @@
// instanceID.
func Delete(c *gophercloud.ServiceClient, instanceID, interfaceID string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", deleteURL(c, instanceID, interfaceID), gophercloud.RequestOpts{
+ _, res.Err = c.Delete(deleteURL(c, instanceID, interfaceID), &gophercloud.RequestOpts{
OkCodes: []int{200, 204},
})
return res