{
  "typeName" : "AWS::CE::AnomalyMonitor",
  "description" : "AWS Cost Anomaly Detection leverages advanced Machine Learning technologies to identify anomalous spend and root causes, so you can quickly take action. You can use Cost Anomaly Detection by creating monitor.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
  "definitions" : {
    "Arn" : {
      "description" : "Monitor ARN",
      "type" : "string",
      "pattern" : "^arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+$"
    },
    "ResourceTag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key name for the tag.",
          "pattern" : "^(?!aws:).*$",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag.",
          "minLength" : 0,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ]
    }
  },
  "properties" : {
    "MonitorArn" : {
      "$ref" : "#/definitions/Arn"
    },
    "MonitorType" : {
      "type" : "string",
      "enum" : [ "DIMENSIONAL", "CUSTOM" ]
    },
    "MonitorName" : {
      "description" : "The name of the monitor.",
      "type" : "string",
      "pattern" : "[\\S\\s]*",
      "minLength" : 0,
      "maxLength" : 1024
    },
    "CreationDate" : {
      "description" : "The date when the monitor was created. ",
      "type" : "string",
      "minLength" : 0,
      "maxLength" : 40,
      "pattern" : "(\\d{4}-\\d{2}-\\d{2})(T\\d{2}:\\d{2}:\\d{2}Z)?"
    },
    "LastEvaluatedDate" : {
      "description" : "The date when the monitor last evaluated for anomalies.",
      "type" : "string",
      "minLength" : 0,
      "maxLength" : 40,
      "pattern" : "(\\d{4}-\\d{2}-\\d{2})(T\\d{2}:\\d{2}:\\d{2}Z)?"
    },
    "LastUpdatedDate" : {
      "description" : "The date when the monitor was last updated.",
      "type" : "string",
      "minLength" : 0,
      "maxLength" : 40,
      "pattern" : "(\\d{4}-\\d{2}-\\d{2})(T\\d{2}:\\d{2}:\\d{2}Z)?"
    },
    "MonitorDimension" : {
      "description" : "The dimensions to evaluate",
      "type" : "string",
      "enum" : [ "SERVICE" ]
    },
    "MonitorSpecification" : {
      "type" : "string"
    },
    "DimensionalValueCount" : {
      "description" : "The value for evaluated dimensions.",
      "type" : "integer",
      "minimum" : 0
    },
    "ResourceTags" : {
      "type" : "array",
      "description" : "Tags to assign to monitor.",
      "items" : {
        "$ref" : "#/definitions/ResourceTag"
      },
      "minItems" : 0,
      "maxItems" : 200,
      "insertionOrder" : false
    }
  },
  "additionalProperties" : false,
  "required" : [ "MonitorName", "MonitorType" ],
  "createOnlyProperties" : [ "/properties/MonitorType", "/properties/MonitorDimension", "/properties/MonitorSpecification", "/properties/ResourceTags" ],
  "readOnlyProperties" : [ "/properties/MonitorArn", "/properties/CreationDate", "/properties/DimensionValueCount", "/properties/LastEvaluatedDate", "/properties/LastUpdatedDate", "/properties/DimensionalValueCount" ],
  "primaryIdentifier" : [ "/properties/MonitorArn" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "ce:CreateAnomalyMonitor", "ce:TagResource" ]
    },
    "read" : {
      "permissions" : [ "ce:GetAnomalyMonitors" ]
    },
    "update" : {
      "permissions" : [ "ce:UpdateAnomalyMonitor" ]
    },
    "delete" : {
      "permissions" : [ "ce:DeleteAnomalyMonitor" ]
    },
    "list" : {
      "permissions" : [ "ce:GetAnomalyMonitors" ]
    }
  }
}