{
  "typeName" : "AWS::AutoScaling::ScalingPolicy",
  "description" : "The AWS::AutoScaling::ScalingPolicy resource specifies an Amazon EC2 Auto Scaling scaling policy so that the Auto Scaling group can scale the number of instances available for your application.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-autoscaling.git",
  "definitions" : {
    "PredictiveScalingMetricSpecification" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "CustomizedCapacityMetricSpecification" : {
          "$ref" : "#/definitions/PredictiveScalingCustomizedCapacityMetric"
        },
        "CustomizedLoadMetricSpecification" : {
          "$ref" : "#/definitions/PredictiveScalingCustomizedLoadMetric"
        },
        "CustomizedScalingMetricSpecification" : {
          "$ref" : "#/definitions/PredictiveScalingCustomizedScalingMetric"
        },
        "PredefinedLoadMetricSpecification" : {
          "$ref" : "#/definitions/PredictiveScalingPredefinedLoadMetric"
        },
        "TargetValue" : {
          "type" : "number"
        },
        "PredefinedScalingMetricSpecification" : {
          "$ref" : "#/definitions/PredictiveScalingPredefinedScalingMetric"
        },
        "PredefinedMetricPairSpecification" : {
          "$ref" : "#/definitions/PredictiveScalingPredefinedMetricPair"
        }
      },
      "required" : [ "TargetValue" ]
    },
    "PredictiveScalingConfiguration" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MetricSpecifications" : {
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/PredictiveScalingMetricSpecification"
          }
        },
        "MaxCapacityBreachBehavior" : {
          "type" : "string"
        },
        "MaxCapacityBuffer" : {
          "type" : "integer"
        },
        "SchedulingBufferTime" : {
          "type" : "integer"
        },
        "Mode" : {
          "type" : "string"
        }
      },
      "required" : [ "MetricSpecifications" ]
    },
    "CustomizedMetricSpecification" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MetricName" : {
          "type" : "string"
        },
        "Dimensions" : {
          "type" : "array",
          "insertionOrder" : false,
          "uniqueItems" : true,
          "items" : {
            "$ref" : "#/definitions/MetricDimension"
          }
        },
        "Metrics" : {
          "type" : "array",
          "insertionOrder" : false,
          "uniqueItems" : true,
          "items" : {
            "$ref" : "#/definitions/TargetTrackingMetricDataQuery"
          }
        },
        "Statistic" : {
          "type" : "string"
        },
        "Unit" : {
          "type" : "string"
        },
        "Namespace" : {
          "type" : "string"
        },
        "Period" : {
          "type" : "integer"
        }
      },
      "required" : [ ]
    },
    "TargetTrackingConfiguration" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "CustomizedMetricSpecification" : {
          "$ref" : "#/definitions/CustomizedMetricSpecification"
        },
        "TargetValue" : {
          "type" : "number"
        },
        "DisableScaleIn" : {
          "type" : "boolean"
        },
        "PredefinedMetricSpecification" : {
          "$ref" : "#/definitions/PredefinedMetricSpecification"
        }
      },
      "required" : [ "TargetValue" ]
    },
    "PredictiveScalingPredefinedLoadMetric" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ResourceLabel" : {
          "type" : "string"
        },
        "PredefinedMetricType" : {
          "type" : "string"
        }
      },
      "required" : [ "PredefinedMetricType" ]
    },
    "StepAdjustment" : {
      "type" : "object",
      "additionalProperties" : false,
      "insertionOrder" : false,
      "properties" : {
        "MetricIntervalUpperBound" : {
          "type" : "number"
        },
        "MetricIntervalLowerBound" : {
          "type" : "number"
        },
        "ScalingAdjustment" : {
          "type" : "integer"
        }
      },
      "required" : [ "ScalingAdjustment" ]
    },
    "PredictiveScalingPredefinedMetricPair" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ResourceLabel" : {
          "type" : "string"
        },
        "PredefinedMetricType" : {
          "type" : "string"
        }
      },
      "required" : [ "PredefinedMetricType" ]
    },
    "PredefinedMetricSpecification" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ResourceLabel" : {
          "type" : "string"
        },
        "PredefinedMetricType" : {
          "type" : "string"
        }
      },
      "required" : [ "PredefinedMetricType" ]
    },
    "MetricDimension" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Value" : {
          "type" : "string"
        },
        "Name" : {
          "type" : "string"
        }
      },
      "required" : [ "Value", "Name" ]
    },
    "PredictiveScalingPredefinedScalingMetric" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ResourceLabel" : {
          "type" : "string"
        },
        "PredefinedMetricType" : {
          "type" : "string"
        }
      },
      "required" : [ "PredefinedMetricType" ]
    },
    "PredictiveScalingCustomizedLoadMetric" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MetricDataQueries" : {
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/MetricDataQuery"
          }
        }
      },
      "required" : [ "MetricDataQueries" ]
    },
    "PredictiveScalingCustomizedCapacityMetric" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MetricDataQueries" : {
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/MetricDataQuery"
          }
        }
      },
      "required" : [ "MetricDataQueries" ]
    },
    "PredictiveScalingCustomizedScalingMetric" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MetricDataQueries" : {
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/MetricDataQuery"
          }
        }
      },
      "required" : [ "MetricDataQueries" ]
    },
    "Metric" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MetricName" : {
          "type" : "string"
        },
        "Dimensions" : {
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/MetricDimension"
          }
        },
        "Namespace" : {
          "type" : "string"
        }
      },
      "required" : [ "MetricName", "Namespace" ]
    },
    "TargetTrackingMetricStat" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Metric" : {
          "$ref" : "#/definitions/Metric"
        },
        "Stat" : {
          "type" : "string"
        },
        "Unit" : {
          "type" : "string"
        },
        "Period" : {
          "type" : "integer"
        }
      },
      "required" : [ "Stat", "Metric" ]
    },
    "MetricStat" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Metric" : {
          "$ref" : "#/definitions/Metric"
        },
        "Stat" : {
          "type" : "string"
        },
        "Unit" : {
          "type" : "string"
        }
      },
      "required" : [ "Stat", "Metric" ]
    },
    "TargetTrackingMetricDataQuery" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Label" : {
          "type" : "string"
        },
        "MetricStat" : {
          "$ref" : "#/definitions/TargetTrackingMetricStat"
        },
        "Id" : {
          "type" : "string"
        },
        "ReturnData" : {
          "type" : "boolean"
        },
        "Expression" : {
          "type" : "string"
        },
        "Period" : {
          "type" : "integer"
        }
      },
      "required" : [ "Id" ]
    },
    "MetricDataQuery" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Label" : {
          "type" : "string"
        },
        "MetricStat" : {
          "$ref" : "#/definitions/MetricStat"
        },
        "Id" : {
          "type" : "string"
        },
        "ReturnData" : {
          "type" : "boolean"
        },
        "Expression" : {
          "type" : "string"
        }
      },
      "required" : [ "Id" ]
    }
  },
  "properties" : {
    "MetricAggregationType" : {
      "description" : "The aggregation type for the CloudWatch metrics. The valid values are Minimum, Maximum, and Average. If the aggregation type is null, the value is treated as Average. Valid only if the policy type is StepScaling.",
      "type" : "string"
    },
    "PolicyName" : {
      "type" : "string"
    },
    "PolicyType" : {
      "description" : "One of the following policy types: TargetTrackingScaling, StepScaling, SimpleScaling (default), PredictiveScaling",
      "type" : "string"
    },
    "PredictiveScalingConfiguration" : {
      "description" : "A predictive scaling policy. Includes support for predefined metrics only.",
      "$ref" : "#/definitions/PredictiveScalingConfiguration"
    },
    "ScalingAdjustment" : {
      "description" : "The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a positive value. Required if the policy type is SimpleScaling. (Not used with any other policy type.)",
      "type" : "integer"
    },
    "Cooldown" : {
      "description" : "The duration of the policy's cooldown period, in seconds. When a cooldown period is specified here, it overrides the default cooldown period defined for the Auto Scaling group.",
      "type" : "string"
    },
    "StepAdjustments" : {
      "description" : "A set of adjustments that enable you to scale based on the size of the alarm breach. Required if the policy type is StepScaling. (Not used with any other policy type.)",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/StepAdjustment"
      }
    },
    "AutoScalingGroupName" : {
      "description" : "The name of the Auto Scaling group.",
      "type" : "string"
    },
    "MinAdjustmentMagnitude" : {
      "description" : "The minimum value to scale by when the adjustment type is PercentChangeInCapacity. For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a MinAdjustmentMagnitude of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.",
      "type" : "integer"
    },
    "TargetTrackingConfiguration" : {
      "description" : "A target tracking scaling policy. Includes support for predefined or customized metrics.",
      "$ref" : "#/definitions/TargetTrackingConfiguration"
    },
    "EstimatedInstanceWarmup" : {
      "description" : "The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. If not provided, the default is to use the value from the default cooldown period for the Auto Scaling group. Valid only if the policy type is TargetTrackingScaling or StepScaling.",
      "type" : "integer"
    },
    "AdjustmentType" : {
      "description" : "Specifies how the scaling adjustment is interpreted. The valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.",
      "type" : "string"
    },
    "Arn" : {
      "description" : "The ARN of the AutoScaling scaling policy",
      "type" : "string"
    }
  },
  "additionalProperties" : false,
  "required" : [ "AutoScalingGroupName" ],
  "primaryIdentifier" : [ "/properties/Arn" ],
  "readOnlyProperties" : [ "/properties/PolicyName", "/properties/Arn" ],
  "createOnlyProperties" : [ "/properties/AutoScalingGroupName" ],
  "tagging" : {
    "taggable" : false,
    "tagOnCreate" : false,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : false
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "autoscaling:DescribePolicies", "autoscaling:PutScalingPolicy", "cloudwatch:GetMetricData" ]
    },
    "read" : {
      "permissions" : [ "autoscaling:DescribePolicies" ]
    },
    "update" : {
      "permissions" : [ "autoscaling:DescribePolicies", "autoscaling:PutScalingPolicy", "cloudwatch:GetMetricData" ]
    },
    "delete" : {
      "permissions" : [ "autoscaling:DeletePolicy", "autoscaling:DescribePolicies" ]
    },
    "list" : {
      "permissions" : [ "autoscaling:DescribePolicies" ]
    }
  }
}