38 KiB

original_name

CreateFirewall.html

Create Firewall

Function

This API is used to create firewall.

URI

POST /v2/{project_id}/firewall

Table 1 Path Parameters
Parameter Mandatory Type Description
project_id Yes String Project ID

Request Parameters

Table 2 Request header parameters
Parameter Mandatory Type Description
X-Auth-Token Yes String User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token.
X-Client-Token No String An identity that guarantees the idempotency of client requests. The identifier is in 32-bit UUID format, generated by the client, and must be unique between requests.
X-Trace-Id No String
Table 3 Request body parameters
Parameter Mandatory Type Description
name Yes String Firewall Name
enterprise_project_id No String

Enterprise project id, the id generated by the enterprise project after the user supports the enterprise project.

Default: 0

tags No Array of tags <createfirewall__request_tags> objects Resource Tag
flavor Yes flavor <createfirewall__request_flavor> object flavor
charge_info Yes charge_info <createfirewall__request_charge_info> object Billing type information, prepaid and postpaid, the default is postpaid.
Table 4 tags
Parameter Mandatory Type Description
key No String Tag Key
value No String Tag Value
Table 5 flavor
Parameter Mandatory Type Description
version Yes String

Firewall version: If charge_mode is set to postPaid, only the Professional Edition is supported, and when charge_mode is set to prePaid, the Standard and Professional Editions are supported.

Enumeration values:

  • Standard
  • Professional
extend_eip_count No Integer

Expand the number of EIPs and take effect only in the prepaid mode.

Minimum: 0

Maximum: 2000

Default: 0

extend_bandwidth No Integer

Expand band width and take effect only in the prepaid mode.

Minimum: 0

Maximum: 5000

extend_vpc_count No Integer

Expand the number of VPCs and take effect only in the prepaid mode.

Minimum: 0

Maximum: 100

Table 6 charge_info
Parameter Mandatory Type Description
charge_mode Yes String The billing mode can be prepaid, i.e., yearly/monthly, and postPaid: postpaid, i.e., pay-per-use.
period_type No String The value range of the subscription cycle,include monthly and yearly. Note: This parameter takes effect when charge_mode is set to prePaid, and the value is required.
period_num No Integer the time of the subscription, take effect when charge_mode is prePaid and it is required, value range: 1~9 when period_type is set to month, and 1~3 when period_type is set to year.
is_auto_renew Yes Boolean

whether the firewall instance is auto renewed

Default: false

is_auto_pay Yes Boolean

whether the firewall instance is auto paid

Default: false

Response Parameters

Status code: 200

Table 7 Response body parameters
Parameter Type Description
job_id String The job id, created when the firewall instance is created, which is returned only when the billing mode is postpaid.
order_id String Order id,which is returned when the firewall instance is created.
data CreateFirewallReq <createfirewall__response_createfirewallreq> object Create Firewall Request
Table 8 CreateFirewallReq
Parameter Type Description
name String Firewall Name
enterprise_project_id String

Enterprise project id, the id generated by the enterprise project after the user supports the enterprise project.

Default: 0

tags Array of tags <createfirewall__response_tags> objects Resource Tag
flavor flavor <createfirewall__response_flavor> object flavor
charge_info charge_info <createfirewall__response_charge_info> object Billing type information, prepaid and postpaid, the default is postpaid.
Table 9 tags
Parameter Type Description
key String Tag Key
value String Tag Value
Table 10 flavor
Parameter Type Description
version String

Firewall version: If charge_mode is set to postPaid, only the Professional Edition is supported, and when charge_mode is set to prePaid, the Standard and Professional Editions are supported.

Enumeration values:

  • Standard
  • Professional
extend_eip_count Integer

Expand the number of EIPs and take effect only in the prepaid mode.

Minimum: 0

Maximum: 2000

Default: 0

extend_bandwidth Integer

Expand band width and take effect only in the prepaid mode.

Minimum: 0

Maximum: 5000

extend_vpc_count Integer

Expand the number of VPCs and take effect only in the prepaid mode.

Minimum: 0

Maximum: 100

Table 11 charge_info
Parameter Type Description
charge_mode String The billing mode can be prepaid, i.e., yearly/monthly, and postPaid: postpaid, i.e., pay-per-use.
period_type String The value range of the subscription cycle,include monthly and yearly. Note: This parameter takes effect when charge_mode is set to prePaid, and the value is required.
period_num Integer the time of the subscription, take effect when charge_mode is prePaid and it is required, value range: 1~9 when period_type is set to month, and 1~3 when period_type is set to year.
is_auto_renew Boolean

whether the firewall instance is auto renewed

Default: false

is_auto_pay Boolean

whether the firewall instance is auto paid

Default: false

Status code: 400

Table 12 Response body parameters
Parameter Type Description
error_code String

Error code

Minimum: 8

Maximum: 36

error_msg String

Description

Minimum: 2

Maximum: 512

Example Requests

Enable a standard firewall with 2000 extended EIP, 5,000 Mbps extended protection bandwidth, 100 extended protection VCPs under a monthly billing auto-renewal model.

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

{
  "name" : "CFW-TEST",
  "enterprise_project_id" : "0",
  "tags" : [ {
    "key" : "TagKey",
    "value" : "TagVal"
  } ],
  "flavor" : {
    "version" : "Standard",
    "extend_eip_count" : 2000,
    "extend_bandwidth" : 5000,
    "extend_vpc_count" : 100
  },
  "charge_info" : {
    "charge_mode" : "prePaid",
    "period_type" : "month",
    "period_num" : 1,
    "is_auto_renew" : true,
    "is_auto_pay" : true
  }
}

Example Responses

Status code: 200

Create Firewall Response

{
  "data" : {
    "charge_info" : {
      "charge_mode" : "prePaid",
      "is_auto_pay" : true,
      "is_auto_renew" : true,
      "period_num" : 1,
      "period_type" : "month"
    },
    "enterprise_project_id" : "0",
    "flavor" : {
      "extend_bandwidth" : 5000,
      "extend_eip_count" : 2000,
      "extend_vpc_count" : 100,
      "version" : "Standard"
    },
    "name" : "CFW-TEST",
    "tags" : [ {
      "key" : "TagKey",
      "value" : "TagVal"
    } ]
  },
  "order_id" : "CS2403271050ZEM0L"
}

Status code: 400

Bad Request

{
  "error_code" : "CFW.00100001",
  "error_msg" : "The system is busy. Please try again later."
}

Status Codes

Status Code Description
200 Create Firewall Response
400 Bad Request

Error Codes

See Error Codes <errorcode>.