{
  "typeName" : "AWS::Logs::QueryDefinition",
  "description" : "The resource schema for AWSLogs QueryDefinition",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs.git",
  "definitions" : {
    "LogGroup" : {
      "type" : "string",
      "pattern" : "[\\.\\-_/#A-Za-z0-9]+",
      "minLength" : 1,
      "maxLength" : 512
    },
    "QueryParameter" : {
      "type" : "object",
      "description" : "This structure defines a query parameter for a saved CloudWatch Logs Insights query definition. Query parameters are supported only for Logs Insights QL queries. They are placeholder variables that you can reference in a query string using the {{parameterName}} syntax. Each parameter can include a default value and a description.",
      "additionalProperties" : false,
      "properties" : {
        "Name" : {
          "type" : "string",
          "description" : "The name of the query parameter. A query parameter name must start with a letter or underscore, and contain only letters, digits, and underscores.",
          "pattern" : "^[a-zA-Z_][a-zA-Z0-9_]*$",
          "maxLength" : 128
        },
        "DefaultValue" : {
          "type" : "string",
          "description" : "The default value to use for this query parameter if no value is supplied at execution time.",
          "maxLength" : 1024
        },
        "Description" : {
          "type" : "string",
          "description" : "A description of the query parameter that explains its purpose or expected values.",
          "maxLength" : 512
        }
      },
      "required" : [ "Name" ]
    }
  },
  "properties" : {
    "Name" : {
      "description" : "A name for the saved query definition",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 255
    },
    "QueryString" : {
      "description" : "The query string to use for this definition",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 10000
    },
    "LogGroupNames" : {
      "description" : "Optionally define specific log groups as part of your query definition",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "description" : "LogGroup name",
        "$ref" : "#/definitions/LogGroup"
      }
    },
    "QueryDefinitionId" : {
      "description" : "Unique identifier of a query definition",
      "type" : "string",
      "minLength" : 0,
      "maxLength" : 256
    },
    "QueryLanguage" : {
      "description" : "Query language of the query string. Possible values are CWLI, SQL, PPL, with CWLI being the default.",
      "type" : "string",
      "enum" : [ "CWLI", "SQL", "PPL" ],
      "default" : "CWLI"
    },
    "Parameters" : {
      "description" : "Use this parameter to include specific query parameters as part of your query definition. Query parameters are supported only for Logs Insights QL queries. Query parameters allow you to use placeholder variables in your query string that are substituted with values at execution time. Use the {{parameterName}} syntax in your query string to reference a parameter.",
      "type" : "array",
      "insertionOrder" : false,
      "maxItems" : 20,
      "items" : {
        "$ref" : "#/definitions/QueryParameter"
      }
    }
  },
  "required" : [ "Name", "QueryString" ],
  "additionalProperties" : false,
  "readOnlyProperties" : [ "/properties/QueryDefinitionId" ],
  "primaryIdentifier" : [ "/properties/QueryDefinitionId" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "logs:PutQueryDefinition" ]
    },
    "read" : {
      "permissions" : [ "logs:DescribeQueryDefinitions" ]
    },
    "update" : {
      "permissions" : [ "logs:PutQueryDefinition" ]
    },
    "delete" : {
      "permissions" : [ "logs:DeleteQueryDefinition" ]
    },
    "list" : {
      "permissions" : [ "logs:DescribeQueryDefinitions" ]
    }
  },
  "tagging" : {
    "taggable" : false
  }
}