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
diff --git a/rackspace/lb/v1/acl/requests.go b/rackspace/lb/v1/acl/requests.go
index 94d98e3..d4ce7c0 100644
--- a/rackspace/lb/v1/acl/requests.go
+++ b/rackspace/lb/v1/acl/requests.go
@@ -74,11 +74,7 @@
return res
}
- _, res.Err = client.Request("POST", rootURL(client, loadBalancerID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- OkCodes: []int{202},
- })
-
+ _, res.Err = client.Post(rootURL(client, loadBalancerID), reqBody, nil, nil)
return res
}
@@ -95,19 +91,14 @@
url := rootURL(c, loadBalancerID)
url += gophercloud.IDSliceToQueryString("id", itemIDs)
- _, res.Err = c.Request("DELETE", url, gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Delete(url, nil)
return res
}
// Delete will remove a single network item from a load balancer's access list.
func Delete(c *gophercloud.ServiceClient, lbID, itemID int) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, lbID, itemID), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, res.Err = c.Delete(resourceURL(c, lbID, itemID), nil)
return res
}
@@ -115,8 +106,6 @@
// effectively resetting it and allowing all traffic.
func DeleteAll(c *gophercloud.ServiceClient, lbID int) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", rootURL(c, lbID), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, res.Err = c.Delete(rootURL(c, lbID), nil)
return res
}
diff --git a/rackspace/lb/v1/lbs/requests.go b/rackspace/lb/v1/lbs/requests.go
index 49a46f6..46f5f02 100644
--- a/rackspace/lb/v1/lbs/requests.go
+++ b/rackspace/lb/v1/lbs/requests.go
@@ -227,12 +227,7 @@
return res
}
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
@@ -243,9 +238,8 @@
func Get(c *gophercloud.ServiceClient, id int) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
@@ -269,21 +263,14 @@
url := rootURL(c)
url += gophercloud.IDSliceToQueryString("id", ids)
- _, res.Err = c.Request("DELETE", url, gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Delete(url, nil)
return res
}
// Delete removes a single load balancer.
func Delete(c *gophercloud.ServiceClient, id int) DeleteResult {
var res DeleteResult
-
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
@@ -363,11 +350,7 @@
return res
}
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, nil, nil)
return res
}
@@ -394,10 +377,7 @@
func IsLoggingEnabled(client *gophercloud.ServiceClient, id int) (bool, error) {
var body interface{}
- _, err := client.Request("GET", loggingURL(client, id), gophercloud.RequestOpts{
- JSONResponse: &body,
- OkCodes: []int{200},
- })
+ _, err := client.Get(loggingURL(client, id), &body, nil)
if err != nil {
return false, err
}
@@ -420,39 +400,22 @@
// EnableLogging will enable connection logging for a specified load balancer.
func EnableLogging(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
- reqBody := toConnLoggingMap(true)
var res gophercloud.ErrResult
-
- _, res.Err = client.Request("PUT", loggingURL(client, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- OkCodes: []int{202},
- })
-
+ _, res.Err = client.Put(loggingURL(client, id), toConnLoggingMap(true), nil, nil)
return res
}
// DisableLogging will disable connection logging for a specified load balancer.
func DisableLogging(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
- reqBody := toConnLoggingMap(false)
var res gophercloud.ErrResult
-
- _, res.Err = client.Request("PUT", loggingURL(client, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- OkCodes: []int{202},
- })
-
+ _, res.Err = client.Put(loggingURL(client, id), toConnLoggingMap(false), nil, nil)
return res
}
// GetErrorPage will retrieve the current error page for the load balancer.
func GetErrorPage(client *gophercloud.ServiceClient, id int) ErrorPageResult {
var res ErrorPageResult
-
- _, res.Err = client.Request("GET", errorPageURL(client, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
-
+ _, res.Err = client.Get(errorPageURL(client, id), &res.Body, nil)
return res
}
@@ -464,10 +427,8 @@
type stringMap map[string]string
reqBody := map[string]stringMap{"errorpage": stringMap{"content": html}}
- _, res.Err = client.Request("PUT", errorPageURL(client, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- JSONBody: &reqBody,
- OkCodes: []int{200},
+ _, res.Err = client.Put(errorPageURL(client, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
@@ -476,23 +437,16 @@
// DeleteErrorPage will delete the current error page for the load balancer.
func DeleteErrorPage(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
var res gophercloud.ErrResult
-
- _, res.Err = client.Request("DELETE", errorPageURL(client, id), gophercloud.RequestOpts{
+ _, res.Err = client.Delete(errorPageURL(client, id), &gophercloud.RequestOpts{
OkCodes: []int{200},
})
-
return res
}
// GetStats will retrieve detailed stats related to the load balancer's usage.
func GetStats(client *gophercloud.ServiceClient, id int) StatsResult {
var res StatsResult
-
- _, res.Err = client.Request("GET", statsURL(client, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
-
+ _, res.Err = client.Get(statsURL(client, id), &res.Body, nil)
return res
}
@@ -507,10 +461,7 @@
func IsContentCached(client *gophercloud.ServiceClient, id int) (bool, error) {
var body interface{}
- _, err := client.Request("GET", cacheURL(client, id), gophercloud.RequestOpts{
- JSONResponse: &body,
- OkCodes: []int{200},
- })
+ _, err := client.Get(cacheURL(client, id), &body, nil)
if err != nil {
return false, err
}
@@ -533,26 +484,14 @@
// EnableCaching will enable content-caching for the specified load balancer.
func EnableCaching(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
- reqBody := toCachingMap(true)
var res gophercloud.ErrResult
-
- _, res.Err = client.Request("PUT", cacheURL(client, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- OkCodes: []int{202},
- })
-
+ _, res.Err = client.Put(cacheURL(client, id), toCachingMap(true), nil, nil)
return res
}
// DisableCaching will disable content-caching for the specified load balancer.
func DisableCaching(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
- reqBody := toCachingMap(false)
var res gophercloud.ErrResult
-
- _, res.Err = client.Request("PUT", cacheURL(client, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- OkCodes: []int{202},
- })
-
+ _, res.Err = client.Put(cacheURL(client, id), toCachingMap(false), nil, nil)
return res
}
diff --git a/rackspace/lb/v1/monitors/requests.go b/rackspace/lb/v1/monitors/requests.go
index 917282c..d4ba276 100644
--- a/rackspace/lb/v1/monitors/requests.go
+++ b/rackspace/lb/v1/monitors/requests.go
@@ -141,33 +141,20 @@
return res
}
- _, res.Err = c.Request("PUT", rootURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Put(rootURL(c, id), reqBody, nil, nil)
return res
}
// Get is the operation responsible for showing details of a health monitor.
func Get(c *gophercloud.ServiceClient, id int) GetResult {
var res GetResult
-
- _, res.Err = c.Request("GET", rootURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
-
+ _, res.Err = c.Get(rootURL(c, id), &res.Body, nil)
return res
}
// Delete is the operation responsible for deleting a health monitor.
func Delete(c *gophercloud.ServiceClient, id int) DeleteResult {
var res DeleteResult
-
- _, res.Err = c.Request("DELETE", rootURL(c, id), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Delete(rootURL(c, id), nil)
return res
}
diff --git a/rackspace/lb/v1/nodes/requests.go b/rackspace/lb/v1/nodes/requests.go
index 86fe5d7..02af86b 100644
--- a/rackspace/lb/v1/nodes/requests.go
+++ b/rackspace/lb/v1/nodes/requests.go
@@ -112,11 +112,8 @@
return res
}
- resp, err := client.Request("POST", rootURL(client, loadBalancerID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{202},
- })
+ resp, err := client.Post(rootURL(client, loadBalancerID), reqBody, &res.Body, nil)
+
if err != nil {
res.Err = err
return res
@@ -145,22 +142,14 @@
url := rootURL(c, loadBalancerID)
url += gophercloud.IDSliceToQueryString("id", nodeIDs)
- _, res.Err = c.Request("DELETE", url, gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Delete(url, nil)
return res
}
// Get is the operation responsible for showing details for a single node.
func Get(c *gophercloud.ServiceClient, lbID, nodeID int) GetResult {
var res GetResult
-
- _, res.Err = c.Request("GET", resourceURL(c, lbID, nodeID), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
-
+ _, res.Err = c.Get(resourceURL(c, lbID, nodeID), &res.Body, nil)
return res
}
@@ -213,20 +202,14 @@
return res
}
- _, res.Err = c.Request("PUT", resourceURL(c, lbID, nodeID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Put(resourceURL(c, lbID, nodeID), reqBody, nil, nil)
return res
}
// Delete is the operation responsible for permanently deleting a node.
func Delete(c *gophercloud.ServiceClient, lbID, nodeID int) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, lbID, nodeID), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, res.Err = c.Delete(resourceURL(c, lbID, nodeID), nil)
return res
}
diff --git a/rackspace/lb/v1/sessions/requests.go b/rackspace/lb/v1/sessions/requests.go
index 5572407..a93d766 100644
--- a/rackspace/lb/v1/sessions/requests.go
+++ b/rackspace/lb/v1/sessions/requests.go
@@ -42,12 +42,7 @@
return res
}
- _, res.Err = c.Request("PUT", rootURL(c, lbID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Put(rootURL(c, lbID), reqBody, &res.Body, nil)
return res
}
@@ -55,12 +50,7 @@
// persistence configuration for a particular load balancer.
func Get(c *gophercloud.ServiceClient, lbID int) GetResult {
var res GetResult
-
- _, res.Err = c.Request("GET", rootURL(c, lbID), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
-
+ _, res.Err = c.Get(rootURL(c, lbID), &res.Body, nil)
return res
}
@@ -68,10 +58,6 @@
// particular load balancer.
func Disable(c *gophercloud.ServiceClient, lbID int) DisableResult {
var res DisableResult
-
- _, res.Err = c.Request("DELETE", rootURL(c, lbID), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Delete(rootURL(c, lbID), nil)
return res
}
diff --git a/rackspace/lb/v1/ssl/requests.go b/rackspace/lb/v1/ssl/requests.go
index e9c6514..bb53ef8 100644
--- a/rackspace/lb/v1/ssl/requests.go
+++ b/rackspace/lb/v1/ssl/requests.go
@@ -85,12 +85,9 @@
return res
}
- _, res.Err = c.Request("PUT", rootURL(c, lbID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(rootURL(c, lbID), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
-
return res
}
@@ -98,12 +95,7 @@
// Termination configuration for a load balancer.
func Get(c *gophercloud.ServiceClient, lbID int) GetResult {
var res GetResult
-
- _, res.Err = c.Request("GET", rootURL(c, lbID), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
-
+ _, res.Err = c.Get(rootURL(c, lbID), &res.Body, nil)
return res
}
@@ -111,11 +103,9 @@
// configuration for a load balancer.
func Delete(c *gophercloud.ServiceClient, lbID int) DeleteResult {
var res DeleteResult
-
- _, res.Err = c.Request("DELETE", rootURL(c, lbID), gophercloud.RequestOpts{
+ _, res.Err = c.Delete(rootURL(c, lbID), &gophercloud.RequestOpts{
OkCodes: []int{200},
})
-
return res
}
@@ -180,10 +170,8 @@
return res
}
- _, res.Err = c.Request("POST", certURL(c, lbID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Post(certURL(c, lbID), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
@@ -192,12 +180,7 @@
// GetCert will show the details of an existing SSL certificate.
func GetCert(c *gophercloud.ServiceClient, lbID, certID int) GetCertResult {
var res GetCertResult
-
- _, res.Err = c.Request("GET", certResourceURL(c, lbID, certID), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
-
+ _, res.Err = c.Get(certResourceURL(c, lbID, certID), &res.Body, nil)
return res
}
@@ -247,12 +230,7 @@
return res
}
- _, res.Err = c.Request("PUT", certResourceURL(c, lbID, certID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Put(certResourceURL(c, lbID, certID), reqBody, &res.Body, nil)
return res
}
@@ -261,7 +239,7 @@
func DeleteCert(c *gophercloud.ServiceClient, lbID, certID int) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", certResourceURL(c, lbID, certID), gophercloud.RequestOpts{
+ _, res.Err = c.Delete(certResourceURL(c, lbID, certID), &gophercloud.RequestOpts{
OkCodes: []int{200},
})
diff --git a/rackspace/lb/v1/throttle/requests.go b/rackspace/lb/v1/throttle/requests.go
index 2680a89..0446b97 100644
--- a/rackspace/lb/v1/throttle/requests.go
+++ b/rackspace/lb/v1/throttle/requests.go
@@ -55,12 +55,7 @@
return res
}
- _, res.Err = c.Request("PUT", rootURL(c, lbID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Put(rootURL(c, lbID), reqBody, &res.Body, nil)
return res
}
@@ -68,12 +63,7 @@
// throttling configuration for a load balancer.
func Get(c *gophercloud.ServiceClient, lbID int) GetResult {
var res GetResult
-
- _, res.Err = c.Request("GET", rootURL(c, lbID), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- OkCodes: []int{200},
- })
-
+ _, res.Err = c.Get(rootURL(c, lbID), &res.Body, nil)
return res
}
@@ -81,10 +71,6 @@
// configuration for a load balancer.
func Delete(c *gophercloud.ServiceClient, lbID int) DeleteResult {
var res DeleteResult
-
- _, res.Err = c.Request("DELETE", rootURL(c, lbID), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Delete(rootURL(c, lbID), nil)
return res
}
diff --git a/rackspace/lb/v1/vips/requests.go b/rackspace/lb/v1/vips/requests.go
index d52a73a..2bc924f 100644
--- a/rackspace/lb/v1/vips/requests.go
+++ b/rackspace/lb/v1/vips/requests.go
@@ -67,12 +67,7 @@
return res
}
- _, res.Err = c.Request("POST", rootURL(c, lbID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Post(rootURL(c, lbID), reqBody, &res.Body, nil)
return res
}
@@ -90,18 +85,13 @@
url := rootURL(c, loadBalancerID)
url += gophercloud.IDSliceToQueryString("id", vipIDs)
- _, res.Err = c.Request("DELETE", url, gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
-
+ _, res.Err = c.Delete(url, nil)
return res
}
// Delete is the operation responsible for permanently deleting a VIP.
func Delete(c *gophercloud.ServiceClient, lbID, vipID int) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, lbID, vipID), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, res.Err = c.Delete(resourceURL(c, lbID, vipID), nil)
return res
}
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
}