cloud-firewall/api-ref/source/api/firewall_management/creating_an_east-west_firewall.rst

15 KiB

original_name

CreateEastWestFirewall.html

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 <cfw_02_0015>.
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 <cfw_02_0027>. 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 <cfw_02_0028>.

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 <cfw_02_0029>.
Table 4 Request body parameters
Parameter Mandatory Type Description
er_id No 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.
mode Yes String East-west firewall mode. Enter er.

Response Parameters

Status code: 200

Table 5 Response body parameters
Parameter Type Description
data CreateEWFirewallResp <createeastwestfirewall__response_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 <createeastwestfirewall__response_er> object Enterprise router information.
inspertion_vpc CreateEWFirewallInspectVpcResp <createeastwestfirewall__response_createewfirewallinspectvpcresp> object Information about the traffic diversion 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 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 8 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

{
  "inspection_cidr" : "10.1.0.0/24",
  "mode" : "er",
  "er_id" : "e0b22a23-02cf-4092-ace9-34b39e10dc77"
}

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 <errorcode>.