Creating a Firewall
Function
This API is used to create a firewall.
URI
POST /v2/{project_id}/firewall
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. |
Request 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. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
name | Yes | String | Firewall name. |
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. |
tags | No | Array of tags objects | List of service resource tags. After tags are added to firewall resources, you can query resources and combine CDRs by key and value. |
flavor | Yes | flavor object | Firewall specifications. |
charge_info | Yes | charge_info object | Billing type, which can be pay-per-use (default setting). |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
key | No | String | Resource tag key. |
value | No | String | Resource tag value. |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
job_id | String | Instance creation task ID. This parameter is returned only when pay-per-use instances are created. |
order_id | String | Order ID. |
data | CreateFirewallReq object | Request body for creating a firewall. |
Parameter | Type | Description |
|---|---|---|
name | String | Firewall name. |
enterprise_project_id | 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. |
tags | Array of tags objects | List of service resource tags. After tags are added to firewall resources, you can query resources and combine CDRs by key and value. |
flavor | flavor object | Firewall specifications. |
charge_info | charge_info object | Billing type, which can be pay-per-use (default setting). |
Parameter | Type | Description |
|---|---|---|
version | String | Firewall edition. Only the professional edition is supported. |
Parameter | Type | Description |
|---|---|---|
charge_mode | String | Billing mode. The value can only be postPaid, indicating pay-per-use billing. |
Status code: 400
Parameter | Type | Description |
|---|---|---|
error_code | String | Error code. |
error_msg | String | Error description. |
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. Pay-per-use billing is used.
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" : "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" : {
"extend_bandwidth" : 5000,
"extend_eip_count" : 2000,
"extend_vpc_count" : 100,
"version" : "Standard"
},
"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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
