{
  "typeName" : "AWS::IoT::FleetMetric",
  "description" : "An aggregated metric of certain devices in your fleet",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-iot.git",
  "taggable" : true,
  "definitions" : {
    "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
    },
    "AggregationType" : {
      "description" : "Aggregation types supported by Fleet Indexing",
      "type" : "object",
      "properties" : {
        "Name" : {
          "description" : "Fleet Indexing aggregation type names such as Statistics, Percentiles and Cardinality",
          "type" : "string"
        },
        "Values" : {
          "description" : "Fleet Indexing aggregation type values",
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          }
        }
      },
      "required" : [ "Name", "Values" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "MetricName" : {
      "description" : "The name of the fleet metric",
      "type" : "string"
    },
    "Description" : {
      "description" : "The description of a fleet metric",
      "type" : "string"
    },
    "QueryString" : {
      "description" : "The Fleet Indexing query used by a fleet metric",
      "type" : "string"
    },
    "Period" : {
      "description" : "The period of metric emission in seconds",
      "type" : "integer"
    },
    "AggregationField" : {
      "description" : "The aggregation field to perform aggregation and metric emission",
      "type" : "string"
    },
    "QueryVersion" : {
      "description" : "The version of a Fleet Indexing query used by a fleet metric",
      "type" : "string"
    },
    "IndexName" : {
      "description" : "The index name of a fleet metric",
      "type" : "string"
    },
    "Unit" : {
      "description" : "The unit of data points emitted by a fleet metric",
      "type" : "string"
    },
    "AggregationType" : {
      "$ref" : "#/definitions/AggregationType"
    },
    "MetricArn" : {
      "description" : "The Amazon Resource Number (ARN) of a fleet metric metric",
      "type" : "string"
    },
    "CreationDate" : {
      "description" : "The creation date of a fleet metric",
      "type" : "number"
    },
    "LastModifiedDate" : {
      "description" : "The last modified date of a fleet metric",
      "type" : "number"
    },
    "Version" : {
      "description" : "The version of a fleet metric",
      "type" : "number"
    },
    "Tags" : {
      "type" : "array",
      "maxItems" : 50,
      "uniqueItems" : true,
      "insertionOrder" : false,
      "description" : "An array of key-value pairs to apply to this resource",
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "additionalProperties" : false,
  "required" : [ "MetricName" ],
  "readOnlyProperties" : [ "/properties/MetricArn", "/properties/CreationDate", "/properties/LastModifiedDate", "/properties/Version" ],
  "createOnlyProperties" : [ "/properties/MetricName" ],
  "primaryIdentifier" : [ "/properties/MetricName" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "iot:CreateFleetMetric" ]
    },
    "read" : {
      "permissions" : [ "iot:DescribeFleetMetric", "iot:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "iot:UpdateFleetMetric", "iot:ListTagsForResource", "iot:UntagResource", "iot:TagResource" ]
    },
    "delete" : {
      "permissions" : [ "iot:DeleteFleetMetric" ]
    },
    "list" : {
      "permissions" : [ "iot:ListFleetMetrics" ]
    }
  }
}