ModifySubnetAttribute

1. API Description

This API is used to modify the attributes of a subnet under a global VPC. Only the subnet name and the IPv4 CIDR block to be displayed can be modified for now.

Note

When modifying a subnet’s CIDR block, if the subnet contains instances, the new CIDR block must encompass the original CIDR block.\ Example: 10.0.0.0/24 10.0.0.0/23

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

subnetId

Yes

String

Subnet ID.

subnetName

No

String

Subnet name.

This parameter must start and end with a number or a letter. Only letters, numbers, - and periods (.) are supported.

cidrBlock

No

String

IPv4 CIDR block to be modified.

Only subnets with an IPv4 stack type are supported.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Code Example

Modify the subnet name and the IPv4 CIDR block.

POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: ModifySubnetAttribute
<Common Request Params>

Request:
{
    "subnetId": "<subnetId>"
    "name": "Test-Subnet"
    "cidrBlock": "10.0.0.0/23"
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 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.

HTTP Status Code
Error Code
Description

400

INVALID_CIDR_BLOCK_FORMAT

Invalid CIDR block format.

400

INVALID_CIDR_BLOCK_NETMASK_RANGE

CIDR block range is invalid.

400

INVALID_CIDR_BLOCK_NOT_EMPTY

CIDR block cannot be empty.

400

INVALID_CIDR_BLOCK_NOT_LAN_IP

CIDR block must be a private IP range.

400

INVALID_IP_BROADCAST_ADDRESS

The IP address cannot be a broadcast address.

400

INVALID_IP_FIRST_ADDRESS

The IP address cannot be a gateway address.

400

INVALID_IP_NETWORK_ADDRESS

The IP address cannot be a network address.

400

INVALID_IP_OUT_OF_RANGE

Invalid IP address. It does not belong to the CIDR block.

400

INVALID_PARAMETER_SUBNET_CIDR_NOT_BELONG_VPC

The subnet does not belong to the specified VPC.

400

INVALID_SUBNET_IPSTACK_NOT_SUPPORT

Subnet IP stack type not supported.

404

INVALID_SUBNET_NOT_FOUND

Subnet does not exist.

400

OPERATION_DENIED_SUBNET_CIDR_CONFLICT

Subnet CIDR blocks conflict.

Last updated