All Products
Search
Document Center

Cloud Firewall:CreateNatFirewallControlPolicy

Last Updated:Sep 02, 2024

Creates an access control policy for a NAT firewall.

Operation description

You can call this operation to create a policy that allows, denies, or monitors the traffic that passes through the NAT firewall.

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:CreateNatFirewallControlPolicycreate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
LangstringNo

The language of the content within the 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.
log
ApplicationNameListarrayYes

The application types supported by the access control policy.

stringYes

The application type supported by the access control policy.

ANY
DescriptionstringYes

The description of the access control policy.

allow
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.

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

XX.XX.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
net
NatGatewayIdstringYes

The ID of the NAT gateway.

ngx-xxxxxxx
ProtostringYes

The protocol type in the access control policy.

Valid values:

  • ANY: all types of protocols.
  • TCP
  • UDP
  • ICMP
Note If the destination address is a threat intelligence address book of the domain name type or a cloud service address book, you can set Proto only to TCP and set ApplicationNameList to HTTP, HTTPS, SMTP, SMTPS, or SSL.
ANY
SourcestringYes

The source address in the access control policy.

Valid values:

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

    Example: 10.2.4.0/24

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

    Example: db_group

192.168.0.25/32
SourceTypestringYes

The type of the source address in the access control policy.

Valid values:

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

The priority of the access control policy. The priority value starts from 1. A small priority value indicates a high 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 it is created. Valid values:

  • true
  • false
true
DomainResolveTypeintegerNo

The domain name resolution method of the access control policy. Valid values:

  • 0: fully qualified domain name (FQDN)-based resolution
  • 1: Domain Name System (DNS)-based dynamic resolution
  • 2: FQDN and DNS-based dynamic resolution
0
IpVersionstringNo

The IP version supported by the access control policy. Valid values:

  • 4: IPv4 (default)
4
DirectionstringYes

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

  • out: outbound.
out
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 RepeatType is set to Permanent, None, or Daily, RepeatDays is left empty. Example: [].
  • If RepeatType is set to Weekly, RepeatDays must be specified. Example: [0, 6].
Note If RepeatType is set to Weekly, the fields in the value of RepeatDays cannot be repeated.
  • If RepeatType is set to Monthly, RepeatDays must be specified. Example: [1, 31].
Note If RepeatType is set to Monthly, the fields in the value of RepeatDays cannot be repeated.
longNo

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

Note If RepeatType is set to Weekly, valid values of this parameter are 0 to 6. Each week starts from Sunday. If RepeatType is set 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 value must be on the hour or on the half hour, and at least 30 minutes earlier than the value of RepeatEndTime.

Note If RepeatType is set to Permanent or None, RepeatStartTime is left empty. If RepeatType is set to Daily, Weekly, or Monthly, this parameter must be specified.
08:00
RepeatEndTimestringNo

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

Note If RepeatType is set to Permanent or None, RepeatEndTime is left empty. If RepeatType is set to Daily, Weekly, or Monthly, this parameter must be specified.
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 value of EndTime.

Note If RepeatType is set to Permanent, StartTime is left empty. If RepeatType is set to None, Daily, Weekly, or Monthly, this parameter must be specified.
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 value of StartTime.

Note If RepeatType is set to Permanent, EndTime is left empty. If RepeatType is set to None, Daily, Weekly, or Monthly, this parameter must be specified.
1694764800

Response parameters

ParameterTypeDescriptionExample
object
AclUuidstring

The unique ID of the access control policy.

Note To modify an access control policy, you must specify the unique ID of the policy. You can call the DescribeNatFirewallControlPolicy operation to obtain the ID.
6504d2fb-ab36-49c3-92a6-822a56549783
RequestIdstring

The request ID.

0DC783F1-B3A7-578D-8A63-687CC9B82C0A

Examples

Sample success responses

JSONformat

{
  "AclUuid": "6504d2fb-ab36-49c3-92a6-822a56549783",
  "RequestId": "0DC783F1-B3A7-578D-8A63-687CC9B82C0A"
}

Error codes

HTTP status codeError codeError messageDescription
400ErrorParametersUidThe aliUid parameter is invalid.The aliUid parameter is invalid.
400ErrorUUIDNewThe UUID is invalid.The UUID is invalid.
400ErrorParametersSourceThe source is invalid.The source 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.
400ErrorParametersAppIdThe AppId parameter is incorrect.The AppId parameter is invalid.
400ErrorDBSelectAn error occurred while querying database.An error occurred while querying database.
400ErrorParametersA parameter error occurred.A parameter error occurred.
400ErrorAddressCountExceedThe maximum number of addresses is exceeded.The maximum number of address is exceeded.
400ErrorParametersNewOrderThe newOrder is invalid.The newOrder is invalid.
400ErrorDBInsertAn error occurred while performing an insert operation in the database.An error occurred while performing an insert operation in the database.
400ErrorDBDeleteAn error occurred while deleting the database.An error occurred while deleting the database.
400ErrorRecordLogAn error occurred while updating the operation log.An error occurred while updating the operation log.
400ErrorParametersDestinationCountExceeding the number of countries in a single ACL.Exceeds the number of selected areas for one ACL. It is recommended to split it into multiple ACLs.

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

Change history

Change timeSummary of changesOperation
2024-08-22The Error code has changedView Change Details
2024-03-13The Error code has changedView Change Details
2023-10-12The Error code has changed. The request parameters of the API has changedView Change Details