{
  "typeName" : "AWS::IoT::Command",
  "description" : "Represents the resource definition of AWS IoT Command.",
  "definitions" : {
    "CommandParameterList" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/CommandParameter"
      },
      "minItems" : 1,
      "insertionOrder" : false
    },
    "CommandParameter" : {
      "type" : "object",
      "properties" : {
        "Name" : {
          "$ref" : "#/definitions/CommandParameterName"
        },
        "Value" : {
          "$ref" : "#/definitions/CommandParameterValue"
        },
        "DefaultValue" : {
          "$ref" : "#/definitions/CommandParameterValue"
        },
        "Description" : {
          "$ref" : "#/definitions/CommandParameterDescription"
        },
        "Type" : {
          "$ref" : "#/definitions/CommandParameterType"
        },
        "ValueConditions" : {
          "$ref" : "#/definitions/CommandParameterValueConditionList"
        }
      },
      "required" : [ "Name" ],
      "additionalProperties" : false
    },
    "CommandParameterName" : {
      "type" : "string",
      "pattern" : "^[.$a-zA-Z0-9_-]+$",
      "minLength" : 1,
      "maxLength" : 192
    },
    "CommandParameterDescription" : {
      "type" : "string",
      "maxLength" : 2028
    },
    "CommandParameterValue" : {
      "type" : "object",
      "properties" : {
        "S" : {
          "type" : "string",
          "minLength" : 1
        },
        "B" : {
          "type" : "boolean"
        },
        "I" : {
          "type" : "integer"
        },
        "L" : {
          "type" : "string",
          "pattern" : "^-?\\d+$",
          "maxLength" : 19
        },
        "D" : {
          "type" : "number"
        },
        "BIN" : {
          "type" : "string",
          "minLength" : 1
        },
        "UL" : {
          "type" : "string",
          "pattern" : "^[0-9]*$",
          "minLength" : 1,
          "maxLength" : 20
        }
      },
      "additionalProperties" : false
    },
    "CommandParameterType" : {
      "type" : "string",
      "enum" : [ "STRING", "INTEGER", "DOUBLE", "LONG", "UNSIGNEDLONG", "BOOLEAN", "BINARY" ]
    },
    "CommandParameterValueConditionList" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/CommandParameterValueCondition"
      },
      "minItems" : 1,
      "insertionOrder" : true
    },
    "CommandParameterValueCondition" : {
      "type" : "object",
      "properties" : {
        "ComparisonOperator" : {
          "$ref" : "#/definitions/CommandParameterValueComparisonOperator"
        },
        "Operand" : {
          "$ref" : "#/definitions/CommandParameterValueComparisonOperand"
        }
      },
      "required" : [ "ComparisonOperator", "Operand" ],
      "additionalProperties" : false
    },
    "CommandParameterValueComparisonOperator" : {
      "type" : "string",
      "enum" : [ "EQUALS", "NOT_EQUALS", "LESS_THAN", "LESS_THAN_EQUALS", "GREATER_THAN", "GREATER_THAN_EQUALS", "IN_SET", "NOT_IN_SET", "IN_RANGE", "NOT_IN_RANGE" ]
    },
    "CommandParameterValueComparisonOperand" : {
      "type" : "object",
      "properties" : {
        "Number" : {
          "type" : "string"
        },
        "Numbers" : {
          "$ref" : "#/definitions/CommandParameterValueStringList"
        },
        "String" : {
          "type" : "string"
        },
        "Strings" : {
          "$ref" : "#/definitions/CommandParameterValueStringList"
        },
        "NumberRange" : {
          "$ref" : "#/definitions/CommandParameterValueNumberRange"
        }
      },
      "additionalProperties" : false
    },
    "CommandParameterValueNumberRange" : {
      "type" : "object",
      "properties" : {
        "Min" : {
          "type" : "string",
          "minLength" : 1
        },
        "Max" : {
          "type" : "string",
          "minLength" : 1
        }
      },
      "required" : [ "Min", "Max" ],
      "additionalProperties" : false
    },
    "CommandParameterValueStringList" : {
      "type" : "array",
      "items" : {
        "type" : "string"
      },
      "minItems" : 1,
      "maxItems" : 10
    },
    "MimeType" : {
      "type" : "string",
      "minLength" : 1
    },
    "CommandPayloadContent" : {
      "type" : "string"
    },
    "CommandPayload" : {
      "type" : "object",
      "properties" : {
        "Content" : {
          "$ref" : "#/definitions/CommandPayloadContent"
        },
        "ContentType" : {
          "$ref" : "#/definitions/MimeType"
        }
      },
      "additionalProperties" : false
    },
    "OutputFormat" : {
      "type" : "string",
      "enum" : [ "JSON", "CBOR" ]
    },
    "AwsJsonSubstitutionCommandPreprocessorConfig" : {
      "type" : "object",
      "properties" : {
        "OutputFormat" : {
          "$ref" : "#/definitions/OutputFormat"
        }
      },
      "required" : [ "OutputFormat" ],
      "additionalProperties" : false
    },
    "CommandPreprocessor" : {
      "type" : "object",
      "properties" : {
        "AwsJsonSubstitution" : {
          "$ref" : "#/definitions/AwsJsonSubstitutionCommandPreprocessorConfig"
        }
      },
      "additionalProperties" : false
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The tag's key.",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "description" : "The tag's value.",
          "minLength" : 1,
          "maxLength" : 256
        }
      },
      "required" : [ "Value", "Key" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "CommandArn" : {
      "type" : "string",
      "description" : "The Amazon Resource Name (ARN) of the command."
    },
    "CommandId" : {
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9_-]+$",
      "minLength" : 1,
      "maxLength" : 64,
      "description" : "The unique identifier for the command."
    },
    "CreatedAt" : {
      "type" : "string",
      "description" : "The date and time when the command was created."
    },
    "Deprecated" : {
      "type" : "boolean",
      "description" : "A flag indicating whether the command is deprecated."
    },
    "Description" : {
      "type" : "string",
      "maxLength" : 2028,
      "description" : "The description of the command."
    },
    "DisplayName" : {
      "type" : "string",
      "description" : "The display name for the command."
    },
    "LastUpdatedAt" : {
      "type" : "string",
      "description" : "The date and time when the command was last updated."
    },
    "MandatoryParameters" : {
      "$ref" : "#/definitions/CommandParameterList",
      "description" : "The list of mandatory parameters for the command."
    },
    "Namespace" : {
      "type" : "string",
      "enum" : [ "AWS-IoT", "AWS-IoT-FleetWise" ],
      "description" : "The namespace to which the command belongs."
    },
    "RoleArn" : {
      "type" : "string",
      "minLength" : 20,
      "maxLength" : 2028,
      "description" : "The customer role associated with the command."
    },
    "Payload" : {
      "$ref" : "#/definitions/CommandPayload",
      "description" : "The payload associated with the command."
    },
    "PayloadTemplate" : {
      "type" : "string",
      "maxLength" : 32768,
      "description" : "The payload template associated with the command."
    },
    "Preprocessor" : {
      "$ref" : "#/definitions/CommandPreprocessor",
      "description" : "The command preprocessor configuration."
    },
    "PendingDeletion" : {
      "type" : "boolean",
      "description" : "A flag indicating whether the command is pending deletion."
    },
    "Tags" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "description" : "The tags to be associated with the command.",
      "insertionOrder" : true
    }
  },
  "required" : [ "CommandId" ],
  "createOnlyProperties" : [ "/properties/CommandId", "/properties/PayloadTemplate", "/properties/Preprocessor" ],
  "readOnlyProperties" : [ "/properties/CommandArn" ],
  "writeOnlyProperties" : [ "/properties/LastUpdatedAt" ],
  "primaryIdentifier" : [ "/properties/CommandId" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "iam:PassRole", "iot:CreateCommand", "iot:TagResource" ]
    },
    "read" : {
      "permissions" : [ "iot:GetCommand", "iot:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "iam:PassRole", "iot:UpdateCommand", "iot:GetCommand", "iot:TagResource", "iot:UntagResource", "iot:ListTagsForResource" ]
    },
    "delete" : {
      "permissions" : [ "iot:GetCommand", "iot:UpdateCommand", "iot:DeleteCommand" ]
    },
    "list" : {
      "permissions" : [ "iot:ListCommands" ]
    }
  },
  "additionalProperties" : false,
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "iot:TagResource", "iot:UntagResource", "iot:ListTagsForResource" ]
  }
}