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

Creating a Firewall

Function

This API is used to create a firewall.

URI

POST /v2/{project_id}/firewall

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

32-bit UUID.

Default Value

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Firewall name.

Constraints

N/A

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

N/A

Range

N/A

Default Value

0

tags

No

Array of tags objects

Definition

List of service resource tags. After tags are added to firewall resources, you can query resources and combine CDRs by key and value.

Constraints

N/A

flavor

Yes

flavor object

Definition

Firewall specifications.

Constraints

N/A

Range

N/A

Default Value

N/A

charge_info

Yes

charge_info object

Definition

Billing type, which is pay-per-use (default setting).

Constraints

N/A

Table 3 tags

Parameter

Mandatory

Type

Description

key

No

String

Definition

Resource tag key.

Constraints

N/A

Range

N/A

Default Value

N/A

value

No

String

Definition

Resource tag value.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 4 flavor

Parameter

Mandatory

Type

Description

version

Yes

String

Definition

Firewall edition.

Constraints

Firewall edition. The professional edition is supported.

Range

  • Professional

Default Value

N/A

Table 5 charge_info

Parameter

Mandatory

Type

Description

charge_mode

Yes

String

Definition

Billing mode.

Constraints

N/A

Range

  • postPaid: pay-per-use billing

Default Value

N/A

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

job_id

String

Definition

Instance creation task ID.

Range

N/A

order_id

String

Definition

Order No.

Range

N/A

data

CreateFirewallReq object

Definition

Request body for creating a firewall.

Range

N/A

Table 7 CreateFirewallReq

Parameter

Type

Description

name

String

Definition

Firewall name.

Constraints

N/A

Range

N/A

Default Value

N/A

enterprise_project_id

String

Definition

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

Constraints

N/A

Range

N/A

Default Value

0

tags

Array of tags objects

Definition

List of service resource tags. After tags are added to firewall resources, you can query resources and combine CDRs by key and value.

Constraints

N/A

flavor

flavor object

Definition

Firewall specifications.

Constraints

N/A

Range

N/A

Default Value

N/A

charge_info

charge_info object

Definition

Billing type, which is pay-per-use (default setting).

Constraints

N/A

Table 8 tags

Parameter

Type

Description

key

String

Definition

Resource tag key.

Constraints

N/A

Range

N/A

Default Value

N/A

value

String

Definition

Resource tag value.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 9 flavor

Parameter

Type

Description

version

String

Definition

Firewall edition.

Constraints

Firewall edition. The professional edition is supported.

Range

  • Professional

Default Value

N/A

Table 10 charge_info

Parameter

Type

Description

charge_mode

String

Definition

Billing mode.

Constraints

N/A

Range

  • postPaid: pay-per-use billing

Default Value

N/A

Status code: 400

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error message.

Range

N/A

Example Requests

The customer whose project ID is 124147da-5b08-471a-93d2-bc82acc290c6 subscribes to the standard firewall. The firewall name is CFW-Test, the enterprise project ID is 0, the resource tag is a key-value pair, the key is TagKey, the value is TagValue, the added number of protected EIPs is 2000, the added protection bandwidth is 5000 Mbit/s, and the added number of protected VPCs is 100. The pay-per-use billing mode is used. Auto-renewal and auto-payment are enabled. The usage duration is one month.

https://{Endpoint}/v2/124147da-5b08-471a-93d2-bc82acc290c6/firewall

{
  "name" : "CFW-TEST",
  "enterprise_project_id" : "0",
  "tags" : [ {
    "key" : "TagKey",
    "value" : "TagVal"
  } ],
  "flavor" : {
    "version" : "Professional"
  },
  "charge_info" : {
    "charge_mode" : "postPaid"
  }
}

Example Responses

Status code: 200

Information returned when the firewall is purchased successfully.

{
  "data" : {
    "charge_info" : {
      "charge_mode" : "postPaid"
    },
    "enterprise_project_id" : "0",
    "flavor" : {
      "version" : "Professional"
    },
    "name" : "CFW-TEST",
    "tags" : [ {
      "key" : "TagKey",
      "value" : "TagVal"
    } ]
  },
  "job_id" : "CS2403271050ZEM0L"
}

Status code: 400

Returned error information.

{
  "error_code" : "CFW.00100001",
  "error_msg" : "System busy. Try again later."
}

Status Codes

Status Code

Description

200

Information returned when the firewall is purchased successfully.

400

Returned error information.

Error Codes

See Error Codes.