Changing the East-West Firewall Protection Status

Function

This API is used to enable or disable east-west protection.

URI

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

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

No

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

object_id

Yes

String

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

status

Yes

Integer

Protection status: 0 (enabled), 1 (disabled).

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

data

ChangeEastWestFirewallStatusResponseData object

Data returned for modifying east-west protection.

Table 6 ChangeEastWestFirewallStatusResponseData

Parameter

Type

Description

id

String

East-west protected object ID, which can be obtained by calling the API for querying a firewall instance. In the return value, find the ID in data.records.protect_objects.object_id (The period [.] is used to separate different levels of objects). Note that type indicates the protected object type. 0 indicates the ID of a protected object at the Internet border, 1 indicates the ID of a 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).

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

In the project with the ID 09bb24e6fe80d23d2fa2c010b53b418c, enable east-west firewall protection for the object with the ID 74820b38-1cc0-4f0b-8cce-32490fa840a3.

https://{Endpoint}/v1/09bb24e6fe80d23d2fa2c010b53b418c/firewall/east-west/protect

{
  "object_id" : "74820b38-1cc0-4f0b-8cce-32490fa840a3",
  "status" : 1
}

Example Responses

Status code: 200

Response body for updating the east-west protection status.

{
  "data" : {
    "id" : "5c539816-7a94-4833-9df0-944b362f0797"
  }
}

Status code: 400

Bad Request

{
  "error_code" : "CFW.00200005",
  "error_msg" : "Object not found."
}

Status Codes

Status Code

Description

200

Response body for updating the east-west protection status.

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.