Finish DB docs for Rackspace
diff --git a/rackspace/db/v1/instances/doc.go b/rackspace/db/v1/instances/doc.go
index 98a1bb3..0c8ad63 100644
--- a/rackspace/db/v1/instances/doc.go
+++ b/rackspace/db/v1/instances/doc.go
@@ -1 +1,3 @@
+// Package instances provides information and interaction with the instance API
+// resource in the Rackspace Database service.
package instances
diff --git a/rackspace/db/v1/instances/requests.go b/rackspace/db/v1/instances/requests.go
index cfebd5d..7a1a4f8 100644
--- a/rackspace/db/v1/instances/requests.go
+++ b/rackspace/db/v1/instances/requests.go
@@ -6,6 +6,10 @@
"github.com/rackspace/gophercloud/rackspace/db/v1/backups"
)
+// GetDefaultConfig lists the default configuration settings from the template
+// that was applied to the specified instance. In a sense, this is the vanilla
+// configuration setting applied to an instance. Further configuration can be
+// applied by associating an instance with a configuration group.
func GetDefaultConfig(client *gophercloud.ServiceClient, id string) ConfigResult {
var res ConfigResult
@@ -17,6 +21,9 @@
return res
}
+// AssociateWithConfigGroup associates a specified instance to a specified
+// configuration group. If any of the parameters within a configuration group
+// require a restart, then the instance will transition into a restart.
func AssociateWithConfigGroup(client *gophercloud.ServiceClient, instanceID, configGroupID string) UpdateResult {
reqBody := map[string]string{
"configuration": configGroupID,
@@ -32,6 +39,7 @@
return res
}
+// ListBackups will list all the backups for a specified database instance.
func ListBackups(client *gophercloud.ServiceClient, instanceID string) pagination.Pager {
pageFn := func(r pagination.PageResult) pagination.Page {
return backups.BackupPage{pagination.SinglePageBase(r)}
@@ -39,6 +47,9 @@
return pagination.NewPager(client, backupsURL(client, instanceID), pageFn)
}
+// DetachReplica will detach a specified replica instance from its source
+// instance, effectively allowing it to operate independently. Detaching a
+// replica will restart the MySQL service on the instance.
func DetachReplica(client *gophercloud.ServiceClient, replicaID string) DetachResult {
var res DetachResult
diff --git a/rackspace/db/v1/instances/results.go b/rackspace/db/v1/instances/results.go
index 2ce302b..7a44f1b 100644
--- a/rackspace/db/v1/instances/results.go
+++ b/rackspace/db/v1/instances/results.go
@@ -45,10 +45,13 @@
// Information about the attached volume of the instance.
Volume os.Volume
+ // IP indicates the various IP addresses which allow access.
IP []string
+ // Indicates whether this instance is a replica of another source instance.
ReplicaOf *Instance `mapstructure:"replica_of" json:"replica_of"`
+ // Indicates whether this instance is the source of other replica instances.
Replicas []Instance
}
@@ -70,6 +73,7 @@
os.CreateResult
}
+// Extract will retrieve an instance from a create result.
func (r CreateResult) Extract() (*Instance, error) {
return commonExtract(r.Err, r.Body)
}
@@ -84,10 +88,13 @@
return commonExtract(r.Err, r.Body)
}
+// ConfigResult represents the result of getting default configuration for an
+// instance.
type ConfigResult struct {
gophercloud.Result
}
+// DetachResult represents the result of detaching a replica from its source.
type DetachResult struct {
gophercloud.ErrResult
}
@@ -114,6 +121,7 @@
gophercloud.ErrResult
}
+// ExtractInstances retrieves a slice of instances from a paginated collection.
func ExtractInstances(page pagination.Page) ([]Instance, error) {
casted := page.(os.InstancePage).Body