分布式端口组相关接口

查询IP地址

GET/zstack/v1/l3-networks/ip-address
GET/zstack/v1/l3-networks/ip-address{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-address
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-address/87b2ab50f6c13ebb9dd73ca46bb22bc7

可查询字段

运行CLI命令行工具,输入QueryIpAddress并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例

{
  "inventories": [
    {
      "uuid": "3ccfbfd6bd483a5eaeabed00b284f4fc",
      "ipRangeUuid": "1b3a29978ea73f0db4ce8d8c2d0bd479",
      "l3NetworkUuid": "c11b366475f836078e5aa86469de2eef",
      "ipVersion": 4.0,
      "ip": "192.168.1.100",
      "netmask": "255.255.255.0",
      "gateway": "192.168.1.1",
      "ipInLong": 0.0,
      "vmNicUuid": "28e22f67b2893b208547333dfef7cfa8"
    }
  ]
}
名字类型描述起始版本
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考errot3.1.0
inventoriesList详情参考inventories3.1.0

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10013.1.0
descriptionString错误的概要描述3.1.0
detailsString错误的详细信息3.1.0
elaborationString保留字段,默认为null3.1.0
opaqueLinkedHashMap保留字段,默认为null3.1.0
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null3.1.0

inventories

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源3.1.0
ipRangeUuidStringIP段UUID3.1.0
l3NetworkUuidString分布式端口组UUID3.1.0
ipVersionIntegerIP协议号3.1.0
ipStringIP地址3.1.0
netmaskString网络掩码3.1.0
gatewayString网关地址3.1.0
usedForString 3.1.0
ipInLonglong 3.1.0
vmNicUuidString虚拟机网卡UUID3.1.0
createDateTimestamp创建时间3.1.0
lastOpDateTimestamp最后一次修改时间3.1.0

SDK示例

Java SDK

QueryIpAddressAction action = new QueryIpAddressAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryIpAddressAction.Result res = action.call();

Python SDK

QueryIpAddressAction action = QueryIpAddressAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryIpAddressAction.Result res = action.call()