获取物理机交集网卡信息(GetCandidateNetworkInterfaces)
API请求
URLs
GET zstack/v1/cluster/hosts-network-interfacesHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cluster/hosts-network-interfaces?hostUuids=5712f3960ae23d24988f4e091bf5704f&slaveOnly=true&limit=1000&start=0参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| hostUuids | List | query | 物理机UUIDs | 4.7.0 | |
| limit (可选) | Integer | query | 4.7.0 | ||
| start (可选) | Integer | query | 4.7.0 | ||
| systemTags (可选) | List | body | 系统标签 | 4.7.0 | |
| userTags (可选) | List | body | 用户标签 | 4.7.0 | |
| slaveOnly (可选) | boolean | query | 仅获取slave网卡 | 4.7.11 |
API返回
返回示例
{
"slaveNames": [
"eth0",
"eth1"
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| slaveUuids | List | 网卡UUIDs | 4.7.0 |
| success | boolean | 4.7.0 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.7.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| description | String | 错误的概要描述 | 4.7.0 |
| details | String | 错误的详细信息 | 4.7.0 |
| elaboration | String | 保留字段,默认为null | 4.7.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.7.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.7.0 |
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.7.0 |
SDK示例
Java
SDK
GetCandidateNetworkInterfacesAction action = new GetCandidateNetworkInterfacesAction();
action.hostUuids = asList("5712f3960ae23d24988f4e091bf5704f");
action.slaveOnly = true;
action.limit = 1000;
action.start = 0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCandidateNetworkInterfacesAction.Result res = action.call();Python
SDK
GetCandidateNetworkInterfacesAction action = GetCandidateNetworkInterfacesAction()
action.hostUuids = [5712f3960ae23d24988f4e091bf5704f]
action.slaveOnly = true
action.limit = 1000
action.start = 0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCandidateNetworkInterfacesAction.Result res = action.call()