Add Networking HTTP operations
diff --git a/openstack/networking/v2/extensions/fwaas/firewalls/requests.go b/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
index a7cd3a4..12d587f 100644
--- a/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
@@ -139,19 +139,14 @@
return res
}
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular firewall based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -207,10 +202,8 @@
}
// Send request to API
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
}
@@ -218,6 +211,6 @@
// Delete will permanently delete a particular firewall based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/extensions/fwaas/policies/requests.go b/openstack/networking/v2/extensions/fwaas/policies/requests.go
index c5bec02..fe07d9a 100644
--- a/openstack/networking/v2/extensions/fwaas/policies/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/policies/requests.go
@@ -128,19 +128,14 @@
return res
}
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular firewall policy based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -196,10 +191,8 @@
}
// Send request to API
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
}
@@ -207,7 +200,7 @@
// Delete will permanently delete a particular firewall policy based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
@@ -226,10 +219,8 @@
// Send request to API
var res commonResult
- _, res.Err = c.Request("PUT", insertURL(c, policyID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(insertURL(c, policyID), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res.Err
}
@@ -245,10 +236,8 @@
// Send request to API
var res commonResult
- _, res.Err = c.Request("PUT", removeURL(c, policyID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(removeURL(c, policyID), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res.Err
}
diff --git a/openstack/networking/v2/extensions/fwaas/rules/requests.go b/openstack/networking/v2/extensions/fwaas/rules/requests.go
index c0065bd..57a0e8b 100644
--- a/openstack/networking/v2/extensions/fwaas/rules/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/rules/requests.go
@@ -163,19 +163,14 @@
return res
}
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular firewall rule based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -275,10 +270,8 @@
}
// Send request to API
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
@@ -287,6 +280,6 @@
// Delete will permanently delete a particular firewall rule based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/extensions/layer3/floatingips/requests.go b/openstack/networking/v2/extensions/layer3/floatingips/requests.go
index 5fee2e0..49d6f0b 100644
--- a/openstack/networking/v2/extensions/layer3/floatingips/requests.go
+++ b/openstack/networking/v2/extensions/layer3/floatingips/requests.go
@@ -107,21 +107,14 @@
TenantID: opts.TenantID,
}}
- // Send request to API
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
-
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular floating IP resource based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -157,10 +150,8 @@
// Send request to API
var res UpdateResult
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
@@ -171,6 +162,6 @@
// internal ports.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/extensions/layer3/routers/requests.go b/openstack/networking/v2/extensions/layer3/routers/requests.go
index edfca67..077a717 100755
--- a/openstack/networking/v2/extensions/layer3/routers/requests.go
+++ b/openstack/networking/v2/extensions/layer3/routers/requests.go
@@ -81,19 +81,14 @@
}
var res CreateResult
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular router based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -131,10 +126,8 @@
// Send request to API
var res UpdateResult
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
@@ -143,7 +136,7 @@
// Delete will permanently delete a particular router based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
@@ -193,10 +186,8 @@
body := request{SubnetID: opts.SubnetID, PortID: opts.PortID}
- _, res.Err = c.Request("PUT", addInterfaceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &body,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(addInterfaceURL(c, id), body, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
@@ -225,10 +216,8 @@
body := request{SubnetID: opts.SubnetID, PortID: opts.PortID}
- _, res.Err = c.Request("PUT", removeInterfaceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &body,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(removeInterfaceURL(c, id), body, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
diff --git a/openstack/networking/v2/extensions/lbaas/members/requests.go b/openstack/networking/v2/extensions/lbaas/members/requests.go
index f710df5..848938f 100644
--- a/openstack/networking/v2/extensions/lbaas/members/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/members/requests.go
@@ -79,19 +79,14 @@
}}
var res CreateResult
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular pool member based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -114,10 +109,8 @@
// Send request to API
var res UpdateResult
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200, 201, 202},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200, 201, 202},
})
return res
}
@@ -125,6 +118,6 @@
// Delete will permanently delete a particular member based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/monitors/requests.go b/openstack/networking/v2/extensions/lbaas/monitors/requests.go
index 1b1921a..71b21ef 100644
--- a/openstack/networking/v2/extensions/lbaas/monitors/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/monitors/requests.go
@@ -176,20 +176,14 @@
AdminStateUp: opts.AdminStateUp,
}}
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
-
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular health monitor based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -256,10 +250,8 @@
AdminStateUp: opts.AdminStateUp,
}}
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200, 202},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200, 202},
})
return res
@@ -268,6 +260,6 @@
// Delete will permanently delete a particular monitor based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/pools/requests.go b/openstack/networking/v2/extensions/lbaas/pools/requests.go
index 6a07d23..2bb0acc 100644
--- a/openstack/networking/v2/extensions/lbaas/pools/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/pools/requests.go
@@ -99,19 +99,14 @@
}}
var res CreateResult
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular pool based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -143,10 +138,8 @@
// Send request to API
var res UpdateResult
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200},
})
return res
}
@@ -154,7 +147,7 @@
// Delete will permanently delete a particular pool based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
@@ -174,10 +167,7 @@
reqBody := request{hm{ID: monitorID}}
var res AssociateResult
- _, res.Err = c.Request("POST", associateURL(c, poolID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Post(associateURL(c, poolID), reqBody, &res.Body, nil)
return res
}
@@ -186,6 +176,6 @@
// check for the health of the members of the pool.
func DisassociateMonitor(c *gophercloud.ServiceClient, poolID, monitorID string) AssociateResult {
var res AssociateResult
- _, res.Err = c.Request("DELETE", disassociateURL(c, poolID, monitorID), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(disassociateURL(c, poolID, monitorID), nil)
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/vips/requests.go b/openstack/networking/v2/extensions/lbaas/vips/requests.go
index 3f7720a..6216f87 100644
--- a/openstack/networking/v2/extensions/lbaas/vips/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/vips/requests.go
@@ -178,20 +178,14 @@
reqBody.VirtualIP.Persistence = opts.Persistence
}
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
-
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular virtual IP based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
@@ -247,10 +241,8 @@
}
var res UpdateResult
- _, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200, 202},
+ _, res.Err = c.Put(resourceURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200, 202},
})
return res
@@ -259,6 +251,6 @@
// Delete will permanently delete a particular virtual IP based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/extensions/security/groups/requests.go b/openstack/networking/v2/extensions/security/groups/requests.go
index 4a4e0e0..55e4b3b 100644
--- a/openstack/networking/v2/extensions/security/groups/requests.go
+++ b/openstack/networking/v2/extensions/security/groups/requests.go
@@ -74,26 +74,20 @@
Description: opts.Description,
}}
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
-
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular security group based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
// Delete will permanently delete a particular security group based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/extensions/security/rules/requests.go b/openstack/networking/v2/extensions/security/rules/requests.go
index 41969b4..0b2d10b 100644
--- a/openstack/networking/v2/extensions/security/rules/requests.go
+++ b/openstack/networking/v2/extensions/security/rules/requests.go
@@ -150,26 +150,20 @@
RemoteIPPrefix: opts.RemoteIPPrefix,
}}
- _, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
-
+ _, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)
return res
}
// Get retrieves a particular security group based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Get(resourceURL(c, id), &res.Body, nil)
return res
}
// Delete will permanently delete a particular security group based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(resourceURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/networks/requests.go b/openstack/networking/v2/networks/requests.go
index 2e38839..7be3227 100644
--- a/openstack/networking/v2/networks/requests.go
+++ b/openstack/networking/v2/networks/requests.go
@@ -79,9 +79,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,
- })
+ _, res.Err = c.Get(getURL(c, id), &res.Body, nil)
return res
}
@@ -133,11 +131,7 @@
return res
}
- // Send request to API
- _, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
+ _, res.Err = c.Post(createURL(c), reqBody, &res.Body, nil)
return res
}
@@ -182,10 +176,8 @@
}
// Send request to API
- _, res.Err = c.Request("PUT", updateURL(c, networkID), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200, 201},
+ _, res.Err = c.Put(updateURL(c, networkID), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200, 201},
})
return res
@@ -194,6 +186,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{})
+ _, res.Err = c.Delete(deleteURL(c, networkID), nil)
return res
}
diff --git a/openstack/networking/v2/ports/requests.go b/openstack/networking/v2/ports/requests.go
index 59087d8..781a3c3 100644
--- a/openstack/networking/v2/ports/requests.go
+++ b/openstack/networking/v2/ports/requests.go
@@ -79,9 +79,7 @@
// Get retrieves a specific port 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,
- })
+ _, res.Err = c.Get(getURL(c, id), &res.Body, nil)
return res
}
@@ -154,12 +152,7 @@
return res
}
- // Response
- _, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
-
+ _, res.Err = c.Post(createURL(c), reqBody, &res.Body, nil)
return res
}
@@ -218,10 +211,8 @@
return res
}
- _, res.Err = c.Request("PUT", updateURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200, 201},
+ _, res.Err = c.Put(updateURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200, 201},
})
return res
}
@@ -229,6 +220,6 @@
// Delete accepts a unique ID and deletes the port associated with it.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", deleteURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(deleteURL(c, id), nil)
return res
}
diff --git a/openstack/networking/v2/subnets/requests.go b/openstack/networking/v2/subnets/requests.go
index f66a6ac..6e01f05 100644
--- a/openstack/networking/v2/subnets/requests.go
+++ b/openstack/networking/v2/subnets/requests.go
@@ -78,9 +78,7 @@
// Get retrieves a specific subnet 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,
- })
+ _, res.Err = c.Get(getURL(c, id), &res.Body, nil)
return res
}
@@ -170,11 +168,7 @@
return res
}
- _, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- })
-
+ _, res.Err = c.Post(createURL(c), reqBody, &res.Body, nil)
return res
}
@@ -227,10 +221,8 @@
return res
}
- _, res.Err = c.Request("PUT", updateURL(c, id), gophercloud.RequestOpts{
- JSONBody: &reqBody,
- JSONResponse: &res.Body,
- OkCodes: []int{200, 201},
+ _, res.Err = c.Put(updateURL(c, id), reqBody, &res.Body, &gophercloud.RequestOpts{
+ OkCodes: []int{200, 201},
})
return res
@@ -239,6 +231,6 @@
// Delete accepts a unique ID and deletes the subnet associated with it.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", deleteURL(c, id), gophercloud.RequestOpts{})
+ _, res.Err = c.Delete(deleteURL(c, id), nil)
return res
}