named return vars
diff --git a/openstack/networking/v2/extensions/fwaas/firewalls/requests.go b/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
index a91710d..d7535f8 100644
--- a/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/firewalls/requests.go
@@ -82,22 +82,18 @@
}
// Create accepts a CreateOpts struct and uses the values to create a new firewall
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToFirewallCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular firewall based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// UpdateOptsBuilder is the interface options structs have to satisfy in order
@@ -123,22 +119,18 @@
}
// Update allows firewalls to be updated.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToFirewallUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Delete will permanently delete a particular firewall based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
diff --git a/openstack/networking/v2/extensions/fwaas/policies/requests.go b/openstack/networking/v2/extensions/fwaas/policies/requests.go
index d4c3665..c9c1400 100644
--- a/openstack/networking/v2/extensions/fwaas/policies/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/policies/requests.go
@@ -81,22 +81,18 @@
}
// Create accepts a CreateOpts struct and uses the values to create a new firewall policy
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToFirewallPolicyCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular firewall policy based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// UpdateOptsBuilder is the interface options structs have to satisfy in order
@@ -122,24 +118,20 @@
}
// Update allows firewall policies to be updated.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToFirewallPolicyUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Delete will permanently delete a particular firewall policy based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
type InsertRuleOptsBuilder interface {
@@ -156,24 +148,20 @@
return gophercloud.BuildRequestBody(opts, "")
}
-func AddRule(c *gophercloud.ServiceClient, id string, opts InsertRuleOptsBuilder) InsertRuleResult {
- var r InsertRuleResult
+func AddRule(c *gophercloud.ServiceClient, id string, opts InsertRuleOptsBuilder) (r InsertRuleResult) {
b, err := opts.ToFirewallPolicyInsertRuleMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(insertURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
-func RemoveRule(c *gophercloud.ServiceClient, id, ruleID string) RemoveRuleResult {
- var r RemoveRuleResult
+func RemoveRule(c *gophercloud.ServiceClient, id, ruleID string) (r RemoveRuleResult) {
b := map[string]interface{}{"firewall_rule_id": ruleID}
_, r.Err = c.Put(removeURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
diff --git a/openstack/networking/v2/extensions/fwaas/rules/requests.go b/openstack/networking/v2/extensions/fwaas/rules/requests.go
index 9e9d36e..f90cad1 100644
--- a/openstack/networking/v2/extensions/fwaas/rules/requests.go
+++ b/openstack/networking/v2/extensions/fwaas/rules/requests.go
@@ -96,22 +96,18 @@
}
// Create accepts a CreateOpts struct and uses the values to create a new firewall rule
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToRuleCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular firewall rule based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// UpdateOptsBuilder is the interface options structs have to satisfy in order
@@ -143,22 +139,18 @@
}
// Update allows firewall policies to be updated.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToRuleUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Delete will permanently delete a particular firewall rule based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
diff --git a/openstack/networking/v2/extensions/layer3/floatingips/requests.go b/openstack/networking/v2/extensions/layer3/floatingips/requests.go
index 9805b56..defa9c0 100644
--- a/openstack/networking/v2/extensions/layer3/floatingips/requests.go
+++ b/openstack/networking/v2/extensions/layer3/floatingips/requests.go
@@ -84,22 +84,18 @@
// operation will fail and return a 400 error code. If the PortID and FixedIP
// are already associated with another resource, the operation will fail and
// returns a 409 error code.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToFloatingIPCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular floating IP resource based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// UpdateOptsBuilder is the interface type must satisfy to be used as Update
@@ -126,24 +122,20 @@
// "update" a floating IP is to associate it with a new internal port, or
// disassociated it from all ports. See UpdateOpts for instructions of how to
// do this.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToFloatingIPUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Delete will permanently delete a particular floating IP resource. Please
// ensure this is what you want - you can also disassociate the IP from existing
// internal ports.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
diff --git a/openstack/networking/v2/extensions/layer3/routers/requests.go b/openstack/networking/v2/extensions/layer3/routers/requests.go
index f2fa073..301db01 100644
--- a/openstack/networking/v2/extensions/layer3/routers/requests.go
+++ b/openstack/networking/v2/extensions/layer3/routers/requests.go
@@ -66,22 +66,18 @@
// GatewayInfo struct. The external gateway for the router must be plugged into
// an external network (it is external if its `router:external' field is set to
// true).
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToRouterCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular router based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
type UpdateOptsBuilder interface {
@@ -106,24 +102,20 @@
// external gateway for a router, see Create. This operation does not enable
// the update of router interfaces. To do this, use the AddInterface and
// RemoveInterface functions.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToRouterUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Delete will permanently delete a particular router based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
// AddInterfaceOptsBuilder is what types must satisfy to be used as AddInterface
@@ -166,17 +158,15 @@
// identifier of a new port created by this operation. After the operation
// completes, the device ID of the port is set to the router ID, and the
// device owner attribute is set to `network:router_interface'.
-func AddInterface(c *gophercloud.ServiceClient, id string, opts AddInterfaceOptsBuilder) InterfaceResult {
- var r InterfaceResult
+func AddInterface(c *gophercloud.ServiceClient, id string, opts AddInterfaceOptsBuilder) (r InterfaceResult) {
b, err := opts.ToRouterAddInterfaceMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(addInterfaceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// RemoveInterfaceOptsBuilder is what types must satisfy to be used as RemoveInterface
@@ -211,15 +201,13 @@
// visible to you, the operation will fail and a 404 Not Found error will be
// returned. After this operation completes, the port connecting the router
// with the subnet is removed from the subnet for the network.
-func RemoveInterface(c *gophercloud.ServiceClient, id string, opts RemoveInterfaceOptsBuilder) InterfaceResult {
- var r InterfaceResult
+func RemoveInterface(c *gophercloud.ServiceClient, id string, opts RemoveInterfaceOptsBuilder) (r InterfaceResult) {
b, err := opts.ToRouterRemoveInterfaceMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(removeInterfaceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
diff --git a/openstack/networking/v2/extensions/lbaas/members/requests.go b/openstack/networking/v2/extensions/lbaas/members/requests.go
index 00c1144..a261fb5 100644
--- a/openstack/networking/v2/extensions/lbaas/members/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/members/requests.go
@@ -65,22 +65,18 @@
// Create accepts a CreateOpts struct and uses the values to create a new
// load balancer pool member.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToLBMemberCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular pool member based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
type UpdateOptsBuilder interface {
@@ -98,22 +94,18 @@
}
// Update allows members to be updated.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToLBMemberUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201, 202},
})
- return r
}
// Delete will permanently delete a particular member based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
diff --git a/openstack/networking/v2/extensions/lbaas/monitors/requests.go b/openstack/networking/v2/extensions/lbaas/monitors/requests.go
index f24e483..686b2ea 100644
--- a/openstack/networking/v2/extensions/lbaas/monitors/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/monitors/requests.go
@@ -130,22 +130,18 @@
// CreateOpts{Type: TypeHTTP, Delay: 20, Timeout: 10, MaxRetries: 3,
// HttpMethod: "HEAD", ExpectedCodes: "200"}
//
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToLBMonitorCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular health monitor based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// UpdateOptsBuilder is what types must satisfy to be used as Update
@@ -193,22 +189,18 @@
}
// Update is an operation which modifies the attributes of the specified monitor.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToLBMonitorUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 202},
})
- return r
}
// Delete will permanently delete a particular monitor based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
diff --git a/openstack/networking/v2/extensions/lbaas/pools/requests.go b/openstack/networking/v2/extensions/lbaas/pools/requests.go
index a79fd01..a5c2b1f 100644
--- a/openstack/networking/v2/extensions/lbaas/pools/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/pools/requests.go
@@ -91,22 +91,18 @@
// Create accepts a CreateOptsBuilder and uses the values to create a new
// load balancer pool.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToLBPoolCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular pool based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// UpdateOptsBuilder is the interface types must satisfy to be used as options
@@ -131,24 +127,20 @@
}
// Update allows pools to be updated.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToLBPoolUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Delete will permanently delete a particular pool based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
// AssociateMonitor will associate a health monitor with a particular pool.
@@ -156,18 +148,14 @@
// 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 {
- var r AssociateResult
+func AssociateMonitor(c *gophercloud.ServiceClient, poolID, monitorID string) (r AssociateResult) {
b := map[string]interface{}{"health_monitor": map[string]string{"id": monitorID}}
_, r.Err = c.Post(associateURL(c, poolID), b, &r.Body, nil)
- return r
}
// 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 r AssociateResult
+func DisassociateMonitor(c *gophercloud.ServiceClient, poolID, monitorID string) (r AssociateResult) {
_, r.Err = c.Delete(disassociateURL(c, poolID, monitorID), nil)
- return r
}
diff --git a/openstack/networking/v2/extensions/lbaas/vips/requests.go b/openstack/networking/v2/extensions/lbaas/vips/requests.go
index e148843..a255258 100644
--- a/openstack/networking/v2/extensions/lbaas/vips/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/vips/requests.go
@@ -97,22 +97,18 @@
//
// Users with an admin role can create VIPs on behalf of other tenants by
// specifying a TenantID attribute different than their own.
-func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOpts) (r CreateResult) {
b, err := opts.ToVIPCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular virtual IP based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// UpdateOptsBuilder is what types must satisfy to be used as Update
@@ -146,22 +142,18 @@
}
// Update is an operation which modifies the attributes of the specified VIP.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToVIPUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 202},
})
- return r
}
// Delete will permanently delete a particular virtual IP based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
diff --git a/openstack/networking/v2/extensions/security/groups/requests.go b/openstack/networking/v2/extensions/security/groups/requests.go
index 42a45e4..267ebdd 100644
--- a/openstack/networking/v2/extensions/security/groups/requests.go
+++ b/openstack/networking/v2/extensions/security/groups/requests.go
@@ -54,29 +54,23 @@
// Create is an operation which provisions a new security group with default
// security group rules for the IPv4 and IPv6 ether types.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToSecGroupCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular security group based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// Delete will permanently delete a particular security group based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
// IDFromName is a convenience function that returns a security group's ID given its name.
diff --git a/openstack/networking/v2/extensions/security/rules/requests.go b/openstack/networking/v2/extensions/security/rules/requests.go
index d93f470..8b81d04 100644
--- a/openstack/networking/v2/extensions/security/rules/requests.go
+++ b/openstack/networking/v2/extensions/security/rules/requests.go
@@ -104,27 +104,21 @@
// Create is an operation which adds a new security group rule and associates it
// with an existing security group (whose ID is specified in CreateOpts).
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToSecGroupRuleCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(rootURL(c), b, &r.Body, nil)
- return r
}
// Get retrieves a particular security group rule based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(resourceURL(c, id), &r.Body, nil)
- return r
}
// Delete will permanently delete a particular security group rule based on its unique ID.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(resourceURL(c, id), nil)
- return r
}
diff --git a/openstack/networking/v2/networks/requests.go b/openstack/networking/v2/networks/requests.go
index ec043b1..31c3037 100644
--- a/openstack/networking/v2/networks/requests.go
+++ b/openstack/networking/v2/networks/requests.go
@@ -53,10 +53,8 @@
}
// Get retrieves a specific network based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(getURL(c, id), &r.Body, nil)
- return r
}
// CreateOptsBuilder is the interface options structs have to satisfy in order
@@ -87,15 +85,13 @@
// The tenant ID that is contained in the URI is the tenant that creates the
// network. An admin user, however, has the option of specifying another tenant
// ID in the CreateOpts struct.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToNetworkCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(createURL(c), b, &r.Body, nil)
- return r
}
// UpdateOptsBuilder is the interface options structs have to satisfy in order
@@ -120,24 +116,20 @@
// Update accepts a UpdateOpts struct and updates an existing network using the
// values provided. For more information, see the Create function.
-func Update(c *gophercloud.ServiceClient, networkID string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, networkID string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToNetworkUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(updateURL(c, networkID), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201},
})
- return r
}
// Delete accepts a unique ID and deletes the network associated with it.
-func Delete(c *gophercloud.ServiceClient, networkID string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, networkID string) (r DeleteResult) {
_, r.Err = c.Delete(deleteURL(c, networkID), nil)
- return r
}
// IDFromName is a convenience function that returns a network's ID given its name.
diff --git a/openstack/networking/v2/ports/errors.go b/openstack/networking/v2/ports/errors.go
deleted file mode 100644
index 111d977..0000000
--- a/openstack/networking/v2/ports/errors.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package ports
-
-import "fmt"
-
-func err(str string) error {
- return fmt.Errorf("%s", str)
-}
-
-var (
- errNetworkIDRequired = err("A Network ID is required")
-)
diff --git a/openstack/networking/v2/ports/requests.go b/openstack/networking/v2/ports/requests.go
index ab5d692..261e8ad 100644
--- a/openstack/networking/v2/ports/requests.go
+++ b/openstack/networking/v2/ports/requests.go
@@ -60,10 +60,8 @@
}
// Get retrieves a specific port based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(getURL(c, id), &r.Body, nil)
- return r
}
// CreateOptsBuilder is the interface options structs have to satisfy in order
@@ -95,15 +93,13 @@
// Create accepts a CreateOpts struct and creates a new network using the values
// provided. You must remember to provide a NetworkID value.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToPortCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(createURL(c), b, &r.Body, nil)
- return r
}
// UpdateOptsBuilder is the interface options structs have to satisfy in order
@@ -132,24 +128,20 @@
// Update accepts a UpdateOpts struct and updates an existing port using the
// values provided.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToPortUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(updateURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201},
})
- return r
}
// Delete accepts a unique ID and deletes the port associated with it.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(deleteURL(c, id), nil)
- return r
}
// IDFromName is a convenience function that returns a port's ID given its name.
diff --git a/openstack/networking/v2/subnets/requests.go b/openstack/networking/v2/subnets/requests.go
index a782cf5..5491f3c 100644
--- a/openstack/networking/v2/subnets/requests.go
+++ b/openstack/networking/v2/subnets/requests.go
@@ -59,10 +59,8 @@
}
// Get retrieves a specific subnet based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(getURL(c, id), &r.Body, nil)
- return r
}
// IPVersion is the IP address version for the subnet. Valid instances are
@@ -104,15 +102,13 @@
// Create accepts a CreateOpts struct and creates a new subnet using the values
// provided. You must remember to provide a valid NetworkID, CIDR and IP version.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToSubnetCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(createURL(c), b, &r.Body, nil)
- return r
}
// UpdateOptsBuilder allows extensions to add additional parameters to the
@@ -137,24 +133,20 @@
// Update accepts a UpdateOpts struct and updates an existing subnet using the
// values provided.
-func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToSubnetUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(updateURL(c, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201},
})
- return r
}
// Delete accepts a unique ID and deletes the subnet associated with it.
-func Delete(c *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = c.Delete(deleteURL(c, id), nil)
- return r
}
// IDFromName is a convenience function that returns a subnet's ID given its name.