AddVmNicToSecurityGroup

API Request

URLs
POST zstack/v1/security-groups/{securityGroupUuid}/vm-instances/nics
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"vmNicUuids": [
"8432b2608a8a4f639cc56a8c65ee42ef"
    ]
  },
"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":{"vmNicUuids":["c37875cec7133f41adbeb336cdd33ef8"]}}' \
http://localhost:8080/zstack/v1/security-groups/f52566f939f635629a43cd3e27f78dd9/vm-instances/nics
Request Parameters
Name Type Location Description Optional Value Starting Version
securityGroupUuid String url The security group UUID. 0.6
vmNicUuids List body (contained in the params structure) The VM NIC UUID list. 0.6
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
AddVmNicToSecurityGroupAction action = new AddVmNicToSecurityGroupAction();
action.securityGroupUuid = "b651075ffcac475c91d3edaa5e9ade75";
action.vmNicUuids = asList("ff0f6c13311b46ddb186a95c0d18350a");
action.sessionId = "605fca0559284eff95d78e418508ff2f";
AddVmNicToSecurityGroupAction.Result res = action.call();
Python SDK
AddVmNicToSecurityGroupAction action = AddVmNicToSecurityGroupAction()
action.securityGroupUuid = "2da1519b9b39451e8742aadaa9241952"
action.vmNicUuids = [bda4ceec2917426cb9ee20b3bcb20653]
action.sessionId = "863d503abfbc4334846d67c1eac375f9"
AddVmNicToSecurityGroupAction.Result res = action.call()