Jamie Hannaford | fac40db | 2015-02-09 17:27:08 +0100 | [diff] [blame] | 1 | package instances |
| 2 | |
| 3 | import ( |
Jamie Hannaford | fac40db | 2015-02-09 17:27:08 +0100 | [diff] [blame] | 4 | "github.com/rackspace/gophercloud" |
Jamie Hannaford | 9fdda58 | 2015-02-10 12:15:43 +0100 | [diff] [blame] | 5 | os "github.com/rackspace/gophercloud/openstack/db/v1/instances" |
Jamie Hannaford | fac40db | 2015-02-09 17:27:08 +0100 | [diff] [blame] | 6 | ) |
| 7 | |
Jamie Hannaford | 27957b2 | 2015-02-12 12:50:55 +0100 | [diff] [blame] | 8 | // Get retrieves the status and information for a specified database instance. |
Jamie Hannaford | 39d4ffb | 2015-02-10 13:19:44 +0100 | [diff] [blame] | 9 | func Get(client *gophercloud.ServiceClient, id string) GetResult { |
| 10 | return GetResult{os.Get(client, id)} |
| 11 | } |
Jamie Hannaford | 1232e04 | 2015-02-10 13:36:32 +0100 | [diff] [blame] | 12 | |
Jamie Hannaford | 27957b2 | 2015-02-12 12:50:55 +0100 | [diff] [blame] | 13 | // Delete permanently destroys the database instance. |
Jamie Hannaford | 1232e04 | 2015-02-10 13:36:32 +0100 | [diff] [blame] | 14 | func Delete(client *gophercloud.ServiceClient, id string) os.DeleteResult { |
| 15 | return os.Delete(client, id) |
| 16 | } |
Jamie Hannaford | ebcac55 | 2015-02-10 13:58:56 +0100 | [diff] [blame] | 17 | |
Jamie Hannaford | 27957b2 | 2015-02-12 12:50:55 +0100 | [diff] [blame] | 18 | // EnableRootUser enables the login from any host for the root user and |
| 19 | // provides the user with a generated root password. |
Jamie Hannaford | ebcac55 | 2015-02-10 13:58:56 +0100 | [diff] [blame] | 20 | func EnableRootUser(client *gophercloud.ServiceClient, id string) os.UserRootResult { |
| 21 | return os.EnableRootUser(client, id) |
| 22 | } |
Jamie Hannaford | e6390d4 | 2015-02-10 15:59:28 +0100 | [diff] [blame] | 23 | |
Jamie Hannaford | 27957b2 | 2015-02-12 12:50:55 +0100 | [diff] [blame] | 24 | // IsRootEnabled checks an instance to see if root access is enabled. It returns |
| 25 | // True if root user is enabled for the specified database instance or False |
| 26 | // otherwise. |
Jamie Hannaford | e6390d4 | 2015-02-10 15:59:28 +0100 | [diff] [blame] | 27 | func IsRootEnabled(client *gophercloud.ServiceClient, id string) (bool, error) { |
| 28 | return os.IsRootEnabled(client, id) |
| 29 | } |
| 30 | |
Jamie Hannaford | 75e8cc4 | 2015-11-16 14:09:25 +0100 | [diff] [blame] | 31 | // Restart will restart only the MySQL Instance. Restarting MySQL will |
Jamie Hannaford | 27957b2 | 2015-02-12 12:50:55 +0100 | [diff] [blame] | 32 | // erase any dynamic configuration settings that you have made within MySQL. |
| 33 | // The MySQL service will be unavailable until the instance restarts. |
Jamie Hannaford | 75e8cc4 | 2015-11-16 14:09:25 +0100 | [diff] [blame] | 34 | func Restart(client *gophercloud.ServiceClient, id string) os.ActionResult { |
| 35 | return os.Restart(client, id) |
Jamie Hannaford | e6390d4 | 2015-02-10 15:59:28 +0100 | [diff] [blame] | 36 | } |
| 37 | |
Jamie Hannaford | 75e8cc4 | 2015-11-16 14:09:25 +0100 | [diff] [blame] | 38 | // Resize changes the memory size of the instance, assuming a valid |
Jamie Hannaford | 27957b2 | 2015-02-12 12:50:55 +0100 | [diff] [blame] | 39 | // flavorRef is provided. It will also restart the MySQL service. |
Jamie Hannaford | 75e8cc4 | 2015-11-16 14:09:25 +0100 | [diff] [blame] | 40 | func Resize(client *gophercloud.ServiceClient, id, flavorRef string) os.ActionResult { |
| 41 | return os.Resize(client, id, flavorRef) |
Jamie Hannaford | e6390d4 | 2015-02-10 15:59:28 +0100 | [diff] [blame] | 42 | } |
| 43 | |
Jamie Hannaford | 27957b2 | 2015-02-12 12:50:55 +0100 | [diff] [blame] | 44 | // ResizeVolume will resize the attached volume for an instance. It supports |
| 45 | // only increasing the volume size and does not support decreasing the size. |
| 46 | // The volume size is in gigabytes (GB) and must be an integer. |
Jamie Hannaford | e6390d4 | 2015-02-10 15:59:28 +0100 | [diff] [blame] | 47 | func ResizeVolume(client *gophercloud.ServiceClient, id string, size int) os.ActionResult { |
| 48 | return os.ResizeVolume(client, id, size) |
| 49 | } |