Skip to main content

List Firewall Rules

curl -X GET "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/firewall-rule" \
  -H "Authorization: Bearer $API_KEY"

Path Parameters

project_id
string
required
ID of the project
location
string
required
The Ubicloud location/region
postgres_database_reference
string
required
Postgres database ID or name

Response

count
integer
required
Total number of firewall rules
items
array
required
Array of firewall rule objects

Create Firewall Rule

curl -X POST "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/firewall-rule" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cidr": "192.168.1.0/24",
    "description": "Allow office network"
  }'

Path Parameters

project_id
string
required
ID of the project
location
string
required
The Ubicloud location/region
postgres_database_reference
string
required
Postgres database ID or name

Body Parameters

cidr
string
required
CIDR of the firewall rule
description
string
Description of the firewall rule

Response

id
string
required
ID of the firewall rulePattern: ^fr[0-9a-hj-km-np-tv-z]{24}$
cidr
string
required
CIDR of the firewall rule
description
string
Port information for the firewall rule
port
integer
Port for the Postgres firewall rule

Update Firewall Rule

curl -X PATCH "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/firewall-rule/{firewall_rule_id}" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cidr": "192.168.2.0/24",
    "description": "Updated office network"
  }'

Path Parameters

project_id
string
required
ID of the project
location
string
required
The Ubicloud location/region
postgres_database_reference
string
required
Postgres database ID or name
firewall_rule_id
string
required
ID of the firewall rulePattern: ^fr[0-9a-hj-km-np-tv-z]{24}$

Body Parameters

cidr
string
CIDR of the firewall rule
description
string
Description of the firewall rule

Delete Firewall Rule

curl -X DELETE "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/firewall-rule/{firewall_rule_id}" \
  -H "Authorization: Bearer $API_KEY"

Path Parameters

project_id
string
required
ID of the project
location
string
required
The Ubicloud location/region
postgres_database_reference
string
required
Postgres database ID or name
firewall_rule_id
string
required
ID of the firewall rule

Response

Returns a 204 No Content status code on successful deletion.

Build docs developers (and LLMs) love