Creates an access control policy.

Description

You can call the AddControlPolicy operation to create an access control policy to allow, deny, or monitor traffic that passes through Cloud Firewall.

Limits

You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.

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
Action String Yes AddControlPolicy

The operation that you want to perform.

Set the value to AddControlPolicy.

AclAction String Yes accept

The action that Cloud Firewall performs on the traffic. Valid values:

  • accept: allows the traffic.
  • drop: denies the traffic.
  • log: monitors the traffic.
ApplicationName String Yes HTTP

The type of the application that the access control policy supports. Valid values:

  • FTP
  • HTTP
  • HTTPS
  • Memcache
  • MongoDB
  • MQTT
  • MySQL
  • RDP
  • Redis
  • SMTP
  • SMTPS
  • SSH
  • SSL
  • VNC
  • ANY: all types of applications
Note The value of this parameter depends on the value of the Proto parameter. If Proto is set to TCP, ApplicationName can be set to any valid value. If Proto is set to UDP, ICMP, or ANY, you can set ApplicationName only to ANY.
Description String Yes Allow all TCP traffic.

The description of the access control policy.

Destination String Yes 192.0.XX.XX/24

The destination address in the access control policy.

Valid values:

  • If DestinationType is set to net, the value of this parameter is a CIDR block.

    Example: 1.2.X.0/24.

  • If DestinationType is set to group, the value of this parameter is an address book.

    Example: db_group.

  • If DestinationType is set to domain, the value of this parameter is a domain name.

    Example: *.aliyuncs.com.

  • If DestinationType is set to location, the value of this parameter is a location.

    Example: ["BJ11", "ZB"].

DestinationType String Yes net

The type of the destination address in the access control policy. Valid values:

  • net: destination CIDR block
  • group: destination address book
  • domain: destination domain name
  • location: destination location
Direction String Yes in

The direction of the traffic to which the access control policy applies. Valid values:

  • in: inbound traffic
  • out: outbound traffic
NewOrder String Yes -1

The priority of the access control policy. The priority value starts from 1. A small priority value indicates a high priority.

Note The value -1 indicates the lowest priority.
Proto String Yes TCP

The type of the protocol in the access control policy. Valid values:

  • ANY: any protocol type
  • TCP
  • UDP
  • ICMP
Source String Yes 192.0.XX.XX/24

The source address in the access control policy. Valid values:

  • If SourceType is set to net, the value of this parameter is a CIDR block.

    Example:1.1.X.0/24.

  • If SourceType is set to group, the value of this parameter is an address book.

    Example: db_group.

  • If SourceType is set to location, the value of this parameter is a location.

    Example: ["BJ11", "ZB"].

SourceType String Yes net

The type of the source address book in the access control policy. Valid values:

  • net: source CIDR block
  • group: source address book
  • location: source location
SourceIp String No 192.0.XX.XX

The source IP address of the request.

Lang String No zh

The natural language of the request and response. Valid values:

  • zh: Chinese
  • en: English
DestPort String No 80

The destination port in the access control policy. Valid values:

  • If Proto is set to ICMP, the value of DestPort is empty.
    Note If Proto is set to ICMP, access control does not take effect on the destination port.
  • If Proto is set to TCP, UDP, or ANY and DestPortType is set to group, the value of DestPort is empty.
Note If DestPortType is set to group, you do not need to specify the destination port number. All ports that the access control policy controls are included in the destination port address book.
  • If Proto is set to TCP, UDP, or ANY and DestPortType is set to port, the value of DestPort is the destination port number.
DestPortType String No port

The type of the destination port in the access control policy.

Valid values:

  • port: port
  • group: port address book
DestPortGroup String No my_port_group

The destination port address book in the access control policy.

Note If DestPortType is set to group, you must specify the name of the destination port address book.
Release String No true

Specifies whether the access control policy is enabled. By default, an access control policy is enabled after it is created. Valid values:

  • true: The access control policy is enabled.
  • false: The access control policy is disabled.
IpVersion String No 6

The IP version of the address in the access control policy.

Valid values:

  • 4: IPv4
  • 6: IPv6

Location codes:

  • China: ZD
  • Beijing: BJ11
  • Tianjin: TJ12
  • Hebei: HB13
  • Shanxi: SX14
  • Liaoning: LN21
  • Jilin: JL22
  • Shanghai: SH31
  • Jiangsu: JS32
  • Zhejiang: ZJ33
  • Anhui: AH34
  • Fujian: FJ35
  • Jiangxi: JX36
  • Shandong: SD37
  • Henan: HN41
  • Hubei: HB42
  • Hunan: HN43
  • Guangdong: GD44
  • Hainan: HN46
  • Chongqing: CQ50
  • Sichuan: SC51
  • Guizhou: GZ52
  • Yunnan: YN53
  • Shaanxi: SX61
  • Gansu: GS62
  • Qinghai: QH63
  • Heilongjiang: HLJ23
  • Xizang: XZ54
  • Guangxi: GX45
  • Nei Mongol: NMG15
  • Ningxia: NX64
  • Xinjiang: XJ65
  • Taiwan (China): TW
  • Hong Kong (China): HK
  • Macao (China): MO
  • Locations outside China: ZB
  • Asia (except mainland China):ZC
  • Europe: EU
  • Africa: AF
  • North America: NA
  • South America: LA
  • Oceania: OA
  • Antarctica: AQ

Response parameters

Parameter Type Example Description
AclUuid String 00281255-d220-4db1-8f4f-c4df221ad84c

The ID of the access control policy that is created on the Internet firewall.

RequestId String CBF1E9B7-D6A0-4E9E-AD3E-2B47E6C2837D

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AddControlPolicy
&AclAction=accept
&ApplicationName=ANY
&Description=demo_rule_1
&Destination=1.2.X.0/24
&DestinationType=net
&Direction=in
&NewOrder=-1
&Proto=TCP
&Source=1.1.X.X/24
&SourceType=net
&<Common request parameters>|

Sample success responses

XML format

<AddControlPolicyResponse>
      <RequestId>CBF1E9B7-D6A0-4E9E-AD3E-2B47E6C2837D</RequestId>
      <AclUuid>00281255-d220-4db1-8f4f-c4df221ad84c</AclUuid>
</AddControlPolicyResponse>

JSON format

{
    "RequestId": "CBF1E9B7-D6A0-4E9E-AD3E-2B47E6C2837D",
    "AclUuid": "00281255-d220-4db1-8f4f-c4df221ad84c"
}