Help Center/ Domain Name Service/ API Reference/ APIs/ Endpoint Rule Management/ Associating a VPC with an Endpoint Rule
Updated on 2025-10-30 GMT+08:00

Associating a VPC with an Endpoint Rule

Function

This API is used to associate a VPC with an endpoint rule.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dns:resolverRule:associaterouter

    Write

    resolverRule *

    -

    -

    vpc:vpcs:get

URI

POST /v2.1/resolverrules/{resolverrule_id}/associaterouter

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

resolverrule_id

Yes

String

ID of an endpoint rule

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

The user token.

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

For details about how to obtain a user token, seeObtaining a User Token.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

router

Yes

RouterForRule object

VPC

Table 4 RouterForRule

Parameter

Mandatory

Type

Description

router_id

Yes

String

ID of the Router (VPC) associated with the zone

Response Parameters

Status code: 202

Table 5 Response body parameters

Parameter

Type

Description

router_id

String

Definition

ID of the associated VPC

Range

N/A

router_region

String

Definition

Region where the associated VPC is located

Range

N/A

status

String

Definition

The status of the associated VPC.

Range

N/A

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

code

String

Definition

Error code

Range

N/A

message

String

Definition

Error description

Range

N/A

Status code: 404

Table 7 Response body parameters

Parameter

Type

Description

code

String

Definition

Error code

Range

N/A

message

String

Definition

Error description

Range

N/A

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

code

String

Definition

Error code

Range

N/A

message

String

Definition

Error description

Range

N/A

Example Requests

Associating a VPC with an endpoint rule

POST https://{endpoint}/v2.1/resolverrules/{resolverrule_id}/associaterouter

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

Example Responses

Status code: 202

Request accepted

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

Status Codes

Status Code

Description

202

Request accepted

400

Error response

404

Error response

500

Error response

Error Codes

See Error Codes.