@@ -60,22 +60,18 @@ type Instance struct {
60
60
AllowedIPs []string `json:"allowed_ips,omitempty"`
61
61
}
62
62
63
- //"cpu_cores":1,"ram_mb":2048,"disk_gb":25
64
-
65
- // InstanceConsole represents a link to a webconsole for an instances
66
- type InstanceConsole struct {
67
- URL string `json:"url"`
68
- }
69
-
70
63
// InstanceVnc represents VNC information for an instances
71
64
type InstanceVnc struct {
72
65
URI string `json:"uri,omitempty"`
73
- Result string `json:"result,omitempty"`
74
- Name string `json:"name,omitempty"`
75
- Label string `json:"label,omitempty"`
76
66
Expiration string `json:"expiration,omitempty"`
77
67
}
78
68
69
+ // CreateInstanceVncResp represents VNC information for a new instance console
70
+ type CreateInstanceVncResp struct {
71
+ URI string `json:"uri,omitempty"`
72
+ Duration string `json:"duration,omitempty"`
73
+ }
74
+
79
75
// PaginatedInstanceList returns a paginated list of Instance object
80
76
type PaginatedInstanceList struct {
81
77
Page int `json:"page"`
@@ -291,7 +287,7 @@ func (c *Client) UpdateInstance(i *Instance) (*SimpleResponse, error) {
291
287
292
288
// GetInstanceVnc enables and gets the VNC information for an instance
293
289
// duration is optional and follows Go's duration string format (e.g. "30m", "1h", "24h")
294
- func (c * Client ) GetInstanceVnc (id string , duration ... string ) (InstanceVnc , error ) {
290
+ func (c * Client ) GetInstanceVnc (id string , duration ... string ) (CreateInstanceVncResp , error ) {
295
291
url := fmt .Sprintf ("/v2/instances/%s/vnc" , id )
296
292
if len (duration ) > 0 && duration [0 ] != "" {
297
293
url = fmt .Sprintf ("%s?duration=%s" , url , duration [0 ])
@@ -300,7 +296,7 @@ func (c *Client) GetInstanceVnc(id string, duration ...string) (InstanceVnc, err
300
296
resp , err := c .SendPutRequest (url , map [string ]string {
301
297
"region" : c .Region ,
302
298
})
303
- vnc := InstanceVnc {}
299
+ vnc := CreateInstanceVncResp {}
304
300
305
301
if err != nil {
306
302
return vnc , decodeError (err )
@@ -402,18 +398,6 @@ func (c *Client) StartInstance(id string) (*SimpleResponse, error) {
402
398
return response , err
403
399
}
404
400
405
- // GetInstanceConsoleURL gets the web URL for an instance's console
406
- func (c * Client ) GetInstanceConsoleURL (id string ) (string , error ) {
407
- resp , err := c .SendGetRequest (fmt .Sprintf ("/v2/instances/%s/console" , id ))
408
- if err != nil {
409
- return "" , decodeError (err )
410
- }
411
-
412
- console := InstanceConsole {}
413
- err = json .NewDecoder (bytes .NewReader (resp )).Decode (& console )
414
- return console .URL , err
415
- }
416
-
417
401
// UpgradeInstance resizes the instance up to the new specification
418
402
// it's not possible to resize the instance to a smaller size
419
403
func (c * Client ) UpgradeInstance (id , newSize string ) (* SimpleResponse , error ) {
0 commit comments