All Products
Search
Document Center

Cloud Firewall:AddControlPolicy

Last Updated:Mar 19, 2024

Creates an access control policy.

Operation description

You can call the AddControlPolicy operation to create an access control policy to allow, block, or monitor traffic that reaches 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.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
yundun-cloudfirewall:AddControlPolicyWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
SourceIpdeprecatedstringNo

The source IP address of the request.

192.0.XX.XX
LangstringNo

The language of the content within the request and response. Valid values:

  • zh: Chinese (default)
  • en: English
zh
AclActionstringYes

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

  • accept: allows the traffic.
  • drop: denies the traffic.
  • log: monitors the traffic.
accept
ApplicationNamestringNo

The application type supported by the access control policy. Valid values:

  • FTP
  • HTTP
  • HTTPS
  • Memcache
  • MongoDB
  • MQTT
  • MySQL
  • RDP
  • Redis
  • SMTP
  • SMTPS
  • SSH
  • SSL_No_Cert
  • SSL
  • VNC
  • ANY
Note The value of this parameter is based on the value of Proto. If Proto is set to TCP, you can set ApplicationName to any valid value. If Proto is set to UDP, ICMP, or ANY, you can set ApplicationName only to ANY. You must specify at least one of the ApplicationNameList and ApplicationName parameters.
ANY
DescriptionstringYes

The description of the access control policy.

Allows traffic
DestPortstringNo

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

  • If Proto is set to ICMP, DestPort is automatically left 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, DestPort is empty.
Note If DestPortType is set to group, you do not need to specify the destination port number. All ports on which the access control policy takes effect 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.
80
DestinationstringYes

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.XX.XX/24

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

    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"]

192.0.XX.XX/24
DestinationTypestringYes

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

  • net: CIDR block
  • group: address book
  • domain: domain name
  • location: location
net
DirectionstringYes

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

  • in: inbound traffic
  • out: outbound traffic
in
ProtostringYes

The protocol type supported by the access control policy. Valid values:

  • ANY
  • TCP
  • UDP
  • ICMP
ANY
SourcestringYes

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.XX.XX/24

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

    Example: db_group

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

    Example: ["BJ11", "ZB"]

192.0.XX.XX/24
SourceTypestringYes

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

  • net: CIDR block
  • group: address book
  • location: location
net
NewOrderstringYes

The priority of the access control policy. The priority value starts from 1. A smaller priority value indicates a higher priority.

1
DestPortTypestringNo

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

Valid values:

  • port: port
  • group: port address book
port
DestPortGroupstringNo

The name of 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.
my_port_group
ReleasestringNo

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

  • true: enables the access control policy.
  • false: disables the access control policy.
true
IpVersionstringNo

The IP version supported by the access control policy.

Valid values:

  • 4: IPv4
  • 6: IPv6
6
ApplicationNameListarrayNo

The application types supported by the access control policy.

stringNo

The application type supported by the access control policy. Valid values:

  • FTP
  • HTTP
  • HTTPS
  • Memcache
  • MongoDB
  • MQTT
  • MySQL
  • RDP
  • Redis
  • SMTP
  • SMTPS
  • SSH
  • SSL_No_Cert
  • SSL
  • VNC
  • ANY
Note The value of this parameter is based on the value of Proto. If Proto is set to TCP, you can set ApplicationNameList to any valid value in the ["HTTP","HTTPS",……] format. If Proto is set to UDP, ICMP, or ANY, you can set ApplicationNameList only to ANY. You must specify at least one of the ApplicationNameList and ApplicationName parameters. If you specify both ApplicationNameList and ApplicationName, only the value of ApplicationNameList takes effect.
["ANY"]
RepeatTypestringNo

The recurrence type for the access control policy to take effect. Valid values:

  • Permanent (default): The policy always takes effect.
  • None: The policy takes effect for only once.
  • Daily: The policy takes effect on a daily basis.
  • Weekly: The policy takes effect on a weekly basis.
  • Monthly: The policy takes effect on a monthly basis.
Permanent
RepeatDaysarrayNo

The days of a week or of a month on which the access control policy takes effect.

  • If you set RepeatType to Permanent, None, or Daily, leave this parameter empty. Example: [].
  • If you set RepeatType to Weekly, you must specify this parameter. Example: [0, 6].
Note If you set RepeatType to Weekly, the fields in the value of this parameter cannot be repeated.
  • If you set RepeatType to Monthly, you must specify this parameter. Example: [1, 31].
Note If you set RepeatType to Monthly, the fields in the value of this parameter cannot be repeated.
longNo

The day of a week or of a month on which the access control policy takes effect.

Note If you set RepeatType to Weekly, valid values of this parameter are 0 to 6. Each week starts from Sunday. If you set RepeatType to Monthly, valid values of this parameter are 1 to 31.
1
RepeatStartTimestringNo

The point in time when the recurrence starts. Example: 08:00. The start time must be on the hour or on the half hour, and at least 30 minutes earlier than the end time.

Note If you set RepeatType to Permanent or None, leave this parameter empty. If you set RepeatType to Daily, Weekly, or Monthly, you must specify this parameter.
08:00
RepeatEndTimestringNo

The point in time when the recurrence ends. Example: 23:30. The end time must be on the hour or on the half hour, and at least 30 minutes later than the start time.

Note If you set RepeatType to Permanent or None, leave this parameter empty. If you set RepeatType to Daily, Weekly, or Monthly, you must specify this parameter.
23:30
StartTimelongNo

The time when the access control policy starts to take effect. The value is a UNIX timestamp. Unit: seconds. The value must be on the hour or on the half hour, and at least 30 minutes earlier than the end time.

Note If you set RepeatType to Permanent, leave this parameter empty. If you set RepeatType to None, Daily, Weekly, or Monthly, you must specify this parameter.
1694761200
EndTimelongNo

The time when the access control policy stops taking effect. The value is a UNIX timestamp. Unit: seconds. The value must be on the hour or on the half hour, and at least 30 minutes later than the start time.

Note If you set RepeatType to Permanent, leave this parameter empty. If you set RepeatType to None, Daily, Weekly, or Monthly, you must specify this parameter.
1694764800

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 the Chinese mainland): ZC
  • Europe: EU
  • Africa: AF
  • North America: NA
  • South America: LA
  • Oceania: OA
  • Antarctica: AQ

Response parameters

ParameterTypeDescriptionExample
object
AclUuidstring

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

00281255-d220-4db1-8f4f-c4df221ad84c
RequestIdstring

The ID of the request.

CBF1E9B7-D6A0-4E9E-AD3E-2B47E6C2837D

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400ErrorAclExtendedCountExceedacl or expand acl count exceed-
400ErrorAddressCountExceedThe maximum number of addresses is exceeded.The maximum number of address is exceeded.
400ErrorParametersSourceThe source is invalid.The source is invalid.
400ErrorDomainResolveAn error occurred while resolving the domain.An error occurred while resolving the domain.
400ErrorParametersDirectionThe direction is invalid.The direction is invalid.
400ErrorDBSelectAn error occurred while querying database.An error occurred while querying database.
400ErrorParameterIpVersionThe IP version is invalid.The IP version is invalid.
400ErrorParametersDestinationThe Destination parameter is invalid.The Destination parameter is invalid.
400ErrorParametersProtoThe protocol is invalid.The protocol is invalid.
400ErrorParametersDestPortThe dst_port is invalid.The dst_port is invalid.
400ErrorParametersActionThe action is invalid.The action is invalid.
400ErrorParametersUidThe aliUid parameter is invalid.The aliUid parameter is invalid.
400ErrorParametersAppIdThe AppId parameter is incorrect.The AppId parameter is invalid.
400ErrorAclDomainAnyCountExceedThe number of resolved domain names cannot exceed 200. ACL configuration can be continued for HTTP, HTTPS, SMTP, SMTPS, and SSL applications.The domain name is resolved to more than 200 IP addresses. We recommend that you set Application in your access control policy to HTTPS, HTTPS, SMTP, SMTPS, or SSL.
400ErrorParametersGroupPortThe group port is invalid.The group port is invalid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-10-12The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: RepeatType
    Added Input Parameters: RepeatDays
    Added Input Parameters: RepeatStartTime
    Added Input Parameters: RepeatEndTime
    Added Input Parameters: StartTime
    Added Input Parameters: EndTime