instances

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 7 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 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) (r 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) (r 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) (r 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 Address

type Address struct {
	// The address type, e.g public
	Type string

	// The actual IP address
	Address string
}

Address represents the IP address and its type to connect with the instance.

type ConfigurationResult

type ConfigurationResult struct {
	gophercloud.ErrResult
}

ConfigurationResult represents the result of a AttachConfigurationGroup/DetachConfigurationGroup operation.

func AttachConfigurationGroup

func AttachConfigurationGroup(client *gophercloud.ServiceClient, instanceID string, configID string) (r ConfigurationResult)

AttachConfigurationGroup will attach configuration group to the instance

func DetachConfigurationGroup

func DetachConfigurationGroup(client *gophercloud.ServiceClient, instanceID string) (r ConfigurationResult)

DetachConfigurationGroup will dettach configuration group from the 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
	// Specifies the volume type.
	VolumeType string
	// 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
	// Networks dictates how this server will be attached to available networks.
	Networks []NetworkOpts
}

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

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r 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

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

Extract will extract an Instance from various result structs.

type DatastoreOpts

type DatastoreOpts struct {
	Version string `json:"version"`
	Type    string `json:"type"`
}

DatastoreOpts represents the configuration for how an instance stores data.

func (DatastoreOpts) ToMap

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

ToMap converts a DatastoreOpts to a map[string]string (for a request body)

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a Delete operation.

func Delete

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

Delete permanently destroys the database instance.

type EnableRootUserResult

type EnableRootUserResult struct {
	gophercloud.Result
}

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

func EnableRootUser

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

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

func (EnableRootUserResult) Extract

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

Extract will extract root user information from a UserRootResult.

type Fault

type Fault struct {
	// Indicates the time when the fault occured
	Created time.Time `json:"-"`

	// A message describing the fault reason
	Message string

	// More details about the fault, for example a stack trace. Only filled
	// in for admin users.
	Details string
}

Fault describes the fault reason in more detail when a database instance has errored

func (*Fault) UnmarshalJSON

func (r *Fault) UnmarshalJSON(b []byte) error

type Flavor

type Flavor struct {
	// The flavor's unique identifier.
	ID string
	// Links to access the flavor.
	Links []gophercloud.Link
}

Flavor represents (virtual) hardware configurations for server resources in a region.

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) (r 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 `json:"-"`

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

	// Indicates the hardware flavor the instance uses.
	Flavor 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

	// The IP addresses associated with the database instance
	// Is empty if the instance has a hostname.
	// Deprecated in favor of Addresses.
	IP []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

	// Fault information (only available when the instance has errored)
	Fault *Fault

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

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

	// The instance addresses
	Addresses []Address
}

Instance represents a remote MySQL instance.

func ExtractInstances

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

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

func (*Instance) UnmarshalJSON

func (r *Instance) UnmarshalJSON(b []byte) error

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 IsRootEnabledResult

type IsRootEnabledResult struct {
	gophercloud.Result
}

IsRootEnabledResult is the result of a call to IsRootEnabled. To see if root is enabled, call the type's Extract method.

func IsRootEnabled

func IsRootEnabled(client *gophercloud.ServiceClient, id string) (r IsRootEnabledResult)

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

func (r IsRootEnabledResult) Extract() (bool, error)

Extract is used to extract the data from a IsRootEnabledResult.

type NetworkOpts

type NetworkOpts struct {
	// UUID of a nova-network to attach to the newly provisioned server.
	// Required unless Port is provided.
	UUID string `json:"net-id,omitempty"`

	// Port of a neutron network to attach to the newly provisioned server.
	// Required unless UUID is provided.
	Port string `json:"port-id,omitempty"`

	// V4FixedIP [optional] specifies a fixed IPv4 address to be used on this network.
	V4FixedIP string `json:"v4-fixed-ip,omitempty"`

	// V6FixedIP [optional] specifies a fixed IPv6 address to be used on this network.
	V6FixedIP string `json:"v6-fixed-ip,omitempty"`
}

NetworkOpts is used within CreateOpts to control a new server's network attachments.

func (NetworkOpts) ToMap

func (opts NetworkOpts) ToMap() (map[string]interface{}, error)

ToMap converts a NetworkOpts to a map[string]string (for a request body)

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.

Directories

Path Synopsis
db_instances_v1
db_instances_v1

Jump to

Keyboard shortcuts

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