Mikko Valkonen | 20de780 | 2016-10-24 22:25:01 +0300 | [diff] [blame^] | 1 | package shares |
| 2 | |
| 3 | import ( |
| 4 | "github.com/gophercloud/gophercloud" |
| 5 | ) |
| 6 | |
| 7 | // Share contains all information associated with an OpenStack Share |
| 8 | type Share struct { |
| 9 | // The availability zone of the share |
| 10 | AvailabilityZone string `json:"availability_zone"` |
| 11 | // A description of the share |
| 12 | Description string `json:"description,omitempty"` |
| 13 | // DisplayDescription is inherited from BlockStorage API. |
| 14 | // Both Description and DisplayDescription can be used |
| 15 | DisplayDescription string `json:"display_description,omitempty"` |
| 16 | // DisplayName is inherited from BlockStorage API |
| 17 | // Both DisplayName and Name can be used |
| 18 | DisplayName string `json:"display_name,omitempty"` |
| 19 | // Indicates whether a share has replicas or not. |
| 20 | HasReplicas bool `json:"has_replicas"` |
| 21 | // The host name of the share |
| 22 | Host string `json:"host"` |
| 23 | // The UUID of the share |
| 24 | ID string `json:"id"` |
| 25 | // Indicates the visibility of the share |
| 26 | IsPublic bool `json:"is_public,omitempty"` |
| 27 | // Share links for pagination |
| 28 | Links []map[string]string `json:"links"` |
| 29 | // Key, value -pairs of custom metadata |
| 30 | Metadata map[string]string `json:"metadata,omitempty"` |
| 31 | // The name of the share |
| 32 | Name string `json:"name,omitempty"` |
| 33 | // The UUID of the project to which this share belongs to |
| 34 | ProjectID string `json:"project_id"` |
| 35 | // The share replication type |
| 36 | ReplicationType string `json:"replication_type,omitempty"` |
| 37 | // The UUID of the share network |
| 38 | ShareNetworkID string `json:"share_network_id"` |
| 39 | // The shared file system protocol |
| 40 | ShareProto string `json:"share_proto"` |
| 41 | // The UUID of the share server |
| 42 | ShareServerID string `json:"share_server_id"` |
| 43 | // The UUID of the share type. |
| 44 | ShareType string `json:"share_type"` |
| 45 | // The name of the share type. |
| 46 | ShareTypeName string `json:"share_type_name"` |
| 47 | // Size of the share in GB |
| 48 | Size int `json:"size"` |
| 49 | // UUID of the snapshot from which to create the share |
| 50 | SnapshotID string `json:"snapshot_id"` |
| 51 | // The share status |
| 52 | Status string `json:"status"` |
| 53 | // The task state, used for share migration |
| 54 | TaskState string `json:"task_state"` |
| 55 | // The type of the volume |
| 56 | VolumeType string `json:"volume_type,omitempty"` |
| 57 | // The UUID of the consistency group this share belongs to |
| 58 | ConsistencyGroupID string `json:"consistency_group_id"` |
| 59 | // Used for filtering backends which either support or do not support share snapshots |
| 60 | SnapshotSupport bool `json:"snapshot_support"` |
| 61 | SourceCgsnapshotMemberID string `json:"source_cgsnapshot_member_id"` |
| 62 | // Timestamp when the share was created |
| 63 | CreatedAt gophercloud.JSONRFC3339MilliNoZ `json:"created_at"` |
| 64 | } |
| 65 | |
| 66 | type commonResult struct { |
| 67 | gophercloud.Result |
| 68 | } |
| 69 | |
| 70 | // Extract will get the Share object from the commonResult |
| 71 | func (r commonResult) Extract() (*Share, error) { |
| 72 | var s struct { |
| 73 | Share *Share `json:"share"` |
| 74 | } |
| 75 | err := r.ExtractInto(&s) |
| 76 | return s.Share, err |
| 77 | } |
| 78 | |
| 79 | // CreateResult contains the result.. |
| 80 | type CreateResult struct { |
| 81 | commonResult |
| 82 | } |