Add Local IP Translation

Last updated: 2019-11-29 19:24:08

PDF

1. API Description

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

1) The original IP within the VPC is mapped to a new IP, which is used to communicate with the Direct Connect peer. Only NAT gateways are supported.
2) The original IP must be in the VPC network segment, while the translated IP cannot be in the VPC network segment.
3) Duplication of original IP and duplication of translated IP are not allowed in the local 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 CreateLocalIPTranslationNatRule.

Parameter Name Required Type Description
vpcId Yes String The Virtual Private Cloud ID assigned by the system. Both the vpcId before upgrading and the upgraded unVpcId are supported. For example: vpc-ddg454.
directConnectGatewayId Yes String Direct Connect gateway ID assigned by the system, for example: dcg-dgd54g.
localIPTranslation.n Yes Array Local IP translation.
localIPTranslation.n.originalIP Yes String Original IP.
localIPTranslation.n.translationIP Yes String Translated IP.
localIPTranslation.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.
data Array Returned information.
data.taskId Int Task ID. The operation result can be queried with taskId. For more information, refer to API for Querying Task Execution Result.
codeDesc String Error code.

4. Error Code List

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 you have entered resource information correctly. This can be queried via the Querying Virtual Private Cloud List (DescribeVpcEx) API.
InvalidDirectConnectGateway.NotFound Invalid Direct Connect gateway. Direct Connect gateway resource does not exist. Please verify that you have entered resource information correctly. This can be queried via the Querying Direct Connect Gateway (DescribeDirectConnectGateway) API.
InvalidOriginalIP.NotInVpcCidr Invalid original IP. The original IP is not in the VPC network segment.
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. Duplication of original IP is not allowed.
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 translation rules of the gateway. Duplication of translated IP is not allowed.
LocalIPTranslationLimitExceeded The local IP translation rules you added have reached the upper limit. Please contact customer service for more resources. For more information on VPC resource restrictions, see VPC Usage Restrictions.

5. Example

Input

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

Output

{
    "code":"0",
    "message":"",
    "data":{
        "taskId":"17934"
    },
    "codeDesc":"Success"
}