CreateVmNic
API Request
URLs
POST zstack/v1/nicsHeaders
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": {
"l3NetworkUuid": "cbb5d7cd7f51332cb18c124ea430863f"
},
"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":{"l3NetworkUuid":"cbb5d7cd7f51332cb18c124ea430863f"}}' http://localhost:8080/zstack/v1/nicsRequest Parameters
| Name | Type | Location | Description | Valid Value | Starting Version |
|---|---|---|---|---|---|
| l3NetworkUuid | String | body(contained in the params structure) | The L3 network UUID. | 4.0.0 | |
| ip | String | body(contained in the params structure) | Optional. | 4.0.0 | |
| resourceUuid | String | body(contained in the params structure) | Optional. | 4.0.0 | |
| systemTags | List | body | Optional. The system tags。 | 4.0.0 | |
| userTags | List | body | Optional. The user tags. | 4.0.0 |
API Response
Sample Response
{
"inventory": {
"uuid": "158c432596ab3418bbdd04583541d42d",
"usedIpUuid": "acfdb23e1b0e39e48b10ee02d10ed74f",
"l3NetworkUuid": "a1791966d2fd375bbb469dd0308d3be6",
"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"
}
}| 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.0.0 |
| inventory | VmInstanceInventory | See inventory. | 4.0.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.0.0 |
| description | String | The brief description of the error. | 4.0.0 |
| details | String | The details about the error. | 4.0.0 |
| elaboration | String | The reserved field. Default value: null. | 4.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.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.0.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The NIC UUID. | 4.0.0 |
| vmInstanceUuid | String | The VM instance UUID. | 4.0.0 |
| l3NetworkUuid | String | The L3 network UUID. | 4.0.0 |
| ip | String | The IP address of the NIC. | 4.0.0 |
| mac | String | The MAC address of the NIC. | 4.0.0 |
| hypervisorType | String | The virtualization type. | 4.0.0 |
| netmask | String | The netmask. | 4.0.0 |
| gateway | String | The gateway IP address. | 4.0.0 |
| metaData | String | 4.0.0 | |
| ipVersion | Integer | The IP version. | 4.0.0 |
| deviceId | Integer | The device ID. | 4.0.0 |
| type | String | The NIC type. | 4.0.0 |
| createDate | Timestamp | The time when the NIC was created. | 4.0.0 |
| lastOpDate | Timestamp | The time when the NIC was last modified. | 4.0.0 |
| usedIps | List | See usedIps | 4.0.0 |
#usedIps
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the IP address. | 4.0.0 |
| ipRangeUuid | String | The IP range UUID. | 4.0.0 |
| l3NetworkUuid | String | The L3 network UUID. | 4.0.0 |
| ipVersion | Integer | The IP version. | 4.0.0 |
| ip | String | The IP address. | 4.0.0 |
| netmask | String | The netmask of the IP address. | 4.0.0 |
| gateway | String | The gateway IP address. | 4.0.0 |
| usedFor | String | 4.0.0 | |
| ipInLong | long | 4.0.0 | |
| vmNicUuid | String | The NIC UUID. | 4.0.0 |
| createDate | Timestamp | The time when the IP address was used. | 4.0.0 |
| lastOpDate | Timestamp | The time when the IP address was last modified. | 4.0.0 |
SDK Sample
Java
SDK
CreateVmNicAction action = new CreateVmNicAction();
action.l3NetworkUuid = "cbb5d7cd7f51332cb18c124ea430863f";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmNicAction.Result res = action.call();Python
SDK
CreateVmNicAction action = CreateVmNicAction()
action.l3NetworkUuid = "cbb5d7cd7f51332cb18c124ea430863f"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmNicAction.Result res = action.call()