mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-12 23:38:30 +08:00
27 lines
684 B
Go
27 lines
684 B
Go
package shell
|
|
|
|
import (
|
|
"yunion.io/x/jsonutils"
|
|
"yunion.io/x/onecloud/pkg/mcclient"
|
|
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
|
)
|
|
|
|
func init() {
|
|
type VNCConnectOptions struct {
|
|
ID string `help:"ID of server to connect"`
|
|
Baremetal bool `help:"Connect to baremetal"`
|
|
}
|
|
R(&VNCConnectOptions{}, "vnc-connect", "Show the VNC console of given server", func(s *mcclient.ClientSession, args *VNCConnectOptions) error {
|
|
params := jsonutils.NewDict()
|
|
if args.Baremetal {
|
|
params.Add(jsonutils.NewString("hosts"), "objtype")
|
|
}
|
|
result, err := modules.VNCProxy.DoConnect(s, args.ID, params)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
printObject(result)
|
|
return nil
|
|
})
|
|
}
|