分布式端口组相关接口

获取空闲IP

GET/zstack/v1/l3-networks/ip/free
GET zstack/v1/l3-networks/{l3NetworkUuid}/ip/free
GET zstack/v1/l3-networks/ip-ranges/{ipRangeUuid}/ip/free

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/free?l3NetworkUuid=c8cd63a1882331a9a5ee83e5d9b265ec&ipRangeUuid=10fc8508fd723e63bcc57b8bb6d7a133&limit=100.0
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/c8cd63a1882331a9a5ee83e5d9b265ec/ip/free?l3NetworkUuid=c8cd63a1882331a9a5ee83e5d9b265ec&ipRangeUuid=10fc8508fd723e63bcc57b8bb6d7a133&limit=100.0
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/l3-networks/ip-ranges/10fc8508fd723e63bcc57b8bb6d7a133/ip/free?l3NetworkUuid=c8cd63a1882331a9a5ee83e5d9b265ec&ipRangeUuid=10fc8508fd723e63bcc57b8bb6d7a133&limit=100.0

参数列表

名字

类型

位置

描述

可选值

起始版本

l3NetworkUuid (可选)

String

query

分布式端口组UUIDNote: l3NetworkUuid和ipRangeUuid二选一

 

0.6

ipRangeUuid (可选)

String

query

IP段UUIDNote: l3NetworkUuid和ipRangeUuid二选一

 

0.6

start (可选)

String

query

起始值

 

0.6

ipRangeType (可选)

String

query

地址类型

  • Normal
  • AddressPool

3.9.0

ipVersion (可选)

Integer

query

IP地址版本号

  • 4
  • 6

3.10.0

limit (可选)

int

query

数量限制

 

0.6

systemTags (可选)

List

query

系统标签

 

0.6

userTags (可选)

List

query

用户标签

 

0.6

API返回

返回示例

{
  "inventories": [
    {
      "ipRangeUuid": "662d600a4b644f98a0c49df2e5430d69",
      "ip": "10.20.10.5",
      "netmask": "255.255.255.0",
      "gateway": "10.20.10.1"
    },
    {
      "ipRangeUuid": "662d600a4b644f98a0c49df2e5430d69",
      "ip": "10.20.10.6",
      "netmask": "255.255.255.0",
      "gateway": "10.20.10.1"
    },
    {
      "ipRangeUuid": "662d600a4b644f98a0c49df2e5430d69",
      "ip": "10.20.10.10",
      "netmask": "255.255.255.0",
      "gateway": "10.20.10.1"
    }
  ]
}
名字类型描述起始版本
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error0.6
inventoryL3NetworkInventory详情参考inventory0.6

error

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

inventory

名字类型描述起始版本
ipRangeUuidStringIP段UUID0.6
ipString 0.6
netmaskString 0.6
gatewayString 0.6

SDK示例

Java SDK

GetFreeIpAction action = new GetFreeIpAction();
action.l3NetworkUuid = "c8cd63a1882331a9a5ee83e5d9b265ec";
action.ipRangeUuid = "10fc8508fd723e63bcc57b8bb6d7a133";
action.limit = 100.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetFreeIpAction.Result res = action.call();

Python SDK

GetFreeIpAction action = GetFreeIpAction()
action.l3NetworkUuid = "c8cd63a1882331a9a5ee83e5d9b265ec"
action.ipRangeUuid = "10fc8508fd723e63bcc57b8bb6d7a133"
action.limit = 100.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetFreeIpAction.Result res = action.call()