Finish DB docs for Rackspace
diff --git a/rackspace/db/v1/backups/results.go b/rackspace/db/v1/backups/results.go
index 402fc86..b6a5f17 100644
--- a/rackspace/db/v1/backups/results.go
+++ b/rackspace/db/v1/backups/results.go
@@ -7,6 +7,19 @@
"github.com/rackspace/gophercloud/rackspace/db/v1/datastores"
)
+// Status represents the various states a Backup can be in.
+type Status string
+
+// Enum types for the status.
+const (
+ StatusNew Status = "NEW"
+ StatusBuilding Status = "BUILDING"
+ StatusCompleted Status = "COMPLETED"
+ StatusFailed Status = "FAILED"
+ StatusDeleteFailed Status = "DELETE_FAILED"
+)
+
+// Backup represents a Backup API resource.
type Backup struct {
Description string
ID string
@@ -15,24 +28,32 @@
Name string
ParentID string `json:"parent_id" mapstructure:"parent_id"`
Size float64
- Status string
+ Status Status
Created string
Updated string
Datastore datastores.DatastorePartial
}
+// CreateResult represents the result of a create operation.
type CreateResult struct {
commonResult
}
+// GetResult represents the result of a get operation.
type GetResult struct {
commonResult
}
+// DeleteResult represents the result of a delete operation.
+type DeleteResult struct {
+ gophercloud.ErrResult
+}
+
type commonResult struct {
gophercloud.Result
}
+// Extract will retrieve a Backup struct from an operation's result.
func (r commonResult) Extract() (*Backup, error) {
if r.Err != nil {
return nil, r.Err
@@ -46,10 +67,7 @@
return &response.Backup, err
}
-type DeleteResult struct {
- gophercloud.ErrResult
-}
-
+// BackupPage represents a page of backups.
type BackupPage struct {
pagination.SinglePageBase
}
@@ -63,6 +81,7 @@
return len(is) == 0, nil
}
+// ExtractBackups will retrieve a slice of Backup structs from a paginated collection.
func ExtractBackups(page pagination.Page) ([]Backup, error) {
casted := page.(BackupPage).Body