Finish DB docs for Rackspace
diff --git a/rackspace/db/v1/backups/requests.go b/rackspace/db/v1/backups/requests.go
index 9bcc25a..9170d78 100644
--- a/rackspace/db/v1/backups/requests.go
+++ b/rackspace/db/v1/backups/requests.go
@@ -7,18 +7,25 @@
"github.com/rackspace/gophercloud/pagination"
)
+// CreateOptsBuilder is the top-level interface for creating JSON maps.
type CreateOptsBuilder interface {
ToBackupCreateMap() (map[string]interface{}, error)
}
+// CreateOpts is responsible for configuring newly provisioned backups.
type CreateOpts struct {
+ // [REQUIRED] The name of the backup. The only restriction is the name must
+ // be less than 64 characters long.
Name string
+ // [REQUIRED] The ID of the instance being backed up.
InstanceID string
+ // [OPTIONAL] A human-readable explanation of the backup.
Description string
}
+// ToBackupCreateMap will create a JSON map for the Create operation.
func (opts CreateOpts) ToBackupCreateMap() (map[string]interface{}, error) {
if opts.Name == "" {
return nil, errors.New("Name is a required field")
@@ -39,6 +46,17 @@
return map[string]interface{}{"backup": backup}, nil
}
+// Create asynchronously creates a new backup for a specified database instance.
+// During the backup process, write access on MyISAM databases will be
+// temporarily disabled; innoDB databases will be unaffected. During this time,
+// you will not be able to add or delete databases or users; nor delete, stop
+// or reboot the instance itself. Only one backup is permitted at once.
+//
+// Backups are not deleted when database instances are deleted; you must
+// manually delete any backups created using Delete(). Backups are saved to your
+// Cloud Files account in a new container called z_CLOUDDB_BACKUPS. It is
+// strongly recommended you do not alter this container or its contents; usual
+// storage costs apply.
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
var res CreateResult
@@ -57,14 +75,18 @@
return res
}
+// ListOptsBuilder is the top-level interface for creating query strings.
type ListOptsBuilder interface {
ToBackupListQuery() (string, error)
}
+// ListOpts allows you to refine a list search by certain parameters.
type ListOpts struct {
+ // The type of datastore by which to filter.
Datastore string `q:"datastore"`
}
+// ToBackupListQuery converts a ListOpts struct into a query string.
func (opts ListOpts) ToBackupListQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
@@ -73,6 +95,7 @@
return q.String(), nil
}
+// List will list all the saved backups for all database instances.
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {
url := baseURL(client)
@@ -91,6 +114,7 @@
return pagination.NewPager(client, url, pageFn)
}
+// Get will retrieve details for a particular backup based on its unique ID.
func Get(client *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
@@ -102,6 +126,7 @@
return res
}
+// Delete will permanently delete a backup.
func Delete(client *gophercloud.ServiceClient, id string) DeleteResult {
var res DeleteResult