Firewall Actions

Apply to Resources

Applies a Firewall to multiple resources.

Supported resources:

  • Servers (with a public network interface)
  • Label Selectors

A Server can be applied to a maximum of 5 Firewalls. This limit applies to Servers applied via a matching Label Selector as well.

Updates to resources matching or no longer matching a Label Selector can take up to a few seconds to be processed.

A Firewall is applied to a resource once the related Action with command apply_firewall successfully finished.

Operation specific errors

StatusCodeDescription
404firewall_resource_not_foundThe resource the Firewall should be applied to was not found
422firewall_already_appliedFirewall is already applied to resource
422incompatible_network_typeThe network type of the resource is not supported by Firewalls
422private_net_only_serverThe Server the Firewall should be applied to has no public interface
post/firewalls/{id}/actions/apply_to_resources

Request

  • Base URL: https://api.hetzner.cloud/v1
  • URL: https://api.hetzner.cloud/v1/firewalls/{id}/actions/apply_to_resources
  • Auth: HTTP bearer

Path parameters

idinteger required

ID of the Firewall.

Example:42

ID of the Firewall.

Request body

Example request

{
  "apply_to": [
    {
      "label_selector": {
        "selector": "env=prod"
      }
    }
  ]
}

Response

Request succeeded.

Example response

{
  "actions": [
    {
      "id": 42,
      "command": "start_resource",
      "started": "2016-01-30T23:55:00Z",
      "finished": "2016-01-30T23:55:00Z",
      "progress": 100,
      "resources": [
        {
          "id": 42,
          "type": "server"
        }
      ],
      "error": {
        "code": "action_failed",
        "message": "Action failed"
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.