named return vars
diff --git a/openstack/blockstorage/v1/apiversions/requests.go b/openstack/blockstorage/v1/apiversions/requests.go
index 4e9df04..5d83e4e 100644
--- a/openstack/blockstorage/v1/apiversions/requests.go
+++ b/openstack/blockstorage/v1/apiversions/requests.go
@@ -14,8 +14,6 @@
// Get will retrieve the volume type with the provided ID. To extract the volume
// type from the result, call the Extract method on the GetResult.
-func Get(client *gophercloud.ServiceClient, v string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, v string) (r GetResult) {
_, r.Err = client.Get(getURL(client, v), &r.Body, nil)
- return r
}
diff --git a/openstack/blockstorage/v1/snapshots/requests.go b/openstack/blockstorage/v1/snapshots/requests.go
index e8583cb..5c05f9b 100644
--- a/openstack/blockstorage/v1/snapshots/requests.go
+++ b/openstack/blockstorage/v1/snapshots/requests.go
@@ -31,32 +31,26 @@
// Create will create a new Snapshot based on the values in CreateOpts. To
// extract the Snapshot object from the response, call the Extract method on the
// CreateResult.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToSnapshotCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201},
})
- return r
}
// Delete will delete the existing Snapshot with the provided ID.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
- return r
}
// Get retrieves the Snapshot with the provided ID. To extract the Snapshot
// object from the response, call the Extract method on the GetResult.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
// ListOptsBuilder allows extensions to add additional parameters to the List
@@ -117,17 +111,15 @@
// UpdateMetadata will update the Snapshot with provided information. To
// extract the updated Snapshot from the response, call the ExtractMetadata
// method on the UpdateMetadataResult.
-func UpdateMetadata(client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder) UpdateMetadataResult {
- var r UpdateMetadataResult
+func UpdateMetadata(client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder) (r UpdateMetadataResult) {
b, err := opts.ToSnapshotUpdateMetadataMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Put(updateMetadataURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// IDFromName is a convienience function that returns a snapshot's ID given its name.
diff --git a/openstack/blockstorage/v1/volumes/requests.go b/openstack/blockstorage/v1/volumes/requests.go
index 7c063b2..b9fc456 100644
--- a/openstack/blockstorage/v1/volumes/requests.go
+++ b/openstack/blockstorage/v1/volumes/requests.go
@@ -35,32 +35,26 @@
// Create will create a new Volume based on the values in CreateOpts. To extract
// the Volume object from the response, call the Extract method on the
// CreateResult.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToVolumeCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201},
})
- return r
}
// Delete will delete the existing Volume with the provided ID.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
- return r
}
// Get retrieves the Volume with the provided ID. To extract the Volume object
// from the response, call the Extract method on the GetResult.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
// ListOptsBuilder allows extensions to add additional parameters to the List
@@ -113,12 +107,9 @@
// to the volumes.Update function. For more information about the parameters, see
// the Volume object.
type UpdateOpts struct {
- // OPTIONAL
- Name string `json:"name,omitempty"`
- // OPTIONAL
- Description string `json:"description,omitempty"`
- // OPTIONAL
- Metadata map[string]string `json:"metadata,omitempty"`
+ Name string `json:"name,omitempty"`
+ Description string `json:"description,omitempty"`
+ Metadata map[string]string `json:"metadata,omitempty"`
}
// ToVolumeUpdateMap assembles a request body based on the contents of an
@@ -129,17 +120,15 @@
// Update will update the Volume with provided information. To extract the updated
// Volume from the response, call the Extract method on the UpdateResult.
-func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToVolumeUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Put(updateURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// IDFromName is a convienience function that returns a server's ID given its name.
diff --git a/openstack/blockstorage/v1/volumetypes/requests.go b/openstack/blockstorage/v1/volumetypes/requests.go
index b895482..8c7dd46 100644
--- a/openstack/blockstorage/v1/volumetypes/requests.go
+++ b/openstack/blockstorage/v1/volumetypes/requests.go
@@ -26,32 +26,26 @@
// Create will create a new volume. To extract the created volume type object,
// call the Extract method on the CreateResult.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToVolumeTypeCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201},
})
- return r
}
// Delete will delete the volume type with the provided ID.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
- return r
}
// Get will retrieve the volume type with the provided ID. To extract the volume
// type from the result, call the Extract method on the GetResult.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
// List returns all volume types.
diff --git a/openstack/cdn/v1/base/requests.go b/openstack/cdn/v1/base/requests.go
index 15f8346..99e7309 100644
--- a/openstack/cdn/v1/base/requests.go
+++ b/openstack/cdn/v1/base/requests.go
@@ -4,18 +4,14 @@
// Get retrieves the home document, allowing the user to discover the
// entire API.
-func Get(c *gophercloud.ServiceClient) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient) (r GetResult) {
_, r.Err = c.Get(getURL(c), &r.Body, nil)
- return r
}
// Ping retrieves a ping to the server.
-func Ping(c *gophercloud.ServiceClient) PingResult {
- var r PingResult
+func Ping(c *gophercloud.ServiceClient) (r PingResult) {
_, r.Err = c.Get(pingURL(c), nil, &gophercloud.RequestOpts{
OkCodes: []int{204},
MoreHeaders: map[string]string{"Accept": ""},
})
- return r
}
diff --git a/openstack/cdn/v1/flavors/requests.go b/openstack/cdn/v1/flavors/requests.go
index d42d1d7..fc05528 100644
--- a/openstack/cdn/v1/flavors/requests.go
+++ b/openstack/cdn/v1/flavors/requests.go
@@ -13,8 +13,6 @@
}
// Get retrieves a specific flavor 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
}
diff --git a/openstack/cdn/v1/serviceassets/requests.go b/openstack/cdn/v1/serviceassets/requests.go
index 3d0543e..e78508d 100644
--- a/openstack/cdn/v1/serviceassets/requests.go
+++ b/openstack/cdn/v1/serviceassets/requests.go
@@ -31,22 +31,20 @@
// it. For example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
-func Delete(c *gophercloud.ServiceClient, idOrURL string, opts DeleteOptsBuilder) DeleteResult {
+func Delete(c *gophercloud.ServiceClient, idOrURL string, opts DeleteOptsBuilder) (r DeleteResult) {
var url string
if strings.Contains(idOrURL, "/") {
url = idOrURL
} else {
url = deleteURL(c, idOrURL)
}
- var r DeleteResult
if opts != nil {
q, err := opts.ToCDNAssetDeleteParams()
if err != nil {
r.Err = err
- return r
+ return
}
url += q
}
_, r.Err = c.Delete(url, nil)
- return r
}
diff --git a/openstack/cdn/v1/services/requests.go b/openstack/cdn/v1/services/requests.go
index 9a0f54b..c0329d6 100644
--- a/openstack/cdn/v1/services/requests.go
+++ b/openstack/cdn/v1/services/requests.go
@@ -77,49 +77,34 @@
// ToCDNServiceCreateMap casts a CreateOpts struct to a map.
func (opts CreateOpts) ToCDNServiceCreateMap() (map[string]interface{}, error) {
-
- /*
- for _, origin := range opts.Origins {
- if origin.Rules == nil && len(opts.Origins) > 1 {
- return nil, no("Origins[].Rules")
- }
- }
- */
-
return gophercloud.BuildRequestBody(opts, "")
}
// Create accepts a CreateOpts struct and creates a new CDN service using the
// values provided.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToCDNServiceCreateMap()
if err != nil {
r.Err = err
return r
}
- // Send request to API
resp, err := c.Post(createURL(c), &b, nil, nil)
r.Header = resp.Header
r.Err = err
- return r
}
// Get retrieves a specific service based on its URL or its unique ID. For
// example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
-func Get(c *gophercloud.ServiceClient, idOrURL string) GetResult {
+func Get(c *gophercloud.ServiceClient, idOrURL string) (r GetResult) {
var url string
if strings.Contains(idOrURL, "/") {
url = idOrURL
} else {
url = getURL(c, idOrURL)
}
-
- var r GetResult
_, r.Err = c.Get(url, &r.Body, nil)
- return r
}
// Path is a JSON pointer location that indicates which service parameter is being added, replaced,
@@ -260,7 +245,7 @@
// URL or its ID. For example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
-func Update(c *gophercloud.ServiceClient, idOrURL string, opts UpdateOpts) UpdateResult {
+func Update(c *gophercloud.ServiceClient, idOrURL string, opts UpdateOpts) (r UpdateResult) {
var url string
if strings.Contains(idOrURL, "/") {
url = idOrURL
@@ -277,25 +262,20 @@
JSONBody: &b,
OkCodes: []int{202},
})
- var r UpdateResult
r.Header = resp.Header
r.Err = err
- return r
}
// Delete accepts a service's ID or its URL and deletes the CDN service
// associated with it. For example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
-func Delete(c *gophercloud.ServiceClient, idOrURL string) DeleteResult {
+func Delete(c *gophercloud.ServiceClient, idOrURL string) (r DeleteResult) {
var url string
if strings.Contains(idOrURL, "/") {
url = idOrURL
} else {
url = deleteURL(c, idOrURL)
}
-
- var r DeleteResult
_, r.Err = c.Delete(url, nil)
- return r
}
diff --git a/openstack/common/extensions/requests.go b/openstack/common/extensions/requests.go
index 05bf35d..bc1ce3e 100755
--- a/openstack/common/extensions/requests.go
+++ b/openstack/common/extensions/requests.go
@@ -6,10 +6,8 @@
)
// Get retrieves information for a specific extension using its alias.
-func Get(c *gophercloud.ServiceClient, alias string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, alias string) (r GetResult) {
_, r.Err = c.Get(ExtensionURL(c, alias), &r.Body, nil)
- return r
}
// List returns a Pager which allows you to iterate over the full collection of extensions.
diff --git a/openstack/compute/v2/extensions/bootfromvolume/requests.go b/openstack/compute/v2/extensions/bootfromvolume/requests.go
index 086cc0a..f99da40 100644
--- a/openstack/compute/v2/extensions/bootfromvolume/requests.go
+++ b/openstack/compute/v2/extensions/bootfromvolume/requests.go
@@ -79,15 +79,13 @@
}
// Create requests the creation of a server from the given block device mapping.
-func Create(client *gophercloud.ServiceClient, opts servers.CreateOptsBuilder) servers.CreateResult {
- var r servers.CreateResult
+func Create(client *gophercloud.ServiceClient, opts servers.CreateOptsBuilder) (r servers.CreateResult) {
b, err := opts.ToServerCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 202},
})
- return r
}
diff --git a/openstack/compute/v2/extensions/defsecrules/requests.go b/openstack/compute/v2/extensions/defsecrules/requests.go
index 62c112e..f01631d 100644
--- a/openstack/compute/v2/extensions/defsecrules/requests.go
+++ b/openstack/compute/v2/extensions/defsecrules/requests.go
@@ -37,29 +37,23 @@
}
// Create is the operation responsible for creating a new default rule.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToRuleCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(rootURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Get will return details for a particular default rule.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(resourceURL(client, id), &r.Body, nil)
- return r
}
// Delete will permanently delete a default rule from the project.
-func Delete(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
- var r gophercloud.ErrResult
+func Delete(client *gophercloud.ServiceClient, id string) (r gophercloud.ErrResult) {
_, r.Err = client.Delete(resourceURL(client, id), nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/floatingips/requests.go b/openstack/compute/v2/extensions/floatingips/requests.go
index 8137d76..2f5cd79 100644
--- a/openstack/compute/v2/extensions/floatingips/requests.go
+++ b/openstack/compute/v2/extensions/floatingips/requests.go
@@ -30,31 +30,25 @@
}
// Create requests the creation of a new floating IP
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToFloatingIPCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Get returns data about a previously created FloatingIP.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
// Delete requests the deletion of a previous allocated FloatingIP.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
- return r
}
// AssociateOptsBuilder is the interface types must satfisfy to be used as
@@ -77,15 +71,13 @@
}
// AssociateInstance pairs an allocated floating IP with an instance.
-func AssociateInstance(client *gophercloud.ServiceClient, serverID string, opts AssociateOptsBuilder) AssociateResult {
- var r AssociateResult
+func AssociateInstance(client *gophercloud.ServiceClient, serverID string, opts AssociateOptsBuilder) (r AssociateResult) {
b, err := opts.ToFloatingIPAssociateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(associateURL(client, serverID), b, nil, nil)
- return r
}
// DisassociateOptsBuilder is the interface types must satfisfy to be used as
@@ -105,13 +97,11 @@
}
// DisassociateInstance decouples an allocated floating IP from an instance
-func DisassociateInstance(client *gophercloud.ServiceClient, serverID string, opts DisassociateOptsBuilder) DisassociateResult {
- var r DisassociateResult
+func DisassociateInstance(client *gophercloud.ServiceClient, serverID string, opts DisassociateOptsBuilder) (r DisassociateResult) {
b, err := opts.ToFloatingIPDisassociateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(disassociateURL(client, serverID), b, nil, nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/floatingips/urls.go b/openstack/compute/v2/extensions/floatingips/urls.go
index f8181da..4768e5a 100644
--- a/openstack/compute/v2/extensions/floatingips/urls.go
+++ b/openstack/compute/v2/extensions/floatingips/urls.go
@@ -24,14 +24,14 @@
return getURL(c, id)
}
-func serverURL(c *gophercloud.ServiceClient, serverId string) string {
- return c.ServiceURL("servers/" + serverId + "/action")
+func serverURL(c *gophercloud.ServiceClient, serverID string) string {
+ return c.ServiceURL("servers/" + serverID + "/action")
}
-func associateURL(c *gophercloud.ServiceClient, serverId string) string {
- return serverURL(c, serverId)
+func associateURL(c *gophercloud.ServiceClient, serverID string) string {
+ return serverURL(c, serverID)
}
-func disassociateURL(c *gophercloud.ServiceClient, serverId string) string {
- return serverURL(c, serverId)
+func disassociateURL(c *gophercloud.ServiceClient, serverID string) string {
+ return serverURL(c, serverID)
}
diff --git a/openstack/compute/v2/extensions/keypairs/requests.go b/openstack/compute/v2/extensions/keypairs/requests.go
index 2a01084..c4d63ce 100644
--- a/openstack/compute/v2/extensions/keypairs/requests.go
+++ b/openstack/compute/v2/extensions/keypairs/requests.go
@@ -59,29 +59,23 @@
// Create requests the creation of a new keypair on the server, or to import a pre-existing
// keypair.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToKeyPairCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Get returns public data about a previously uploaded KeyPair.
-func Get(client *gophercloud.ServiceClient, name string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, name string) (r GetResult) {
_, r.Err = client.Get(getURL(client, name), &r.Body, nil)
- return r
}
// Delete requests the deletion of a previous stored KeyPair from the server.
-func Delete(client *gophercloud.ServiceClient, name string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, name string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, name), nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/networks/requests.go b/openstack/compute/v2/extensions/networks/requests.go
index 6f0f182..4f66ff9 100644
--- a/openstack/compute/v2/extensions/networks/requests.go
+++ b/openstack/compute/v2/extensions/networks/requests.go
@@ -13,8 +13,6 @@
}
// Get returns data about a previously created Network.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/secgroups/requests.go b/openstack/compute/v2/extensions/secgroups/requests.go
index 48ff698..cfb2df8 100644
--- a/openstack/compute/v2/extensions/secgroups/requests.go
+++ b/openstack/compute/v2/extensions/secgroups/requests.go
@@ -47,17 +47,15 @@
}
// Create will create a new security group.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToSecGroupCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(rootURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// UpdateOpts is the struct responsible for updating an existing security group.
@@ -75,31 +73,25 @@
// Update will modify the mutable properties of a security group, notably its
// name and description.
-func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToSecGroupUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Put(resourceURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Get will return details for a particular security group.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(resourceURL(client, id), &r.Body, nil)
- return r
}
// Delete will permanently delete a security group from the project.
-func Delete(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
- var r gophercloud.ErrResult
+func Delete(client *gophercloud.ServiceClient, id string) (r gophercloud.ErrResult) {
_, r.Err = client.Delete(resourceURL(client, id), nil)
- return r
}
// CreateRuleOpts represents the configuration for adding a new rule to an
@@ -137,24 +129,20 @@
// CreateRule will add a new rule to an existing security group (whose ID is
// specified in CreateRuleOpts). You have the option of controlling inbound
// traffic from either an IP range (CIDR) or from another security group.
-func CreateRule(client *gophercloud.ServiceClient, opts CreateRuleOptsBuilder) CreateRuleResult {
- var r CreateRuleResult
+func CreateRule(client *gophercloud.ServiceClient, opts CreateRuleOptsBuilder) (r CreateRuleResult) {
b, err := opts.ToRuleCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(rootRuleURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// DeleteRule will permanently delete a rule from a security group.
-func DeleteRule(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
- var r gophercloud.ErrResult
+func DeleteRule(client *gophercloud.ServiceClient, id string) (r gophercloud.ErrResult) {
_, r.Err = client.Delete(resourceRuleURL(client, id), nil)
- return r
}
func actionMap(prefix, groupName string) map[string]map[string]string {
@@ -165,15 +153,11 @@
// AddServer will associate a server and a security group, enforcing the
// rules of the group on the server.
-func AddServer(client *gophercloud.ServiceClient, serverID, groupName string) gophercloud.ErrResult {
- var r gophercloud.ErrResult
+func AddServer(client *gophercloud.ServiceClient, serverID, groupName string) (r gophercloud.ErrResult) {
_, r.Err = client.Post(serverActionURL(client, serverID), actionMap("add", groupName), &r.Body, nil)
- return r
}
// RemoveServer will disassociate a server from a security group.
-func RemoveServer(client *gophercloud.ServiceClient, serverID, groupName string) gophercloud.ErrResult {
- var r gophercloud.ErrResult
+func RemoveServer(client *gophercloud.ServiceClient, serverID, groupName string) (r gophercloud.ErrResult) {
_, r.Err = client.Post(serverActionURL(client, serverID), actionMap("remove", groupName), &r.Body, nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/servergroups/requests.go b/openstack/compute/v2/extensions/servergroups/requests.go
index 1348cfa..c5d5f95 100644
--- a/openstack/compute/v2/extensions/servergroups/requests.go
+++ b/openstack/compute/v2/extensions/servergroups/requests.go
@@ -32,29 +32,23 @@
}
// Create requests the creation of a new Server Group
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToServerGroupCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Get returns data about a previously created ServerGroup.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
// Delete requests the deletion of a previously allocated ServerGroup.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/startstop/requests.go b/openstack/compute/v2/extensions/startstop/requests.go
index 460223a..27076b7 100644
--- a/openstack/compute/v2/extensions/startstop/requests.go
+++ b/openstack/compute/v2/extensions/startstop/requests.go
@@ -7,15 +7,11 @@
}
// Start is the operation responsible for starting a Compute server.
-func Start(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
- var r gophercloud.ErrResult
+func Start(client *gophercloud.ServiceClient, id string) (r gophercloud.ErrResult) {
_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"os-start": nil}, nil, nil)
- return r
}
// Stop is the operation responsible for stopping a Compute server.
-func Stop(client *gophercloud.ServiceClient, id string) gophercloud.ErrResult {
- var r gophercloud.ErrResult
+func Stop(client *gophercloud.ServiceClient, id string) (r gophercloud.ErrResult) {
_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"os-stop": nil}, nil, nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/tenantnetworks/requests.go b/openstack/compute/v2/extensions/tenantnetworks/requests.go
index ca33c37..2df856f 100644
--- a/openstack/compute/v2/extensions/tenantnetworks/requests.go
+++ b/openstack/compute/v2/extensions/tenantnetworks/requests.go
@@ -13,8 +13,6 @@
}
// Get returns data about a previously created Network.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/volumeattach/requests.go b/openstack/compute/v2/extensions/volumeattach/requests.go
index c8ef930..d6c8ddc 100644
--- a/openstack/compute/v2/extensions/volumeattach/requests.go
+++ b/openstack/compute/v2/extensions/volumeattach/requests.go
@@ -32,29 +32,23 @@
}
// Create requests the creation of a new volume attachment on the server
-func Create(client *gophercloud.ServiceClient, serverID string, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, serverID string, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToVolumeAttachmentCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(createURL(client, serverID), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Get returns public data about a previously created VolumeAttachment.
-func Get(client *gophercloud.ServiceClient, serverID, attachmentID string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, serverID, attachmentID string) (r GetResult) {
_, r.Err = client.Get(getURL(client, serverID, attachmentID), &r.Body, nil)
- return r
}
// Delete requests the deletion of a previous stored VolumeAttachment from the server.
-func Delete(client *gophercloud.ServiceClient, serverID, attachmentID string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, serverID, attachmentID string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, serverID, attachmentID), nil)
- return r
}
diff --git a/openstack/compute/v2/extensions/volumeattach/requests_test.go b/openstack/compute/v2/extensions/volumeattach/requests_test.go
index 9c220e7..3257f39 100644
--- a/openstack/compute/v2/extensions/volumeattach/requests_test.go
+++ b/openstack/compute/v2/extensions/volumeattach/requests_test.go
@@ -41,10 +41,10 @@
th.SetupHTTP()
defer th.TeardownHTTP()
fixtures.HandleListSuccessfully(t)
- serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
+ serverID := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
count := 0
- err := List(client.ServiceClient(), serverId).EachPage(func(page pagination.Page) (bool, error) {
+ err := List(client.ServiceClient(), serverID).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := ExtractVolumeAttachments(page)
th.AssertNoErr(t, err)
@@ -60,9 +60,9 @@
th.SetupHTTP()
defer th.TeardownHTTP()
fixtures.HandleCreateSuccessfully(t)
- serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
+ serverID := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
- actual, err := Create(client.ServiceClient(), serverId, CreateOpts{
+ actual, err := Create(client.ServiceClient(), serverID, CreateOpts{
Device: "/dev/vdc",
VolumeID: "a26887c6-c47b-4654-abb5-dfadf7d3f804",
}).Extract()
@@ -74,10 +74,10 @@
th.SetupHTTP()
defer th.TeardownHTTP()
fixtures.HandleGetSuccessfully(t)
- aId := "a26887c6-c47b-4654-abb5-dfadf7d3f804"
- serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
+ aID := "a26887c6-c47b-4654-abb5-dfadf7d3f804"
+ serverID := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
- actual, err := Get(client.ServiceClient(), serverId, aId).Extract()
+ actual, err := Get(client.ServiceClient(), serverID, aID).Extract()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, &SecondVolumeAttachment, actual)
}
@@ -86,9 +86,9 @@
th.SetupHTTP()
defer th.TeardownHTTP()
fixtures.HandleDeleteSuccessfully(t)
- aId := "a26887c6-c47b-4654-abb5-dfadf7d3f804"
- serverId := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
+ aID := "a26887c6-c47b-4654-abb5-dfadf7d3f804"
+ serverID := "4d8c3732-a248-40ed-bebc-539a6ffd25c0"
- err := Delete(client.ServiceClient(), serverId, aId).ExtractErr()
+ err := Delete(client.ServiceClient(), serverID, aID).ExtractErr()
th.AssertNoErr(t, err)
}
diff --git a/openstack/compute/v2/extensions/volumeattach/results.go b/openstack/compute/v2/extensions/volumeattach/results.go
index 2eef0cd..53faf5d 100644
--- a/openstack/compute/v2/extensions/volumeattach/results.go
+++ b/openstack/compute/v2/extensions/volumeattach/results.go
@@ -42,6 +42,7 @@
return s.VolumeAttachments, err
}
+// VolumeAttachmentResult is the result from a volume attachment operation.
type VolumeAttachmentResult struct {
gophercloud.Result
}
diff --git a/openstack/compute/v2/extensions/volumeattach/testing/doc.go b/openstack/compute/v2/extensions/volumeattach/testing/doc.go
index 251315a..29faced 100644
--- a/openstack/compute/v2/extensions/volumeattach/testing/doc.go
+++ b/openstack/compute/v2/extensions/volumeattach/testing/doc.go
@@ -1,5 +1,5 @@
/*
-This is package created is to hold fixtures (which imports testing),
+Package testing holds fixtures (which imports testing),
so that importing volumeattach package does not inadvertently import testing into production code
More information here:
https://github.com/gophercloud/gophercloud/issues/473
diff --git a/openstack/compute/v2/extensions/volumeattach/urls.go b/openstack/compute/v2/extensions/volumeattach/urls.go
index c60674a..083f8dc 100644
--- a/openstack/compute/v2/extensions/volumeattach/urls.go
+++ b/openstack/compute/v2/extensions/volumeattach/urls.go
@@ -4,22 +4,22 @@
const resourcePath = "os-volume_attachments"
-func resourceURL(c *gophercloud.ServiceClient, serverId string) string {
- return c.ServiceURL("servers", serverId, resourcePath)
+func resourceURL(c *gophercloud.ServiceClient, serverID string) string {
+ return c.ServiceURL("servers", serverID, resourcePath)
}
-func listURL(c *gophercloud.ServiceClient, serverId string) string {
- return resourceURL(c, serverId)
+func listURL(c *gophercloud.ServiceClient, serverID string) string {
+ return resourceURL(c, serverID)
}
-func createURL(c *gophercloud.ServiceClient, serverId string) string {
- return resourceURL(c, serverId)
+func createURL(c *gophercloud.ServiceClient, serverID string) string {
+ return resourceURL(c, serverID)
}
-func getURL(c *gophercloud.ServiceClient, serverId, aId string) string {
- return c.ServiceURL("servers", serverId, resourcePath, aId)
+func getURL(c *gophercloud.ServiceClient, serverID, aID string) string {
+ return c.ServiceURL("servers", serverID, resourcePath, aID)
}
-func deleteURL(c *gophercloud.ServiceClient, serverId, aId string) string {
- return getURL(c, serverId, aId)
+func deleteURL(c *gophercloud.ServiceClient, serverID, aID string) string {
+ return getURL(c, serverID, aID)
}
diff --git a/openstack/compute/v2/flavors/requests.go b/openstack/compute/v2/flavors/requests.go
index 4f3fc46..4b2d3d0 100644
--- a/openstack/compute/v2/flavors/requests.go
+++ b/openstack/compute/v2/flavors/requests.go
@@ -56,10 +56,8 @@
// Get instructs OpenStack to provide details on a single flavor, identified by its ID.
// Use ExtractFlavor to convert its result into a Flavor.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
// IDFromName is a convienience function that returns a flavor's ID given its name.
diff --git a/openstack/compute/v2/images/requests.go b/openstack/compute/v2/images/requests.go
index 00461f8..9b2b985 100644
--- a/openstack/compute/v2/images/requests.go
+++ b/openstack/compute/v2/images/requests.go
@@ -52,17 +52,13 @@
// Get acquires additional detail about a specific image by ID.
// Use ExtractImage() to interpret the result as an openstack Image.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
// Delete deletes the specified image ID.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
- return r
}
// IDFromName is a convienience function that returns an image's ID given its name.
diff --git a/openstack/compute/v2/servers/requests.go b/openstack/compute/v2/servers/requests.go
index 4257a4a..ba30a79 100644
--- a/openstack/compute/v2/servers/requests.go
+++ b/openstack/compute/v2/servers/requests.go
@@ -259,38 +259,30 @@
}
// Create requests a server to be provisioned to the user in the current tenant.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
reqBody, err := opts.ToServerCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(listURL(client), reqBody, &r.Body, nil)
- return r
}
// Delete requests that a server previously provisioned be removed from your account.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
- return r
}
// ForceDelete forces the deletion of a server
-func ForceDelete(client *gophercloud.ServiceClient, id string) ActionResult {
- var r ActionResult
+func ForceDelete(client *gophercloud.ServiceClient, id string) (r ActionResult) {
_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"forceDelete": ""}, nil, nil)
- return r
}
// Get requests details on a single server, by ID.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 203},
})
- return r
}
// UpdateOptsBuilder allows extensions to add additional attributes to the Update request.
@@ -318,29 +310,25 @@
}
// Update requests that various attributes of the indicated server be changed.
-func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToServerUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Put(updateURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// ChangeAdminPassword alters the administrator or root password for a specified server.
-func ChangeAdminPassword(client *gophercloud.ServiceClient, id, newPassword string) ActionResult {
- var r ActionResult
+func ChangeAdminPassword(client *gophercloud.ServiceClient, id, newPassword string) (r ActionResult) {
b := map[string]interface{}{
"changePassword": map[string]string{
"adminPass": newPassword,
},
}
_, r.Err = client.Post(actionURL(client, id), b, nil, nil)
- return r
}
// RebootMethod describes the mechanisms by which a server reboot can be requested.
@@ -382,15 +370,13 @@
//
// SoftReboot (aka OSReboot) simply tells the OS to rtart under its own procedur.
// E.g., in Linux, asking it to enter runlevel 6, or executing "sudo shutdown -r now", or by asking Windows to rtart the machine.
-func Reboot(client *gophercloud.ServiceClient, id string, opts RebootOptsBuilder) ActionResult {
- var r ActionResult
+func Reboot(client *gophercloud.ServiceClient, id string, opts RebootOptsBuilder) (r ActionResult) {
b, err := opts.ToServerRebootMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(actionURL(client, id), b, nil, nil)
- return r
}
// RebuildOptsBuilder is an interface that allows extensions to override the
@@ -453,15 +439,13 @@
// Rebuild will reprovision the server according to the configuration options
// provided in the RebuildOpts struct.
-func Rebuild(client *gophercloud.ServiceClient, id string, opts RebuildOptsBuilder) RebuildResult {
- var r RebuildResult
+func Rebuild(client *gophercloud.ServiceClient, id string, opts RebuildOptsBuilder) (r RebuildResult) {
b, err := opts.ToServerRebuildMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(actionURL(client, id), b, &r.Body, nil)
- return r
}
// ResizeOptsBuilder is an interface that allows extensions to override the default structure of
@@ -489,33 +473,27 @@
// While in this state, you can explore the use of the new server's configuration.
// If you like it, call ConfirmResize() to commit the rize permanently.
// Otherwise, call RevertResize() to rtore the old configuration.
-func Resize(client *gophercloud.ServiceClient, id string, opts ResizeOptsBuilder) ActionResult {
- var r ActionResult
+func Resize(client *gophercloud.ServiceClient, id string, opts ResizeOptsBuilder) (r ActionResult) {
b, err := opts.ToServerResizeMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(actionURL(client, id), b, nil, nil)
- return r
}
// ConfirmResize confirms a previous rize operation on a server.
// See Resize() for more details.
-func ConfirmResize(client *gophercloud.ServiceClient, id string) ActionResult {
- var r ActionResult
+func ConfirmResize(client *gophercloud.ServiceClient, id string) (r ActionResult) {
_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"confirmResize": nil}, nil, &gophercloud.RequestOpts{
OkCodes: []int{201, 202, 204},
})
- return r
}
// RevertResize cancels a previous rize operation on a server.
// See Resize() for more details.
-func RevertResize(client *gophercloud.ServiceClient, id string) ActionResult {
- var r ActionResult
+func RevertResize(client *gophercloud.ServiceClient, id string) (r ActionResult) {
_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"revertResize": nil}, nil, nil)
- return r
}
// RescueOptsBuilder is an interface that allows extensions to override the
@@ -539,17 +517,15 @@
}
// Rescue instructs the provider to place the server into RESCUE mode.
-func Rescue(client *gophercloud.ServiceClient, id string, opts RescueOptsBuilder) RescueResult {
- var r RescueResult
+func Rescue(client *gophercloud.ServiceClient, id string, opts RescueOptsBuilder) (r RescueResult) {
b, err := opts.ToServerRescueMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(actionURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// ResetMetadataOptsBuilder allows extensions to add additional parameters to the
@@ -575,24 +551,20 @@
// Note: Using this operation will erase any already-existing metadata and create
// the new metadata provided. To keep any already-existing metadata, use the
// UpdateMetadatas or UpdateMetadata function.
-func ResetMetadata(client *gophercloud.ServiceClient, id string, opts ResetMetadataOptsBuilder) ResetMetadataResult {
- var r ResetMetadataResult
+func ResetMetadata(client *gophercloud.ServiceClient, id string, opts ResetMetadataOptsBuilder) (r ResetMetadataResult) {
b, err := opts.ToMetadataResetMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Put(metadataURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Metadata requests all the metadata for the given server ID.
-func Metadata(client *gophercloud.ServiceClient, id string) GetMetadataResult {
- var r GetMetadataResult
+func Metadata(client *gophercloud.ServiceClient, id string) (r GetMetadataResult) {
_, r.Err = client.Get(metadataURL(client, id), &r.Body, nil)
- return r
}
// UpdateMetadataOptsBuilder allows extensions to add additional parameters to the
@@ -604,17 +576,15 @@
// UpdateMetadata updates (or creates) all the metadata specified by opts for the given server ID.
// This operation does not affect already-existing metadata that is not specified
// by opts.
-func UpdateMetadata(client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder) UpdateMetadataResult {
- var r UpdateMetadataResult
+func UpdateMetadata(client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder) (r UpdateMetadataResult) {
b, err := opts.ToMetadataUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(metadataURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// MetadatumOptsBuilder allows extensions to add additional parameters to the
@@ -643,31 +613,25 @@
}
// CreateMetadatum will create or update the key-value pair with the given key for the given server ID.
-func CreateMetadatum(client *gophercloud.ServiceClient, id string, opts MetadatumOptsBuilder) CreateMetadatumResult {
- var r CreateMetadatumResult
+func CreateMetadatum(client *gophercloud.ServiceClient, id string, opts MetadatumOptsBuilder) (r CreateMetadatumResult) {
b, key, err := opts.ToMetadatumCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Put(metadatumURL(client, id, key), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Metadatum requests the key-value pair with the given key for the given server ID.
-func Metadatum(client *gophercloud.ServiceClient, id, key string) GetMetadatumResult {
- var r GetMetadatumResult
+func Metadatum(client *gophercloud.ServiceClient, id, key string) (r GetMetadatumResult) {
_, r.Err = client.Get(metadatumURL(client, id, key), &r.Body, nil)
- return r
}
// DeleteMetadatum will delete the key-value pair with the given key for the given server ID.
-func DeleteMetadatum(client *gophercloud.ServiceClient, id, key string) DeleteMetadatumResult {
- var r DeleteMetadatumResult
+func DeleteMetadatum(client *gophercloud.ServiceClient, id, key string) (r DeleteMetadatumResult) {
_, r.Err = client.Delete(metadatumURL(client, id, key), nil)
- return r
}
// ListAddresses makes a request against the API to list the servers IP addresses.
@@ -705,19 +669,17 @@
}
// CreateImage makes a request against the nova API to schedule an image to be created of the server
-func CreateImage(client *gophercloud.ServiceClient, id string, opts CreateImageOptsBuilder) CreateImageResult {
- var r CreateImageResult
+func CreateImage(client *gophercloud.ServiceClient, id string, opts CreateImageOptsBuilder) (r CreateImageResult) {
b, err := opts.ToServerCreateImageMap()
if err != nil {
r.Err = err
- return r
+ return
}
resp, err := client.Post(actionURL(client, id), b, nil, &gophercloud.RequestOpts{
OkCodes: []int{202},
})
r.Err = err
r.Header = resp.Header
- return r
}
// IDFromName is a convienience function that returns a server's ID given its name.
diff --git a/openstack/db/v1/configurations/requests.go b/openstack/db/v1/configurations/requests.go
index eb59cc2..9e1bf05 100644
--- a/openstack/db/v1/configurations/requests.go
+++ b/openstack/db/v1/configurations/requests.go
@@ -29,17 +29,14 @@
// CreateOpts is the struct responsible for configuring new configurations.
type CreateOpts struct {
- // [REQUIRED] The configuration group name
+ // The configuration group name
Name string `json:"name" required:"true"`
-
- // [REQUIRED] A map of user-defined configuration settings that will define
+ // A map of user-defined configuration settings that will define
// how each associated datastore works. Each key/value pair is specific to a
// datastore type.
Values map[string]interface{} `json:"values" required:"true"`
-
// Associates the configuration group with a particular datastore.
Datastore *DatastoreOpts `json:"datastore,omitempty"`
-
// A human-readable explanation for the group.
Description string `json:"description,omitempty"`
}
@@ -50,22 +47,18 @@
}
// Create will create a new configuration group.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToConfigCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(baseURL(client), &b, &r.Body, &gophercloud.RequestOpts{OkCodes: []int{200}})
- return r
}
// Get will retrieve the details for a specified configuration group.
-func Get(client *gophercloud.ServiceClient, configID string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, configID string) (r GetResult) {
_, r.Err = client.Get(resourceURL(client, configID), &r.Body, nil)
- return r
}
// UpdateOptsBuilder is the top-level interface for casting update options into
@@ -96,38 +89,32 @@
// Update will modify an existing configuration group by performing a merge
// between new and existing values. If the key already exists, the new value
// will overwrite. All other keys will remain unaffected.
-func Update(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToConfigUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Patch(resourceURL(client, configID), &b, nil, nil)
- return r
}
// Replace will modify an existing configuration group by overwriting the
// entire parameter group with the new values provided. Any existing keys not
// included in UpdateOptsBuilder will be deleted.
-func Replace(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) ReplaceResult {
- var r ReplaceResult
+func Replace(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) (r ReplaceResult) {
b, err := opts.ToConfigUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Put(resourceURL(client, configID), &b, nil, nil)
- return r
}
// Delete will permanently delete a configuration group. Please note that
// config groups cannot be deleted whilst still attached to running instances -
// you must detach and then delete them.
-func Delete(client *gophercloud.ServiceClient, configID string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, configID string) (r DeleteResult) {
_, r.Err = client.Delete(resourceURL(client, configID), nil)
- return r
}
// ListInstances will list all the instances associated with a particular
@@ -154,10 +141,8 @@
// "innodb_file_per_table" configuration param for MySQL datastores. You will
// need the param's ID first, which can be attained by using the ListDatastoreParams
// operation.
-func GetDatastoreParam(client *gophercloud.ServiceClient, datastoreID, versionID, paramID string) ParamResult {
- var r ParamResult
+func GetDatastoreParam(client *gophercloud.ServiceClient, datastoreID, versionID, paramID string) (r ParamResult) {
_, r.Err = client.Get(getDSParamURL(client, datastoreID, versionID, paramID), &r.Body, nil)
- return r
}
// ListGlobalParams is similar to ListDatastoreParams but does not require a
@@ -170,8 +155,6 @@
// GetGlobalParam is similar to GetDatastoreParam but does not require a
// DatastoreID.
-func GetGlobalParam(client *gophercloud.ServiceClient, versionID, paramID string) ParamResult {
- var r ParamResult
+func GetGlobalParam(client *gophercloud.ServiceClient, versionID, paramID string) (r ParamResult) {
_, r.Err = client.Get(getGlobalParamURL(client, versionID, paramID), &r.Body, nil)
- return r
}
diff --git a/openstack/db/v1/databases/requests.go b/openstack/db/v1/databases/requests.go
index 7338112..f441d12 100644
--- a/openstack/db/v1/databases/requests.go
+++ b/openstack/db/v1/databases/requests.go
@@ -62,15 +62,13 @@
// Create will create a new database within the specified instance. If the
// specified instance does not exist, a 404 error will be returned.
-func Create(client *gophercloud.ServiceClient, instanceID string, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, instanceID string, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToDBCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(baseURL(client, instanceID), &b, nil, nil)
- return r
}
// List will list all of the databases for a specified instance. Note: this
@@ -84,8 +82,6 @@
// Delete will permanently delete the database within a specified instance.
// All contained data inside the database will also be permanently deleted.
-func Delete(client *gophercloud.ServiceClient, instanceID, dbName string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, instanceID, dbName string) (r DeleteResult) {
_, r.Err = client.Delete(dbURL(client, instanceID, dbName), nil)
- return r
}
diff --git a/openstack/db/v1/datastores/requests.go b/openstack/db/v1/datastores/requests.go
index d820915..aff397b 100644
--- a/openstack/db/v1/datastores/requests.go
+++ b/openstack/db/v1/datastores/requests.go
@@ -13,10 +13,8 @@
}
// Get will retrieve the details of a specified datastore type.
-func Get(client *gophercloud.ServiceClient, datastoreID string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, datastoreID string) (r GetResult) {
_, r.Err = client.Get(resourceURL(client, datastoreID), &r.Body, nil)
- return r
}
// ListVersions will list all of the available versions for a specified
@@ -28,8 +26,6 @@
}
// GetVersion will retrieve the details of a specified datastore version.
-func GetVersion(client *gophercloud.ServiceClient, datastoreID, versionID string) GetVersionResult {
- var r GetVersionResult
+func GetVersion(client *gophercloud.ServiceClient, datastoreID, versionID string) (r GetVersionResult) {
_, r.Err = client.Get(versionURL(client, datastoreID, versionID), &r.Body, nil)
- return r
}
diff --git a/openstack/db/v1/flavors/requests.go b/openstack/db/v1/flavors/requests.go
index 8b7797f..a7cfeb5 100644
--- a/openstack/db/v1/flavors/requests.go
+++ b/openstack/db/v1/flavors/requests.go
@@ -15,8 +15,6 @@
}
// Get will retrieve information for a specified hardware flavor.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
- return r
}
diff --git a/openstack/db/v1/instances/requests.go b/openstack/db/v1/instances/requests.go
index b8cae03..5e43078 100644
--- a/openstack/db/v1/instances/requests.go
+++ b/openstack/db/v1/instances/requests.go
@@ -98,15 +98,13 @@
// Although this call only allows the creation of 1 instance per request, you
// can create an instance with multiple databases and users. The default
// binding for a MySQL instance is port 3306.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToInstanceCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(baseURL(client), &b, &r.Body, &gophercloud.RequestOpts{OkCodes: []int{200}})
- return r
}
// List retrieves the status and information for all database instances.
@@ -117,61 +115,47 @@
}
// Get retrieves the status and information for a specified database instance.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(resourceURL(client, id), &r.Body, nil)
- return r
}
// Delete permanently destroys the database instance.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(resourceURL(client, id), nil)
- return r
}
// EnableRootUser enables the login from any host for the root user and
// provides the user with a generated root password.
-func EnableRootUser(client *gophercloud.ServiceClient, id string) EnableRootUserResult {
- var r EnableRootUserResult
+func EnableRootUser(client *gophercloud.ServiceClient, id string) (r EnableRootUserResult) {
_, r.Err = client.Post(userRootURL(client, id), nil, &r.Body, &gophercloud.RequestOpts{OkCodes: []int{200}})
- return r
}
// IsRootEnabled checks an instance to see if root access is enabled. It returns
// True if root user is enabled for the specified database instance or False
// otherwise.
-func IsRootEnabled(client *gophercloud.ServiceClient, id string) IsRootEnabledResult {
- var r IsRootEnabledResult
+func IsRootEnabled(client *gophercloud.ServiceClient, id string) (r IsRootEnabledResult) {
_, r.Err = client.Get(userRootURL(client, id), &r.Body, nil)
- return r
}
// Restart will restart only the MySQL Instance. Restarting MySQL will
// erase any dynamic configuration settings that you have made within MySQL.
// The MySQL service will be unavailable until the instance restarts.
-func Restart(client *gophercloud.ServiceClient, id string) ActionResult {
- var r ActionResult
+func Restart(client *gophercloud.ServiceClient, id string) (r ActionResult) {
b := map[string]interface{}{"restart": struct{}{}}
_, r.Err = client.Post(actionURL(client, id), &b, nil, nil)
- return r
}
// Resize changes the memory size of the instance, assuming a valid
// flavorRef is provided. It will also restart the MySQL service.
-func Resize(client *gophercloud.ServiceClient, id, flavorRef string) ActionResult {
- var r ActionResult
+func Resize(client *gophercloud.ServiceClient, id, flavorRef string) (r ActionResult) {
b := map[string]interface{}{"resize": map[string]string{"flavorRef": flavorRef}}
_, r.Err = client.Post(actionURL(client, id), &b, nil, nil)
- return r
}
// ResizeVolume will resize the attached volume for an instance. It supports
// only increasing the volume size and does not support decreasing the size.
// The volume size is in gigabytes (GB) and must be an integer.
-func ResizeVolume(client *gophercloud.ServiceClient, id string, size int) ActionResult {
- var r ActionResult
+func ResizeVolume(client *gophercloud.ServiceClient, id string, size int) (r ActionResult) {
b := map[string]interface{}{"resize": map[string]interface{}{"volume": map[string]int{"size": size}}}
_, r.Err = client.Post(actionURL(client, id), &b, nil, nil)
- return r
}
diff --git a/openstack/db/v1/users/requests.go b/openstack/db/v1/users/requests.go
index 910a615..c0bfa42 100644
--- a/openstack/db/v1/users/requests.go
+++ b/openstack/db/v1/users/requests.go
@@ -65,15 +65,13 @@
// instance based on the configuration defined in CreateOpts. If databases are
// assigned for a particular user, the user will be granted all privileges
// for those specified databases. "root" is a reserved name and cannot be used.
-func Create(client *gophercloud.ServiceClient, instanceID string, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, instanceID string, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToUserCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(baseURL(client, instanceID), &b, nil, nil)
- return r
}
// List will list all the users associated with a specified database instance,
@@ -86,8 +84,6 @@
}
// Delete will permanently delete a user from a specified database instance.
-func Delete(client *gophercloud.ServiceClient, instanceID, userName string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, instanceID, userName string) (r DeleteResult) {
_, r.Err = client.Delete(userURL(client, instanceID, userName), nil)
- return r
}
diff --git a/openstack/identity/v2/extensions/admin/roles/requests.go b/openstack/identity/v2/extensions/admin/roles/requests.go
index d80c53f..ba19fd4 100644
--- a/openstack/identity/v2/extensions/admin/roles/requests.go
+++ b/openstack/identity/v2/extensions/admin/roles/requests.go
@@ -16,17 +16,13 @@
// AddUser is the operation responsible for assigning a particular role to
// a user. This is confined to the scope of the user's tenant - so the tenant
// ID is a required argument.
-func AddUser(client *gophercloud.ServiceClient, tenantID, userID, roleID string) UserRoleResult {
- var r UserRoleResult
+func AddUser(client *gophercloud.ServiceClient, tenantID, userID, roleID string) (r UserRoleResult) {
_, r.Err = client.Put(userRoleURL(client, tenantID, userID, roleID), nil, nil, nil)
- return r
}
// DeleteUser is the operation responsible for deleting a particular role
// from a user. This is confined to the scope of the user's tenant - so the
// tenant ID is a required argument.
-func DeleteUser(client *gophercloud.ServiceClient, tenantID, userID, roleID string) UserRoleResult {
- var r UserRoleResult
+func DeleteUser(client *gophercloud.ServiceClient, tenantID, userID, roleID string) (r UserRoleResult) {
_, r.Err = client.Delete(userRoleURL(client, tenantID, userID, roleID), nil)
- return r
}
diff --git a/openstack/identity/v2/users/requests.go b/openstack/identity/v2/users/requests.go
index f62f979..90f7c72 100644
--- a/openstack/identity/v2/users/requests.go
+++ b/openstack/identity/v2/users/requests.go
@@ -48,27 +48,20 @@
}
// Create is the operation responsible for creating new users.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var res CreateResult
-
- reqBody, err := opts.ToUserCreateMap()
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
+ b, err := opts.ToUserCreateMap()
if err != nil {
- res.Err = err
- return res
+ r.Err = err
+ return
}
-
- _, res.Err = client.Post(rootURL(client), reqBody, &res.Body, &gophercloud.RequestOpts{
+ _, r.Err = client.Post(rootURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201},
})
-
- return res
}
// Get requests details on a single user, either by ID.
-func Get(client *gophercloud.ServiceClient, id string) GetResult {
- var result GetResult
- _, result.Err = client.Get(ResourceURL(client, id), &result.Body, nil)
- return result
+func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
+ _, r.Err = client.Get(ResourceURL(client, id), &r.Body, nil)
}
// UpdateOptsBuilder allows extensions to add additional attributes to the Update request.
@@ -85,24 +78,20 @@
}
// Update is the operation responsible for updating exist users by their UUID.
-func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToUserUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Put(ResourceURL(client, id), &b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Delete is the operation responsible for permanently deleting an API user.
-func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(ResourceURL(client, id), nil)
- return r
}
// ListRoles lists the existing roles that can be assigned to users.
diff --git a/openstack/identity/v3/endpoints/requests.go b/openstack/identity/v3/endpoints/requests.go
index 7165fb4..30ceacf 100644
--- a/openstack/identity/v3/endpoints/requests.go
+++ b/openstack/identity/v3/endpoints/requests.go
@@ -24,15 +24,13 @@
// Create inserts a new Endpoint into the service catalog.
// Within EndpointOpts, Region may be omitted by being left as "", but all other fields are required.
-func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToEndpointCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Post(listURL(client), &b, &r.Body, nil)
- return r
}
type ListOptsBuilder interface {
@@ -86,20 +84,16 @@
}
// Update changes an existing endpoint with new data.
-func Update(client *gophercloud.ServiceClient, endpointID string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(client *gophercloud.ServiceClient, endpointID string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToEndpointUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = client.Patch(endpointURL(client, endpointID), &b, &r.Body, nil)
- return r
}
// Delete removes an endpoint from the service catalog.
-func Delete(client *gophercloud.ServiceClient, endpointID string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, endpointID string) (r DeleteResult) {
_, r.Err = client.Delete(endpointURL(client, endpointID), nil)
- return r
}
diff --git a/openstack/identity/v3/services/requests.go b/openstack/identity/v3/services/requests.go
index 34bf979..81c8960 100644
--- a/openstack/identity/v3/services/requests.go
+++ b/openstack/identity/v3/services/requests.go
@@ -6,11 +6,9 @@
)
// Create adds a new service of the requested type to the catalog.
-func Create(client *gophercloud.ServiceClient, serviceType string) CreateResult {
- var r CreateResult
+func Create(client *gophercloud.ServiceClient, serviceType string) (r CreateResult) {
b := map[string]string{"type": serviceType}
_, r.Err = client.Post(listURL(client), b, &r.Body, nil)
- return r
}
type ListOptsBuilder interface {
@@ -45,24 +43,18 @@
}
// Get returns additional information about a service, given its ID.
-func Get(client *gophercloud.ServiceClient, serviceID string) GetResult {
- var r GetResult
+func Get(client *gophercloud.ServiceClient, serviceID string) (r GetResult) {
_, r.Err = client.Get(serviceURL(client, serviceID), &r.Body, nil)
- return r
}
// Update changes the service type of an existing service.
-func Update(client *gophercloud.ServiceClient, serviceID string, serviceType string) UpdateResult {
- var r UpdateResult
+func Update(client *gophercloud.ServiceClient, serviceID string, serviceType string) (r UpdateResult) {
b := map[string]string{"type": serviceType}
_, r.Err = client.Patch(serviceURL(client, serviceID), &b, &r.Body, nil)
- return r
}
// Delete removes an existing service.
// It either deletes all associated endpoints, or fails until all endpoints are deleted.
-func Delete(client *gophercloud.ServiceClient, serviceID string) DeleteResult {
- var r DeleteResult
+func Delete(client *gophercloud.ServiceClient, serviceID string) (r DeleteResult) {
_, r.Err = client.Delete(serviceURL(client, serviceID), nil)
- return r
}
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.
diff --git a/openstack/objectstorage/v1/accounts/requests.go b/openstack/objectstorage/v1/accounts/requests.go
index 41479a2..57616c0 100644
--- a/openstack/objectstorage/v1/accounts/requests.go
+++ b/openstack/objectstorage/v1/accounts/requests.go
@@ -23,14 +23,13 @@
// custom metadata, call the ExtractMetadata method on the GetResult. To extract
// all the headers that are returned (including the metadata), call the
// ExtractHeader method on the GetResult.
-func Get(c *gophercloud.ServiceClient, opts GetOptsBuilder) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, opts GetOptsBuilder) (r GetResult) {
h := make(map[string]string)
if opts != nil {
headers, err := opts.ToAccountGetMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -44,7 +43,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// UpdateOptsBuilder allows extensions to add additional headers to the Update
@@ -77,14 +75,13 @@
// Update is a function that creates, updates, or deletes an account's metadata.
// To extract the headers returned, call the Extract method on the UpdateResult.
-func Update(c *gophercloud.ServiceClient, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, opts UpdateOptsBuilder) (r UpdateResult) {
h := make(map[string]string)
if opts != nil {
headers, err := opts.ToAccountUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -98,5 +95,4 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
diff --git a/openstack/objectstorage/v1/containers/requests.go b/openstack/objectstorage/v1/containers/requests.go
index f575ea7..ba11916 100644
--- a/openstack/objectstorage/v1/containers/requests.go
+++ b/openstack/objectstorage/v1/containers/requests.go
@@ -89,14 +89,13 @@
}
// Create is a function that creates a new container.
-func Create(c *gophercloud.ServiceClient, containerName string, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, containerName string, opts CreateOptsBuilder) (r CreateResult) {
h := make(map[string]string)
if opts != nil {
headers, err := opts.ToContainerCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -110,14 +109,11 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// Delete is a function that deletes a container.
-func Delete(c *gophercloud.ServiceClient, containerName string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, containerName string) (r DeleteResult) {
_, r.Err = c.Delete(deleteURL(c, containerName), nil)
- return r
}
// UpdateOptsBuilder allows extensions to add additional parameters to the
@@ -154,14 +150,13 @@
// Update is a function that creates, updates, or deletes a container's
// metadata.
-func Update(c *gophercloud.ServiceClient, containerName string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, containerName string, opts UpdateOptsBuilder) (r UpdateResult) {
h := make(map[string]string)
if opts != nil {
headers, err := opts.ToContainerUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
@@ -176,14 +171,12 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// Get is a function that retrieves the metadata of a container. To extract just
// the custom metadata, pass the GetResult response to the ExtractMetadata
// function.
-func Get(c *gophercloud.ServiceClient, containerName string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, containerName string) (r GetResult) {
resp, err := c.Request("HEAD", getURL(c, containerName), &gophercloud.RequestOpts{
OkCodes: []int{200, 204},
})
@@ -191,5 +184,4 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index 2505bdb..5f8e7c1 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -107,15 +107,14 @@
// Download is a function that retrieves the content and metadata for an object.
// To extract just the content, pass the DownloadResult response to the
// ExtractContent function.
-func Download(c *gophercloud.ServiceClient, containerName, objectName string, opts DownloadOptsBuilder) DownloadResult {
- var r DownloadResult
+func Download(c *gophercloud.ServiceClient, containerName, objectName string, opts DownloadOptsBuilder) (r DownloadResult) {
url := downloadURL(c, containerName, objectName)
h := make(map[string]string)
if opts != nil {
headers, query, err := opts.ToObjectDownloadParams()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -132,7 +131,6 @@
r.Body = resp.Body
}
r.Err = err
- return r
}
// CreateOptsBuilder allows extensions to add additional parameters to the
@@ -192,8 +190,7 @@
// Create is a function that creates a new object or replaces an existing object. If the returned response's ETag
// header fails to match the local checksum, the failed request will automatically be retried up to a maximum of 3 times.
-func Create(c *gophercloud.ServiceClient, containerName, objectName string, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, containerName, objectName string, opts CreateOptsBuilder) (r CreateResult) {
url := createURL(c, containerName, objectName)
h := make(map[string]string)
var b io.Reader
@@ -201,7 +198,7 @@
tmpB, headers, query, err := opts.ToObjectCreateParams()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -218,7 +215,6 @@
if resp != nil {
r.Header = resp.Header
}
- return r
}
// CopyOptsBuilder allows extensions to add additional parameters to the
@@ -250,13 +246,12 @@
}
// Copy is a function that copies one object to another.
-func Copy(c *gophercloud.ServiceClient, containerName, objectName string, opts CopyOptsBuilder) CopyResult {
- var r CopyResult
+func Copy(c *gophercloud.ServiceClient, containerName, objectName string, opts CopyOptsBuilder) (r CopyResult) {
h := make(map[string]string)
headers, err := opts.ToObjectCopyMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
@@ -272,7 +267,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// DeleteOptsBuilder allows extensions to add additional parameters to the
@@ -293,14 +287,13 @@
}
// Delete is a function that deletes an object.
-func Delete(c *gophercloud.ServiceClient, containerName, objectName string, opts DeleteOptsBuilder) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, containerName, objectName string, opts DeleteOptsBuilder) (r DeleteResult) {
url := deleteURL(c, containerName, objectName)
if opts != nil {
query, err := opts.ToObjectDeleteQuery()
if err != nil {
r.Err = err
- return r
+ return
}
url += query
}
@@ -309,7 +302,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// GetOptsBuilder allows extensions to add additional parameters to the
@@ -332,14 +324,13 @@
// Get is a function that retrieves the metadata of an object. To extract just the custom
// metadata, pass the GetResult response to the ExtractMetadata function.
-func Get(c *gophercloud.ServiceClient, containerName, objectName string, opts GetOptsBuilder) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, containerName, objectName string, opts GetOptsBuilder) (r GetResult) {
url := getURL(c, containerName, objectName)
if opts != nil {
query, err := opts.ToObjectGetQuery()
if err != nil {
r.Err = err
- return r
+ return
}
url += query
}
@@ -350,7 +341,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// UpdateOptsBuilder allows extensions to add additional parameters to the
@@ -384,14 +374,13 @@
}
// Update is a function that creates, updates, or deletes an object's metadata.
-func Update(c *gophercloud.ServiceClient, containerName, objectName string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, containerName, objectName string, opts UpdateOptsBuilder) (r UpdateResult) {
h := c.AuthenticatedHeaders()
if opts != nil {
headers, err := opts.ToObjectUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
@@ -406,7 +395,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// HTTPMethod represents an HTTP method string (e.g. "GET").
diff --git a/openstack/orchestration/v1/buildinfo/requests.go b/openstack/orchestration/v1/buildinfo/requests.go
index ad12a73..f0e3ec4 100644
--- a/openstack/orchestration/v1/buildinfo/requests.go
+++ b/openstack/orchestration/v1/buildinfo/requests.go
@@ -3,8 +3,6 @@
import "github.com/gophercloud/gophercloud"
// Get retreives data for the given stack template.
-func Get(c *gophercloud.ServiceClient) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient) (r GetResult) {
_, r.Err = c.Get(getURL(c), &r.Body, nil)
- return r
}
diff --git a/openstack/orchestration/v1/stackevents/requests.go b/openstack/orchestration/v1/stackevents/requests.go
index 794d4c8..c3ae4b1 100644
--- a/openstack/orchestration/v1/stackevents/requests.go
+++ b/openstack/orchestration/v1/stackevents/requests.go
@@ -6,10 +6,8 @@
)
// Find retrieves stack events for the given stack name.
-func Find(c *gophercloud.ServiceClient, stackName string) FindResult {
- var r FindResult
+func Find(c *gophercloud.ServiceClient, stackName string) (r FindResult) {
_, r.Err = c.Get(findURL(c, stackName), &r.Body, nil)
- return r
}
// SortDir is a type for specifying in which direction to sort a list of events.
@@ -177,10 +175,6 @@
}
// Get retreives data for the given stack resource.
-func Get(c *gophercloud.ServiceClient, stackName, stackID, resourceName, eventID string) GetResult {
- var r GetResult
- _, r.Err = c.Get(getURL(c, stackName, stackID, resourceName, eventID), &r.Body, &gophercloud.RequestOpts{
- OkCodes: []int{200},
- })
- return r
+func Get(c *gophercloud.ServiceClient, stackName, stackID, resourceName, eventID string) (r GetResult) {
+ _, r.Err = c.Get(getURL(c, stackName, stackID, resourceName, eventID), &r.Body, nil)
}
diff --git a/openstack/orchestration/v1/stackresources/requests.go b/openstack/orchestration/v1/stackresources/requests.go
index 608ce90..cc4b990 100644
--- a/openstack/orchestration/v1/stackresources/requests.go
+++ b/openstack/orchestration/v1/stackresources/requests.go
@@ -6,10 +6,8 @@
)
// Find retrieves stack resources for the given stack name.
-func Find(c *gophercloud.ServiceClient, stackName string) FindResult {
- var r FindResult
+func Find(c *gophercloud.ServiceClient, stackName string) (r FindResult) {
_, r.Err = c.Get(findURL(c, stackName), &r.Body, nil)
- return r
}
// ListOptsBuilder allows extensions to add additional parameters to the
@@ -47,17 +45,13 @@
}
// Get retreives data for the given stack resource.
-func Get(c *gophercloud.ServiceClient, stackName, stackID, resourceName string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, stackName, stackID, resourceName string) (r GetResult) {
_, r.Err = c.Get(getURL(c, stackName, stackID, resourceName), &r.Body, nil)
- return r
}
// Metadata retreives the metadata for the given stack resource.
-func Metadata(c *gophercloud.ServiceClient, stackName, stackID, resourceName string) MetadataResult {
- var r MetadataResult
+func Metadata(c *gophercloud.ServiceClient, stackName, stackID, resourceName string) (r MetadataResult) {
_, r.Err = c.Get(metadataURL(c, stackName, stackID, resourceName), &r.Body, nil)
- return r
}
// ListTypes makes a request against the API to list resource types.
@@ -68,15 +62,11 @@
}
// Schema retreives the schema for the given resource type.
-func Schema(c *gophercloud.ServiceClient, resourceType string) SchemaResult {
- var r SchemaResult
+func Schema(c *gophercloud.ServiceClient, resourceType string) (r SchemaResult) {
_, r.Err = c.Get(schemaURL(c, resourceType), &r.Body, nil)
- return r
}
// Template retreives the template representation for the given resource type.
-func Template(c *gophercloud.ServiceClient, resourceType string) TemplateResult {
- var r TemplateResult
+func Template(c *gophercloud.ServiceClient, resourceType string) (r TemplateResult) {
_, r.Err = c.Get(templateURL(c, resourceType), &r.Body, nil)
- return r
}
diff --git a/openstack/orchestration/v1/stacks/requests.go b/openstack/orchestration/v1/stacks/requests.go
index 04c5150..46d0f46 100644
--- a/openstack/orchestration/v1/stacks/requests.go
+++ b/openstack/orchestration/v1/stacks/requests.go
@@ -86,15 +86,13 @@
// Create accepts a CreateOpts struct and creates a new stack using the values
// provided.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToStackCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(createURL(c), b, &r.Body, nil)
- return r
}
// AdoptOptsBuilder is the interface options structs have to satisfy in order
@@ -176,15 +174,13 @@
// Adopt accepts an AdoptOpts struct and creates a new stack using the resources
// from another stack.
-func Adopt(c *gophercloud.ServiceClient, opts AdoptOptsBuilder) AdoptResult {
- var r AdoptResult
+func Adopt(c *gophercloud.ServiceClient, opts AdoptOptsBuilder) (r AdoptResult) {
b, err := opts.ToStackAdoptMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(adoptURL(c), b, &r.Body, nil)
- return r
}
// SortDir is a type for specifying in which direction to sort a list of stacks.
@@ -333,22 +329,18 @@
// Update accepts an UpdateOpts struct and updates an existing stack using the values
// provided.
-func Update(c *gophercloud.ServiceClient, stackName, stackID string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, stackName, stackID string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToStackUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Put(updateURL(c, stackName, stackID), b, nil, nil)
- return r
}
// Delete deletes a stack based on the stack name and stack ID.
-func Delete(c *gophercloud.ServiceClient, stackName, stackID string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, stackName, stackID string) (r DeleteResult) {
_, r.Err = c.Delete(deleteURL(c, stackName, stackID), nil)
- return r
}
// PreviewOptsBuilder is the interface options structs have to satisfy in order
@@ -422,26 +414,22 @@
// Preview accepts a PreviewOptsBuilder interface and creates a preview of a stack using the values
// provided.
-func Preview(c *gophercloud.ServiceClient, opts PreviewOptsBuilder) PreviewResult {
- var r PreviewResult
+func Preview(c *gophercloud.ServiceClient, opts PreviewOptsBuilder) (r PreviewResult) {
b, err := opts.ToStackPreviewMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(previewURL(c), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}
// Abandon deletes the stack with the provided stackName and stackID, but leaves its
// resources intact, and returns data describing the stack and its resources.
-func Abandon(c *gophercloud.ServiceClient, stackName, stackID string) AbandonResult {
- var r AbandonResult
+func Abandon(c *gophercloud.ServiceClient, stackName, stackID string) (r AbandonResult) {
_, r.Err = c.Delete(abandonURL(c, stackName, stackID), &gophercloud.RequestOpts{
JSONResponse: &r.Body,
OkCodes: []int{200},
})
- return r
}
diff --git a/openstack/orchestration/v1/stacktemplates/requests.go b/openstack/orchestration/v1/stacktemplates/requests.go
index 9337cae..57f990f 100644
--- a/openstack/orchestration/v1/stacktemplates/requests.go
+++ b/openstack/orchestration/v1/stacktemplates/requests.go
@@ -3,10 +3,8 @@
import "github.com/gophercloud/gophercloud"
// Get retreives data for the given stack template.
-func Get(c *gophercloud.ServiceClient, stackName, stackID string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, stackName, stackID string) (r GetResult) {
_, r.Err = c.Get(getURL(c, stackName, stackID), &r.Body, nil)
- return r
}
// ValidateOptsBuilder describes struct types that can be accepted by the Validate call.
@@ -27,15 +25,13 @@
}
// Validate validates the given stack template.
-func Validate(c *gophercloud.ServiceClient, opts ValidateOptsBuilder) ValidateResult {
- var r ValidateResult
+func Validate(c *gophercloud.ServiceClient, opts ValidateOptsBuilder) (r ValidateResult) {
b, err := opts.ToStackTemplateValidateMap()
if err != nil {
r.Err = err
- return r
+ return
}
_, r.Err = c.Post(validateURL(c), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
})
- return r
}