ModifySnatEntry
1. API Description
This API (ModifySnatEntry) is used to modify a SNAT rule.
2. Input Parameters
The following request parameter list only provides API request parameters.
snatEntryId
Yes
String
SNAT rule ID.
eipIds
No
Array of String
IDs of the elastic IPs added to the SNAT rule.
To change it to all elastic IPs on the NAT gateway, specify isAllEip=true.
It can be obtained by calling DescribeEips.
isAllEip
No
Boolean
Whether the public egress IPs are all elastic IPs bound to this NAT gateway
cidr
No
String
CIDR block.
Either cidr or subnetIds must be specified.
sourceCidrBlocks
No
Array of String
List of source CIDR blocks.
One of sourceCidrBlocks or subnetIds must be specified.
To use the full address range, specify 0.0.0.0/0.
subnetIds
No
Array of String
IDs of the subnets to be modified.
This parameter indicates that all instances in these subnets can access external networks through the SNAT rule.
Specify either this parameter or sourceCidrBlocks.
It can be obtained by calling DescribeSubnets.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request.
RequestId is required for locating a problem.
4. Code Example
Modify a SNAT entry of type subnet.
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: ModifySnatEntry
<Common Request Params>
Request:
{
"snatEntryId": "<snatEntryId>",
"subnetIds": ["<subnetId>"],
"eipIds": ["<eipId>"]
}
Response:
{
"requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
"response": {
"requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3"
}
}5. Developer Resources
Zenlayer Cloud API 2.0 integrates SDKs,to make it easier for you to call APIs. More programming languages will be supported.
6. Error Codes
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
404
INVALID_SNAT_ENTRY_NOT_FOUND
SNAT entry does not exist.
404
INVALID_NAT_NOT_FOUND
NAT gateway does not exist.
400
OPERATION_DENIED_NAT_STATUS
NAT gateway state is not RUNNING.
404
INVALID_EIP_NOT_FOUND
Elastic IP does not exist.
400
OPERATION_DENIED_EIP_NOT_ASSIGNED
Elastic IP is not bound.
400
OPERATION_DENIED_EIP_NOT_ASSIGN_NAT
The elastic IP isn't assigned to the NAT gateway.
400
OPERATION_DENIED_ANYPORT_DNAT_ENTRY
DNAT mapping method is Any Port.
400
OPERATION_DENIED_SNAT_ENTRY_COUNT_LIMIT
The number of SNAT entries is limited.
400
INVALID_CIDR_FORMAT
The specified CIDR block format error.
404
INVALID_NAT_SUBNET_NOT_FOUND
The specified subnet does not exist on the NAT gateway.
400
OPERATION_DENIED_CIDR_CONFLICT_WITH_SNAT_ENTRY
The specified CIDR conflicts with another SNAT rule.
400
OPERATION_DENIED_NAT_SUBNET_CONFLICT
Subnet is associated already.
400
OPERATION_DENIED_NAT_ENTRY_CONFIG_CONFLICT
NAT rules conflict.
400
OPERATION_DENIED_SUBNET_CONFLICT_WITH_SNAT_ENTRY
The specified subnet conflicts with another SNAT rule.
Last updated