Files
doc-exports/docs/cfw/api-ref/CreateEastWestFirewall.html
qinweiwei ca5c9a3342 CFW API 20250428 version
Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: qinweiwei <qinweiwei@huawei.com>
Co-committed-by: qinweiwei <qinweiwei@huawei.com>
2025-08-01 08:53:39 +00:00

17 KiB

Creating an East-West Firewall

Function

This API is used to create an east-west firewall.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which can be obtained by calling an API or from the console. For details, see Obtaining a Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Enterprise project ID, which is the ID of a project planned based on organizations. You can obtain the enterprise project ID by referring to Obtaining an Enterprise Project ID. If the enterprise project function is not enabled, the value is 0.

fw_instance_id

Yes

String

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

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. You can obtain the token by referring to Obtaining a User Token.

Content-Type

Yes

String

Content type. It can only be set to application/json.

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

er_id

Yes

String

ID of the associated enterprise router in the outbound direction, which can be obtained by calling the API for querying the enterprise router list of the Enterprise Router service. Find the enterprise router ID in instances.id (The period [.] is used to separate different levels of objects).

inspection_cidr

Yes

String

CIDR block used for creating a traffic diversion VPC.

Only private network address segments (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) are supported. Otherwise, route conflicts may occur in public network access scenarios, such as SNAT.

The CIDR block 10.6.0.0/16-10.7.0.0/16 is reserved for CFW and cannot be specified.

This CIDR block cannot overlap with the private CIDR block to be protected, or routing conflicts and protection failures may occur.

mode

Yes

String

East-west firewall mode. Enter er.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

data

CreateEWFirewallResp object

Return value for creating an east-west firewall.

Table 6 CreateEWFirewallResp

Parameter

Type

Description

id

String

East-west protection ID, corresponding to the object_id field.

er

ER object

Enterprise router information.

inspertion_vpc

CreateEWFirewallInspectVpcResp object

Information about the inspection VPC.

Table 7 ER

Parameter

Type

Description

er_id

String

Enterprise router ID, which is referenced when east-west protection is created.

er_attach_id

String

Attachment ID of an enterprise router. This attachment is used to connect the firewall and the enterprise router. To obtain the value of this field, query the enterprise router by er_id on the Enterprise Router page, and then query the attachment on the Manage Attachment page.

Table 8 CreateEWFirewallInspectVpcResp

Parameter

Type

Description

vpc_id

String

ID of a inspection VPC.

subnet_ids

Array of strings

Subnet ID list of the created inspection VPC.

Example Requests

In project 09bb24e6f280d23d0f9fc0104b901480, create a firewall 55b26ab5-e4b0-40e8-941c-a1778fe2a500 in Enterprise Router mode. Set inspection_cidr to 10.1.0.0/24 and er_id to 0eb296a4-aa9b-493e-b58a-ce993a16edfc.

https://{Endpoint}/v1/09bb24e6f280d23d0f9fc0104b901480/firewall/east-west?fw_instance_id=55b26ab5-e4b0-40e8-941c-a1778fe2a500&enterprise_project_id=default

{
  "er_id" : "0eb296a4-aa9b-493e-b58a-ce993a16edfc",
  "mode" : "er",
  "inspection_cidr" : "10.1.0.0/24"
}

Example Responses

Status code: 200

Return value for creating an east-west firewall.

{
  "data" : {
    "id" : "acc86ca7-818b-4c3d-8a9a-3915a2b21651",
    "er" : {
      "er_id" : "f0f5275a-40aa-4d1e-ac78-2550f7818d43",
      "er_attach_id" : "bd62ddd3-5e20-482b-aefa-9e2940e2b1a9"
    },
    "inspertion_vpc" : {
      "vpc_id" : "00672633-0466-4c35-99ef-5e3f5c813a4b",
      "subnet_ids" : [ "294682a0-1e85-45f5-92c8-e52bee09c204", "a86277bb-35d5-4442-bc0b-2e9d4e6a9080", "95829240-14e0-47e6-b9e7-2ac228e7b00f" ]
    }
  }
}

Status Codes

Status Code

Description

200

Return value for creating an east-west firewall.

Error Codes

See Error Codes.