更新主机Kernel适配器
Headers
Authorization: OAuth the-session-uuidBody
{
"updateHostKernelInterface": {
"name": "test2",
"description": "test2-descrption",
"requiredIp": "172.16.100.100",
"netmask": "255.255.255.0",
"trafficTypes": [
"Management"
]
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateHostKernelInterface":{"name":"test2","description":"test2-descrption","requiredIp":"172.16.100.100","netmask":"255.255.255.0","trafficTypes":["Management"]}}' http://localhost:8080/zstack/v1/l2-networks/kernel-interfaces/6a57407c26ed39838c25650452da1526/actions参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
uuid | String | url | 资源的UUID,唯一标示该资源 |
| 4.1.0 |
name | String | body(包含在 | 资源名称 |
| 4.1.0 |
description (可选) | String | body(包含在 | 资源的详细描述 |
| 4.1.0 |
requiredIp (可选) | String | body(包含在 | 请求的IP |
| 4.1.0 |
netmask (可选) | String | body(包含在 | 网络掩码 |
| 4.1.0 |
trafficTypes (可选) | List | body(包含在 | 流量类型 |
| 4.1.0 |
systemTags (可选) | List | body | 系统标签 |
| 4.1.0 |
userTags (可选) | List | body | 用户标签 |
| 4.1.0 |
API返回
返回示例
{
"inventory": {
"uuid": "d8704bf64eb3387c9eaddd22c28258ed",
"name": "test-kernel",
"description": "test-kernel",
"hostUuid": "925a0c209777387e92203118f48359d0",
"l2NetworkUuid": "e36292d8f0d4366f88224b5c725927f7",
"l3NetworkUuid": "981959800846388e8e3be6bf91a85d01",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 4.1.0 | |
| inventory | HostKernelInterfaceInventory | 详情参考inventory | 4.1.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.1.0 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.1.0 |
| name | String | 资源名称 | 4.1.0 |
| description | String | 资源的详细描述 | 4.1.0 |
| hostUuid | String | 主机UUID | 4.1.0 |
| l2PortGroupUuid | String | 端口组UUID | 4.1.0 |
| l3NetworkUuid | String | 分布式端口组UUID | 4.1.0 |
| usedIps | List | IP配置 | 4.1.0 |
| trafficTypes | List | 流量类型 | 4.1.0 |
| createDate | Timestamp | 创建时间 | 4.1.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.1.0 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.1.0 |
| description | String | 错误的概要描述 | 4.1.0 |
| details | String | 错误的详细信息 | 4.1.0 |
| elaboration | String | 保留字段,默认为null | 4.1.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.1.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.1.0 |
SDK示例
Java SDK
UpdateHostKernelInterfaceAction action = new UpdateHostKernelInterfaceAction();
action.uuid = "6a57407c26ed39838c25650452da1526";
action.name = "test2";
action.description = "test2-descrption";
action.requiredIp = "172.16.100.100";
action.netmask = "255.255.255.0";
action.trafficTypes = asList("Management");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateHostKernelInterfaceAction.Result res = action.call();Python SDK
UpdateHostKernelInterfaceAction action = UpdateHostKernelInterfaceAction()
action.uuid = "6a57407c26ed39838c25650452da1526"
action.name = "test2"
action.description = "test2-descrption"
action.requiredIp = "172.16.100.100"
action.netmask = "255.255.255.0"
action.trafficTypes = [Management]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateHostKernelInterfaceAction.Result res = action.call()