File: results.go

package info (click to toggle)
golang-github-gophercloud-gophercloud 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,416 kB
  • sloc: sh: 99; makefile: 21
file content (38 lines) | stat: -rw-r--r-- 1,126 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
35
36
37
38
package remoteconsoles

import "github.com/gophercloud/gophercloud"

type commonResult struct {
	gophercloud.Result
}

// CreateResult represents the result of a create operation. Call its Extract
// method to interpret it as a RemoteConsole.
type CreateResult struct {
	commonResult
}

// RemoteConsole represents the Compute service remote console object.
type RemoteConsole struct {
	// Protocol contains remote console protocol.
	// You can use the RemoteConsoleProtocol custom type to unmarshal raw JSON
	// response into the pre-defined valid console protocol.
	Protocol string `json:"protocol"`

	// Type contains remote console type.
	// You can use the RemoteConsoleType custom type to unmarshal raw JSON
	// response into the pre-defined valid console type.
	Type string `json:"type"`

	// URL can be used to connect to the remote console.
	URL string `json:"url"`
}

// Extract interprets any commonResult as a RemoteConsole.
func (r commonResult) Extract() (*RemoteConsole, error) {
	var s struct {
		RemoteConsole *RemoteConsole `json:"remote_console"`
	}
	err := r.ExtractInto(&s)
	return s.RemoteConsole, err
}