Refactor OpenStack services to use default OkCodes
diff --git a/openstack/blockstorage/v1/apiversions/requests.go b/openstack/blockstorage/v1/apiversions/requests.go
index f5a793c..5b213db 100644
--- a/openstack/blockstorage/v1/apiversions/requests.go
+++ b/openstack/blockstorage/v1/apiversions/requests.go
@@ -17,7 +17,6 @@
func Get(client *gophercloud.ServiceClient, v string) GetResult {
var res GetResult
_, res.Err = client.Request("GET", getURL(client, v), gophercloud.RequestOpts{
- OkCodes: []int{200},
JSONResponse: &res.Body,
})
return res
diff --git a/openstack/blockstorage/v1/snapshots/requests.go b/openstack/blockstorage/v1/snapshots/requests.go
index 1b313a6..cb1fd51 100644
--- a/openstack/blockstorage/v1/snapshots/requests.go
+++ b/openstack/blockstorage/v1/snapshots/requests.go
@@ -78,9 +78,7 @@
// Delete will delete the existing Snapshot with the provided ID.
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = client.Request("DELETE", deleteURL(client, id), gophercloud.RequestOpts{
- OkCodes: []int{202, 204},
- })
+ _, res.Err = client.Request("DELETE", deleteURL(client, id), gophercloud.RequestOpts{})
return res
}
@@ -89,7 +87,6 @@
func Get(client *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
_, res.Err = client.Request("GET", getURL(client, id), gophercloud.RequestOpts{
- OkCodes: []int{200},
JSONResponse: &res.Body,
})
return res
diff --git a/openstack/blockstorage/v1/volumes/requests.go b/openstack/blockstorage/v1/volumes/requests.go
index e67ba10..ad4e574 100644
--- a/openstack/blockstorage/v1/volumes/requests.go
+++ b/openstack/blockstorage/v1/volumes/requests.go
@@ -94,9 +94,7 @@
// Delete will delete the existing Volume with the provided ID.
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = client.Request("DELETE", deleteURL(client, id), gophercloud.RequestOpts{
- OkCodes: []int{202, 204},
- })
+ _, res.Err = client.Request("DELETE", deleteURL(client, id), gophercloud.RequestOpts{})
return res
}
@@ -106,7 +104,6 @@
var res GetResult
_, res.Err = client.Request("GET", getURL(client, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
diff --git a/openstack/blockstorage/v1/volumetypes/requests.go b/openstack/blockstorage/v1/volumetypes/requests.go
index 6fedaa6..451f5be 100644
--- a/openstack/blockstorage/v1/volumetypes/requests.go
+++ b/openstack/blockstorage/v1/volumetypes/requests.go
@@ -45,7 +45,6 @@
}
_, res.Err = client.Request("POST", createURL(client), gophercloud.RequestOpts{
- MoreHeaders: client.AuthenticatedHeaders(),
OkCodes: []int{200, 201},
JSONBody: &reqBody,
JSONResponse: &res.Body,
@@ -56,10 +55,7 @@
// Delete will delete the volume type with the provided ID.
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = client.Request("DELETE", deleteURL(client, id), gophercloud.RequestOpts{
- MoreHeaders: client.AuthenticatedHeaders(),
- OkCodes: []int{202},
- })
+ _, res.Err = client.Request("DELETE", deleteURL(client, id), gophercloud.RequestOpts{})
return res
}
@@ -68,8 +64,6 @@
func Get(client *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
_, err := client.Request("GET", getURL(client, id), gophercloud.RequestOpts{
- MoreHeaders: client.AuthenticatedHeaders(),
- OkCodes: []int{200},
JSONResponse: &res.Body,
})
res.Err = err
diff --git a/openstack/cdn/v1/base/requests.go b/openstack/cdn/v1/base/requests.go
index b63dc95..4169e8c 100644
--- a/openstack/cdn/v1/base/requests.go
+++ b/openstack/cdn/v1/base/requests.go
@@ -8,7 +8,6 @@
var res GetResult
_, res.Err = c.Request("GET", getURL(c), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
diff --git a/openstack/cdn/v1/flavors/requests.go b/openstack/cdn/v1/flavors/requests.go
index 138fd97..e029749 100644
--- a/openstack/cdn/v1/flavors/requests.go
+++ b/openstack/cdn/v1/flavors/requests.go
@@ -19,7 +19,6 @@
var res GetResult
_, res.Err = c.Request("GET", getURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
diff --git a/openstack/cdn/v1/serviceassets/requests.go b/openstack/cdn/v1/serviceassets/requests.go
index a80aa0d..0a5b073 100644
--- a/openstack/cdn/v1/serviceassets/requests.go
+++ b/openstack/cdn/v1/serviceassets/requests.go
@@ -43,8 +43,6 @@
}
var res DeleteResult
- _, res.Err = c.Request("DELETE", url, gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, res.Err = c.Request("DELETE", url, gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/cdn/v1/services/requests.go b/openstack/cdn/v1/services/requests.go
index 78a3087..85a73ed 100644
--- a/openstack/cdn/v1/services/requests.go
+++ b/openstack/cdn/v1/services/requests.go
@@ -179,7 +179,6 @@
// Send request to API
resp, err := c.Request("POST", createURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
- OkCodes: []int{202},
})
res.Header = resp.Header
res.Err = err
@@ -201,7 +200,6 @@
var res GetResult
_, res.Err = c.Request("GET", url, gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -379,8 +377,6 @@
}
var res DeleteResult
- _, res.Err = c.Request("DELETE", url, gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, res.Err = c.Request("DELETE", url, gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/common/extensions/requests.go b/openstack/common/extensions/requests.go
index dfd81c9..b6f371a 100755
--- a/openstack/common/extensions/requests.go
+++ b/openstack/common/extensions/requests.go
@@ -10,7 +10,6 @@
var res GetResult
_, res.Err = c.Request("GET", ExtensionURL(c, alias), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
diff --git a/openstack/compute/v2/extensions/defsecrules/requests.go b/openstack/compute/v2/extensions/defsecrules/requests.go
index 294bae3..c29d46f 100644
--- a/openstack/compute/v2/extensions/defsecrules/requests.go
+++ b/openstack/compute/v2/extensions/defsecrules/requests.go
@@ -88,7 +88,6 @@
_, result.Err = client.Request("GET", resourceURL(client, id), gophercloud.RequestOpts{
JSONResponse: &result.Body,
- OkCodes: []int{200},
})
return result
@@ -98,9 +97,7 @@
func Delete(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
var result gophercloud.ErrResult
- _, result.Err = client.Request("DELETE", resourceURL(client, id), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, result.Err = client.Request("DELETE", resourceURL(client, id), gophercloud.RequestOpts{})
return result
}
diff --git a/openstack/compute/v2/extensions/floatingip/requests.go b/openstack/compute/v2/extensions/floatingip/requests.go
index d154038..1fad93a 100644
--- a/openstack/compute/v2/extensions/floatingip/requests.go
+++ b/openstack/compute/v2/extensions/floatingip/requests.go
@@ -58,7 +58,6 @@
var res GetResult
_, res.Err = client.Request("GET", getURL(client, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -66,9 +65,7 @@
// 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{
- OkCodes: []int{202},
- })
+ _, res.Err = client.Request("DELETE", deleteURL(client, id), gophercloud.RequestOpts{})
return res
}
@@ -84,7 +81,6 @@
_, res.Err = client.Request("POST", associateURL(client, serverId), gophercloud.RequestOpts{
JSONBody: reqBody,
- OkCodes: []int{202},
})
return res
}
@@ -99,7 +95,6 @@
_, res.Err = client.Request("POST", disassociateURL(client, serverId), gophercloud.RequestOpts{
JSONBody: reqBody,
- OkCodes: []int{202},
})
return res
}
diff --git a/openstack/compute/v2/extensions/keypairs/requests.go b/openstack/compute/v2/extensions/keypairs/requests.go
index 287e412..1ab7274 100644
--- a/openstack/compute/v2/extensions/keypairs/requests.go
+++ b/openstack/compute/v2/extensions/keypairs/requests.go
@@ -94,7 +94,6 @@
var res GetResult
_, res.Err = client.Request("GET", getURL(client, name), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -102,8 +101,6 @@
// Delete requests the deletion of a previous stored KeyPair from the server.
func Delete(client *gophercloud.ServiceClient, name string) DeleteResult {
var res DeleteResult
- _, res.Err = client.Request("DELETE", deleteURL(client, name), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, res.Err = client.Request("DELETE", deleteURL(client, name), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/compute/v2/extensions/secgroups/requests.go b/openstack/compute/v2/extensions/secgroups/requests.go
index 8f0a7a0..f8d88d3 100644
--- a/openstack/compute/v2/extensions/secgroups/requests.go
+++ b/openstack/compute/v2/extensions/secgroups/requests.go
@@ -138,7 +138,6 @@
_, result.Err = client.Request("GET", resourceURL(client, id), gophercloud.RequestOpts{
JSONResponse: &result.Body,
- OkCodes: []int{200},
})
return result
@@ -148,9 +147,7 @@
func Delete(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
var result gophercloud.ErrResult
- _, result.Err = client.Request("DELETE", resourceURL(client, id), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, result.Err = client.Request("DELETE", resourceURL(client, id), gophercloud.RequestOpts{})
return result
}
@@ -247,9 +244,7 @@
func DeleteRule(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
var result gophercloud.ErrResult
- _, result.Err = client.Request("DELETE", resourceRuleURL(client, id), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, result.Err = client.Request("DELETE", resourceRuleURL(client, id), gophercloud.RequestOpts{})
return result
}
@@ -268,7 +263,6 @@
_, result.Err = client.Request("POST", serverActionURL(client, serverID), gophercloud.RequestOpts{
JSONResponse: &result.Body,
JSONBody: actionMap("add", groupName),
- OkCodes: []int{202},
})
return result
@@ -281,7 +275,6 @@
_, result.Err = client.Request("POST", serverActionURL(client, serverID), gophercloud.RequestOpts{
JSONResponse: &result.Body,
JSONBody: actionMap("remove", groupName),
- OkCodes: []int{202},
})
return result
diff --git a/openstack/compute/v2/extensions/startstop/requests.go b/openstack/compute/v2/extensions/startstop/requests.go
index 04b5909..89bc248 100644
--- a/openstack/compute/v2/extensions/startstop/requests.go
+++ b/openstack/compute/v2/extensions/startstop/requests.go
@@ -14,7 +14,6 @@
_, res.Err = client.Request("POST", actionURL(client, id), gophercloud.RequestOpts{
JSONBody: reqBody,
- OkCodes: []int{202},
})
return res
@@ -28,7 +27,6 @@
_, res.Err = client.Request("POST", actionURL(client, id), gophercloud.RequestOpts{
JSONBody: reqBody,
- OkCodes: []int{202},
})
return res
diff --git a/openstack/compute/v2/extensions/tenantnetworks/requests.go b/openstack/compute/v2/extensions/tenantnetworks/requests.go
index cd73479..99cd1ae 100644
--- a/openstack/compute/v2/extensions/tenantnetworks/requests.go
+++ b/openstack/compute/v2/extensions/tenantnetworks/requests.go
@@ -19,7 +19,6 @@
var res GetResult
_, res.Err = client.Request("GET", getURL(client, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
diff --git a/openstack/compute/v2/extensions/volumeattach/requests.go b/openstack/compute/v2/extensions/volumeattach/requests.go
index 79709fd..62de27c 100644
--- a/openstack/compute/v2/extensions/volumeattach/requests.go
+++ b/openstack/compute/v2/extensions/volumeattach/requests.go
@@ -67,7 +67,6 @@
var res GetResult
_, res.Err = client.Request("GET", getURL(client, serverId, aId), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -75,8 +74,6 @@
// Delete requests the deletion of a previous stored VolumeAttachment from the server.
func Delete(client *gophercloud.ServiceClient, serverId, aId string) DeleteResult {
var res DeleteResult
- _, res.Err = client.Request("DELETE", deleteURL(client, serverId, aId), gophercloud.RequestOpts{
- OkCodes: []int{202},
- })
+ _, res.Err = client.Request("DELETE", deleteURL(client, serverId, aId), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/compute/v2/images/requests.go b/openstack/compute/v2/images/requests.go
index 9e9c3b1..b41d1d9 100644
--- a/openstack/compute/v2/images/requests.go
+++ b/openstack/compute/v2/images/requests.go
@@ -62,7 +62,6 @@
var result GetResult
_, result.Err = client.Request("GET", getURL(client, id), gophercloud.RequestOpts{
JSONResponse: &result.Body,
- OkCodes: []int{200},
})
return result
}
diff --git a/openstack/compute/v2/servers/requests.go b/openstack/compute/v2/servers/requests.go
index de112cf..c862b4d 100644
--- a/openstack/compute/v2/servers/requests.go
+++ b/openstack/compute/v2/servers/requests.go
@@ -283,6 +283,7 @@
_, result.Err = client.Request("PUT", updateURL(client, id), gophercloud.RequestOpts{
JSONResponse: &result.Body,
JSONBody: opts.ToServerUpdateMap(),
+ OkCodes: []int{200},
})
return result
}
@@ -628,6 +629,7 @@
_, res.Err = client.Request("PUT", metadataURL(client, id), gophercloud.RequestOpts{
JSONBody: metadata,
JSONResponse: &res.Body,
+ OkCodes: []int{200},
})
return res
}
@@ -660,6 +662,7 @@
_, res.Err = client.Request("POST", metadataURL(client, id), gophercloud.RequestOpts{
JSONBody: metadata,
JSONResponse: &res.Body,
+ OkCodes: []int{200},
})
return res
}
@@ -698,6 +701,7 @@
_, res.Err = client.Request("PUT", metadatumURL(client, id, key), gophercloud.RequestOpts{
JSONBody: metadatum,
JSONResponse: &res.Body,
+ OkCodes: []int{200},
})
return res
}
diff --git a/openstack/identity/v2/extensions/admin/roles/requests.go b/openstack/identity/v2/extensions/admin/roles/requests.go
index bbdf76a..619bf3b 100644
--- a/openstack/identity/v2/extensions/admin/roles/requests.go
+++ b/openstack/identity/v2/extensions/admin/roles/requests.go
@@ -19,11 +19,7 @@
// ID is a required argument.
func AddUserRole(client *gophercloud.ServiceClient, tenantID, userID, roleID string) UserRoleResult {
var result UserRoleResult
-
- _, result.Err = client.Request("PUT", userRoleURL(client, tenantID, userID, roleID), gophercloud.RequestOpts{
- OkCodes: []int{200, 201},
- })
-
+ _, result.Err = client.Request("PUT", userRoleURL(client, tenantID, userID, roleID), gophercloud.RequestOpts{})
return result
}
@@ -32,10 +28,6 @@
// tenant ID is a required argument.
func DeleteUserRole(client *gophercloud.ServiceClient, tenantID, userID, roleID string) UserRoleResult {
var result UserRoleResult
-
- _, result.Err = client.Request("DELETE", userRoleURL(client, tenantID, userID, roleID), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
-
+ _, result.Err = client.Request("DELETE", userRoleURL(client, tenantID, userID, roleID), gophercloud.RequestOpts{})
return result
}
diff --git a/openstack/identity/v2/users/requests.go b/openstack/identity/v2/users/requests.go
index 2afe62a..8aa1a20 100644
--- a/openstack/identity/v2/users/requests.go
+++ b/openstack/identity/v2/users/requests.go
@@ -105,7 +105,6 @@
_, result.Err = client.Request("GET", ResourceURL(client, id), gophercloud.RequestOpts{
JSONResponse: &result.Body,
- OkCodes: []int{200},
})
return result
@@ -159,9 +158,7 @@
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
var result DeleteResult
- _, result.Err = client.Request("DELETE", ResourceURL(client, id), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, result.Err = client.Request("DELETE", ResourceURL(client, id), gophercloud.RequestOpts{})
return result
}
diff --git a/openstack/identity/v3/endpoints/requests.go b/openstack/identity/v3/endpoints/requests.go
index 3e09b2a..7591de0 100644
--- a/openstack/identity/v3/endpoints/requests.go
+++ b/openstack/identity/v3/endpoints/requests.go
@@ -122,8 +122,6 @@
// Delete removes an endpoint from the service catalog.
func Delete(client *gophercloud.ServiceClient, endpointID string) DeleteResult {
var res DeleteResult
- _, res.Err = client.Request("DELETE", endpointURL(client, endpointID), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, res.Err = client.Request("DELETE", endpointURL(client, endpointID), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/identity/v3/services/requests.go b/openstack/identity/v3/services/requests.go
index c6820c7..a93cfe7 100644
--- a/openstack/identity/v3/services/requests.go
+++ b/openstack/identity/v3/services/requests.go
@@ -21,7 +21,6 @@
_, result.Err = client.Request("POST", listURL(client), gophercloud.RequestOpts{
JSONBody: &req,
JSONResponse: &result.Body,
- OkCodes: []int{201},
})
return result
}
@@ -53,7 +52,6 @@
var result GetResult
_, result.Err = client.Request("GET", serviceURL(client, serviceID), gophercloud.RequestOpts{
JSONResponse: &result.Body,
- OkCodes: []int{200},
})
return result
}
@@ -79,8 +77,6 @@
// It either deletes all associated endpoints, or fails until all endpoints are deleted.
func Delete(client *gophercloud.ServiceClient, serviceID string) DeleteResult {
var res DeleteResult
- _, res.Err = client.Request("DELETE", serviceURL(client, serviceID), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, res.Err = client.Request("DELETE", serviceURL(client, serviceID), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/identity/v3/tokens/requests.go b/openstack/identity/v3/tokens/requests.go
index bbd3c56..ecbe10e 100644
--- a/openstack/identity/v3/tokens/requests.go
+++ b/openstack/identity/v3/tokens/requests.go
@@ -238,7 +238,6 @@
response, result.Err = c.Request("POST", tokenURL(c), gophercloud.RequestOpts{
JSONBody: &req,
JSONResponse: &result.Body,
- OkCodes: []int{201},
})
if result.Err != nil {
return result
@@ -281,7 +280,6 @@
var res RevokeResult
_, res.Err = c.Request("DELETE", tokenURL(c), gophercloud.RequestOpts{
MoreHeaders: subjectTokenHeaders(c, token),
- OkCodes: []int{204},
})
return res
}
diff --git a/openstack/networking/v2/extensions/fwaas/firewalls/requests.go b/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
index 69f3dca..a7cd3a4 100644
--- a/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
@@ -142,7 +142,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -152,7 +151,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -220,8 +218,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/fwaas/policies/requests.go b/openstack/networking/v2/extensions/fwaas/policies/requests.go
index 95081df..c5bec02 100644
--- a/openstack/networking/v2/extensions/fwaas/policies/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/policies/requests.go
@@ -131,7 +131,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -141,7 +140,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -209,9 +207,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/fwaas/rules/requests.go b/openstack/networking/v2/extensions/fwaas/rules/requests.go
index 3780106..c0065bd 100644
--- a/openstack/networking/v2/extensions/fwaas/rules/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/rules/requests.go
@@ -166,7 +166,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -176,7 +175,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -289,8 +287,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/layer3/floatingips/requests.go b/openstack/networking/v2/extensions/layer3/floatingips/requests.go
index 46f2b22..5fee2e0 100644
--- a/openstack/networking/v2/extensions/layer3/floatingips/requests.go
+++ b/openstack/networking/v2/extensions/layer3/floatingips/requests.go
@@ -111,7 +111,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
@@ -122,7 +121,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -173,8 +171,6 @@
// internal ports.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/layer3/routers/requests.go b/openstack/networking/v2/extensions/layer3/routers/requests.go
index 12640de..edfca67 100755
--- a/openstack/networking/v2/extensions/layer3/routers/requests.go
+++ b/openstack/networking/v2/extensions/layer3/routers/requests.go
@@ -84,7 +84,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -94,7 +93,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -145,9 +143,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/members/requests.go b/openstack/networking/v2/extensions/lbaas/members/requests.go
index 023a04d..f710df5 100644
--- a/openstack/networking/v2/extensions/lbaas/members/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/members/requests.go
@@ -82,7 +82,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -92,7 +91,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -119,7 +117,7 @@
_, res.Err = c.Request("PUT", resourceURL(c, id), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{200},
+ OkCodes: []int{200, 201, 202},
})
return res
}
@@ -127,8 +125,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/monitors/requests.go b/openstack/networking/v2/extensions/lbaas/monitors/requests.go
index de6f688..1b1921a 100644
--- a/openstack/networking/v2/extensions/lbaas/monitors/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/monitors/requests.go
@@ -179,7 +179,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
@@ -190,7 +189,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -270,8 +268,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/pools/requests.go b/openstack/networking/v2/extensions/lbaas/pools/requests.go
index e7e6d94..6a07d23 100644
--- a/openstack/networking/v2/extensions/lbaas/pools/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/pools/requests.go
@@ -102,7 +102,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -112,7 +111,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -156,9 +154,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
@@ -181,7 +177,6 @@
_, res.Err = c.Request("POST", associateURL(c, poolID), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -191,8 +186,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", disassociateURL(c, poolID, monitorID), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/vips/requests.go b/openstack/networking/v2/extensions/lbaas/vips/requests.go
index 5b0bfd9..3f7720a 100644
--- a/openstack/networking/v2/extensions/lbaas/vips/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/vips/requests.go
@@ -181,7 +181,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
@@ -192,7 +191,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -261,8 +259,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/security/groups/requests.go b/openstack/networking/v2/extensions/security/groups/requests.go
index c07508b..4a4e0e0 100644
--- a/openstack/networking/v2/extensions/security/groups/requests.go
+++ b/openstack/networking/v2/extensions/security/groups/requests.go
@@ -77,7 +77,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
@@ -88,7 +87,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -96,8 +94,6 @@
// 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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/extensions/security/rules/requests.go b/openstack/networking/v2/extensions/security/rules/requests.go
index 108acf6..41969b4 100644
--- a/openstack/networking/v2/extensions/security/rules/requests.go
+++ b/openstack/networking/v2/extensions/security/rules/requests.go
@@ -153,7 +153,6 @@
_, res.Err = c.Request("POST", rootURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
@@ -164,7 +163,6 @@
var res GetResult
_, res.Err = c.Request("GET", resourceURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -172,8 +170,6 @@
// 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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", resourceURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/networks/requests.go b/openstack/networking/v2/networks/requests.go
index b0db67e..2e38839 100644
--- a/openstack/networking/v2/networks/requests.go
+++ b/openstack/networking/v2/networks/requests.go
@@ -81,7 +81,6 @@
var res GetResult
_, res.Err = c.Request("GET", getURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -138,7 +137,6 @@
_, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -196,8 +194,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.Request("DELETE", deleteURL(c, networkID), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/ports/requests.go b/openstack/networking/v2/ports/requests.go
index 01d550f..59087d8 100644
--- a/openstack/networking/v2/ports/requests.go
+++ b/openstack/networking/v2/ports/requests.go
@@ -81,7 +81,6 @@
var res GetResult
_, res.Err = c.Request("GET", getURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -159,7 +158,6 @@
_, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
@@ -231,8 +229,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", deleteURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/networking/v2/subnets/requests.go b/openstack/networking/v2/subnets/requests.go
index 63ac290..f66a6ac 100644
--- a/openstack/networking/v2/subnets/requests.go
+++ b/openstack/networking/v2/subnets/requests.go
@@ -80,7 +80,6 @@
var res GetResult
_, res.Err = c.Request("GET", getURL(c, id), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -174,7 +173,6 @@
_, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
@@ -241,8 +239,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{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", deleteURL(c, id), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/objectstorage/v1/accounts/requests.go b/openstack/objectstorage/v1/accounts/requests.go
index 3e404c3..a645115 100644
--- a/openstack/objectstorage/v1/accounts/requests.go
+++ b/openstack/objectstorage/v1/accounts/requests.go
@@ -95,7 +95,7 @@
resp, err := c.Request("POST", updateURL(c), gophercloud.RequestOpts{
MoreHeaders: h,
- OkCodes: []int{204},
+ OkCodes: []int{201, 202, 204},
})
res.Header = resp.Header
res.Err = err
diff --git a/openstack/objectstorage/v1/containers/requests.go b/openstack/objectstorage/v1/containers/requests.go
index a29d7da..39dd4d3 100644
--- a/openstack/objectstorage/v1/containers/requests.go
+++ b/openstack/objectstorage/v1/containers/requests.go
@@ -122,9 +122,7 @@
// Delete is a function that deletes a container.
func Delete(c *gophercloud.ServiceClient, containerName string) DeleteResult {
var res DeleteResult
- _, res.Err = c.Request("DELETE", deleteURL(c, containerName), gophercloud.RequestOpts{
- OkCodes: []int{202, 204},
- })
+ _, res.Err = c.Request("DELETE", deleteURL(c, containerName), gophercloud.RequestOpts{})
return res
}
@@ -180,7 +178,7 @@
resp, err := c.Request("POST", updateURL(c, containerName), gophercloud.RequestOpts{
MoreHeaders: h,
- OkCodes: []int{202, 204},
+ OkCodes: []int{201, 202, 204},
})
res.Header = resp.Header
res.Err = err
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index 30ea94c..b69b8dd 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -211,7 +211,6 @@
ropts := gophercloud.RequestOpts{
RawBody: content,
MoreHeaders: h,
- OkCodes: []int{201, 202},
}
resp, err := c.Request("PUT", url, ropts)
@@ -310,9 +309,7 @@
url += query
}
- resp, err := c.Request("DELETE", url, gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ resp, err := c.Request("DELETE", url, gophercloud.RequestOpts{})
res.Header = resp.Header
res.Err = err
return res
@@ -412,7 +409,6 @@
url := updateURL(c, containerName, objectName)
resp, err := c.Request("POST", url, gophercloud.RequestOpts{
MoreHeaders: h,
- OkCodes: []int{202},
})
res.Header = resp.Header
res.Err = err
diff --git a/openstack/orchestration/v1/buildinfo/requests.go b/openstack/orchestration/v1/buildinfo/requests.go
index 379f34f..6068867 100644
--- a/openstack/orchestration/v1/buildinfo/requests.go
+++ b/openstack/orchestration/v1/buildinfo/requests.go
@@ -7,7 +7,6 @@
var res GetResult
_, res.Err = c.Request("GET", getURL(c), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
diff --git a/openstack/orchestration/v1/stackevents/requests.go b/openstack/orchestration/v1/stackevents/requests.go
index 37eab1e..4f486bc 100644
--- a/openstack/orchestration/v1/stackevents/requests.go
+++ b/openstack/orchestration/v1/stackevents/requests.go
@@ -11,7 +11,6 @@
_, res.Err = c.Request("GET", findURL(c, stackName), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
diff --git a/openstack/orchestration/v1/stackresources/requests.go b/openstack/orchestration/v1/stackresources/requests.go
index 2a66edc..b63ef68 100644
--- a/openstack/orchestration/v1/stackresources/requests.go
+++ b/openstack/orchestration/v1/stackresources/requests.go
@@ -12,7 +12,6 @@
// Send request to API
_, res.Err = c.Request("GET", findURL(c, stackName), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
diff --git a/openstack/orchestration/v1/stacks/requests.go b/openstack/orchestration/v1/stacks/requests.go
index c0388c3..68ba787 100644
--- a/openstack/orchestration/v1/stacks/requests.go
+++ b/openstack/orchestration/v1/stacks/requests.go
@@ -115,7 +115,6 @@
_, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -225,7 +224,6 @@
_, res.Err = c.Request("POST", adoptURL(c), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &res.Body,
- OkCodes: []int{201},
})
return res
}
@@ -306,7 +304,6 @@
// Send request to API
_, res.Err = c.Request("GET", getURL(c, stackName, stackID), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}
@@ -391,7 +388,6 @@
// Send request to API
_, res.Err = c.Request("PUT", updateURL(c, stackName, stackID), gophercloud.RequestOpts{
JSONBody: &reqBody,
- OkCodes: []int{202},
})
return res
}
@@ -399,11 +395,7 @@
// Delete deletes a stack based on the stack name and stack ID.
func Delete(c *gophercloud.ServiceClient, stackName, stackID string) DeleteResult {
var res DeleteResult
-
- // Send request to API
- _, res.Err = c.Request("DELETE", deleteURL(c, stackName, stackID), gophercloud.RequestOpts{
- OkCodes: []int{204},
- })
+ _, res.Err = c.Request("DELETE", deleteURL(c, stackName, stackID), gophercloud.RequestOpts{})
return res
}
diff --git a/openstack/orchestration/v1/stacktemplates/requests.go b/openstack/orchestration/v1/stacktemplates/requests.go
index f57e226..d9050b1 100644
--- a/openstack/orchestration/v1/stacktemplates/requests.go
+++ b/openstack/orchestration/v1/stacktemplates/requests.go
@@ -11,7 +11,6 @@
var res GetResult
_, res.Err = c.Request("GET", getURL(c, stackName, stackID), gophercloud.RequestOpts{
JSONResponse: &res.Body,
- OkCodes: []int{200},
})
return res
}