DigitalOcean-public.v2-new_Firewalls
Add Rules to a Firewall
To add additional access rules to a firewall, send a POST request to /v2/firewalls/$FIREWALL_ID/rules. The body of the request may include an inbound_rules and/or outbound_rules attribute containing an array of rules to be added.
No response body will be sent back, but the response code will indicate success. Specifically, the response code will be a 204, which means that the action was successful with no returned body data.
post/v2/firewalls/{firewall_id}/rules
Path parameters
firewall_idstring uuid required
A unique ID that can be used to identify and reference a firewall.
Request body
Example request
{
"inbound_rules": [
{
"protocol": "tcp",
"ports": "8000",
"sources": {
"addresses": [
"1.2.3.4",
"18.0.0.0/8"
],
"droplet_ids": [
8043964
],
"load_balancer_uids": [
"4de7ac8b-495b-4884-9a69-1050c6793cd6"
],
"kubernetes_ids": [
"41b74c5d-9bd0-5555-5555-a57c495b81a3"
],
"tags": [
"frontend"
]
}
}
],
"outbound_rules": [
{
"protocol": "tcp",
"ports": "8000",
"destinations": {
"addresses": [
"1.2.3.4",
"18.0.0.0/8"
],
"droplet_ids": [
8043964
],
"load_balancer_uids": [
"4de7ac8b-495b-4884-9a69-1050c6793cd6"
],
"kubernetes_ids": [
"41b74c5d-9bd0-5555-5555-a57c495b81a3"
],
"tags": [
"frontend"
]
}
}
]
}Response
The action was successful and the response body is empty.