ChangeVmNicNetwork
API Request
URLs
POST zstack/v1/vm-instances/nics/{vmNicUuid}/l3-networks/{l3NetworkUuid}Headers
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/vm-instances/nics/1183a0462aa83243a659ff91326888fb/l3-networks/e46ab07103763f0dbd3e99af2e3be4b0Request Parameters
| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| vmNicUuid | String | url | The VM NIC UUID. | 4.1.0 | |
| destL3NetworkUuid | String | body (contained in the params structure) | 4.1.0 | ||
| systemTags | List | body | Optional. The system tags. | 4.1.0 | |
| userTags | List | body | Optional. The user tags. | 4.1.0 |
API Response
Sample Response
{
"inventory": {
"uuid": "9d4cdab9192b3de3b2495b1e326910c7",
"vmInstanceUuid": "0ae9a1992fb436a58e820bdcb4dd17c4",
"usedIpUuid": "c0c5860c05ce3e70b14b4f501fedff71",
"l3NetworkUuid": "9390346b3a8a3c829b05dbe30569390a",
"ip": "192.168.1.10",
"mac": "00:0c:29:bd:99:fc",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"deviceId": 0.0
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.1.0 |
| inventory | VmNicInventory | See inventory. | 4.1.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.1.0 |
| description | String | The brief description of the error. | 4.1.0 |
| details | String | The details about the error. | 4.1.0 |
| elaboration | String | The reserved field. Default value: null. | 4.1.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.1.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 4.1.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| vmInstanceUuid | String | The VM UUID. | 4.1.0 |
| l3NetworkUuid | String | The L3 network UUID. | 4.1.0 |
| ip | String | The IP address. | 4.1.0 |
| mac | String | The MAC address. | 4.1.0 |
| hypervisorType | String | The hypervisor type. | 4.1.0 |
| netmask | String | The netmask. | 4.1.0 |
| gateway | String | The gateway. | 4.1.0 |
| metaData | String | 4.1.0 | |
| ipVersion | Integer | The IP version. | 4.1.0 |
| deviceId | Integer | The device ID. | 4.1.0 |
| type | String | The NIC type. | 4.1.0 |
| createDate | Timestamp | The creation time. | 4.1.0 |
| lastOpDate | Timestamp | The last update time. | 4.1.0 |
| usedIps | List | See usedIps | 4.1.0 |
#usedIps
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 4.1.0 |
| ipRangeUuid | String | The IP range UUID. | 4.1.0 |
| l3NetworkUuid | String | The L3 network UUID. | 4.1.0 |
| ipVersion | Integer | The IP version. | 4.1.0 |
| ip | String | The IP address. | 4.1.0 |
| netmask | String | The netmask. | 4.1.0 |
| gateway | String | The gateway. | 4.1.0 |
| usedFor | String | 4.1.0 | |
| ipInLong | long | 4.1.0 | |
| vmNicUuid | String | The VM NIC UUID. | 4.1.0 |
| createDate | Timestamp | The creation time. | 4.1.0 |
| lastOpDate | Timestamp | The last update time. | 4.1.0 |
SDK Sample
Java
SDK
ChangeVmNicNetworkAction action = new ChangeVmNicNetworkAction();
action.vmNicUuid = "1183a0462aa83243a659ff91326888fb";
action.destL3NetworkUuid = "e46ab07103763f0dbd3e99af2e3be4b0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVmNicNetworkAction.Result res = action.call();Python
SDK
ChangeVmNicNetworkAction action = ChangeVmNicNetworkAction()
action.vmNicUuid = "1183a0462aa83243a659ff91326888fb"
action.destL3NetworkUuid = "e46ab07103763f0dbd3e99af2e3be4b0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeVmNicNetworkAction.Result res = action.call()