feature/shared file systems: create share (#119)
* sfs/add url for create
* sfs/results: add share type and result type
* sfs/requests: add CreateOpts and Create method
* sfs/tests: add tests for creating a share
* sfs/shares: fixes according to comments
* sfs/create: fix Metadata field naming in Share
diff --git a/openstack/sharedfilesystems/v2/shares/results.go b/openstack/sharedfilesystems/v2/shares/results.go
new file mode 100644
index 0000000..f303201
--- /dev/null
+++ b/openstack/sharedfilesystems/v2/shares/results.go
@@ -0,0 +1,82 @@
+package shares
+
+import (
+ "github.com/gophercloud/gophercloud"
+)
+
+// Share contains all information associated with an OpenStack Share
+type Share struct {
+ // The availability zone of the share
+ AvailabilityZone string `json:"availability_zone"`
+ // A description of the share
+ Description string `json:"description,omitempty"`
+ // DisplayDescription is inherited from BlockStorage API.
+ // Both Description and DisplayDescription can be used
+ DisplayDescription string `json:"display_description,omitempty"`
+ // DisplayName is inherited from BlockStorage API
+ // Both DisplayName and Name can be used
+ DisplayName string `json:"display_name,omitempty"`
+ // Indicates whether a share has replicas or not.
+ HasReplicas bool `json:"has_replicas"`
+ // The host name of the share
+ Host string `json:"host"`
+ // The UUID of the share
+ ID string `json:"id"`
+ // Indicates the visibility of the share
+ IsPublic bool `json:"is_public,omitempty"`
+ // Share links for pagination
+ Links []map[string]string `json:"links"`
+ // Key, value -pairs of custom metadata
+ Metadata map[string]string `json:"metadata,omitempty"`
+ // The name of the share
+ Name string `json:"name,omitempty"`
+ // The UUID of the project to which this share belongs to
+ ProjectID string `json:"project_id"`
+ // The share replication type
+ ReplicationType string `json:"replication_type,omitempty"`
+ // The UUID of the share network
+ ShareNetworkID string `json:"share_network_id"`
+ // The shared file system protocol
+ ShareProto string `json:"share_proto"`
+ // The UUID of the share server
+ ShareServerID string `json:"share_server_id"`
+ // The UUID of the share type.
+ ShareType string `json:"share_type"`
+ // The name of the share type.
+ ShareTypeName string `json:"share_type_name"`
+ // Size of the share in GB
+ Size int `json:"size"`
+ // UUID of the snapshot from which to create the share
+ SnapshotID string `json:"snapshot_id"`
+ // The share status
+ Status string `json:"status"`
+ // The task state, used for share migration
+ TaskState string `json:"task_state"`
+ // The type of the volume
+ VolumeType string `json:"volume_type,omitempty"`
+ // The UUID of the consistency group this share belongs to
+ ConsistencyGroupID string `json:"consistency_group_id"`
+ // Used for filtering backends which either support or do not support share snapshots
+ SnapshotSupport bool `json:"snapshot_support"`
+ SourceCgsnapshotMemberID string `json:"source_cgsnapshot_member_id"`
+ // Timestamp when the share was created
+ CreatedAt gophercloud.JSONRFC3339MilliNoZ `json:"created_at"`
+}
+
+type commonResult struct {
+ gophercloud.Result
+}
+
+// Extract will get the Share object from the commonResult
+func (r commonResult) Extract() (*Share, error) {
+ var s struct {
+ Share *Share `json:"share"`
+ }
+ err := r.ExtractInto(&s)
+ return s.Share, err
+}
+
+// CreateResult contains the result..
+type CreateResult struct {
+ commonResult
+}