{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-cloud-compute-engine/json-schema/google-cloud-compute-engine-firewall-policy-rule-schema.json",
  "title": "FirewallPolicyRule",
  "description": "Represents a rule that describes one or more match conditions along with\nthe action to be taken when traffic matches this condition (allow or deny).",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-cloud-compute-engine-firewall-policies-api-openapi.yml#/components/schemas/FirewallPolicyRule",
  "type": "object",
  "properties": {
    "kind": {
      "description": "Output only. [Output only] Type of the resource. Returnscompute#firewallPolicyRule for firewall rules andcompute#packetMirroringRule for packet mirroring rules.",
      "type": "string",
      "readOnly": true,
      "default": "compute#firewallPolicyRule"
    },
    "targetServiceAccounts": {
      "type": "array",
      "description": "A list of service accounts indicating the sets of instances that are\napplied with this rule.",
      "items": {
        "type": "string"
      }
    },
    "targetType": {
      "enum": [
        "INSTANCES",
        "INTERNAL_MANAGED_LB"
      ],
      "type": "string",
      "description": "Target types of the firewall policy rule.\nDefault value is INSTANCES."
    },
    "ruleTupleCount": {
      "type": "integer",
      "description": "Output only. [Output Only] Calculation of the complexity of a single firewall policy\nrule.",
      "format": "int32",
      "readOnly": true
    },
    "targetSecureTags": {
      "description": "A list of secure tags that controls which instances the firewall rule\napplies to. If targetSecureTag are specified, then the\nfirewall rule applies only to instances in the VPC network that have one\nof those EFFECTIVE secure tags, if all the target_secure_tag are in\nINEFFECTIVE state, then this rule will be ignored.targetSecureTag may not be set at the same time astargetServiceAccounts.\nIf neither targetServiceAccounts nortargetSecureTag are specified, the firewall rule applies\nto all instances on the specified network.\nMaximum number of target label tags allowed is 256.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/FirewallPolicyRuleSecureTag"
      }
    },
    "priority": {
      "type": "integer",
      "format": "int32",
      "description": "An integer indicating the priority of a rule in the list. The priority\nmust be a positive value between 0 and 2147483647.\nRules are evaluated from highest to lowest priority where 0 is the\nhighest priority and 2147483647 is the lowest priority."
    },
    "match": {
      "$ref": "#/$defs/FirewallPolicyRuleMatcher",
      "description": "A match condition that incoming traffic is evaluated against.\nIf it evaluates to true, the corresponding 'action' is enforced."
    },
    "direction": {
      "description": "The direction in which this rule applies.",
      "enum": [
        "EGRESS",
        "INGRESS"
      ],
      "type": "string"
    },
    "description": {
      "description": "An optional description for this resource.",
      "type": "string"
    },
    "action": {
      "type": "string",
      "description": "The Action to perform when the client connection triggers the rule.\nValid actions for firewall rules are: \"allow\", \"deny\",\n\"apply_security_profile_group\" and \"goto_next\" (\n\"apply_security_profile_group\" can be specified only for global\nnetwork firewall policies or hierarchical firewall policies).\nValid actions for packet mirroring rules are: \"mirror\", \"do_not_mirror\"\nand \"goto_next\"."
    },
    "tlsInspect": {
      "description": "Boolean flag indicating if the traffic should be TLS decrypted.\nCan be set only if action = 'apply_security_profile_group' and cannot\nbe set for other actions.",
      "type": "boolean"
    },
    "targetForwardingRules": {
      "type": "array",
      "description": "A list of forwarding rules to which this rule applies.\nThis field allows you to control which load balancers get this rule.\nFor example, the following are valid values:\n   \n   \n     - https://www.googleapis.com/compute/v1/projects/project/global/forwardingRules/forwardingRule\n     - https://www.googleapis.com/compute/v1/projects/project/regions/region/forwardingRules/forwardingRule\n     - projects/project/global/\n     forwardingRules/forwardingRule\n     - projects/project/regions/region/forwardingRules/\n     forwardingRule",
      "items": {
        "type": "string"
      }
    },
    "disabled": {
      "type": "boolean",
      "description": "Denotes whether the firewall policy rule is disabled. When set to true,\nthe firewall policy rule is not enforced and traffic behaves as if it did\nnot exist. If this is unspecified, the firewall policy rule will be\nenabled."
    },
    "targetResources": {
      "type": "array",
      "description": "A list of network resource URLs to which this rule applies.  This field\nallows you to control which network's VMs get this rule.  If this field\nis left blank, all VMs within the organization will receive the rule.",
      "items": {
        "type": "string"
      }
    },
    "enableLogging": {
      "description": "Denotes whether to enable logging for a particular rule. If logging is\nenabled, logs will be exported to the configured export destination in\nStackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you\ncannot enable logging on \"goto_next\" rules.",
      "type": "boolean"
    },
    "ruleName": {
      "description": "An optional name for the rule. This field is not a unique identifier\nand can be updated.",
      "type": "string"
    },
    "securityProfileGroup": {
      "description": "A fully-qualified URL of a SecurityProfileGroup resource instance.\nExample:\nhttps://networksecurity.googleapis.com/v1/projects/{project}/locations/{location}/securityProfileGroups/my-security-profile-group\nMust be specified if action is one of 'apply_security_profile_group' or\n'mirror'. Cannot be specified for other actions. Can be specified only\nfor global network firewall policies or hierarchical firewall policies.",
      "type": "string"
    }
  },
  "$defs": {
    "FirewallPolicyRuleMatcher": {
      "properties": {
        "srcFqdns": {
          "description": "Fully Qualified Domain Name (FQDN) which should be matched against\ntraffic source.\nMaximum number of source fqdn allowed is 100.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "srcIpRanges": {
          "type": "array",
          "description": "CIDR IP address range.\nMaximum number of source CIDR IP ranges allowed is 5000.",
          "items": {
            "type": "string"
          }
        },
        "srcNetworkContext": {
          "description": "Network context of the traffic source. Allowed values are:\n   \n   \n     - UNSPECIFIED\n     - INTERNET\n     - INTRA_VPC\n     - NON_INTERNET\n     - VPC_NETWORKS",
          "type": "string",
          "enum": [
            "INTERNET",
            "INTRA_VPC",
            "NON_INTERNET",
            "UNSPECIFIED",
            "VPC_NETWORKS"
          ]
        },
        "destNetworkContext": {
          "description": "Network context of the traffic destination. Allowed values are:\n   \n   \n     - UNSPECIFIED\n     - INTERNET\n     - NON_INTERNET",
          "type": "string",
          "enum": [
            "INTERNET",
            "INTRA_VPC",
            "NON_INTERNET",
            "UNSPECIFIED",
            "VPC_NETWORKS"
          ]
        },
        "srcThreatIntelligences": {
          "type": "array",
          "description": "Names of Network Threat Intelligence lists.\nThe IPs in these lists will be matched against traffic source.",
          "items": {
            "type": "string"
          }
        },
        "destThreatIntelligences": {
          "description": "Names of Network Threat Intelligence lists.\nThe IPs in these lists will be matched against traffic destination.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "layer4Configs": {
          "items": {
            "$ref": "#/$defs/FirewallPolicyRuleMatcherLayer4Config"
          },
          "type": "array",
          "description": "Pairs of IP protocols and ports that the rule should match."
        },
        "destNetworkType": {
          "type": "string",
          "description": "Network type of the traffic destination. Allowed values are:\n   \n   \n     - UNSPECIFIED\n     - INTERNET\n     - NON_INTERNET",
          "enum": [
            "INTERNET",
            "INTRA_VPC",
            "NON_INTERNET",
            "UNSPECIFIED",
            "VPC_NETWORKS"
          ]
        },
        "srcSecureTags": {
          "items": {
            "$ref": "#/$defs/FirewallPolicyRuleSecureTag"
          },
          "description": "List of secure tag values, which should be matched at the source\nof the traffic.\nFor INGRESS rule, if all the srcSecureTag are INEFFECTIVE,\nand there is no srcIpRange, this rule will be ignored.\nMaximum number of source tag values allowed is 256.",
          "type": "array"
        },
        "srcNetworkType": {
          "type": "string",
          "description": "Network type of the traffic source. Allowed values are:\n   \n   \n     - UNSPECIFIED\n     - INTERNET\n     - INTRA_VPC\n     - NON_INTERNET\n     - VPC_NETWORKS",
          "enum": [
            "INTERNET",
            "INTRA_VPC",
            "NON_INTERNET",
            "UNSPECIFIED",
            "VPC_NETWORKS"
          ]
        },
        "destAddressGroups": {
          "items": {
            "type": "string"
          },
          "description": "Address groups which should be matched against the traffic destination.\nMaximum number of destination address groups is 10.",
          "type": "array"
        },
        "srcNetworks": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Networks of the traffic source. It can be either a full or partial url."
        },
        "destFqdns": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Fully Qualified Domain Name (FQDN) which should be matched against\ntraffic destination.\nMaximum number of destination fqdn allowed is 100."
        },
        "srcAddressGroups": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Address groups which should be matched against the traffic source.\nMaximum number of source address groups is 10."
        },
        "destIpRanges": {
          "type": "array",
          "description": "CIDR IP address range.\nMaximum number of destination CIDR IP ranges allowed is 5000.",
          "items": {
            "type": "string"
          }
        },
        "srcRegionCodes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Region codes whose IP addresses will be used to match for source\nof traffic. Should be specified as 2 letter country code defined as per\nISO 3166 alpha-2 country codes. ex.\"US\"\nMaximum number of source region codes allowed is 5000."
        },
        "destRegionCodes": {
          "type": "array",
          "description": "Region codes whose IP addresses will be used to match for destination\nof traffic. Should be specified as 2 letter country code defined as per\nISO 3166 alpha-2 country codes. ex.\"US\"\nMaximum number of dest region codes allowed is 5000.",
          "items": {
            "type": "string"
          }
        }
      },
      "type": "object",
      "description": "Represents a match condition that incoming traffic is evaluated against.\nExactly one field must be specified."
    },
    "FirewallPolicyRuleMatcherLayer4Config": {
      "type": "object",
      "properties": {
        "ports": {
          "description": "An optional list of ports to which this rule applies. This field is\nonly applicable for UDP or TCP protocol. Each entry must be either\nan integer or a range. If not specified, this rule applies to\nconnections through any port.\n\nExample inputs include: [\"22\"],[\"80\",\"443\"], and [\"12345-12349\"].",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "ipProtocol": {
          "description": "The IP protocol to which this rule applies. The protocol type is\nrequired when creating a firewall rule. This value can either be\none of the following well known protocol strings (tcp,udp, icmp, esp,ah, ipip, sctp), or the IP\nprotocol number.",
          "type": "string"
        }
      }
    },
    "FirewallPolicyRuleSecureTag": {
      "type": "object",
      "properties": {
        "name": {
          "pattern": "tagValues/[0-9]+",
          "type": "string",
          "description": "Name of the secure tag, created with TagManager's TagValue API."
        },
        "state": {
          "readOnly": true,
          "type": "string",
          "enum": [
            "EFFECTIVE",
            "INEFFECTIVE"
          ],
          "description": "Output only. [Output Only] State of the secure tag, either `EFFECTIVE` or\n`INEFFECTIVE`. A secure tag is `INEFFECTIVE` when it is deleted\nor its network is deleted."
        }
      }
    }
  }
}