Add Peer IP Translation

Last updated: 2017-12-05 17:18:55

PDF

1. API Description

This API (CreatePeerIPTranslationNatRule) is used to add peer IP translation for Direct Connect gateway.
Domain for API request:vpc.api.qcloud.com

1) The original IP of the Direct Connect peer is mapped to a new IP, which is used to communicate with the connected VPC. Only NAT gateways are supported.
2) The translated IP cannot be in the VPC network segment.
3) The original IP and translated IP must be unique in the peer IP translation rules under the same NAT gateway.

2. Input Parameters

The following request parameter list only provides API request parameters. Common request parameters need to be added when the API is called. For more information, refer to Common Request Parameters. The Action field for this API is CreatePeerIPTranslationNatRule.

Parameter Name Required Type Description
vpcId Yes String Virtual private cloud ID or unified ID (unified ID is recommended).
directConnectGatewayId Yes String Direct Connect gateway ID.
peerIPTranslation.n Yes Array Array of peer IP translation rules.
peerIPTranslation.n.originalIP Yes String Original IP.
peerIPTranslation.n.translationIP Yes String Translated IP.
peerIPTranslation.n.description No String Note.

3. Output Parameters

Parameter Name Type Description
code Int Common error code; 0: Succeeded; other values: Failed. For more information, please refer to Common Error Codes on the Error Code page.
message String Module error message description depending on API.
codeDesc String Error code
data Array Returned information.

4. Error Code Table

The following error code list only provides the business logic error codes for this API. For additional common error codes, refer to VPC Error Codes.

Error Code Description
InvalidVpc.NotFound Invalid VPC. VPC resource does not exist. Please verify that the resource information you entered is correct. This can be queried via the Query Virtual Private Cloud List (DescribeVpcEx) API.
InvalidDirectConnectGateway.NotFound Invalid Direct Connect gateway. Direct Connect gateway resource does not exist. Please verify that the resource information you entered is correct. This can be queried via the Query Direct Connect Gateway (DescribeDirectConnectGateway) API.
InvalidOriginalIP.Duplicate Invalid original IP. Duplication of original IP. The original IP has already existed in the local IP Direct Connect rules of the gateway. The original IP must be unique.
InvalidTranslationIP.InVpcCidr Invalid translated IP. The translated IP is in the VPC network segment.
InvalidTranslationIP.Duplicate Invalid translated IP. Duplication of translated IP. The translated IP has already existed in the local IP Direct Connect rules of the gateway. The translated IP must be unique.
PeerIPTranslationLimitExceeded The peer IP translation rules you added have reached the upper limit. Please contact customer service for more resources. For more information on VPC resource restrictions, refer to VPC Usage Restrictions.

5. Example

Input


https://vpc.api.qcloud.com/v2/index.php?Action=CreatePeerIPTranslationNatRule
&<Common request parameters>
&vpcId=vpc-csnmo39l
&directConnectGatewayId=dcg-mm01ughx
&peerIPTranslation.0.originalIP=10.100.10.3
&peerIPTranslation.0.translationIP=183.0.0.1
&peerIPTranslation.0.description=183.0.0.1

Output

{
    "code":"0",
    "message":"",
    "codeDesc":"Success",
    "data":[

    ]
}