feisky | cf0c7fe | 2015-11-05 22:06:17 +0800 | [diff] [blame] | 1 | package volumeactions |
| 2 | |
| 3 | import ( |
| 4 | "github.com/mitchellh/mapstructure" |
| 5 | "github.com/rackspace/gophercloud" |
| 6 | ) |
| 7 | |
| 8 | type commonResult struct { |
| 9 | gophercloud.Result |
| 10 | } |
| 11 | |
| 12 | // AttachResult contains the response body and error from a Get request. |
| 13 | type AttachResult struct { |
| 14 | commonResult |
| 15 | } |
| 16 | |
| 17 | // DetachResult contains the response body and error from a Get request. |
| 18 | type DetachResult struct { |
| 19 | commonResult |
| 20 | } |
| 21 | |
| 22 | // ReserveResult contains the response body and error from a Get request. |
| 23 | type ReserveResult struct { |
| 24 | commonResult |
| 25 | } |
| 26 | |
| 27 | // UnreserveResult contains the response body and error from a Get request. |
| 28 | type UnreserveResult struct { |
| 29 | commonResult |
| 30 | } |
| 31 | |
| 32 | // InitializeConnectionResult contains the response body and error from a Get request. |
| 33 | type InitializeConnectionResult struct { |
| 34 | commonResult |
| 35 | } |
| 36 | |
| 37 | // TerminateConnectionResult contains the response body and error from a Get request. |
| 38 | type TerminateConnectionResult struct { |
| 39 | commonResult |
| 40 | } |
| 41 | |
| 42 | // Extract will get the Volume object out of the commonResult object. |
| 43 | func (r commonResult) Extract() (map[string]interface{}, error) { |
| 44 | if r.Err != nil { |
| 45 | return nil, r.Err |
| 46 | } |
| 47 | |
| 48 | var res map[string]interface{} |
| 49 | |
| 50 | err := mapstructure.Decode(r.Body, &res) |
| 51 | |
| 52 | return res, err |
| 53 | } |