github.com/gophercloud/gophercloud@v1.11.0/openstack/compute/v2/extensions/remoteconsoles/results.go (about)

     1  package remoteconsoles
     2  
     3  import "github.com/gophercloud/gophercloud"
     4  
     5  type commonResult struct {
     6  	gophercloud.Result
     7  }
     8  
     9  // CreateResult represents the result of a create operation. Call its Extract
    10  // method to interpret it as a RemoteConsole.
    11  type CreateResult struct {
    12  	commonResult
    13  }
    14  
    15  // RemoteConsole represents the Compute service remote console object.
    16  type RemoteConsole struct {
    17  	// Protocol contains remote console protocol.
    18  	// You can use the RemoteConsoleProtocol custom type to unmarshal raw JSON
    19  	// response into the pre-defined valid console protocol.
    20  	Protocol string `json:"protocol"`
    21  
    22  	// Type contains remote console type.
    23  	// You can use the RemoteConsoleType custom type to unmarshal raw JSON
    24  	// response into the pre-defined valid console type.
    25  	Type string `json:"type"`
    26  
    27  	// URL can be used to connect to the remote console.
    28  	URL string `json:"url"`
    29  }
    30  
    31  // Extract interprets any commonResult as a RemoteConsole.
    32  func (r commonResult) Extract() (*RemoteConsole, error) {
    33  	var s struct {
    34  		RemoteConsole *RemoteConsole `json:"remote_console"`
    35  	}
    36  	err := r.ExtractInto(&s)
    37  	return s.RemoteConsole, err
    38  }