forked from docs/doc-exports
Reviewed-by: Sarda, Priya <prsarda@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: Qin Ying, Fan <fanqinying@huawei.com> Co-committed-by: Qin Ying, Fan <fanqinying@huawei.com>
16 KiB
16 KiB
Associating Multiple NIC Ports to or Disassociating Them from a Security Group at a Time
Function
This API is used to associate multiple NIC ports to or disassociate them from a specified security group at a time.
Restrictions
- A maximum of 20 ports can be associated to or disassociated from a security group at a time. Therefore, the ports can contain a maximum of 20 values.
- No error message is displayed if a port is repeatedly associated with a security group.
URI
POST /v2.0/{project_id}/security-groups/{security_group_id}/instance/action
Table 1 describes the parameters.
Request Message
- Request parameter
Table 2 Request parameter Parameter
Mandatory
Type
Description
ports
Yes
Array of Port objects
Specifies the port list. A maximum of 20 ports are supported. For details, see Table 3.
action
Yes
String
Specifies the operation. The value can be add (associate) or remove (disassociate). The values are case-insensitive.
- Example request
POST https://{Endpoint}/v1/{project_id}/security-groups/0c4a2336-b036-4fa2-bc3c-1a291ed4c431/instance/action { "ports": [ { "id": "b9ac5247-c4ca-4c9b-b8fa-7d19132e560a" }, { "id": "aa2f8625-0042-4627-a05c-61500b604cc3" } ], "action": "add" }
Response Message
- Response parameter
- Example normal response 1
- Example normal response 2Some NIC ports fail to be associated to or disassociated from a security group at a time.
{ "fail": [ { "id": "99d9d709-8478-4b46-9f3f-2206b1023fd3", "error_code": "VPC.0608", "error_msg": "{\"NeutronError\":{\"message\":\"Port 99d9d709-8478-4b46-9f3f-2206b1023fd3 could not be found.\",\"type\":\"PortNotFound\",\"detail\":\"\"}}" }, { "id": "aa2f8625-0042-4627-a05c-61500b604cc3", "error_code": "VPC.0607", "error_msg": "An instance must belong to at least one security group" } ] }
- Example abnormal response
{ "code": "VPC.0606", "message": "Request is invalid" }
Status Code
See Status Codes.
Error Code
See Error Codes.
Parent topic: Security Group