File: results.go

package info (click to toggle)
golang-github-gophercloud-gophercloud 0.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, bullseye-backports
  • size: 10,224 kB
  • sloc: sh: 125; makefile: 21
file content (34 lines) | stat: -rw-r--r-- 821 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package imagedata

import (
	"io"

	"github.com/gophercloud/gophercloud"
)

// UploadResult is the result of an upload image operation. Call its ExtractErr
// method to determine if the request succeeded or failed.
type UploadResult struct {
	gophercloud.ErrResult
}

// StageResult is the result of a stage image operation. Call its ExtractErr
// method to determine if the request succeeded or failed.
type StageResult struct {
	gophercloud.ErrResult
}

// DownloadResult is the result of a download image operation. Call its Extract
// method to gain access to the image data.
type DownloadResult struct {
	gophercloud.Result
	Body io.ReadCloser
}

// Extract builds images model from io.Reader
func (r DownloadResult) Extract() (io.ReadCloser, error) {
	if r.Err != nil {
		return nil, r.Err
	}
	return r.Body, nil
}