Create Firewall
POST https://infrahub-api.nexgencloud.com/v1/core/firewalls
Creates a firewall to which firewall rules can be added. A firewall containing firewall rules can be attached to one or more virtual machines to control inbound and outbound traffic. In the body of the request, include the name of the firewall, the ID of the environment within which the firewall will be created, and an optional description. To obtain the ID of the environment, make a request to the list environments endpoint.
Request body parameters
name string
Required
Name of the firewall.
A string with a maximum length of 50 characters.
environment_id integer
Required
The ID of the environment within which your firewall will be created.
description string
optional
An optional description of the firewall.
Attributes
status boolean
Indicates the success or failure of the request to create a firewall. true
, indicates success, while false
indicates error.
message string
A message confirming the status of the request to create a firewall.
firewall object
Returns the firewall
object, containing details on the firewall that was created.
For descriptions of the fields within the firewall
object returned in response to your request, please refer to the documentation here.
curl -X POST "https://infrahub-api.nexgencloud.com/v1/core/firewalls" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"name": "example-firewall",
"description": "Example firewall for documentaion.",
"environment_id": 135
}'
{
"status": true,
"message": "Firewall is scheduled for creation.",
"firewall": {
"id": 71,
"name": "example-firewall",
"description": "Example firewall for documentaion.",
"environment": {
"id": 135,
"name": "test-norwway",
"region": "staging-NORWAY-1"
},
"status": "CREATING",
"created_at": "2024-03-01T09:36:52"
}
}
Returns
The response will include the status of the request and the firewall
object, providing detailed information about the newly created firewall. To learn more about the attributes of the firewall
object, click here.