{
  "$schema": "https://github.com/apache/trafficserver/tree/master/configs/ip_allow.schema.json",
  "title": "Traffic Server IP Allow Configuration",
  "description": "IP ACL configuration file structure. Licensed under Apache V2 https://www.apache.org/licenses/LICENSE-2.0",
  "type": "object",
  "properties": {
    "version": {
      "type": "string",
      "description": "Configuration format version."
    },
    "ip_allow": {
      "description": "Root tag for IP address ACL configuration",
      "type": "array",
      "items": {
        "$ref": "#/definitions/rule"
      }
    }
  },
  "required": [ "ip_allow" ],
  "definitions": {
    "range": {
      "description": "A range of IP addresses in a single family.",
      "type": "string"
    },
    "action": {
      "description": "Enforcement action.",
      "type": "string",
      "enum": [ "allow", "deny" ]
    },
    "methods": {
      "description": "Methods to check.",
      "oneOf": [
        {
          "type": "string",
          "description": "Method name"
        },
        {
          "type": "array",
          "description": "List of method names.",
          "minItems": 1,
          "items": {
            "type": "string",
            "description": "Method name"
          }
        }
      ]
    },
    "rule": {
      "description": "Connection ACL.",
      "type": "object",
      "properties": {
        "apply": {
          "description": "Where to apply the rule, inbound or outbound.",
          "type": "string",
          "enum": [ "in", "out" ]
        },
        "ip_addrs": {
          "oneOf": [
            {
              "$ref": "#/definitions/range"
            },
            {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/definitions/range"
              }
            }
          ]
        },
        "action": {
          "$ref": "#/definitions/action"
        },
        "methods": {
          "$ref": "#/definitions/methods"
        }
      },
      "required": [ "apply", "ip_addrs", "action" ]
    }
  }
}
