Move deps from _workspace/ to vendor/
godep restore pushd $GOPATH/src/github.com/appc/spec git co master popd go get go4.org/errorutil rm -rf Godeps godep save ./... git add vendor git add -f $(git ls-files --other vendor/) git co -- Godeps/LICENSES Godeps/.license_file_state Godeps/OWNERS
This commit is contained in:
11
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/doc.go
generated
vendored
Normal file
11
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/doc.go
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// 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.
|
||||
package configurations
|
||||
157
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/fixtures.go
generated
vendored
Normal file
157
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/fixtures.go
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
package configurations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
timestamp = "2015-11-12T14:22:42Z"
|
||||
timeVal, _ = time.Parse(time.RFC3339, timestamp)
|
||||
)
|
||||
|
||||
var singleConfigJSON = `
|
||||
{
|
||||
"created": "` + timestamp + `",
|
||||
"datastore_name": "mysql",
|
||||
"datastore_version_id": "b00000b0-00b0-0b00-00b0-000b000000bb",
|
||||
"datastore_version_name": "5.6",
|
||||
"description": "example_description",
|
||||
"id": "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
|
||||
"name": "example-configuration-name",
|
||||
"updated": "` + timestamp + `"
|
||||
}
|
||||
`
|
||||
|
||||
var singleConfigWithValuesJSON = `
|
||||
{
|
||||
"created": "` + timestamp + `",
|
||||
"datastore_name": "mysql",
|
||||
"datastore_version_id": "b00000b0-00b0-0b00-00b0-000b000000bb",
|
||||
"datastore_version_name": "5.6",
|
||||
"description": "example description",
|
||||
"id": "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
|
||||
"instance_count": 0,
|
||||
"name": "example-configuration-name",
|
||||
"updated": "` + timestamp + `",
|
||||
"values": {
|
||||
"collation_server": "latin1_swedish_ci",
|
||||
"connect_timeout": 120
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var (
|
||||
ListConfigsJSON = fmt.Sprintf(`{"configurations": [%s]}`, singleConfigJSON)
|
||||
GetConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigJSON)
|
||||
CreateConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigWithValuesJSON)
|
||||
)
|
||||
|
||||
var CreateReq = `
|
||||
{
|
||||
"configuration": {
|
||||
"datastore": {
|
||||
"type": "a00000a0-00a0-0a00-00a0-000a000000aa",
|
||||
"version": "b00000b0-00b0-0b00-00b0-000b000000bb"
|
||||
},
|
||||
"description": "example description",
|
||||
"name": "example-configuration-name",
|
||||
"values": {
|
||||
"collation_server": "latin1_swedish_ci",
|
||||
"connect_timeout": 120
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var UpdateReq = `
|
||||
{
|
||||
"configuration": {
|
||||
"values": {
|
||||
"connect_timeout": 300
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var ListInstancesJSON = `
|
||||
{
|
||||
"instances": [
|
||||
{
|
||||
"id": "d4603f69-ec7e-4e9b-803f-600b9205576f",
|
||||
"name": "json_rack_instance"
|
||||
}
|
||||
]
|
||||
}
|
||||
`
|
||||
|
||||
var ListParamsJSON = `
|
||||
{
|
||||
"configuration-parameters": [
|
||||
{
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "innodb_file_per_table",
|
||||
"restart_required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"max": 4294967296,
|
||||
"min": 0,
|
||||
"name": "key_buffer_size",
|
||||
"restart_required": false,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"max": 65535,
|
||||
"min": 2,
|
||||
"name": "connect_timeout",
|
||||
"restart_required": false,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"max": 4294967296,
|
||||
"min": 0,
|
||||
"name": "join_buffer_size",
|
||||
"restart_required": false,
|
||||
"type": "integer"
|
||||
}
|
||||
]
|
||||
}
|
||||
`
|
||||
|
||||
var GetParamJSON = `
|
||||
{
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "innodb_file_per_table",
|
||||
"restart_required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
`
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
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,
|
||||
},
|
||||
}
|
||||
287
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/requests.go
generated
vendored
Normal file
287
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/requests.go
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
package configurations
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack/db/v1/instances"
|
||||
"github.com/rackspace/gophercloud/pagination"
|
||||
)
|
||||
|
||||
// List will list all of the available configurations.
|
||||
func List(client *gophercloud.ServiceClient) pagination.Pager {
|
||||
pageFn := func(r pagination.PageResult) pagination.Page {
|
||||
return ConfigPage{pagination.SinglePageBase(r)}
|
||||
}
|
||||
|
||||
return pagination.NewPager(client, baseURL(client), pageFn)
|
||||
}
|
||||
|
||||
// CreateOptsBuilder is a top-level interface which renders a JSON map.
|
||||
type CreateOptsBuilder interface {
|
||||
ToConfigCreateMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
// DatastoreOpts is the primary options struct for creating and modifying
|
||||
// how configuration resources are associated with datastores.
|
||||
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
|
||||
}
|
||||
|
||||
// ToMap renders a JSON map for a datastore setting.
|
||||
func (opts DatastoreOpts) ToMap() (map[string]string, error) {
|
||||
datastore := map[string]string{}
|
||||
|
||||
if opts.Type != "" {
|
||||
datastore["type"] = opts.Type
|
||||
}
|
||||
|
||||
if opts.Version != "" {
|
||||
datastore["version"] = opts.Version
|
||||
}
|
||||
|
||||
return datastore, nil
|
||||
}
|
||||
|
||||
// CreateOpts is the struct responsible for configuring new configurations.
|
||||
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
|
||||
}
|
||||
|
||||
// ToConfigCreateMap casts a CreateOpts struct into a JSON map.
|
||||
func (opts CreateOpts) ToConfigCreateMap() (map[string]interface{}, error) {
|
||||
if opts.Name == "" {
|
||||
return nil, errors.New("Name is a required field")
|
||||
}
|
||||
if len(opts.Values) == 0 {
|
||||
return nil, errors.New("Values must be a populated map")
|
||||
}
|
||||
|
||||
config := map[string]interface{}{
|
||||
"name": opts.Name,
|
||||
"values": opts.Values,
|
||||
}
|
||||
|
||||
if opts.Datastore != nil {
|
||||
ds, err := opts.Datastore.ToMap()
|
||||
if err != nil {
|
||||
return config, err
|
||||
}
|
||||
config["datastore"] = ds
|
||||
}
|
||||
|
||||
if opts.Description != "" {
|
||||
config["description"] = opts.Description
|
||||
}
|
||||
|
||||
return map[string]interface{}{"configuration": config}, nil
|
||||
}
|
||||
|
||||
// Create will create a new configuration group.
|
||||
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
|
||||
var res CreateResult
|
||||
|
||||
reqBody, err := opts.ToConfigCreateMap()
|
||||
if err != nil {
|
||||
res.Err = err
|
||||
return res
|
||||
}
|
||||
|
||||
_, res.Err = client.Request("POST", baseURL(client), gophercloud.RequestOpts{
|
||||
OkCodes: []int{200},
|
||||
JSONBody: &reqBody,
|
||||
JSONResponse: &res.Body,
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// Get will retrieve the details for a specified configuration group.
|
||||
func Get(client *gophercloud.ServiceClient, configID string) GetResult {
|
||||
var res GetResult
|
||||
|
||||
_, res.Err = client.Request("GET", resourceURL(client, configID), gophercloud.RequestOpts{
|
||||
OkCodes: []int{200},
|
||||
JSONResponse: &res.Body,
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// UpdateOptsBuilder is the top-level interface for casting update options into
|
||||
// JSON maps.
|
||||
type UpdateOptsBuilder interface {
|
||||
ToConfigUpdateMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
// UpdateOpts is the struct responsible for modifying existing configurations.
|
||||
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
|
||||
}
|
||||
|
||||
// ToConfigUpdateMap will cast an UpdateOpts struct into a JSON map.
|
||||
func (opts UpdateOpts) ToConfigUpdateMap() (map[string]interface{}, error) {
|
||||
config := map[string]interface{}{}
|
||||
|
||||
if opts.Name != "" {
|
||||
config["name"] = opts.Name
|
||||
}
|
||||
|
||||
if opts.Description != "" {
|
||||
config["description"] = opts.Description
|
||||
}
|
||||
|
||||
if opts.Datastore != nil {
|
||||
ds, err := opts.Datastore.ToMap()
|
||||
if err != nil {
|
||||
return config, err
|
||||
}
|
||||
config["datastore"] = ds
|
||||
}
|
||||
|
||||
if len(opts.Values) > 0 {
|
||||
config["values"] = opts.Values
|
||||
}
|
||||
|
||||
return map[string]interface{}{"configuration": config}, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
func Update(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) UpdateResult {
|
||||
var res UpdateResult
|
||||
|
||||
reqBody, err := opts.ToConfigUpdateMap()
|
||||
if err != nil {
|
||||
res.Err = err
|
||||
return res
|
||||
}
|
||||
|
||||
_, res.Err = client.Request("PATCH", resourceURL(client, configID), gophercloud.RequestOpts{
|
||||
OkCodes: []int{200},
|
||||
JSONBody: &reqBody,
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// 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.
|
||||
func Replace(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) ReplaceResult {
|
||||
var res ReplaceResult
|
||||
|
||||
reqBody, err := opts.ToConfigUpdateMap()
|
||||
if err != nil {
|
||||
res.Err = err
|
||||
return res
|
||||
}
|
||||
|
||||
_, res.Err = client.Request("PUT", resourceURL(client, configID), gophercloud.RequestOpts{
|
||||
OkCodes: []int{202},
|
||||
JSONBody: &reqBody,
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// 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.
|
||||
func Delete(client *gophercloud.ServiceClient, configID string) DeleteResult {
|
||||
var res DeleteResult
|
||||
|
||||
_, res.Err = client.Request("DELETE", resourceURL(client, configID), gophercloud.RequestOpts{
|
||||
OkCodes: []int{202},
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// ListInstances will list all the instances associated with a particular
|
||||
// configuration group.
|
||||
func ListInstances(client *gophercloud.ServiceClient, configID string) pagination.Pager {
|
||||
pageFn := func(r pagination.PageResult) pagination.Page {
|
||||
return instances.InstancePage{pagination.LinkedPageBase{PageResult: r}}
|
||||
}
|
||||
return pagination.NewPager(client, instancesURL(client, configID), pageFn)
|
||||
}
|
||||
|
||||
// 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 ListDatastoreParams(client *gophercloud.ServiceClient, datastoreID, versionID string) pagination.Pager {
|
||||
pageFn := func(r pagination.PageResult) pagination.Page {
|
||||
return ParamPage{pagination.SinglePageBase(r)}
|
||||
}
|
||||
return pagination.NewPager(client, listDSParamsURL(client, datastoreID, versionID), pageFn)
|
||||
}
|
||||
|
||||
// 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 GetDatastoreParam(client *gophercloud.ServiceClient, datastoreID, versionID, paramID string) ParamResult {
|
||||
var res ParamResult
|
||||
|
||||
_, res.Err = client.Request("GET", getDSParamURL(client, datastoreID, versionID, paramID), gophercloud.RequestOpts{
|
||||
OkCodes: []int{200},
|
||||
JSONResponse: &res.Body,
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// ListGlobalParams is similar to ListDatastoreParams but does not require a
|
||||
// DatastoreID.
|
||||
func ListGlobalParams(client *gophercloud.ServiceClient, versionID string) pagination.Pager {
|
||||
pageFn := func(r pagination.PageResult) pagination.Page {
|
||||
return ParamPage{pagination.SinglePageBase(r)}
|
||||
}
|
||||
return pagination.NewPager(client, listGlobalParamsURL(client, versionID), pageFn)
|
||||
}
|
||||
|
||||
// GetGlobalParam is similar to GetDatastoreParam but does not require a
|
||||
// DatastoreID.
|
||||
func GetGlobalParam(client *gophercloud.ServiceClient, versionID, paramID string) ParamResult {
|
||||
var res ParamResult
|
||||
|
||||
_, res.Err = client.Request("GET", getGlobalParamURL(client, versionID, paramID), gophercloud.RequestOpts{
|
||||
OkCodes: []int{200},
|
||||
JSONResponse: &res.Body,
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
197
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/results.go
generated
vendored
Normal file
197
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/results.go
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
package configurations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/pagination"
|
||||
)
|
||||
|
||||
// Config represents a configuration group API resource.
|
||||
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{}
|
||||
}
|
||||
|
||||
// ConfigPage contains a page of Config resources in a paginated collection.
|
||||
type ConfigPage struct {
|
||||
pagination.SinglePageBase
|
||||
}
|
||||
|
||||
// IsEmpty indicates whether a ConfigPage is empty.
|
||||
func (r ConfigPage) IsEmpty() (bool, error) {
|
||||
is, err := ExtractConfigs(r)
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
return len(is) == 0, nil
|
||||
}
|
||||
|
||||
// ExtractConfigs will retrieve a slice of Config structs from a page.
|
||||
func ExtractConfigs(page pagination.Page) ([]Config, error) {
|
||||
casted := page.(ConfigPage).Body
|
||||
|
||||
var resp struct {
|
||||
Configs []Config `mapstructure:"configurations" json:"configurations"`
|
||||
}
|
||||
|
||||
if err := mapstructure.Decode(casted, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var vals []interface{}
|
||||
switch casted.(type) {
|
||||
case map[string]interface{}:
|
||||
vals = casted.(map[string]interface{})["configurations"].([]interface{})
|
||||
case map[string][]interface{}:
|
||||
vals = casted.(map[string][]interface{})["configurations"]
|
||||
default:
|
||||
return resp.Configs, fmt.Errorf("Unknown type: %v", reflect.TypeOf(casted))
|
||||
}
|
||||
|
||||
for i, v := range vals {
|
||||
val := v.(map[string]interface{})
|
||||
|
||||
if t, ok := val["created"].(string); ok && t != "" {
|
||||
creationTime, err := time.Parse(time.RFC3339, t)
|
||||
if err != nil {
|
||||
return resp.Configs, err
|
||||
}
|
||||
resp.Configs[i].Created = creationTime
|
||||
}
|
||||
|
||||
if t, ok := val["updated"].(string); ok && t != "" {
|
||||
updatedTime, err := time.Parse(time.RFC3339, t)
|
||||
if err != nil {
|
||||
return resp.Configs, err
|
||||
}
|
||||
resp.Configs[i].Updated = updatedTime
|
||||
}
|
||||
}
|
||||
|
||||
return resp.Configs, nil
|
||||
}
|
||||
|
||||
type commonResult struct {
|
||||
gophercloud.Result
|
||||
}
|
||||
|
||||
// Extract will retrieve a Config resource from an operation result.
|
||||
func (r commonResult) Extract() (*Config, error) {
|
||||
if r.Err != nil {
|
||||
return nil, r.Err
|
||||
}
|
||||
|
||||
var response struct {
|
||||
Config Config `mapstructure:"configuration"`
|
||||
}
|
||||
|
||||
err := mapstructure.Decode(r.Body, &response)
|
||||
val := r.Body.(map[string]interface{})["configuration"].(map[string]interface{})
|
||||
|
||||
if t, ok := val["created"].(string); ok && t != "" {
|
||||
creationTime, err := time.Parse(time.RFC3339, t)
|
||||
if err != nil {
|
||||
return &response.Config, err
|
||||
}
|
||||
response.Config.Created = creationTime
|
||||
}
|
||||
|
||||
if t, ok := val["updated"].(string); ok && t != "" {
|
||||
updatedTime, err := time.Parse(time.RFC3339, t)
|
||||
if err != nil {
|
||||
return &response.Config, err
|
||||
}
|
||||
response.Config.Updated = updatedTime
|
||||
}
|
||||
|
||||
return &response.Config, err
|
||||
}
|
||||
|
||||
// GetResult represents the result of a Get operation.
|
||||
type GetResult struct {
|
||||
commonResult
|
||||
}
|
||||
|
||||
// CreateResult represents the result of a Create operation.
|
||||
type CreateResult struct {
|
||||
commonResult
|
||||
}
|
||||
|
||||
// UpdateResult represents the result of an Update operation.
|
||||
type UpdateResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
// ReplaceResult represents the result of a Replace operation.
|
||||
type ReplaceResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
// DeleteResult represents the result of a Delete operation.
|
||||
type DeleteResult struct {
|
||||
gophercloud.ErrResult
|
||||
}
|
||||
|
||||
// Param represents a configuration parameter API resource.
|
||||
type Param struct {
|
||||
Max int
|
||||
Min int
|
||||
Name string
|
||||
RestartRequired bool `mapstructure:"restart_required" json:"restart_required"`
|
||||
Type string
|
||||
}
|
||||
|
||||
// ParamPage contains a page of Param resources in a paginated collection.
|
||||
type ParamPage struct {
|
||||
pagination.SinglePageBase
|
||||
}
|
||||
|
||||
// IsEmpty indicates whether a ParamPage is empty.
|
||||
func (r ParamPage) IsEmpty() (bool, error) {
|
||||
is, err := ExtractParams(r)
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
return len(is) == 0, nil
|
||||
}
|
||||
|
||||
// ExtractParams will retrieve a slice of Param structs from a page.
|
||||
func ExtractParams(page pagination.Page) ([]Param, error) {
|
||||
casted := page.(ParamPage).Body
|
||||
|
||||
var resp struct {
|
||||
Params []Param `mapstructure:"configuration-parameters" json:"configuration-parameters"`
|
||||
}
|
||||
|
||||
err := mapstructure.Decode(casted, &resp)
|
||||
return resp.Params, err
|
||||
}
|
||||
|
||||
// ParamResult represents the result of an operation which retrieves details
|
||||
// about a particular configuration param.
|
||||
type ParamResult struct {
|
||||
gophercloud.Result
|
||||
}
|
||||
|
||||
// Extract will retrieve a param from an operation result.
|
||||
func (r ParamResult) Extract() (*Param, error) {
|
||||
if r.Err != nil {
|
||||
return nil, r.Err
|
||||
}
|
||||
|
||||
var param Param
|
||||
|
||||
err := mapstructure.Decode(r.Body, ¶m)
|
||||
return ¶m, err
|
||||
}
|
||||
31
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/urls.go
generated
vendored
Normal file
31
vendor/github.com/rackspace/gophercloud/openstack/db/v1/configurations/urls.go
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
package configurations
|
||||
|
||||
import "github.com/rackspace/gophercloud"
|
||||
|
||||
func baseURL(c *gophercloud.ServiceClient) string {
|
||||
return c.ServiceURL("configurations")
|
||||
}
|
||||
|
||||
func resourceURL(c *gophercloud.ServiceClient, configID string) string {
|
||||
return c.ServiceURL("configurations", configID)
|
||||
}
|
||||
|
||||
func instancesURL(c *gophercloud.ServiceClient, configID string) string {
|
||||
return c.ServiceURL("configurations", configID, "instances")
|
||||
}
|
||||
|
||||
func listDSParamsURL(c *gophercloud.ServiceClient, datastoreID, versionID string) string {
|
||||
return c.ServiceURL("datastores", datastoreID, "versions", versionID, "parameters")
|
||||
}
|
||||
|
||||
func getDSParamURL(c *gophercloud.ServiceClient, datastoreID, versionID, paramID string) string {
|
||||
return c.ServiceURL("datastores", datastoreID, "versions", versionID, "parameters", paramID)
|
||||
}
|
||||
|
||||
func listGlobalParamsURL(c *gophercloud.ServiceClient, versionID string) string {
|
||||
return c.ServiceURL("datastores", "versions", versionID, "parameters")
|
||||
}
|
||||
|
||||
func getGlobalParamURL(c *gophercloud.ServiceClient, versionID, paramID string) string {
|
||||
return c.ServiceURL("datastores", "versions", versionID, "parameters", paramID)
|
||||
}
|
||||
Reference in New Issue
Block a user