Updated on 2025-11-21 GMT+08:00

Querying the Number of Protected VPCs

Function

This API is used to query information about protected VPCs.

URI

GET /v1/{project_id}/vpcs/protection

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which can be obtained by calling an API or from the 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

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. Find the value in data.records.protect_objects.object_id (The period [.] is used to separate different levels of objects).

Constraints

If type is set to 0, object_id is the ID of the protected object at the Internet border. If type is set to 1, object_id is the ID of the protected object at the VPC border. Here, a protected object ID whose type is 1 is used. You can obtain the value of type from data.records.protect_objects.type (The period [.] is used to separate different levels of objects).

Range

N/A

Default Value

N/A

enterprise_project_id

No

String

Definition

Enterprise project ID. The ID is the enterprise project ID planned based on organization conditions.

Constraints

If no enterprise project is enabled, the value is 0.

Range

N/A

Default Value

N/A

fw_instance_id

No

String

Definition

Firewall ID, which can be obtained by referring to Obtaining a Firewall ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

data

VPCProtectsVo object

Definition

Returned value of the protected VPC.

Range

N/A

Table 5 VPCProtectsVo

Parameter

Type

Description

total

Integer

Definition

Total number of protected VPCs.

Range

N/A

self_total

Integer

Definition

The firewall can protect VPCs across accounts. self_total indicates the total number of protected VPCs in the current project.

Range

N/A

other_total

Integer

Definition

The east-west firewall protection can protect VPCs across accounts. other_total indicates the number of protected VPCs in other projects.

Range

N/A

protect_vpcs

Array of VpcAttachmentDetail objects

Definition

The firewall can protect cross-account VPCs in the east-west direction. protect_vpcs indicates the list of all protected VPCs.

Range

N/A

self_protect_vpcs

Array of VpcAttachmentDetail objects

Definition

The firewall can protect cross-account VPCs in the east-west direction. self_protect_vpcs indicates the list of protected VPCs in the current project.

Range

N/A

other_protect_vpcs

Array of VpcAttachmentDetail objects

Definition

The firewall can protect cross-account VPCs in the east-west direction. other_protect_vpcs indicates the list of protected VPCs in other projects.

Range

N/A

total_assets

Integer

Definition

Total number of VPC assets of a tenant.

Range

N/A

Table 6 VpcAttachmentDetail

Parameter

Type

Description

vpc_id

String

Definition

ID of a protected VPC added for east-west protection.

Range

N/A

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Example Requests

Query the east-west firewall protection information about the projected object with the ID 8839526e-b804-4a15-a082-a2c797dce633 in project 0b2179bbe180d3762fb0c01a2d5725c7.

https://{Endpoint}/v1/0b2179bbe180d3762fb0c01a2d5725c7/vpcs/protection?object_id=8839526e-b804-4a15-a082-a2c797dce633

Example Responses

Status code: 200

OK

{
  "data" : {
    "other_protect_vpcs" : [ ],
    "other_total" : 0,
    "protect_vpcs" : [ ],
    "self_protect_vpcs" : [ ],
    "self_total" : 0,
    "total" : 0,
    "total_assets" : 5
  }
}

Status code: 400

Bad Request

{
  "error_code" : "CFW.00109004",
  "error_msg" : "HTTP request error."
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized: Request error.

403

Forbidden: Access forbidden.

404

Not Found: Web page not found.

500

Internal Server Error

Error Codes

See Error Codes.