Help Center/ Cloud Firewall/ API Reference/ API/ Inter-VPC Firewall Management/ Adding a VPC for East-West Protection in Peering Mode
Updated on 2025-08-12 GMT+08:00

Adding a VPC for East-West Protection in Peering Mode

Function

This API is used to add an east-west protected VPC in peering mode.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/firewall/east-west/protected-vpc

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

32-bit UUID.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

fw_instance_id

Yes

String

Definition

Firewall ID. It is a unique ID generated after a firewall instance is created. You can obtain the firewall ID by referring to Obtaining a Firewall ID.

Constraints

N/A

Range

32-bit UUID.

Default Value

N/A

Request Parameters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

inspection_vpc_route

Yes

Array of RouteInfo objects

Definition

Firewall route.

Constraints

N/A

Range

N/A

Default Value

N/A

need_config_vpc_route

No

Boolean

Definition

Whether to configure the VPC route.

Constraints

N/A

Range

false\true

Default Value

false

object_id

Yes

String

Definition

Protected object ID, which is used to distinguish between Internet border protection and VPC border protection after a cloud firewall is created. You can obtain the ID by calling the API for querying firewall instances. In the return value, find the ID in data.records.protect_objects.object_id (The period [.] is used to separate different levels of objects). If the value of type is 0, the protected object ID belongs to the Internet border. If the value of type is 1, the protected object ID belongs to the VPC border.

Constraints

N/A

Range

32-bit UUID.

Default Value

N/A

vpc_id

Yes

String

Definition

ID of the VPC to be protected.

Constraints

N/A

Range

N/A

Default Value

N/A

other_project_id

No

String

Definition

Peer project ID, which is used to protect the VPCs with different project IDs in Huawei Cloud Stack. You do not need to specify it on Huawei Cloud.

Constraints

N/A

Range

N/A

Default Value

N/A

peering_id

No

String

Definition

Peering connection ID, which is used to protect the VPCs with different project IDs in Huawei Cloud Stack. You do not need to specify it on Huawei Cloud.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 4 RouteInfo

Parameter

Mandatory

Type

Description

desc

No

String

Definition

Description.

Constraints

N/A

Range

N/A

Default Value

N/A

destination

Yes

String

Definition

Destination IP address.

Constraints

IP address.

Range

IP address.

Default Value

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

data

data object

Definition

Response body for adding a protected VPC.

Range

N/A

Table 6 data

Parameter

Type

Description

id

String

Definition

VPC ID

Range

N/A

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error message.

Range

N/A

Example Requests

The project ID is a16df7cf1d094befa6bbc72cbf51e93a, the firewall ID is af050cf8-8ad8-4c12-a027-d7a5784e0f64, the protected object ID is 37ccee40-a967-4eb7-bd38-cbe1cddc787b, the VPC ID is 005fe9bf-a70c-4601-ad08-c51b27a165ac, the destination address of the firewall route is 192.168.0.0/20, the VPC route does not need to be configured, and the description is left blank.

https://{Endpoint}/v1/a16df7cf1d094befa6bbc72cbf51e93a/firewall/east-west/protected-vpc?fw_instance_id=af050cf8-8ad8-4c12-a027-d7a5784e0f64

{
  "inspection_vpc_route" : [ {
    "destination" : "192.168.0.0/20",
    "desc" : ""
  } ],
  "need_config_vpc_route" : false,
  "object_id" : "37ccee40-a967-4eb7-bd38-cbe1cddc787b",
  "vpc_id" : "005fe9bf-a70c-4601-ad08-c51b27a165ac"
}

Example Responses

Status code: 400

Bad Request

{
  "error_code" : "CFW.00200003",
  "error_msg" : "Parameter error."
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

See Error Codes.