blob: f2656fe3b76dd8e34675933700e803907cce69ab [file] [log] [blame]
Jamie Hannafordfac40db2015-02-09 17:27:08 +01001package instances
2
3import (
Jamie Hannafordfac40db2015-02-09 17:27:08 +01004 "github.com/rackspace/gophercloud"
Jamie Hannaford9fdda582015-02-10 12:15:43 +01005 os "github.com/rackspace/gophercloud/openstack/db/v1/instances"
Jamie Hannafordfac40db2015-02-09 17:27:08 +01006)
7
Jamie Hannaford27957b22015-02-12 12:50:55 +01008// Get retrieves the status and information for a specified database instance.
Jamie Hannaford39d4ffb2015-02-10 13:19:44 +01009func Get(client *gophercloud.ServiceClient, id string) GetResult {
10 return GetResult{os.Get(client, id)}
11}
Jamie Hannaford1232e042015-02-10 13:36:32 +010012
Jamie Hannaford27957b22015-02-12 12:50:55 +010013// Delete permanently destroys the database instance.
Jamie Hannaford1232e042015-02-10 13:36:32 +010014func Delete(client *gophercloud.ServiceClient, id string) os.DeleteResult {
15 return os.Delete(client, id)
16}
Jamie Hannafordebcac552015-02-10 13:58:56 +010017
Jamie Hannaford27957b22015-02-12 12:50:55 +010018// EnableRootUser enables the login from any host for the root user and
19// provides the user with a generated root password.
Jamie Hannafordebcac552015-02-10 13:58:56 +010020func EnableRootUser(client *gophercloud.ServiceClient, id string) os.UserRootResult {
21 return os.EnableRootUser(client, id)
22}
Jamie Hannaforde6390d42015-02-10 15:59:28 +010023
Jamie Hannaford27957b22015-02-12 12:50:55 +010024// 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 Hannaforde6390d42015-02-10 15:59:28 +010027func IsRootEnabled(client *gophercloud.ServiceClient, id string) (bool, error) {
28 return os.IsRootEnabled(client, id)
29}
30
Jamie Hannaford75e8cc42015-11-16 14:09:25 +010031// Restart will restart only the MySQL Instance. Restarting MySQL will
Jamie Hannaford27957b22015-02-12 12:50:55 +010032// erase any dynamic configuration settings that you have made within MySQL.
33// The MySQL service will be unavailable until the instance restarts.
Jamie Hannaford75e8cc42015-11-16 14:09:25 +010034func Restart(client *gophercloud.ServiceClient, id string) os.ActionResult {
35 return os.Restart(client, id)
Jamie Hannaforde6390d42015-02-10 15:59:28 +010036}
37
Jamie Hannaford75e8cc42015-11-16 14:09:25 +010038// Resize changes the memory size of the instance, assuming a valid
Jamie Hannaford27957b22015-02-12 12:50:55 +010039// flavorRef is provided. It will also restart the MySQL service.
Jamie Hannaford75e8cc42015-11-16 14:09:25 +010040func Resize(client *gophercloud.ServiceClient, id, flavorRef string) os.ActionResult {
41 return os.Resize(client, id, flavorRef)
Jamie Hannaforde6390d42015-02-10 15:59:28 +010042}
43
Jamie Hannaford27957b22015-02-12 12:50:55 +010044// 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 Hannaforde6390d42015-02-10 15:59:28 +010047func ResizeVolume(client *gophercloud.ServiceClient, id string, size int) os.ActionResult {
48 return os.ResizeVolume(client, id, size)
49}