Associates a network access control list (ACL) with a vSwitch.

Usage notes

  • The AssociateNetworkAcl operation is asynchronous. After you send the request, the system returns a request ID. However, the operation is still being performed in the system background. You can call the DescribeNetworkAclAttributes operation to query the status of a network ACL:
    • If the network ACL is in the BINDING state, the network ACL is being associated.
    • If the network ACL is in the BINDED state, the network ACL is associated.
  • You cannot repeatedly call the AssociateNetworkAcl operation to associate a network ACL within the specified period of time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Resource.N.ResourceType String Yes VSwitch

The type of resource with which you want to associate the network ACL. Set the value to VSwitch.

Valid values of N: 0 to 29. You can associate a network ACL with up to 30 vSwitches.

Resource.N.ResourceId String Yes vsw-bp1de348lntdw****

The ID of the resource with which you want to associate the network ACL.

NetworkAclId String Yes nacl-a2do9e413e0sp****

The ID of the network ACL.

RegionId String Yes cn-hangzhou

The region ID of the network ACL. You can call the DescribeRegions operation to query the most recent region list.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the value, but you must make sure that it is unique among all requests. ClientToken can contain only ASCII characters.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId may be different for each API request.
Action String Yes AssociateNetworkAcl

The operation that you want to perform. Set the value to AssociateNetworkAcl.

Response parameters

Parameter Type Example Description
RequestId String 4CF20CC7-D1FC-425B-A15B-DF7C8E2131A7

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Resource=[{"ResourceType":"VSwitch","ResourceId":"vsw-bp1de348lntdw****"}]
&NetworkAclId=nacl-a2do9e413e0sp****
&RegionId=cn-hangzhou
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&Action=AssociateNetworkAcl
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AssociateNetworkAclResponse>
    <RequestId>4CF20CC7-D1FC-425B-A15B-DF7C8E2131A7</RequestId>
</AssociateNetworkAclResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "4CF20CC7-D1FC-425B-A15B-DF7C8E2131A7"
}

Error codes

HttpCode Error code Error message Description
400 InvalidNetworkAcl.NotFound The special Network Acl is not found. The error message returned because the network ACL is not found.
400 InvalidResource.BindingExist The binding instance has been binded. The error message returned because the instance is already in the Associated state.
500 InternalError The request processing has failed due to some unknown error. The error message returned because some unknown errors occurred.

For a list of error codes, see Service error codes.