{
  "typeName" : "AWS::ApiGatewayV2::RoutingRule",
  "description" : "Represents a routing rule. When the incoming request to a domain name matches the conditions for a rule, API Gateway invokes a stage of a target API. Supported only for REST APIs.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-apigatewayv2.git",
  "properties" : {
    "RoutingRuleId" : {
      "description" : "",
      "type" : "string"
    },
    "RoutingRuleArn" : {
      "type" : "string",
      "description" : ""
    },
    "DomainNameArn" : {
      "type" : "string",
      "description" : "The ARN of the domain name."
    },
    "Priority" : {
      "type" : "integer",
      "description" : "The order in which API Gateway evaluates a rule. Priority is evaluated from the lowest value to the highest value. Rules can't have the same priority. Priority values 1-1,000,000 are supported."
    },
    "Conditions" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Condition"
      },
      "description" : "The conditions of the routing rule."
    },
    "Actions" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Action"
      },
      "description" : "The resulting action based on matching a routing rules condition. Only InvokeApi is supported."
    }
  },
  "definitions" : {
    "Condition" : {
      "type" : "object",
      "properties" : {
        "MatchHeaders" : {
          "$ref" : "#/definitions/MatchHeaders",
          "description" : "The headers to be matched."
        },
        "MatchBasePaths" : {
          "$ref" : "#/definitions/MatchBasePaths",
          "description" : "The base path to be matched."
        }
      },
      "description" : "Represents a condition. Conditions can contain up to two ``matchHeaders`` conditions and one ``matchBasePaths`` conditions. API Gateway evaluates header conditions and base path conditions together. You can only use AND between header and base path conditions."
    },
    "MatchHeaders" : {
      "type" : "object",
      "required" : [ "AnyOf" ],
      "properties" : {
        "AnyOf" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/MatchHeaderValue"
          },
          "description" : "The header name and header value glob to be matched. The matchHeaders condition is matched if any of the header name and header value globs are matched."
        }
      },
      "description" : "Represents a ``MatchHeaders`` condition."
    },
    "MatchBasePaths" : {
      "type" : "object",
      "required" : [ "AnyOf" ],
      "properties" : {
        "AnyOf" : {
          "type" : "array",
          "items" : {
            "type" : "string"
          },
          "description" : "The string of the case sensitive base path to be matched."
        }
      },
      "description" : "Represents a ``MatchBasePaths`` condition."
    },
    "MatchHeaderValue" : {
      "type" : "object",
      "required" : [ "Header", "ValueGlob" ],
      "properties" : {
        "Header" : {
          "type" : "string",
          "description" : "The case insensitive header name to be matched. The header name must be less than 40 characters and the only allowed characters are ``a-z``, ``A-Z``, ``0-9``, and the following special characters: ``*?-!#$%&'.^_`|~.``."
        },
        "ValueGlob" : {
          "type" : "string",
          "description" : "The case sensitive header glob value to be matched against entire header value. The header glob value must be less than 128 characters and the only allowed characters are ``a-z``, ``A-Z``, ``0-9``, and the following special characters: ``*?-!#$%&'.^_`|~``. Wildcard matching is supported for header glob values but must be for ``*prefix-match``, ``suffix-match*``, or ``*infix*-match``."
        }
      },
      "description" : "Represents a ``MatchHeaderValue``."
    },
    "Action" : {
      "type" : "object",
      "required" : [ "InvokeApi" ],
      "properties" : {
        "InvokeApi" : {
          "$ref" : "#/definitions/ActionInvokeApi",
          "description" : "Represents an InvokeApi action."
        }
      },
      "description" : "Represents a routing rule action. The only supported action is ``invokeApi``."
    },
    "ActionInvokeApi" : {
      "type" : "object",
      "required" : [ "ApiId", "Stage" ],
      "properties" : {
        "ApiId" : {
          "type" : "string",
          "description" : "The API identifier of the target API."
        },
        "Stage" : {
          "type" : "string",
          "description" : "The name of the target stage."
        },
        "StripBasePath" : {
          "type" : "boolean",
          "description" : "The strip base path setting. When true, API Gateway strips the incoming matched base path when forwarding the request to the target API."
        }
      },
      "description" : "Represents an InvokeApi action."
    }
  },
  "additionalProperties" : false,
  "required" : [ "DomainNameArn", "Priority", "Conditions", "Actions" ],
  "createOnlyProperties" : [ "/properties/DomainNameArn" ],
  "primaryIdentifier" : [ "/properties/RoutingRuleArn" ],
  "readOnlyProperties" : [ "/properties/RoutingRuleArn", "/properties/RoutingRuleId" ],
  "tagging" : {
    "taggable" : false,
    "tagOnCreate" : false,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : false
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "apigateway:CreateRoutingRule" ]
    },
    "read" : {
      "permissions" : [ "apigateway:GetRoutingRule" ]
    },
    "update" : {
      "permissions" : [ "apigateway:UpdateRoutingRule" ]
    },
    "delete" : {
      "permissions" : [ "apigateway:DeleteRoutingRule" ]
    },
    "list" : {
      "permissions" : [ "apigateway:ListRoutingRules" ],
      "handlerSchema" : {
        "properties" : {
          "DomainNameArn" : {
            "$ref" : "resource-schema.json#/properties/DomainNameArn"
          }
        },
        "required" : [ "DomainNameArn" ]
      }
    }
  }
}