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_vpc_id

No

String

Traffic diversion VPC ID.

er_associated_subnet

No

AssociatedSubnet object

Subnet associated with an enterprise router.

firewall_associated_subnets

No

Array of AssociatedSubnet objects

List of subnets associated with a firewall.

Table 5 AssociatedSubnet

Parameter

Mandatory

Type

Description

az

Yes

String

AZ.

subnet_segment

Yes

String

Subnet CIDR block.

subnet_name

Yes

String

Subnet name.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

data

CreateEWFirewallResp object

Return value for creating an east-west firewall.

Table 7 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 traffic diversion VPC.

Table 8 ER

Parameter

Type

Description

er_id

String

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

er_attach_id

String

Connection ID of an enterprise router. This connection is used to connect the firewall and the enterprise router. This field can be used to obtain the connection details on the connection management page after querying a specified enterprise router by its ID on the Enterprise Router page.

Table 9 CreateEWFirewallInspectVpcResp

Parameter

Type

Description

vpc_id

String

ID of a traffic diversion VPC.

subnet_ids

Array of strings

Subnet ID list of the created traffic diversion VPC.

Example Requests

Under firewall 55b26ab5-e4b0-40e8-941c-a1778fe2a500 in project 09bb24e6f280d23d0f9fc0104b901480, create a firewall in enterprise router mode. The enterprise router ID is 0eb296a4-aa9b-493e-b58a-ce993a16edfc, the traffic diversion VPC is 0eb296a4-aa9b-493e-b58a-ce993a16edfd, the subnets associated with the firewall are fw-subnet and cfw-subnet, and the subnet associated with the enterprise router is er-subnet.

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

{
  "er_associated_subnet" : {
    "cidr" : "192.168.2.0/24",
    "name" : "er-subnet",
    "vpc_id" : "0eb296a4-aa9b-493e-b58a-ce993a16edfd"
  },
  "er_id" : "0eb296a4-aa9b-493e-b58a-ce993a16edfc",
  "firewall_associated_subnets" : [ {
    "cidr" : "192.168.1.0/24",
    "name" : "fw-subnet",
    "vpc_id" : "0eb296a4-aa9b-493e-b58a-ce993a16edfd"
  }, {
    "cidr" : "192.168.3.0/24",
    "name" : "cfw-subnet",
    "vpc_id" : "0eb296a4-aa9b-493e-b58a-ce993a16edfd"
  } ],
  "inspection_vpc_id" : "0eb296a4-aa9b-493e-b58a-ce993a16edfd"
}

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.