获取云主机控制台地址和访问协议(GetVmConsoleAddress)
API请求
URLs
GET zstack/v1/vm-instances/{uuid}/console-addressesHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json" \
-H "Authorization: OAuth 5c66c9a616334283b055d150680fff98" \
-X GET http://localhost:8080/zstack/v1/vm-instances/bf2211ae8eaf408b817d3a05c19e2226/console-addresses参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 云主机UUID | 0.6 | |
| systemTags (可选) | List | query | 系统标签 | 0.6 | |
| userTags (可选) | List | query | 用户标签 | 0.6 |
API返回
返回示例
{
"hostIp": "192.168.10.100",
"port": 5900.0,
"protocol": "vnc",
"vdiPortInfo": {
"vncPort": 5900.0
}
}
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| hostIp | String | 云主机运行物理机IP | 0.6 |
| port | int | 云主机控制台端口 | 0.6 |
| protocol | String | 云主机控制台协议,vnc或spice或vncAndSpice | 0.6 |
| success | boolean | 操作是否成功 | 0.6 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。详情参考error | 0.6 |
| vdiPortInfo | vdiPortInfo | 详情参考vdiPortInfo | 3.7.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
#vdiPortInfo
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| vncPort | Integer | vnc端口号 | 3.7.0 |
| spicePort | Integer | spice端口号 | 3.7.0 |
| spiceTlsPort | Integer | spice开启Tls加密,会存在spiceTlsPort和spicePort两个端口号,通过spice客户端连接云主机需要使用spiceTlsPort端口号 | 3.7.0 |
SDK示例
Java
SDK
GetVmConsoleAddressAction action = new GetVmConsoleAddressAction();
action.uuid = "d6bb8b652c1445969b5c4227385956d3";
action.sessionId = "1c0ec00749234a96978591d641e0c64d";
GetVmConsoleAddressAction.Result res = action.call();Python
SDK
GetVmConsoleAddressAction action = GetVmConsoleAddressAction()
action.uuid = "f6b7fe2da3ae4c929ad1c8ed14f37c8e"
action.sessionId = "5f127b3df90245ed93ef9da531442fdc"
GetVmConsoleAddressAction.Result res = action.call()