blob: 65778e5434c8f8d96d446cf87097e10d63ba87f7 [file] [log] [blame]
feiskycf0c7fe2015-11-05 22:06:17 +08001package volumeactions
2
3import (
4 "github.com/mitchellh/mapstructure"
5 "github.com/rackspace/gophercloud"
6)
7
8type commonResult struct {
9 gophercloud.Result
10}
11
12// AttachResult contains the response body and error from a Get request.
13type AttachResult struct {
Jamie Hannaford531e0cc2016-05-13 13:03:39 +020014 gophercloud.ErrResult
feiskycf0c7fe2015-11-05 22:06:17 +080015}
16
17// DetachResult contains the response body and error from a Get request.
18type DetachResult struct {
Jamie Hannaford531e0cc2016-05-13 13:03:39 +020019 gophercloud.ErrResult
feiskycf0c7fe2015-11-05 22:06:17 +080020}
21
22// ReserveResult contains the response body and error from a Get request.
23type ReserveResult struct {
Jamie Hannaford531e0cc2016-05-13 13:03:39 +020024 gophercloud.ErrResult
feiskycf0c7fe2015-11-05 22:06:17 +080025}
26
27// UnreserveResult contains the response body and error from a Get request.
28type UnreserveResult struct {
Jamie Hannaford531e0cc2016-05-13 13:03:39 +020029 gophercloud.ErrResult
feiskycf0c7fe2015-11-05 22:06:17 +080030}
31
32// InitializeConnectionResult contains the response body and error from a Get request.
33type InitializeConnectionResult struct {
34 commonResult
35}
36
37// TerminateConnectionResult contains the response body and error from a Get request.
38type TerminateConnectionResult struct {
Jamie Hannaford531e0cc2016-05-13 13:03:39 +020039 gophercloud.ErrResult
feiskycf0c7fe2015-11-05 22:06:17 +080040}
41
42// Extract will get the Volume object out of the commonResult object.
43func (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{}
feiskycf0c7fe2015-11-05 22:06:17 +080049 err := mapstructure.Decode(r.Body, &res)
50
51 return res, err
52}