configurations

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: 7 Imported by: 0

Documentation

Overview

Package configurations provides information and interaction with the configuration API resource in the Rackspace Database service.

A configuration group is a collection of key/value pairs which define how a particular database operates. These key/value pairs are specific to each datastore type and serve like settings. Some directives are capable of being applied dynamically, while other directives require a server restart to take effect. The configuration group can be applied to an instance at creation or applied to an existing instance to modify the behavior of the running datastore on the instance.

Index

Constants

This section is empty.

Variables

View Source
var (
	ListConfigsJSON  = fmt.Sprintf(`{"configurations": [%s]}`, singleConfigJSON)
	GetConfigJSON    = fmt.Sprintf(`{"configuration": %s}`, singleConfigJSON)
	CreateConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigWithValuesJSON)
)
View Source
var CreateReq = `` /* 348-byte string literal not displayed */
View Source
var ExampleConfig = Config{
	Created:              timeVal,
	DatastoreName:        "mysql",
	DatastoreVersionID:   "b00000b0-00b0-0b00-00b0-000b000000bb",
	DatastoreVersionName: "5.6",
	Description:          "example_description",
	ID:                   "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
	Name:                 "example-configuration-name",
	Updated:              timeVal,
}
View Source
var ExampleConfigWithValues = Config{
	Created:              timeVal,
	DatastoreName:        "mysql",
	DatastoreVersionID:   "b00000b0-00b0-0b00-00b0-000b000000bb",
	DatastoreVersionName: "5.6",
	Description:          "example description",
	ID:                   "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
	Name:                 "example-configuration-name",
	Updated:              timeVal,
	Values: map[string]interface{}{
		"collation_server": "latin1_swedish_ci",
		"connect_timeout":  120,
	},
}
View Source
var GetParamJSON = `
{
  "max": 1,
  "min": 0,
  "name": "innodb_file_per_table",
  "restart_required": true,
  "type": "integer"
}
`
View Source
var ListInstancesJSON = `
{
  "instances": [
    {
      "id": "d4603f69-ec7e-4e9b-803f-600b9205576f",
      "name": "json_rack_instance"
    }
  ]
}
`
View Source
var ListParamsJSON = `` /* 608-byte string literal not displayed */
View Source
var UpdateReq = `
{
  "configuration": {
    "values": {
      "connect_timeout": 300
    }
  }
}
`

Functions

func List

List will list all of the available configurations.

func ListDatastoreParams

func ListDatastoreParams(client *gophercloud.ServiceClient, datastoreID, versionID string) pagination.Pager

ListDatastoreParams will list all the available and supported parameters that can be used for a particular datastore ID and a particular version. For example, if you are wondering how you can configure a MySQL 5.6 instance, you can use this operation (you will need to retrieve the MySQL datastore ID by using the datastores API).

func ListGlobalParams

func ListGlobalParams(client *gophercloud.ServiceClient, versionID string) pagination.Pager

ListGlobalParams is similar to ListDatastoreParams but does not require a DatastoreID.

func ListInstances

func ListInstances(client *gophercloud.ServiceClient, configID string) pagination.Pager

ListInstances will list all the instances associated with a particular configuration group.

Types

type Config

type Config struct {
	Created              time.Time `mapstructure:"-"`
	Updated              time.Time `mapstructure:"-"`
	DatastoreName        string    `mapstructure:"datastore_name"`
	DatastoreVersionID   string    `mapstructure:"datastore_version_id"`
	DatastoreVersionName string    `mapstructure:"datastore_version_name"`
	Description          string
	ID                   string
	Name                 string
	Values               map[string]interface{}
}

Config represents a configuration group API resource.

func ExtractConfigs

func ExtractConfigs(page pagination.Page) ([]Config, error)

ExtractConfigs will retrieve a slice of Config structs from a page.

type ConfigPage

type ConfigPage struct {
	pagination.SinglePageBase
}

ConfigPage contains a page of Config resources in a paginated collection.

func (ConfigPage) IsEmpty

func (r ConfigPage) IsEmpty() (bool, error)

IsEmpty indicates whether a ConfigPage is empty.

type CreateOpts

type CreateOpts struct {
	// [REQUIRED] The configuration group name
	Name string

	// [REQUIRED] A map of user-defined configuration settings that will define
	// how each associated datastore works. Each key/value pair is specific to a
	// datastore type.
	Values map[string]interface{}

	// [OPTIONAL] Associates the configuration group with a particular datastore.
	Datastore *DatastoreOpts

	// [OPTIONAL] A human-readable explanation for the group.
	Description string
}

CreateOpts is the struct responsible for configuring new configurations.

func (CreateOpts) ToConfigCreateMap

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

ToConfigCreateMap casts a CreateOpts struct into a JSON map.

type CreateOptsBuilder

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

CreateOptsBuilder is a top-level interface which renders a JSON map.

type CreateResult

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

CreateResult represents the result of a Create operation.

func Create

Create will create a new configuration group.

func (CreateResult) Extract

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

Extract will retrieve a Config resource from an operation result.

type DatastoreOpts

type DatastoreOpts struct {
	// [OPTIONAL] The type of datastore. Defaults to "MySQL".
	Type string

	// [OPTIONAL] The specific version of a datastore. Defaults to "5.6".
	Version string
}

DatastoreOpts is the primary options struct for creating and modifying how configuration resources are associated with datastores.

func (DatastoreOpts) ToMap

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

ToMap renders a JSON map for a datastore setting.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a Delete operation.

func Delete

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

Delete will permanently delete a configuration group. Please note that config groups cannot be deleted whilst still attached to running instances - you must detach and then delete them.

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, configID string) GetResult

Get will retrieve the details for a specified configuration group.

func (GetResult) Extract

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

Extract will retrieve a Config resource from an operation result.

type Param

type Param struct {
	Max             int
	Min             int
	Name            string
	RestartRequired bool `mapstructure:"restart_required" json:"restart_required"`
	Type            string
}

Param represents a configuration parameter API resource.

func ExtractParams

func ExtractParams(page pagination.Page) ([]Param, error)

ExtractParams will retrieve a slice of Param structs from a page.

type ParamPage

type ParamPage struct {
	pagination.SinglePageBase
}

ParamPage contains a page of Param resources in a paginated collection.

func (ParamPage) IsEmpty

func (r ParamPage) IsEmpty() (bool, error)

IsEmpty indicates whether a ParamPage is empty.

type ParamResult

type ParamResult struct {
	gophercloud.Result
}

ParamResult represents the result of an operation which retrieves details about a particular configuration param.

func GetDatastoreParam

func GetDatastoreParam(client *gophercloud.ServiceClient, datastoreID, versionID, paramID string) ParamResult

GetDatastoreParam will retrieve information about a specific configuration parameter. For example, you can use this operation to understand more about "innodb_file_per_table" configuration param for MySQL datastores. You will need the param's ID first, which can be attained by using the ListDatastoreParams operation.

func GetGlobalParam

func GetGlobalParam(client *gophercloud.ServiceClient, versionID, paramID string) ParamResult

GetGlobalParam is similar to GetDatastoreParam but does not require a DatastoreID.

func (ParamResult) Extract

func (r ParamResult) Extract() (*Param, error)

Extract will retrieve a param from an operation result.

type ReplaceResult

type ReplaceResult struct {
	gophercloud.ErrResult
}

ReplaceResult represents the result of a Replace operation.

func Replace

func Replace(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) ReplaceResult

Replace will modify an existing configuration group by overwriting the entire parameter group with the new values provided. Any existing keys not included in UpdateOptsBuilder will be deleted.

type UpdateOpts

type UpdateOpts struct {
	// [OPTIONAL] The configuration group name
	Name string

	// [OPTIONAL] A map of user-defined configuration settings that will define
	// how each associated datastore works. Each key/value pair is specific to a
	// datastore type.
	Values map[string]interface{}

	// [OPTIONAL] Associates the configuration group with a particular datastore.
	Datastore *DatastoreOpts

	// [OPTIONAL] A human-readable explanation for the group.
	Description string
}

UpdateOpts is the struct responsible for modifying existing configurations.

func (UpdateOpts) ToConfigUpdateMap

func (opts UpdateOpts) ToConfigUpdateMap() (map[string]interface{}, error)

ToConfigUpdateMap will cast an UpdateOpts struct into a JSON map.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToConfigUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder is the top-level interface for casting update options into JSON maps.

type UpdateResult

type UpdateResult struct {
	gophercloud.ErrResult
}

UpdateResult represents the result of an Update operation.

func Update

func Update(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) UpdateResult

Update will modify an existing configuration group by performing a merge between new and existing values. If the key already exists, the new value will overwrite. All other keys will remain unaffected.

Jump to

Keyboard shortcuts

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