Change HTTP methods for OpenStack Compute
diff --git a/openstack/compute/v2/extensions/floatingip/requests.go b/openstack/compute/v2/extensions/floatingip/requests.go
index 1fad93a..8abb72d 100644
--- a/openstack/compute/v2/extensions/floatingip/requests.go
+++ b/openstack/compute/v2/extensions/floatingip/requests.go
@@ -45,10 +45,8 @@
return res
}
- _, res.Err = client.Request("POST", createURL(client), gophercloud.RequestOpts{
- JSONBody: reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = client.Post(createURL(client), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
}
@@ -56,16 +54,14 @@
// Get returns data about a previously created FloatingIP.
func Get(client *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = client.Request("GET", getURL(client, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = client.Get(getURL(client, id), &res.Body, nil)
return res
}
// Delete requests the deletion of a previous allocated FloatingIP.
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = client.Request("DELETE", deleteURL(client, id), gophercloud.RequestOpts{})
+ _, res.Err = client.Delete(deleteURL(client, id), nil)
return res
}
@@ -79,9 +75,7 @@
addFloatingIp["address"] = fip
reqBody := map[string]interface{}{"addFloatingIp": addFloatingIp}
- _, res.Err = client.Request("POST", associateURL(client, serverId), gophercloud.RequestOpts{
- JSONBody: reqBody,
- })
+ _, res.Err = client.Post(associateURL(client, serverId), reqBody, nil, nil)
return res
}
@@ -93,8 +87,6 @@
removeFloatingIp["address"] = fip
reqBody := map[string]interface{}{"removeFloatingIp": removeFloatingIp}
- _, res.Err = client.Request("POST", disassociateURL(client, serverId), gophercloud.RequestOpts{
- JSONBody: reqBody,
- })
+ _, res.Err = client.Post(disassociateURL(client, serverId), reqBody, nil, nil)
return res
}