弹性IP相关接口
创建弹性IP(CreateEip)
API请求
URLs
POST zstack/v1/eipsHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "Test-EIP",
"vipUuid": "7fdf1752627948afb2418f93825c478b",
"vmNicUuid": "be5532b08b7a48949667b654468dc5a5"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c0bd88f213cf42bc8b8fd42d1b269d50" \
-X POST -d '{"params":{"name":"Test-EIP","vipUuid":"f1b1901cefa939d7bf5775ec71735637","vmNicUuid":"bb64d3fc676b3b5cbdf0d768eb7d05a1"}}' \
http://localhost:8080/zstack/v1/eips
参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) | 弹性IP名称 | 0.6 | |
| description (可选) | String | body(包含在params结构中) | 弹性IP的详细描述 | 0.6 | |
| vipUuid | String | body(包含在params结构中) | VIP UUID | 0.6 | |
| vmNicUuid (可选) | String | body(包含在params结构中) | 云主机网卡UUID | 0.6 | |
| usedIpUuid (可选) | String | body(包含在params结构中) | IP地址Uuid | 3.1.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID。若指定,云主机会使用该字段值作为UUID | 0.6 | |
| systemTags (可选) | List | body | EIP的系统标签 | 0.6 | |
| userTags (可选) | List | body | EIP的用户标签 | 0.6 |
API返回
返回示例
{
"inventory": {
"name": "Test-EIP",
"vmNicUuid": "07f9715b85da40d9bd17e5f4277304bd",
"vipUuid": "acc6dc9271f54e58ab94e4a1069bc7e5"
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| name | String | 资源名称 | 0.6 |
| description | String | 资源的详细描述 | 0.6 |
| vmNicUuid | String | 云主机网卡UUID | 0.6 |
| vipUuid | String | VIP UUID | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| state | String | 0.6 | |
| vipIp | String | 0.6 | |
| guestIp | String | 0.6 |
SDK示例
Java
SDK
CreateEipAction action = new CreateEipAction();
action.name = "Test-EIP";
action.vipUuid = "a600144228904c709d9d36a7d8e7bc50";
action.vmNicUuid = "c6ef3b3fc5c54033ad07514e3ee71199";
action.sessionId = "284027438a4e46d4abb185a30eaac6ff";
CreateEipAction.Result res = action.call();Python
SDK
CreateEipAction action = CreateEipAction()
action.name = "Test-EIP"
action.vipUuid = "8e6507f39d6f40479f48a974a9d6afd2"
action.vmNicUuid = "91ad47c708e140fd83348182a3f098a6"
action.sessionId = "9bdd3970d72144c8899edb0158a4ed6d"
CreateEipAction.Result res = action.call()删除弹性IP(DeleteEip)
API请求
URLs
DELETE/v1/eips/{uuid}?deleteMode={deleteMode}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 45ccb9eb4add405d9059fb45990a6e8c" \
-X DELETE http://localhost:8080/zstack/v1/eips/468cb75384344acd87f22610d07080e5?deleteMode=Permissive
参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 弹性IP的UUID,唯一标示该资源 | 0.6 | |
| deleteMode (可选) | String | body | 删除模式 | 0.6 | |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
DeleteEipAction action = new DeleteEipAction();
action.uuid = "7ff634c9d79c48ca976a34ce53951c76";
action.deleteMode = "Permissive";
action.sessionId = "44b7b711d77b4dfa91257db5b9a61585";
DeleteEipAction.Result res = action.call();Python
SDK
DeleteEipAction action = DeleteEipAction()
action.uuid = "e0699e3693ea429180371be5ca95e49e"
action.deleteMode = "Permissive"
action.sessionId = "ee71c70ee83a4ef8876f86d3876dbc8f"
DeleteEipAction.Result res = action.call()查询弹性IP(QueryEip)
API请求
URLs
GET zstack/v1/eips
GET zstack/v1/eips/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth ecbf8328397545a890cb7f299016ff65" \
-X GET http://localhost:8080/zstack/v1/eipscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 58e98c60b171447b8c1940b5a8a1ad0f" \
-X GET http://localhost:8080/zstack/v1/eips/66803656d159456dacda9c074945e40d可查询字段
运行CLI命令行工具,输入QueryEip并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"name": "Test-EIP",
"vmNicUuid": "67dfb04014b64489addb9ff7db5c7eb8",
"vipUuid": "e5bafce543e044419a8ffad7d416201e"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 0.6 |
| inventories | List | 详情参考inventories | 0.6 |
#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 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| name | String | 资源名称 | 0.6 |
| description | String | 资源的详细描述 | 0.6 |
| vmNicUuid | String | 云主机网卡UUID | 0.6 |
| vipUuid | String | VIP UUID | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| state | String | 0.6 | |
| vipIp | String | 0.6 | |
| guestIp | String | 0.6 |
SDK示例
Java SDK
QueryEipAction action = new QueryEipAction();
action.conditions = asList();
action.sessionId = "02a7bb80af0a43ea8cecb01e8361f4a3";
QueryEipAction.Result res = action.call();
Python
SDK
QueryEipAction action = QueryEipAction()
action.conditions = []
action.sessionId = "84b2e52f0e2a41d09b428627b6266f28"
QueryEipAction.Result res = action.call()更新弹性IP(UpdateEip)
API请求
URLs
PUT zstack/v1/eips/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateEip": {
"name": "Test-EIP"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 48675e997cc24705a248f756bd4c617c" \
-X PUT -d '{"updateEip":{"name":"Test-EIP"}}' \
http://localhost:8080/zstack/v1/eips/4d153a67262f341cbb4d5351ec844ab7/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 弹性IP的UUID,唯一标示该资源 | 0.6 | |
| name (可选) | String | body(包含在updateEip结构中) | 弹性IP名称 | 0.6 | |
| description (可选) | String | body(包含在updateEip结构中) | 弹性IP的详细描述 | 0.6 | |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
API返回
返回示例
{
"inventory": {
"name": "Test-EIP",
"vmNicUuid": "cb1779456b2e47ecb436385e9731fa92",
"vipUuid": "b092230e024e4d4bab4f8919ee6b4848"
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| name | String | 资源名称 | 0.6 |
| description | String | 资源的详细描述 | 0.6 |
| vmNicUuid | String | 云主机网卡UUID | 0.6 |
| vipUuid | String | VIP UUID | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| state | String | 0.6 | |
| vipIp | String | 0.6 | |
| guestIp | String | 0.6 |
SDK示例
Java
SDK
UpdateEipAction action = new UpdateEipAction();
action.uuid = "81ab4053a9484332b8e1aafa7e00a399";
action.name = "Test-EIP";
action.sessionId = "08c50da7ac034e6f9461785af2f94a7e";
UpdateEipAction.Result res = action.call();Python
SDK
UpdateEipAction action = UpdateEipAction()
action.uuid = "e510fba3a1c646559d1db59f9b37c751"
action.name = "Test-EIP"
action.sessionId = "2d0aff43d9fe4294b16069f6762d0832"
UpdateEipAction.Result res = action.call()更改弹性IP启用状态(ChangeEipState)
API请求
URLs
PUT zstack/v1/eips/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"changeEipState": {
"stateEvent": "enable"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth ba708ad93aa54eb696ea994d412d539a" \
-X PUT -d '{"changeEipState":{"stateEvent":"enable"}}' \
http://localhost:8080/zstack/v1/eips/e6c715aaa65c39aa948d88e548a5f044/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 弹性IP的UUID,唯一标示该资源 | 0.6 | |
| stateEvent | String | body(包含在changeEipState结构中) | 状态事件 |
|
0.6 |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
API返回
返回示例
{
"inventory": {
"name": "Test-EIP",
"vmNicUuid": "8384e17c064a4b3f819421beb695891d",
"vipUuid": "4ab30bbbf55f4bcda38acd573335d6d7",
"state": "Enabled"
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| name | String | 资源名称 | 0.6 |
| description | String | 资源的详细描述 | 0.6 |
| vmNicUuid | String | 云主机网卡UUID | 0.6 |
| vipUuid | String | VIP UUID | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| state | String | 0.6 | |
| vipIp | String | 0.6 | |
| guestIp | String | 0.6 |
SDK示例
Java
SDK
ChangeEipStateAction action = new ChangeEipStateAction();
action.uuid = "ae4f106e8e884788bf73ee2e863a2ad3";
action.stateEvent = "enable";
action.sessionId = "c35fc61e1a784c41a17cb9a0fe9cd2a5";
ChangeEipStateAction.Result res = action.call();Python
SDK
ChangeEipStateAction action = ChangeEipStateAction()
action.uuid = "b5b5cd464d2d48cca37352fb904e5226"
action.stateEvent = "enable"
action.sessionId = "17f673d897dc47fb845c48fba7af7942"
ChangeEipStateAction.Result res = action.call()获取可绑定指定弹性IP的云主机网卡(GetEipAttachableVmNics)
API请求
URLs
GET zstack/v1/eips/{eipUuid}/vm-instances/candidate-nicsHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth dd4a7d40a7e246879ea53fff9fb6dc02" \
-X GET http://localhost:8080/zstack/v1/eips/6bd0a6a4e5dd4f618ff314289acc112f/vm-instances/candidate-nics参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| eipUuid (可选) | String | url | 弹性IP UUID | 0.6 | |
| vipUuid (可选) | String | query | VIP UUID | 0.6 | |
| systemTags (可选) | List | query | 系统标签 | 0.6 | |
| userTags (可选) | List | query | 用户标签 | 0.6 |
API返回
返回示例
{
"inventories": [
{
"uuid": "b9d15f91920738cb9c1d3d54c543da87",
"vmInstanceUuid": "426e0bf3909c3049be70e9f621d69cae",
"usedIpUuid": "74f3ce37130c386f8b79d1656285a41b",
"l3NetworkUuid": "cad25a3e482d39e8b428a4f25db07b41",
"ip": "192.168.1.10",
"mac": "00:0c:29:bd:99:fc",
"hypervisorType": "KVM",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"deviceId": 0.0,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 0.6 |
| inventories | List | 详情参考inventories | 0.6 |
#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 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| vmInstanceUuid | String | 云主机UUID | 0.6 |
| l3NetworkUuid | String | 三层网络UUID | 0.6 |
| ip | String | 0.6 | |
| mac | String | 0.6 | |
| netmask | String | 0.6 | |
| gateway | String | 0.6 | |
| metaData | String | 0.6 | |
| ipVersion | Integer | ip协议号 | 3.1.0 |
| deviceId | Integer | 0.6 | |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| usedIps | List | 详情参考usedIps | 0.6 |
#usedIps
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| ipRangeUuid | String | IP段UUID | 0.6 |
| l3NetworkUuid | String | 三层网络UUID | 0.6 |
| ipVersion | Integer | IP协议号 | 3.1.0 |
| ip | String | IP地址 | 0.6 |
| netmask | String | 网络掩码 | 0.6 |
| gateway | String | 网关地址 | 0.6 |
| usedFor | String | 0.6 | |
| ipInLong | long | 0.6 | |
| vmNicUuid | String | 云主机网卡UUID | 3.1.0 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
SDK示例
Java
SDK
GetEipAttachableVmNicsAction action = new GetEipAttachableVmNicsAction();
action.eipUuid = "281f3fe6c8bc42d7a2b7911db8bc8a9b";
action.sessionId = "05d5744919984e6680655fcfc85e6dd9";
GetEipAttachableVmNicsAction.Result res = action.call();Python
SDK
GetEipAttachableVmNicsAction action = GetEipAttachableVmNicsAction()
action.eipUuid = "998c40730b1b4dd19ca464d7d30f432c"
action.sessionId = "7682cccdd2c74324b1a82232cd730657"
GetEipAttachableVmNicsAction.Result res = action.call()获取vmNic可绑定的EIp(GetVmNicAttachableEips)
API请求
URLs
GET zstack/vm-instances/nics/{vmNicUuid}/candidate-eipsHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth dd4a7d40a7e246879ea53fff9fb6dc02" \
-X GET http://localhost:8080/zstack/v1/vm-instances/nics/9d11dc19607c32cda7268c0655e117fc/candidate-eips?limit=1000.0&start=0.0参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| vmNicUuid | String | url | 云主机网卡UUID | 4.4.6 | |
| ipVersion (可选) | Integer | query | IP地址版本 |
|
4.4.6 |
| limit (可选) | Integer | query | 统计结果数量 | 4.4.6 | |
| start (可选) | Integer | query | 起始查询记录位置 | 4.4.6 | |
| systemTags (可选) | List | query | 系统标签 | 4.4.6 | |
| userTags (可选) | List | query | 用户标签 | 4.4.6 |
API返回
返回示例
{
"inventories": [
{
"uuid": "fe174df8c1003e3a9f13aa73104f45ee",
"name": "eip",
"vmNicUuid": "d29fb63d5aba4bbf98ec8663d6b4ba21",
"vipUuid": "a5cfe85eb0d7448fbe153360c52114ce",
"createDate": "Nov 14, 2017 9:20:57 AM",
"lastOpDate": "Nov 14, 2017 9:20:57 AM",
"state": "Enable",
"vipIp": "10.72.109.11",
"guestIp": "172.168.1.1"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 4.4.6 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.4.6 |
| inventories | List | 详情参考inventories | 4.4.6 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.4.6 |
| description | String | 错误的概要描述 | 4.4.6 |
| details | String | 错误的详细信息 | 4.4.6 |
| elaboration | String | 保留字段,默认为null | 4.4.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.4.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.4.6 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.4.6 |
| name | String | 资源名称 | 4.4.6 |
| description | String | 资源的详细描述 | 4.4.6 |
| vmNicUuid | String | 云主机网卡UUID | 4.4.6 |
| vipUuid | String | VIP UUID | 4.4.6 |
| createDate | Timestamp | 创建时间 | 4.4.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.4.6 |
| state | String | 4.4.6 | |
| vipIp | String | 4.4.6 | |
| guestIp | String | 4.4.6 |
SDK示例
Java
SDK
GetVmNicAttachableEipsAction action = new GetVmNicAttachableEipsAction();
action.vmNicUuid = "9d11dc19607c32cda7268c0655e117fc";
action.limit = 1000.0;
action.start = 0.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVmNicAttachableEipsAction.Result res = action.call();Python
SDK
GetVmNicAttachableEipsAction action = GetVmNicAttachableEipsAction()
action.vmNicUuid = "9d11dc19607c32cda7268c0655e117fc"
action.limit = 1000.0
action.start = 0.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVmNicAttachableEipsAction.Result res = action.call()绑定弹性IP(AttachEip)
API请求
URLs
POST zstack/v1/eips/{eipUuid}/vm-instances/nics/{vmNicUuid}Headers
Authorization: OAuth the-session-uuidBody
{
"params": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/eips/b7b3d87e803434f3b597638377830e68/vm-instances/nics/3fb731573096397c90dbe65781d5b616参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| eipUuid | String | url | 弹性IP UUID | 0.6 | |
| vmNicUuid | String | body | 云主机网卡UUID | 0.6 | |
| usedIpUuid (可选) | String | body(包含在params结构中) | IP地址Uuid | 3.1.0 | |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK示例
Java
SDK
AttachEipAction action = new AttachEipAction();
action.eipUuid = "dfee2872f32f4eab81cce8be02d564f7";
action.vmNicUuid = "77439a0f6c464053937fdfc12531647e";
action.sessionId = "80a49201196649f296e8b1c3b03d2284";
AttachEipAction.Result res = action.call();Python
SDK
AttachEipAction action = AttachEipAction()
action.eipUuid = "080064a02ea9470a9364bdc255c1cfa6"
action.vmNicUuid = "e255a04227b94b5181eda063e1f8b17a"
action.sessionId = "beebaac6f3fe4ac99db525f8775b5a61"
AttachEipAction.Result res = action.call()解绑弹性IP(DetachEip)
API请求
URLs
DELETE/v1/eips/{uuid}/vm-instances/nicsHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 7e5d824e15c64e1ca2fc3eca9e315c41" \
-X DELETE http://localhost:8080/zstack/v1/eips/6e1a3bdbe38045658546a6b7fb3df990/vm-instances/nics?参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 弹性IP的UUID,唯一标示该资源 | 0.6 | |
| systemTags (可选) | List | body | 系统标签 | 0.6 | |
| userTags (可选) | List | body | 用户标签 | 0.6 |
API返回
返回示例
{
"inventory": {
"name": "Test-EIP",
"vmNicUuid": "04c0bc3e4c1d44c8aac1fd2e1be10d81",
"vipUuid": "8284fce519774899a3ba01e304df6c3b"
}
}#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 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| name | String | 资源名称 | 0.6 |
| description | String | 资源的详细描述 | 0.6 |
| vmNicUuid | String | 云主机网卡UUID | 0.6 |
| vipUuid | String | VIP UUID | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| state | String | 0.6 | |
| vipIp | String | 0.6 | |
| guestIp | String | 0.6 |
SDK示例
Java
SDK
DetachEipAction action = new DetachEipAction();
action.uuid = "9a8c75df80524b13adf769626703efc0";
action.sessionId = "e7b6f5ef6d134d058e7d85e3ccd226a8";
DetachEipAction.Result res = action.call();Python SDK
DetachEipAction action = DetachEipAction()
action.uuid = "28ddb9165c1444a7a7aa5119a5ceb926"
action.sessionId = "47e371f392934e3f8edbc49031fcf376"
DetachEipAction.Result res = action.call()
