jrperritt | c5c590a | 2016-11-04 14:41:15 -0500 | [diff] [blame^] | 1 | package imagedata |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "io" |
| 6 | |
| 7 | "github.com/gophercloud/gophercloud" |
| 8 | ) |
| 9 | |
| 10 | // UploadResult is the result of an upload image operation |
| 11 | type UploadResult struct { |
| 12 | gophercloud.ErrResult |
| 13 | } |
| 14 | |
| 15 | // DownloadResult is the result of a download image operation |
| 16 | type DownloadResult struct { |
| 17 | gophercloud.Result |
| 18 | } |
| 19 | |
| 20 | // Extract builds images model from io.Reader |
| 21 | func (r DownloadResult) Extract() (io.Reader, error) { |
| 22 | if r, ok := r.Body.(io.Reader); ok { |
| 23 | return r, nil |
| 24 | } |
| 25 | return nil, fmt.Errorf("Expected io.Reader but got: %T(%#v)", r.Body, r.Body) |
| 26 | } |