gophercloud: Index | Files

package instances

import ""

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.


Package Files

doc.go requests.go results.go urls.go

func IsRootEnabled Uses

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 Uses

func List(client *gophercloud.ServiceClient) pagination.Pager

List retrieves the status and information for all database instances.

type ActionResult Uses

type ActionResult struct {

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

ToInstanceCreateMap will render a JSON map.

type CreateOptsBuilder Uses

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

CreateOptsBuilder is the top-level interface for create options.

type CreateResult Uses

type CreateResult struct {
    // contains filtered or unexported fields

CreateResult represents the result of a Create operation.

func Create Uses

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult

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 Uses

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

Extract will extract an Instance from various result structs.

type DatastoreOpts Uses

type DatastoreOpts struct {
    Version string
    Type    string

DatastoreOpts represents the configuration for how an instance stores data.

func (DatastoreOpts) ToMap Uses

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

type DeleteResult Uses

type DeleteResult struct {

DeleteResult represents the result of a Delete operation.

func Delete Uses

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

Delete permanently destroys the database instance.

type GetResult Uses

type GetResult struct {
    // contains filtered or unexported fields

GetResult represents the result of a Get operation.

func Get Uses

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

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

func (GetResult) Extract Uses

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

Extract will extract an Instance from various result structs.

type Instance Uses

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 Uses

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

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

type InstancePage Uses

type InstancePage struct {

InstancePage represents a single page of a paginated instance collection.

func (InstancePage) IsEmpty Uses

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

IsEmpty checks to see whether the collection is empty.

func (InstancePage) NextPageURL Uses

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

NextPageURL will retrieve the next page URL.

type UserRootResult Uses

type UserRootResult struct {

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

func EnableRootUser Uses

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 Uses

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

Extract will extract root user information from a UserRootResult.

type Volume Uses

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.

Package instances imports 10 packages (graph) and is imported by 8 packages. Updated 2018-07-02. Refresh now. Tools for package owners.