{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/contabo/json-schema/contabo-create-firewall-request-schema.json",
  "title": "CreateFirewallRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/contabo-firewalls-api-openapi.yml#/components/schemas/CreateFirewallRequest",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "The name of the firewall."
    },
    "description": {
      "type": "string",
      "maxLength": 255,
      "description": "The description of the firewall."
    },
    "status": {
      "type": "string",
      "description": "The status of the firewall determines whether the rules are active or not.",
      "enum": [
        "active",
        "inactive"
      ]
    },
    "rules": {
      "$ref": "#/$defs/RulesRequest"
    }
  },
  "required": [
    "name",
    "status"
  ],
  "$defs": {
    "FirewallRuleRequest": {
      "type": "object",
      "properties": {
        "protocol": {
          "type": "string",
          "description": "Protocol for incoming traffic to be allowed. ‘tcp‘, ´udp´, ´icmp´ or ´´ empty value are allowed. Empty means any traffic.",
          "enum": [
            "tcp",
            "udp",
            "icmp",
            ""
          ]
        },
        "destPorts": {
          "type": "array",
          "items": {
            "type": "string",
            "maxItems": 15
          },
          "description": "Ports to specify allowed traffic. Not available for protocol `ICMP`. Port ranges can specified like in example."
        },
        "srcCidr": {
          "description": "Source CIDR configuration. Use \"AnyIPv4\" to allow all IPv4 sources (0.0.0.0/0) or \"AnyIPv6\" to allow all IPv6 sources (::/0). Both can be combined to allow all IP sources. Regular CIDR notation is also supported.",
          "allOf": [
            {
              "$ref": "#/$defs/SrcCidr"
            }
          ]
        },
        "action": {
          "type": "string",
          "enum": [
            "accept",
            "drop"
          ],
          "description": "Currently only `accept` is supported."
        },
        "status": {
          "type": "string",
          "description": "Status of the inbound rule. An inactive rule is removed from all assigned instances.",
          "enum": [
            "active",
            "inactive"
          ]
        },
        "displayName": {
          "type": "string",
          "description": "Display name for the firewall rule."
        }
      },
      "required": [
        "protocol",
        "destPorts",
        "srcCidr",
        "action",
        "status"
      ]
    },
    "RulesRequest": {
      "type": "object",
      "properties": {
        "inbound": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FirewallRuleRequest"
          }
        }
      },
      "required": [
        "inbound"
      ]
    },
    "SrcCidr": {
      "type": "object",
      "properties": {
        "ipv4": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "IPv4 addresses in CIDR notation or \"AnyIPv4\" to allow all IPv4 sources (translates to 0.0.0.0/0)"
        },
        "ipv6": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "IPv6 addresses in CIDR notation or \"AnyIPv6\" to allow all IPv6 sources (translates to ::/0)"
        }
      }
    }
  }
}