Updating Subnet Information
Function
This API is used to update information about a subnet.
URI
PUT /v1/{project_id}/vpcs/{vpc_id}/subnets/{subnet_id}
| Parameter | Mandatory | Description |
|---|---|---|
| project_id | Yes | Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
| vpc_id | Yes | Specifies the VPC ID of the subnet. |
| subnet_id | Yes | Specifies the subnet ID that uniquely identifies the subnet. If you use the management console, the value of this parameter is the Network ID value. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| subnet | Yes | subnet object | Specifies the subnet objects. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String |
|
| description | No | String |
|
| ipv6_enable | No | Boolean |
|
| dhcp_enable | No | Boolean |
|
| primary_dns | No | String |
|
| secondary_dns | No | String | |
| dnsList | No | Array of strings |
|
| extra_dhcp_opts | No | Array of extra_dhcp_opt objects | Specifies the NTP server address or DHCP lease time configured for the subnet. For details, see Table 4. |
Example Request
- Change the name of the subnet whose ID is 4779ab1c-7c1a-44b1-a02e-93dfc361b32d to subnet02, and also change its DNS and DHCP configurations.
PUT https://{Endpoint}/v1/{project_id}/vpcs/{vpc_id}/subnets/4779ab1c-7c1a-44b1-a02e-93dfc361b32d { "subnet": { "name": "subnet02", "ipv6_enable": true, "dhcp_enable": false, "primary_dns": "114.xx.xx.115", "secondary_dns": "114.xx.xx.116", "extra_dhcp_opts": [ { "opt_value": "10.100.0.33,10.100.0.34", "opt_name": "ntp" }, { "opt_value": "24h", "opt_name": "addresstime" }, { "opt_value": "2h", "opt_name": "ipv6_addresstime" } ] } }
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| subnet | subnet object | Specifies the subnet objects. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Specifies a resource ID in UUID format. |
| status | String |
|
Example Response
{
"subnet": {
"id": "4779ab1c-7c1a-44b1-a02e-93dfc361b32d",
"status": "ACTIVE"
}
} Status Code
See Status Codes.
Error Code
See Error Codes.