named return vars
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
}