SetVmStaticIp
API Request
URLs
PUT zstack/v1/vm-instances/{vmInstanceUuid}/actionsHeaders
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.
{
"setVmStaticIp": {
"l3NetworkUuid": "61e66d487dff454f9509a1f19606d274",
"ip": "192.168.10.10"
},
"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 PUT -d '{"setVmStaticIp":{"l3NetworkUuid":"9fcbd78edb58391f8d9b879ea87598fd","ip":"192.168.10.10"}}' http://localhost:8080/zstack/v1/vm-instances/e3749802228a36038d0e17041414fd17/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | The VM instance UUID. | 0.6 | |
| l3NetworkUuid | String | body (contained in the setVmStaticIp structure) | The L3 network UUID. | 0.6 | |
| ip | String | body (contained in the setVmStaticIp structure) | The specified IP address. | 0.6 | |
| ip6 | String | body (contained in the setVmStaticIp structure) | Optional. The specified IPv6 address. | 3.10.0 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes an error field. For
example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
Java
SDK
SetVmStaticIpAction action = new SetVmStaticIpAction();
action.vmInstanceUuid = "ba40d9c668384207bf297e36a5b687d5";
action.l3NetworkUuid = "016dbda9a11a4f679378845052422164";
action.ip = "192.168.10.10";
action.sessionId = "3c5be55dcf2d4885b32f46e7711603e1";
SetVmStaticIpAction.Result res = action.call();Python
SDK
SetVmStaticIpAction action = SetVmStaticIpAction()
action.vmInstanceUuid = "b8472643ebe34e7dab186b8df4e0f930"
action.l3NetworkUuid = "c5ba309fd4e24be1a406b1c9e203e637"
action.ip = "192.168.10.10"
action.sessionId = "6f1fb28af50a438783d971f195629ed9"
SetVmStaticIpAction.Result res = action.call()