Help Center> Domain Name Service> API Reference> APIs> Private Zone Management> Associating a VPC with a Private Zone
Updated on 2024-03-25 GMT+08:00

Associating a VPC with a Private Zone

Function

This API is used to associate a VPC with a private zone.

Calling Method

For details, see Calling APIs.

URI

POST /v2/zones/{zone_id}/associaterouter

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

zone_id

Yes

String

ID of the zone associated with the VPC

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

router

Yes

Router object

VPC associated with the endpoint rule

Table 4 Router

Parameter

Mandatory

Type

Description

router_id

Yes

String

ID of the VPC associated with the zone

router_region

No

String

Region of the VPC

status

No

String

Resource status

Response Parameters

Status code: 202

Table 5 Response body parameters

Parameter

Type

Description

router_id

String

VPC ID

router_region

String

Region of the VPC

status

String

Resource status

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

code

String

Error code

Minimum: 8

Maximum: 36

message

String

Description

Minimum: 2

Maximum: 512

Status code: 404

Table 7 Response body parameters

Parameter

Type

Description

code

String

Error code

Minimum: 8

Maximum: 36

message

String

Description

Minimum: 2

Maximum: 512

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

code

String

Error code

Minimum: 8

Maximum: 36

message

String

Description

Minimum: 2

Maximum: 512

Example Requests

Associating a VPC with a private zone

POST https://{endpoint}/v2/zones/{zone_id}/associaterouter

{
  "router" : {
    "router_id" : "f0791650-db8c-4a20-8a44-a06c6e24b15b",
    "router_region" : "xx"
  }
}

Example Responses

Status code: 202

Response to the request for associating a VPC with a private zone

{
  "status" : "PENDING_CREATE",
  "router_id" : "f0791650-db8c-4a20-8a44-a06c6e24b15b",
  "router_region" : "xx"
}

Status Codes

Status Code

Description

202

Response to the request for associating a VPC with a private zone

400

Error response

404

Error response

500

Error response

Error Codes

See Error Codes.