Removing unnecessary 'err' vars
diff --git a/openstack/networking/v2/extensions/layer3/floatingips/requests.go b/openstack/networking/v2/extensions/layer3/floatingips/requests.go
index cbe30b2..36b4411 100644
--- a/openstack/networking/v2/extensions/layer3/floatingips/requests.go
+++ b/openstack/networking/v2/extensions/layer3/floatingips/requests.go
@@ -141,27 +141,24 @@
}}
// Send request to API
- _, err := perigee.Request("POST", rootURL(c), perigee.Options{
+ _, res.Err = perigee.Request("POST", rootURL(c), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{201},
})
- res.Err = err
-
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
- _, err := perigee.Request("GET", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -197,13 +194,13 @@
// Send request to API
var res UpdateResult
- _, err := perigee.Request("PUT", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("PUT", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
+
return res
}
@@ -212,10 +209,9 @@
// internal ports.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
diff --git a/openstack/networking/v2/extensions/layer3/routers/requests.go b/openstack/networking/v2/extensions/layer3/routers/requests.go
index 53a80d5..f53f878 100755
--- a/openstack/networking/v2/extensions/layer3/routers/requests.go
+++ b/openstack/networking/v2/extensions/layer3/routers/requests.go
@@ -109,25 +109,23 @@
}
var res CreateResult
- _, err := perigee.Request("POST", rootURL(c), perigee.Options{
+ _, res.Err = perigee.Request("POST", rootURL(c), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{201},
})
- res.Err = err
return res
}
// Get retrieves a particular router based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -165,24 +163,23 @@
// Send request to API
var res UpdateResult
- _, err := perigee.Request("PUT", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("PUT", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
+
return res
}
// Delete will permanently delete a particular router based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
@@ -231,13 +228,13 @@
body := request{SubnetID: opts.SubnetID, PortID: opts.PortID}
- _, err := perigee.Request("PUT", addInterfaceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("PUT", addInterfaceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &body,
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
+
return res
}
@@ -264,12 +261,12 @@
body := request{SubnetID: opts.SubnetID, PortID: opts.PortID}
- _, err := perigee.Request("PUT", removeInterfaceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("PUT", removeInterfaceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &body,
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
+
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/members/requests.go b/openstack/networking/v2/extensions/lbaas/members/requests.go
index e402444..66302ab 100644
--- a/openstack/networking/v2/extensions/lbaas/members/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/members/requests.go
@@ -119,25 +119,23 @@
}}
var res CreateResult
- _, err := perigee.Request("POST", rootURL(c), perigee.Options{
+ _, res.Err = perigee.Request("POST", rootURL(c), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{201},
})
- res.Err = err
return res
}
// Get retrieves a particular pool member based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -160,23 +158,21 @@
// Send request to API
var res UpdateResult
- _, err := perigee.Request("PUT", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("PUT", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
// Delete will permanently delete a particular member based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/monitors/requests.go b/openstack/networking/v2/extensions/lbaas/monitors/requests.go
index 572ea80..a16f22f 100644
--- a/openstack/networking/v2/extensions/lbaas/monitors/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/monitors/requests.go
@@ -230,12 +230,11 @@
// Get retrieves a particular health monitor based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -311,10 +310,9 @@
// Delete will permanently delete a particular monitor based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/pools/requests.go b/openstack/networking/v2/extensions/lbaas/pools/requests.go
index bfdbefe..c0098af 100644
--- a/openstack/networking/v2/extensions/lbaas/pools/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/pools/requests.go
@@ -141,25 +141,23 @@
}}
var res CreateResult
- _, err := perigee.Request("POST", rootURL(c), perigee.Options{
+ _, res.Err = perigee.Request("POST", rootURL(c), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{201},
})
- res.Err = err
return res
}
// Get retrieves a particular pool based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -191,27 +189,30 @@
// Send request to API
var res UpdateResult
- _, err := perigee.Request("PUT", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("PUT", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
// Delete will permanently delete a particular pool based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
+// AssociateMonitor will associate a health monitor with a particular pool.
+// Once associated, the health monitor will start monitoring the members of the
+// pool and will deactivate these members if they are deemed unhealthy. A
+// member can be deactivated (status set to INACTIVE) if any of health monitors
+// finds it unhealthy.
func AssociateMonitor(c *gophercloud.ServiceClient, poolID, monitorID string) AssociateResult {
type hm struct {
ID string `json:"id"`
@@ -223,22 +224,23 @@
reqBody := request{hm{ID: monitorID}}
var res AssociateResult
- _, err := perigee.Request("POST", associateURL(c, poolID), perigee.Options{
+ _, res.Err = perigee.Request("POST", associateURL(c, poolID), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{201},
})
- res.Err = err
return res
}
+// DisassociateMonitor will disassociate a health monitor with a particular
+// pool. When dissociation is successful, the health monitor will no longer
+// check for the health of the members of the pool.
func DisassociateMonitor(c *gophercloud.ServiceClient, poolID, monitorID string) AssociateResult {
var res AssociateResult
- _, err := perigee.Request("DELETE", disassociateURL(c, poolID, monitorID), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", disassociateURL(c, poolID, monitorID), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
diff --git a/openstack/networking/v2/extensions/lbaas/vips/requests.go b/openstack/networking/v2/extensions/lbaas/vips/requests.go
index c2e27f9..f2d6ab7 100644
--- a/openstack/networking/v2/extensions/lbaas/vips/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/vips/requests.go
@@ -17,7 +17,7 @@
iTrue = true
iFalse = false
- Nothing AdminState = nil
+ Nothing AdminState
Up AdminState = &iTrue
Down AdminState = &iFalse
)
@@ -237,12 +237,11 @@
// Get retrieves a particular virtual IP based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -311,10 +310,9 @@
// Delete will permanently delete a particular virtual IP based on its unique ID.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", resourceURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
diff --git a/openstack/networking/v2/extensions/provider/results_test.go b/openstack/networking/v2/extensions/provider/results_test.go
index 20b95c9..9cb5c6d 100644
--- a/openstack/networking/v2/extensions/provider/results_test.go
+++ b/openstack/networking/v2/extensions/provider/results_test.go
@@ -249,8 +249,8 @@
`)
})
- iTrue, iFalse := true, false
- options := networks.UpdateOpts{Name: "new_network_name", AdminStateUp: &iFalse, Shared: &iTrue}
+ iFalse := false
+ options := networks.UpdateOpts{Name: "new_network_name", AdminStateUp: Down, Shared: &iTrue}
res := networks.Update(serviceClient(), "4e8e5957-649f-477b-9e5b-f1f75b21c03c", options)
n, err := ExtractUpdate(res)
diff --git a/openstack/networking/v2/extensions/requests.go b/openstack/networking/v2/extensions/requests.go
index 8f7fd67..2d3dc65 100755
--- a/openstack/networking/v2/extensions/requests.go
+++ b/openstack/networking/v2/extensions/requests.go
@@ -9,12 +9,11 @@
// Get retrieves information for a specific extension using its alias.
func Get(c *gophercloud.ServiceClient, alias string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", extensionURL(c, alias), perigee.Options{
+ _, res.Err = perigee.Request("GET", extensionURL(c, alias), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
diff --git a/openstack/networking/v2/networks/requests.go b/openstack/networking/v2/networks/requests.go
index 180914f..9b52c8d 100644
--- a/openstack/networking/v2/networks/requests.go
+++ b/openstack/networking/v2/networks/requests.go
@@ -81,12 +81,11 @@
// Get retrieves a specific network based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", getURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", getURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -139,13 +138,12 @@
reqBody := opts.ToMap()
// Send request to API
- _, err := perigee.Request("POST", createURL(c), perigee.Options{
+ _, res.Err = perigee.Request("POST", createURL(c), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{201},
})
- res.Err = err
return res
}
@@ -190,23 +188,22 @@
reqBody := opts.ToMap()
// Send request to API
- _, err := perigee.Request("PUT", getURL(c, networkID), perigee.Options{
+ _, res.Err = perigee.Request("PUT", getURL(c, networkID), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{200, 201},
})
- res.Err = err
+
return res
}
// Delete accepts a unique ID and deletes the network associated with it.
func Delete(c *gophercloud.ServiceClient, networkID string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", deleteURL(c, networkID), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", deleteURL(c, networkID), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
diff --git a/openstack/networking/v2/ports/requests.go b/openstack/networking/v2/ports/requests.go
index 0c4ae74..da738d2 100644
--- a/openstack/networking/v2/ports/requests.go
+++ b/openstack/networking/v2/ports/requests.go
@@ -104,12 +104,11 @@
// Get retrieves a specific port based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", getURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", getURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -172,14 +171,14 @@
}
// Response
- _, err := perigee.Request("POST", createURL(c), perigee.Options{
+ _, res.Err = perigee.Request("POST", createURL(c), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{201},
DumpReqJson: true,
})
- res.Err = err
+
return res
}
@@ -226,23 +225,21 @@
// Response
var res UpdateResult
- _, err := perigee.Request("PUT", updateURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("PUT", updateURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{200, 201},
})
- res.Err = err
return res
}
// Delete accepts a unique ID and deletes the port associated with it.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", deleteURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", deleteURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}
diff --git a/openstack/networking/v2/subnets/requests.go b/openstack/networking/v2/subnets/requests.go
index 591af24..153b3a2 100644
--- a/openstack/networking/v2/subnets/requests.go
+++ b/openstack/networking/v2/subnets/requests.go
@@ -85,12 +85,11 @@
// Get retrieves a specific subnet based on its unique ID.
func Get(c *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
- _, err := perigee.Request("GET", getURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("GET", getURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
Results: &res.Resp,
OkCodes: []int{200},
})
- res.Err = err
return res
}
@@ -173,13 +172,12 @@
reqBody.Subnet.HostRoutes = opts.HostRoutes
}
- _, err := perigee.Request("POST", createURL(c), perigee.Options{
+ _, res.Err = perigee.Request("POST", createURL(c), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{201},
})
- res.Err = err
return res
}
@@ -222,13 +220,12 @@
}
var res UpdateResult
- _, err := perigee.Request("PUT", updateURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("PUT", updateURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Resp,
OkCodes: []int{200, 201},
})
- res.Err = err
return res
}
@@ -236,10 +233,9 @@
// Delete accepts a unique ID and deletes the subnet associated with it.
func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult
- _, err := perigee.Request("DELETE", deleteURL(c, id), perigee.Options{
+ _, res.Err = perigee.Request("DELETE", deleteURL(c, id), perigee.Options{
MoreHeaders: c.Provider.AuthenticatedHeaders(),
OkCodes: []int{204},
})
- res.Err = err
return res
}