Code | Description |
---|---|
server_already_added | Server added more than one time to resource |
incompatible_network_type | The Network type is incompatible for the given resource |
firewall_resource_not_found | The resource the Firewall should be attached to was not found |
curl --location --request POST 'https://api.hetzner.cloud/v1/firewalls' \
--header 'Content-Type: application/json' \
--data-raw '{
"apply_to": [
{
"server": {
"id": 42
},
"type": "server"
}
],
"labels": {
"env": "dev"
},
"name": "Corporate Intranet Protection",
"rules": [
{
"description": "Allow port 80",
"direction": "in",
"port": "80",
"protocol": "tcp",
"source_ips": [
"28.239.13.1/32",
"28.239.14.0/24",
"ff21:1eac:9a3b:ee58:5ca:990c:8bc9:c03b/128"
]
}
]
}'
{
"actions": [
{
"command": "set_firewall_rules",
"error": {
"code": "action_failed",
"message": "Action failed"
},
"finished": "2016-01-30T23:56:00.000Z",
"id": 13,
"progress": 100,
"resources": [
{
"id": 38,
"type": "firewall"
}
],
"started": "2016-01-30T23:55:00.000Z",
"status": "success"
},
{
"command": "apply_firewall",
"error": {
"code": "action_failed",
"message": "Action failed"
},
"finished": "2016-01-30T23:56:00.000Z",
"id": 14,
"progress": 100,
"resources": [
{
"id": 42,
"type": "server"
},
{
"id": 38,
"type": "firewall"
}
],
"started": "2016-01-30T23:55:00.000Z",
"status": "success"
}
],
"firewall": {
"applied_to": [
{
"applied_to_resources": [
{
"server": {
"id": 42
},
"type": "server"
}
],
"label_selector": {
"selector": "env=prod"
},
"server": {
"id": 42
},
"type": "server"
}
],
"created": "2016-01-30T23:55:00.000Z",
"id": 42,
"labels": {
"property1": "string",
"property2": "string"
},
"name": "my-resource",
"rules": [
{
"description": "string",
"destination_ips": [
"28.239.13.1/32",
"28.239.14.0/24",
"ff21:1eac:9a3b:ee58:5ca:990c:8bc9:c03b/128"
],
"direction": "in",
"port": "80",
"protocol": "tcp",
"source_ips": [
"28.239.13.1/32",
"28.239.14.0/24",
"ff21:1eac:9a3b:ee58:5ca:990c:8bc9:c03b/128"
]
}
]
}
}