{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-iot-core/json-schema/amazon-iot-core-create-fleet-metric-request-schema.json",
  "title": "CreateFleetMetricRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-iot-core-fleet-metric-api-openapi.yml#/components/schemas/CreateFleetMetricRequest",
  "type": "object",
  "properties": {
    "metricName": {
      "type": "string",
      "description": "The name of the fleet metric to create."
    },
    "queryString": {
      "type": "string",
      "description": "The search query string."
    },
    "aggregationType": {
      "$ref": "#/$defs/AggregationType"
    },
    "period": {
      "type": "integer",
      "description": "The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60."
    },
    "aggregationField": {
      "type": "string",
      "description": "The field to aggregate."
    },
    "description": {
      "type": "string",
      "description": "The fleet metric description."
    },
    "queryVersion": {
      "type": "string",
      "description": "The query version."
    },
    "indexName": {
      "type": "string",
      "description": "The name of the index to search."
    },
    "unit": {
      "type": "string",
      "enum": [
        "Seconds",
        "Microseconds",
        "Milliseconds",
        "Bytes",
        "Kilobytes",
        "Megabytes",
        "Gigabytes",
        "Terabytes",
        "Bits",
        "Kilobits",
        "Megabits",
        "Gigabits",
        "Terabits",
        "Percent",
        "Count",
        "Bytes/Second",
        "Kilobytes/Second",
        "Megabytes/Second",
        "Gigabytes/Second",
        "Terabytes/Second",
        "Bits/Second",
        "Kilobits/Second",
        "Megabits/Second",
        "Gigabits/Second",
        "Terabits/Second",
        "Count/Second",
        "None"
      ],
      "description": "Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric. Default to null."
    },
    "tags": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Tag"
      },
      "description": "Metadata, which can be used to manage the fleet metric."
    }
  },
  "required": [
    "metricName",
    "queryString",
    "aggregationType",
    "period",
    "aggregationField"
  ],
  "$defs": {
    "AggregationType": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "enum": [
            "Statistics",
            "Percentiles",
            "Cardinality"
          ],
          "description": "The name of the aggregation type."
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "A list of the values of aggregation types."
        }
      },
      "required": [
        "name"
      ]
    },
    "Tag": {
      "type": "object",
      "properties": {
        "Key": {
          "type": "string",
          "description": "The tag's key."
        },
        "Value": {
          "type": "string",
          "description": "The tag's value."
        }
      },
      "required": [
        "Key"
      ]
    }
  }
}