block storage v1 comments
diff --git a/openstack/blockstorage/v1/volumes/results.go b/openstack/blockstorage/v1/volumes/results.go
index 7bf83a5..78c863f 100644
--- a/openstack/blockstorage/v1/volumes/results.go
+++ b/openstack/blockstorage/v1/volumes/results.go
@@ -9,28 +9,39 @@
"github.com/mitchellh/mapstructure"
)
+// Volume contains all the information associated with an OpenStack Volume.
type Volume struct {
- Status string `mapstructure:"status"`
- Name string `mapstructure:"display_name"`
- Attachments []string `mapstructure:"attachments"`
- AvailabilityZone string `mapstructure:"availability_zone"`
- Bootable string `mapstructure:"bootable"`
- CreatedAt string `mapstructure:"created_at"`
- Description string `mapstructure:"display_discription"`
- VolumeType string `mapstructure:"volume_type"`
- SnapshotID string `mapstructure:"snapshot_id"`
- SourceVolID string `mapstructure:"source_volid"`
- Metadata map[string]string `mapstructure:"metadata"`
- ID string `mapstructure:"id"`
- Size int `mapstructure:"size"`
+ Status string `mapstructure:"status"` // current status of the Volume
+ Name string `mapstructure:"display_name"` // display name
+ Attachments []string `mapstructure:"attachments"` // instances onto which the Volume is attached
+ AvailabilityZone string `mapstructure:"availability_zone"` // logical group
+ Bootable string `mapstructure:"bootable"` // is the volume bootable
+ CreatedAt string `mapstructure:"created_at"` // date created
+ Description string `mapstructure:"display_discription"` // display description
+ VolumeType string `mapstructure:"volume_type"` // see VolumeType object for more information
+ SnapshotID string `mapstructure:"snapshot_id"` // ID of the Snapshot from which the Volume was created
+ SourceVolID string `mapstructure:"source_volid"` // ID of the Volume from which the Volume was created
+ Metadata map[string]string `mapstructure:"metadata"` // user-defined key-value pairs
+ ID string `mapstructure:"id"` // unique identifier
+ Size int `mapstructure:"size"` // size of the Volume, in GB
}
-// ListResult is a *http.Response that is returned from a call to the List function.
+// CreateResult contains the response body and error from a Create request.
+type CreateResult struct {
+ commonResult
+}
+
+// GetResult contains the response body and error from a Get request.
+type GetResult struct {
+ commonResult
+}
+
+// ListResult is a pagination.pager that is returned from a call to the List function.
type ListResult struct {
pagination.SinglePageBase
}
-// IsEmpty returns true if a ListResult contains no container names.
+// IsEmpty returns true if a ListResult contains no Volumes.
func (r ListResult) IsEmpty() (bool, error) {
volumes, err := ExtractVolumes(r)
if err != nil {
@@ -39,7 +50,7 @@
return len(volumes) == 0, nil
}
-// ExtractVolumes extracts and returns the Volumes from a 'List' request.
+// ExtractVolumes extracts and returns Volumes. It is used while iterating over a volumes.List call.
func ExtractVolumes(page pagination.Page) ([]Volume, error) {
var response struct {
Volumes []Volume `json:"volumes"`
@@ -49,11 +60,16 @@
return response.Volumes, err
}
+// UpdateResult contains the response body and error from an Update request.
+type UpdateResult struct {
+ commonResult
+}
+
type commonResult struct {
gophercloud.CommonResult
}
-// ExtractVolume extracts and returns the Volume from a 'Get' request.
+// Extract will get the Volume object out of the commonResult object.
func (r commonResult) Extract() (*Volume, error) {
if r.Err != nil {
return nil, r.Err
@@ -69,14 +85,3 @@
}
return res.Volume, nil
}
-
-type GetResult struct {
- commonResult
-}
-
-type CreateResult struct {
- commonResult
-}
-type UpdateResult struct {
- commonResult
-}