All Products
Search
Document Center

Smart Access Gateway:AddDnatEntry

Last Updated:Mar 03, 2024

Adds a destination network address translation (DNAT) entry to a Smart Access Gateway (SAG) instance.

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
smartag:AddDnatEntryWrite
  • SmartAccessGateway
    acs:smartag:{#regionId}:{#accountId}:smartag/{#SmartAGId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The ID of the region where the SAG instance is deployed.

cn-hangzhou
SagIdstringYes

The ID of the SAG instance.

Note Only SAG instances used to manage SAG devices support DNAT.
sag-kdhg*******
TypestringYes

The type of the DNAT entry. Valid values:

  • Intranet: translates the destination IP address to a specific internal IP address. This is the default value.
  • Internet: translates the destination IP address to a specific public IP address.
Intranet
ExternalIpstringNo

The public IP address.

Note If the DNAT entry is used to forward packets transmitted over the Internet, the DNAT entry automatically recognizes the current public IP address.
10.10.1.xx
ExternalPortstringYes

The public port.

Valid values: 1 to 65535.

80
InternalIpstringYes

The destination private IP address.

192.168.0.1
IpProtocolstringYes

The protocol used in DNAT. Valid values:

  • TCP: forwards TCP packets.
  • UDP: The NAT gateway forwards UDP packets.
  • Any: forwards packets of all protocols.
TCP
InternalPortstringYes

The destination private port.

Valid values: 1 to 65535.

80

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

56BF6C79-C77D-41A0-86DD-A4B156E784EA
DnatEntryIdstring

The ID of the DNAT entry.

fwd-kxe4fq3xuzczze****

Examples

Sample success responses

JSONformat

{
  "RequestId": "56BF6C79-C77D-41A0-86DD-A4B156E784EA",
  "DnatEntryId": "fwd-kxe4fq3xuzczze****"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidRegionIDThe specified regionId does not exist.The specified region ID does not exist.
400MissingParamYou must specify the parameter.A required parameter is not set.
400IllegalParamThe parameter is invalid.A parameter is set to an invalid value.
400DuplicatedDnatEntryThe specified ExternalIp, IpProtocol, ExternalPort, InternalIp, and InternalPort are duplicated.The specified public IP address, port, public port, private IP address, and private port overlap.
400SmartAccessGatewayNotActivatedThe specified Smart Access Gateway has not been activated.The specified SAG instance is inactive. You must activate the instance first.
400SmartAccessGatewayInArrearsThe specified Smart Access Gateway has expired.The specified Smart Access Gateway has expired.
403ForbiddenUser not authorized to operate on the specified resource.You do not have permissions to manage the specified resource.
403MissingParameterThe input parameter is missing, please check your input.Missing parameters. Check whether all required parameters are set.
403InvalidParameterThe specified parameter is invalid.Invalid parameters.
403InternalErrorAn internal server error occurred.An internal server error occurred.
403FeatureNotSupportThe current edition of the smart access gateway does not support this feature.The current version of Smart Access Gateway does not support this feature.
403InvalidId.SMARTAGThe specified smart access gateway instance id is invalid.The SAG instance ID is invalid.

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

Change history

Change timeSummary of changesOperation
2023-12-06The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403