Converting Rackspace services to new HTTP methods
diff --git a/rackspace/rackconnect/v3/cloudnetworks/requests.go b/rackspace/rackconnect/v3/cloudnetworks/requests.go
index 33f5e04..5884303 100644
--- a/rackspace/rackconnect/v3/cloudnetworks/requests.go
+++ b/rackspace/rackconnect/v3/cloudnetworks/requests.go
@@ -19,9 +19,6 @@
// 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
}
diff --git a/rackspace/rackconnect/v3/lbpools/requests.go b/rackspace/rackconnect/v3/lbpools/requests.go
index 4b4a103..c300c56 100644
--- a/rackspace/rackconnect/v3/lbpools/requests.go
+++ b/rackspace/rackconnect/v3/lbpools/requests.go
@@ -18,10 +18,7 @@
// 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
}
@@ -44,11 +41,7 @@
"id": serverID,
},
}
- _, res.Err = c.Request("POST", createNodeURL(c, poolID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{201},
- })
+ _, res.Err = c.Post(createNodeURL(c, poolID), reqBody, &res.Body, nil)
return res
}
@@ -66,10 +59,7 @@
// based on its unique ID and the LB pool's unique ID.
func GetNode(c *gophercloud.ServiceClient, poolID, nodeID string) GetNodeResult {
var res GetNodeResult
- _, res.Err = c.Request("GET", nodeURL(c, poolID, nodeID), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
+ _, res.Err = c.Get(nodeURL(c, poolID, nodeID), &res.Body, nil)
return res
}
@@ -77,9 +67,7 @@
// given poolID.
func DeleteNode(c *gophercloud.ServiceClient, poolID, nodeID string) DeleteNodeResult {
var res DeleteNodeResult
- _, res.Err = c.Request("DELETE", deleteNodeURL(c, poolID, nodeID), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Delete(deleteNodeURL(c, poolID, nodeID), nil)
return res
}
@@ -87,10 +75,7 @@
// ID and the LB pool's unique ID.
func GetNodeDetails(c *gophercloud.ServiceClient, poolID, nodeID string) GetNodeDetailsResult {
var res GetNodeDetailsResult
- _, res.Err = c.Request("GET", nodeDetailsURL(c, poolID, nodeID), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
+ _, res.Err = c.Get(nodeDetailsURL(c, poolID, nodeID), &res.Body, nil)
return res
}
@@ -129,11 +114,7 @@
return res
}
- _, res.Err = c.Request("POST", createNodesURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{201},
- })
+ _, res.Err = c.Post(createNodesURL(c), reqBody, &res.Body, nil)
return res
}
diff --git a/rackspace/rackconnect/v3/publicips/requests.go b/rackspace/rackconnect/v3/publicips/requests.go
index 82a5295..1164260 100644
--- a/rackspace/rackconnect/v3/publicips/requests.go
+++ b/rackspace/rackconnect/v3/publicips/requests.go
@@ -22,11 +22,7 @@
"id": serverID,
},
}
- _, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{201},
- })
+ _, res.Err = c.Post(createURL(c), reqBody, &res.Body, nil)
return res
}
@@ -42,18 +38,13 @@
// Get retrieves the public IP with the given 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
}
// Delete removes the public IP with the given id.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", deleteURL(c, id), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Delete(deleteURL(c, id), nil)
return res
}