instances

package
Version: v0.9.0 Latest Latest
Warning

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

Documentation

Overview

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

A database instance is an isolated database environment with compute and storage resources in a single tenant environment on a shared physical host machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleCreate

func HandleCreate(t *testing.T)

func HandleDelete

func HandleDelete(t *testing.T)

func HandleEnableRoot

func HandleEnableRoot(t *testing.T)

func HandleGet

func HandleGet(t *testing.T)

func HandleIsRootEnabled

func HandleIsRootEnabled(t *testing.T)

func HandleList

func HandleList(t *testing.T)

func HandleResize

func HandleResize(t *testing.T)

func HandleResizeVol

func HandleResizeVol(t *testing.T)

func HandleRestart

func HandleRestart(t *testing.T)

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

List retrieves the status and information for all database instances.

Types

type ActionResult

type ActionResult struct {
	gophercloud.ErrResult
}

ActionResult represents the result of action requests, such as: restarting an instance service, resizing its memory allocation, and resizing its attached volume size.

func Resize

func Resize(client *gophercloud.ServiceClient, id, flavorRef string) 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) 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) 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 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 db.CreateOptsBuilder

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

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

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

func (CreateOpts) ToInstanceCreateMap

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

ToInstanceCreateMap will render a JSON map.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToInstanceCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder is the top-level interface for create options.

type CreateResult

type CreateResult struct {
	// contains filtered or unexported fields
}

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 extract an Instance from various result structs.

type DatastoreOpts

type DatastoreOpts struct {
	Version string
	Type    string
}

DatastoreOpts represents the configuration for how an instance stores data.

func (DatastoreOpts) ToMap

func (opts DatastoreOpts) ToMap() (map[string]string, error)

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a Delete operation.

func Delete

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

Delete permanently destroys the database instance.

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

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 various result structs.

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 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 Volume

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

Instance represents a remote MySQL instance.

func ExtractInstances

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

ExtractInstances will convert a generic pagination struct into a more relevant slice of Instance structs.

type InstancePage

type InstancePage struct {
	pagination.LinkedPageBase
}

InstancePage represents a single page of a paginated instance collection.

func (InstancePage) IsEmpty

func (page InstancePage) IsEmpty() (bool, error)

IsEmpty checks to see whether the collection is empty.

func (InstancePage) NextPageURL

func (page InstancePage) NextPageURL() (string, error)

NextPageURL will retrieve the next page URL.

type UserRootResult

type UserRootResult struct {
	gophercloud.Result
}

UserRootResult represents the result of an operation to enable the root user.

func EnableRootUser

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

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

func (UserRootResult) Extract

func (r UserRootResult) Extract() (*users.User, error)

Extract will extract root user information from a UserRootResult.

type Volume

type Volume struct {
	// The size in GB of the volume
	Size int

	Used float64
}

Volume represents information about an attached volume for a database instance.

Jump to

Keyboard shortcuts

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