Version: v0.9.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2016 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0



Package instances provides information and interaction with the instance API resource in the Rackspace Database service.



This section is empty.


This section is empty.


func Delete

func Delete(client *gophercloud.ServiceClient, id string) os.DeleteResult

Delete permanently destroys the database instance.

func EnableRootUser

func EnableRootUser(client *gophercloud.ServiceClient, id string) os.UserRootResult

EnableRootUser enables the login from any host for the root user and provides the user with a generated root password.

func IsRootEnabled

func IsRootEnabled(client *gophercloud.ServiceClient, id string) (bool, error)

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 List

func List(client *gophercloud.ServiceClient, opts *ListOpts) pagination.Pager

List retrieves the status and information for all database instances.

func ListBackups

func ListBackups(client *gophercloud.ServiceClient, instanceID string) pagination.Pager

ListBackups will list all the backups for a specified database instance.

func Resize

func Resize(client *gophercloud.ServiceClient, id, flavorRef string) os.ActionResult

Resize changes the memory size of the instance, assuming a valid flavorRef is provided. It will also restart the MySQL service.

func ResizeVolume

func ResizeVolume(client *gophercloud.ServiceClient, id string, size int) os.ActionResult

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 Restart

func Restart(client *gophercloud.ServiceClient, id string) os.ActionResult

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.


type ConfigResult

type ConfigResult struct {

ConfigResult represents the result of getting default configuration for an instance.

func GetDefaultConfig

func GetDefaultConfig(client *gophercloud.ServiceClient, id string) ConfigResult

GetDefaultConfig lists the default configuration settings from the template that was applied to the specified instance. In a sense, this is the vanilla configuration setting applied to an instance. Further configuration can be applied by associating an instance with a configuration group.

func (ConfigResult) Extract

func (r ConfigResult) Extract() (map[string]string, error)

Extract will extract the configuration information (in the form of a map) about a particular instance.

type CreateOpts

type CreateOpts struct {
	// Either the integer UUID (in string form) of the flavor, or its URI
	// reference as specified in the response from the List() call. Required.
	FlavorRef string

	// Specifies the volume size in gigabytes (GB). The value must be between 1
	// and 300. Required.
	Size int

	// Name of the instance to create. The length of the name is limited to
	// 255 characters and any characters are permitted. Optional.
	Name string

	// A slice of database information options.
	Databases osDBs.CreateOptsBuilder

	// A slice of user information options.
	Users osUsers.CreateOptsBuilder

	// ID of the configuration group to associate with the instance. Optional.
	ConfigID string

	// Options to configure the type of datastore the instance will use. This is
	// optional, and if excluded will default to MySQL.
	Datastore *os.DatastoreOpts

	// Specifies the backup ID from which to restore the database instance. There
	// are some things to be aware of before using this field.  When you execute
	// the Restore Backup operation, a new database instance is created to store
	// the backup whose ID is specified by the restorePoint attribute. This will
	// mean that:
	// - All users, passwords and access that were on the instance at the time of
	// the backup will be restored along with the databases.
	// - You can create new users or databases if you want, but they cannot be
	// the same as the ones from the instance that was backed up.
	RestorePoint string

	ReplicaOf string

CreateOpts is the struct responsible for configuring a new database instance.

func (CreateOpts) ToInstanceCreateMap

func (opts CreateOpts) ToInstanceCreateMap() (map[string]interface{}, error)

type CreateResult

type CreateResult struct {

CreateResult represents the result of a Create operation.

func Create

Create asynchronously provisions a new database instance. It requires the user to specify a flavor and a volume size. The API service then provisions the instance with the requested flavor and sets up a volume of the specified size, which is the storage for the database instance.

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 (CreateResult) Extract

func (r CreateResult) Extract() (*Instance, error)

Extract will retrieve an instance from a create result.

type DetachResult

type DetachResult struct {

DetachResult represents the result of detaching a replica from its source.

func DetachReplica

func DetachReplica(client *gophercloud.ServiceClient, replicaID string) DetachResult

DetachReplica will detach a specified replica instance from its source instance, effectively allowing it to operate independently. Detaching a replica will restart the MySQL service on the instance.

type GetResult

type GetResult struct {

GetResult represents the result of a Get operation.

func Get

func Get(client *gophercloud.ServiceClient, id string) GetResult

Get retrieves the status and information for a specified database instance.

func (GetResult) Extract

func (r GetResult) Extract() (*Instance, error)

Extract will extract an Instance from a GetResult.

type Instance

type Instance struct {
	// Indicates the datetime that the instance was created
	Created time.Time `mapstructure:"-"`

	// Indicates the most recent datetime that the instance was updated.
	Updated time.Time `mapstructure:"-"`

	// Indicates how the instance stores data.
	Datastore datastores.DatastorePartial

	// Indicates the hardware flavor the instance uses.
	Flavor flavors.Flavor

	// A DNS-resolvable hostname associated with the database instance (rather
	// than an IPv4 address). Since the hostname always resolves to the correct
	// IP address of the database instance, this relieves the user from the task
	// of maintaining the mapping. Note that although the IP address may likely
	// change on resizing, migrating, and so forth, the hostname always resolves
	// to the correct database instance.
	Hostname string

	// Indicates the unique identifier for the instance resource.
	ID string

	// Exposes various links that reference the instance resource.
	Links []gophercloud.Link

	// The human-readable name of the instance.
	Name string

	// The build status of the instance.
	Status string

	// Information about the attached volume of the instance.
	Volume os.Volume

	// IP indicates the various IP addresses which allow access.
	IP []string

	// Indicates whether this instance is a replica of another source instance.
	ReplicaOf *Instance `mapstructure:"replica_of" json:"replica_of"`

	// Indicates whether this instance is the source of other replica instances.
	Replicas []Instance

Instance represents a remote MySQL instance.

func ExtractInstances

func ExtractInstances(page pagination.Page) ([]Instance, error)

ExtractInstances retrieves a slice of instances from a paginated collection.

type ListOpts

type ListOpts struct {
	// IncludeHA includes or excludes High Availability instances from the result set
	IncludeHA bool `q:"include_ha"`

	// IncludeReplicas includes or excludes Replica instances from the result set
	IncludeReplicas bool `q:"include_replicas"`

ListOpts specifies all of the query options to be used when returning a list of database instances.

func (ListOpts) ToInstanceListQuery

func (opts ListOpts) ToInstanceListQuery() (string, error)

ToInstanceListQuery formats a ListOpts into a query string.

type UpdateResult

type UpdateResult struct {

UpdateResult represents the result of an Update operation.

func AssociateWithConfigGroup

func AssociateWithConfigGroup(client *gophercloud.ServiceClient, instanceID, configGroupID string) UpdateResult

AssociateWithConfigGroup associates a specified instance to a specified configuration group. If any of the parameters within a configuration group require a restart, then the instance will transition into a restart.

func DetachFromConfigGroup

func DetachFromConfigGroup(client *gophercloud.ServiceClient, instanceID string) UpdateResult

DetachFromConfigGroup will detach an instance from all config groups.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL