{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-cdn/json-schema/microsoft-azure-cdn-rule-set-schema.json",
  "title": "RuleSet",
  "description": "Friendly RuleSet name mapping to the any RuleSet or secret related information.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-cdn-rulesets-api-openapi.yml#/components/schemas/RuleSet",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/RuleSetProperties",
      "description": "The JSON object that contains the properties of the Rule Set to create.",
      "x-ms-client-flatten": true
    }
  },
  "allOf": [
    {
      "$ref": "../../../../../../common-types/resource-management/v6/types.json#/definitions/ProxyResource"
    }
  ],
  "$defs": {
    "AFDStateProperties": {
      "type": "object",
      "description": "The tracking states for afd resources.",
      "properties": {
        "provisioningState": {
          "$ref": "#/$defs/AfdProvisioningState",
          "description": "Provisioning status",
          "readOnly": true
        },
        "deploymentStatus": {
          "$ref": "#/$defs/DeploymentStatus",
          "readOnly": true
        }
      }
    },
    "AfdProvisioningState": {
      "type": "string",
      "description": "Provisioning status",
      "enum": [
        "Succeeded",
        "Failed",
        "Updating",
        "Deleting",
        "Creating"
      ],
      "x-ms-enum": {
        "name": "AfdProvisioningState",
        "modelAsString": true,
        "values": [
          {
            "name": "Succeeded",
            "value": "Succeeded"
          },
          {
            "name": "Failed",
            "value": "Failed"
          },
          {
            "name": "Updating",
            "value": "Updating"
          },
          {
            "name": "Deleting",
            "value": "Deleting"
          },
          {
            "name": "Creating",
            "value": "Creating"
          }
        ]
      }
    },
    "BatchRuleProperties": {
      "type": "object",
      "description": "The JSON object that contains a rule with its name for batch mode operations.",
      "properties": {
        "ruleName": {
          "type": "string",
          "description": "Name of the rule.",
          "minLength": 1,
          "maxLength": 60,
          "pattern": "^[a-zA-Z][a-zA-Z0-9]{0,59}$",
          "x-ms-mutability": [
            "read",
            "create"
          ]
        },
        "ruleSetName": {
          "type": "string",
          "description": "The name of the rule set containing the rule.",
          "readOnly": true
        },
        "order": {
          "type": "integer",
          "format": "int32",
          "description": "The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied."
        },
        "conditions": {
          "type": "array",
          "description": "A list of conditions that must be matched for the actions to be executed",
          "items": {
            "$ref": "#/$defs/DeliveryRuleCondition"
          },
          "x-ms-identifiers": [
            "name"
          ]
        },
        "actions": {
          "type": "array",
          "description": "A list of actions that are executed when all the conditions of a rule are satisfied.",
          "items": {
            "$ref": "#/$defs/DeliveryRuleAction"
          },
          "x-ms-identifiers": [
            "name"
          ]
        },
        "matchProcessingBehavior": {
          "type": "string",
          "description": "If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue.",
          "default": "Continue",
          "enum": [
            "Continue",
            "Stop"
          ],
          "x-ms-enum": {
            "name": "MatchProcessingBehavior",
            "modelAsString": true,
            "values": [
              {
                "name": "Continue",
                "value": "Continue"
              },
              {
                "name": "Stop",
                "value": "Stop"
              }
            ]
          }
        }
      },
      "required": [
        "ruleName"
      ]
    },
    "DeliveryRuleAction": {
      "type": "object",
      "description": "An action for the delivery rule.",
      "properties": {
        "name": {
          "$ref": "#/$defs/DeliveryRuleActionName",
          "description": "The name of the action for the delivery rule."
        }
      },
      "required": [
        "name"
      ]
    },
    "DeliveryRuleActionName": {
      "type": "string",
      "description": "The name of the action for the delivery rule.",
      "enum": [
        "CacheExpiration",
        "CacheKeyQueryString",
        "ModifyRequestHeader",
        "ModifyResponseHeader",
        "UrlRedirect",
        "UrlRewrite",
        "UrlSigning",
        "OriginGroupOverride",
        "RouteConfigurationOverride",
        "EdgeAction",
        "AfdUrlSigning"
      ],
      "x-ms-enum": {
        "name": "DeliveryRuleActionName",
        "modelAsString": true,
        "values": [
          {
            "name": "CacheExpiration",
            "value": "CacheExpiration"
          },
          {
            "name": "CacheKeyQueryString",
            "value": "CacheKeyQueryString"
          },
          {
            "name": "ModifyRequestHeader",
            "value": "ModifyRequestHeader"
          },
          {
            "name": "ModifyResponseHeader",
            "value": "ModifyResponseHeader"
          },
          {
            "name": "UrlRedirect",
            "value": "UrlRedirect"
          },
          {
            "name": "UrlRewrite",
            "value": "UrlRewrite"
          },
          {
            "name": "UrlSigning",
            "value": "UrlSigning"
          },
          {
            "name": "OriginGroupOverride",
            "value": "OriginGroupOverride"
          },
          {
            "name": "RouteConfigurationOverride",
            "value": "RouteConfigurationOverride"
          },
          {
            "name": "EdgeAction",
            "value": "EdgeAction"
          },
          {
            "name": "AfdUrlSigning",
            "value": "AfdUrlSigning"
          }
        ]
      }
    },
    "DeliveryRuleCondition": {
      "type": "object",
      "description": "A condition for the delivery rule.",
      "properties": {
        "name": {
          "$ref": "#/$defs/MatchVariable",
          "description": "The name of the condition for the delivery rule."
        }
      },
      "required": [
        "name"
      ]
    },
    "DeploymentStatus": {
      "type": "string",
      "enum": [
        "NotStarted",
        "InProgress",
        "Succeeded",
        "Failed"
      ],
      "x-ms-enum": {
        "name": "DeploymentStatus",
        "modelAsString": true,
        "values": [
          {
            "name": "NotStarted",
            "value": "NotStarted"
          },
          {
            "name": "InProgress",
            "value": "InProgress"
          },
          {
            "name": "Succeeded",
            "value": "Succeeded"
          },
          {
            "name": "Failed",
            "value": "Failed"
          }
        ]
      }
    },
    "MatchVariable": {
      "type": "string",
      "description": "Request variable to compare with.",
      "enum": [
        "RemoteAddress",
        "RequestMethod",
        "QueryString",
        "PostArgs",
        "RequestUri",
        "RequestHeader",
        "RequestBody",
        "RequestScheme",
        "UrlPath",
        "UrlFileExtension",
        "UrlFileName",
        "HttpVersion",
        "Cookies",
        "IsDevice",
        "SocketAddr",
        "ClientPort",
        "ServerPort",
        "HostName",
        "SslProtocol"
      ],
      "x-ms-enum": {
        "name": "MatchVariable",
        "modelAsString": true,
        "values": [
          {
            "name": "RemoteAddress",
            "value": "RemoteAddress"
          },
          {
            "name": "RequestMethod",
            "value": "RequestMethod"
          },
          {
            "name": "QueryString",
            "value": "QueryString"
          },
          {
            "name": "PostArgs",
            "value": "PostArgs"
          },
          {
            "name": "RequestUri",
            "value": "RequestUri"
          },
          {
            "name": "RequestHeader",
            "value": "RequestHeader"
          },
          {
            "name": "RequestBody",
            "value": "RequestBody"
          },
          {
            "name": "RequestScheme",
            "value": "RequestScheme"
          },
          {
            "name": "UrlPath",
            "value": "UrlPath"
          },
          {
            "name": "UrlFileExtension",
            "value": "UrlFileExtension"
          },
          {
            "name": "UrlFileName",
            "value": "UrlFileName"
          },
          {
            "name": "HttpVersion",
            "value": "HttpVersion"
          },
          {
            "name": "Cookies",
            "value": "Cookies"
          },
          {
            "name": "IsDevice",
            "value": "IsDevice"
          },
          {
            "name": "SocketAddr",
            "value": "SocketAddr"
          },
          {
            "name": "ClientPort",
            "value": "ClientPort"
          },
          {
            "name": "ServerPort",
            "value": "ServerPort"
          },
          {
            "name": "HostName",
            "value": "HostName"
          },
          {
            "name": "SslProtocol",
            "value": "SslProtocol"
          }
        ]
      }
    },
    "RuleSetProperties": {
      "type": "object",
      "description": "The JSON object that contains the properties of the Rule Set to create.",
      "properties": {
        "profileName": {
          "type": "string",
          "description": "The name of the profile which holds the rule set.",
          "readOnly": true
        },
        "batchMode": {
          "type": "boolean",
          "description": "Indicates whether rule set is in batch mode. When batch mode is enabled, rules will be processed in a batch along with the rule set.\nWhen batch mode is disabled, rules would need to be processed independently.\nThis property can only be set during rule set creation and cannot be updated later.\nFor switching modes, a new rule set needs to be created with the desired mode and rules need to be migrated to the new rule set.",
          "x-ms-mutability": [
            "read",
            "create"
          ]
        },
        "rules": {
          "type": "array",
          "description": "A list of rules that are part of this rule set provided the rule set is in batch mode.\nThis property will be ignored if the rule set is not in batch mode.",
          "items": {
            "$ref": "#/$defs/BatchRuleProperties"
          },
          "x-ms-identifiers": [
            "ruleName"
          ]
        }
      },
      "allOf": [
        {
          "$ref": "#/$defs/AFDStateProperties"
        }
      ]
    }
  }
}