:original_name: CreateFirewall.html .. _CreateFirewall: Create Firewall =============== Function -------- This API is used to create firewall. URI --- POST /v2/{project_id}/firewall .. table:: **Table 1** Path Parameters ========== ========= ====== =========== Parameter Mandatory Type Description ========== ========= ====== =========== project_id Yes String Project ID ========== ========= ====== =========== Request Parameters ------------------ .. table:: **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. | +----------------+-----------+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. table:: **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, which can be obtained by calling the ListFirewallList. | | | | | | | | | | Default: **0** | +-----------------------+-----------------+-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | tags | No | Array of :ref:`tags ` objects | Resource Tag | +-----------------------+-----------------+-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | flavor | Yes | :ref:`flavor ` object | flavor | +-----------------------+-----------------+-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | charge_info | Yes | :ref:`charge_info ` object | Billing type information, postpaid. | +-----------------------+-----------------+-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. _createfirewall__request_tags: .. table:: **Table 4** tags ========= ========= ====== =========== Parameter Mandatory Type Description ========= ========= ====== =========== key No String Tag Key value No String Tag Value ========= ========= ====== =========== .. _createfirewall__request_flavor: .. table:: **Table 5** flavor +-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------+ | Parameter | Mandatory | Type | Description | +=================+=================+=================+=======================================================================================+ | version | Yes | String | Firewall version: charge_mode is postPaid, only the Professional Edition is supported | | | | | | | | | | Enumeration values: | | | | | | | | | | - **Professional** | +-----------------+-----------------+-----------------+---------------------------------------------------------------------------------------+ .. _createfirewall__request_charge_info: .. table:: **Table 6** charge_info +-------------+-----------+--------+----------------------------------------------------------------+ | Parameter | Mandatory | Type | Description | +=============+===========+========+================================================================+ | charge_mode | Yes | String | The billing mode can be postPaid: postpaid, i.e., pay-per-use. | +-------------+-----------+--------+----------------------------------------------------------------+ Response Parameters ------------------- **Status code: 200** .. table:: **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 | :ref:`CreateFirewallReq ` object | Create Firewall Request | +-----------+------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+ .. _createfirewall__response_createfirewallreq: .. table:: **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, which can be obtained by calling the ListFirewallList. | | | | | | | | Default: **0** | +-----------------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | tags | Array of :ref:`tags ` objects | Resource Tag | +-----------------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | flavor | :ref:`flavor ` object | flavor | +-----------------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | charge_info | :ref:`charge_info ` object | Billing type information, postpaid. | +-----------------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. _createfirewall__response_tags: .. table:: **Table 9** tags ========= ====== =========== Parameter Type Description ========= ====== =========== key String Tag Key value String Tag Value ========= ====== =========== .. _createfirewall__response_flavor: .. table:: **Table 10** flavor +-----------------------+-----------------------+---------------------------------------------------------------------------------------+ | Parameter | Type | Description | +=======================+=======================+=======================================================================================+ | version | String | Firewall version: charge_mode is postPaid, only the Professional Edition is supported | | | | | | | | Enumeration values: | | | | | | | | - **Professional** | +-----------------------+-----------------------+---------------------------------------------------------------------------------------+ .. _createfirewall__response_charge_info: .. table:: **Table 11** charge_info +-------------+--------+----------------------------------------------------------------+ | Parameter | Type | Description | +=============+========+================================================================+ | charge_mode | String | The billing mode can be postPaid: postpaid, i.e., pay-per-use. | +-------------+--------+----------------------------------------------------------------+ **Status code: 400** .. table:: **Table 12** Response body parameters ========== ====== =========== Parameter Type Description ========== ====== =========== error_code String Error code error_msg String Description ========== ====== =========== 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. .. code-block:: 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", "period_type" : "month", "period_num" : 1, "is_auto_renew" : true, "is_auto_pay" : true } } Example Responses ----------------- **Status code: 200** Create Firewall Response .. code-block:: { "data" : { "charge_info" : { "charge_mode" : "postPaid" }, "enterprise_project_id" : "0", "flavor" : { "version" : "Professional" }, "name" : "CFW-TEST", "tags" : [ { "key" : "TagKey", "value" : "TagVal" } ] }, "job_id" : "jobId" } **Status code: 400** Bad Request .. code-block:: { "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 :ref:`Error Codes `.