{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AutoScalingPlans.Types.ScalingInstruction
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AutoScalingPlans.Types.ScalingInstruction where

import Amazonka.AutoScalingPlans.Types.CustomizedLoadMetricSpecification
import Amazonka.AutoScalingPlans.Types.PredefinedLoadMetricSpecification
import Amazonka.AutoScalingPlans.Types.PredictiveScalingMaxCapacityBehavior
import Amazonka.AutoScalingPlans.Types.PredictiveScalingMode
import Amazonka.AutoScalingPlans.Types.ScalableDimension
import Amazonka.AutoScalingPlans.Types.ScalingPolicyUpdateBehavior
import Amazonka.AutoScalingPlans.Types.ServiceNamespace
import Amazonka.AutoScalingPlans.Types.TargetTrackingConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a scaling instruction for a scalable resource in a scaling
-- plan. Each scaling instruction applies to one resource.
--
-- AWS Auto Scaling creates target tracking scaling policies based on the
-- scaling instructions. Target tracking scaling policies adjust the
-- capacity of your scalable resource as required to maintain resource
-- utilization at the target value that you specified.
--
-- AWS Auto Scaling also configures predictive scaling for your Amazon EC2
-- Auto Scaling groups using a subset of parameters, including the load
-- metric, the scaling metric, the target value for the scaling metric, the
-- predictive scaling mode (forecast and scale or forecast only), and the
-- desired behavior when the forecast capacity exceeds the maximum capacity
-- of the resource. With predictive scaling, AWS Auto Scaling generates
-- forecasts with traffic predictions for the two days ahead and schedules
-- scaling actions that proactively add and remove resource capacity to
-- match the forecast.
--
-- We recommend waiting a minimum of 24 hours after creating an Auto
-- Scaling group to configure predictive scaling. At minimum, there must be
-- 24 hours of historical data to generate a forecast. For more
-- information, see
-- <https://docs.aws.amazon.com/autoscaling/plans/userguide/gs-best-practices.html Best Practices for AWS Auto Scaling>
-- in the /AWS Auto Scaling User Guide/.
--
-- /See:/ 'newScalingInstruction' smart constructor.
data ScalingInstruction = ScalingInstruction'
  { -- | The amount of time, in seconds, to buffer the run time of scheduled
    -- scaling actions when scaling out. For example, if the forecast says to
    -- add capacity at 10:00 AM, and the buffer time is 5 minutes, then the run
    -- time of the corresponding scheduled scaling action will be 9:55 AM. The
    -- intention is to give resources time to be provisioned. For example, it
    -- can take a few minutes to launch an EC2 instance. The actual amount of
    -- time required depends on several factors, such as the size of the
    -- instance and whether there are startup scripts to complete.
    --
    -- The value must be less than the forecast interval duration of 3600
    -- seconds (60 minutes). The default is 300 seconds.
    --
    -- Only valid when configuring predictive scaling.
    ScalingInstruction -> Maybe Natural
scheduledActionBufferTime :: Prelude.Maybe Prelude.Natural,
    -- | The size of the capacity buffer to use when the forecast capacity is
    -- close to or exceeds the maximum capacity. The value is specified as a
    -- percentage relative to the forecast capacity. For example, if the buffer
    -- is 10, this means a 10 percent buffer, such that if the forecast
    -- capacity is 50, and the maximum capacity is 40, then the effective
    -- maximum capacity is 55.
    --
    -- Only valid when configuring predictive scaling. Required if the
    -- __PredictiveScalingMaxCapacityBehavior__ is set to
    -- @SetMaxCapacityAboveForecastCapacity@, and cannot be used otherwise.
    --
    -- The range is 1-100.
    ScalingInstruction -> Maybe Int
predictiveScalingMaxCapacityBuffer :: Prelude.Maybe Prelude.Int,
    -- | Controls whether a resource\'s externally created scaling policies are
    -- kept or replaced.
    --
    -- The default value is @KeepExternalPolicies@. If the parameter is set to
    -- @ReplaceExternalPolicies@, any scaling policies that are external to AWS
    -- Auto Scaling are deleted and new target tracking scaling policies
    -- created.
    --
    -- Only valid when configuring dynamic scaling.
    --
    -- Condition: The number of existing policies to be replaced must be less
    -- than or equal to 50. If there are more than 50 policies to be replaced,
    -- AWS Auto Scaling keeps all existing policies and does not create new
    -- ones.
    ScalingInstruction -> Maybe ScalingPolicyUpdateBehavior
scalingPolicyUpdateBehavior :: Prelude.Maybe ScalingPolicyUpdateBehavior,
    -- | The customized load metric to use for predictive scaling. This parameter
    -- or a __PredefinedLoadMetricSpecification__ is required when configuring
    -- predictive scaling, and cannot be used otherwise.
    ScalingInstruction -> Maybe CustomizedLoadMetricSpecification
customizedLoadMetricSpecification :: Prelude.Maybe CustomizedLoadMetricSpecification,
    -- | The predictive scaling mode. The default value is @ForecastAndScale@.
    -- Otherwise, AWS Auto Scaling forecasts capacity but does not create any
    -- scheduled scaling actions based on the capacity forecast.
    ScalingInstruction -> Maybe PredictiveScalingMode
predictiveScalingMode :: Prelude.Maybe PredictiveScalingMode,
    -- | Controls whether dynamic scaling by AWS Auto Scaling is disabled. When
    -- dynamic scaling is enabled, AWS Auto Scaling creates target tracking
    -- scaling policies based on the specified target tracking configurations.
    --
    -- The default is enabled (@false@).
    ScalingInstruction -> Maybe Bool
disableDynamicScaling :: Prelude.Maybe Prelude.Bool,
    -- | Defines the behavior that should be applied if the forecast capacity
    -- approaches or exceeds the maximum capacity specified for the resource.
    -- The default value is @SetForecastCapacityToMaxCapacity@.
    --
    -- The following are possible values:
    --
    -- -   @SetForecastCapacityToMaxCapacity@ - AWS Auto Scaling cannot scale
    --     resource capacity higher than the maximum capacity. The maximum
    --     capacity is enforced as a hard limit.
    --
    -- -   @SetMaxCapacityToForecastCapacity@ - AWS Auto Scaling may scale
    --     resource capacity higher than the maximum capacity to equal but not
    --     exceed forecast capacity.
    --
    -- -   @SetMaxCapacityAboveForecastCapacity@ - AWS Auto Scaling may scale
    --     resource capacity higher than the maximum capacity by a specified
    --     buffer value. The intention is to give the target tracking scaling
    --     policy extra capacity if unexpected traffic occurs.
    --
    -- Only valid when configuring predictive scaling.
    ScalingInstruction -> Maybe PredictiveScalingMaxCapacityBehavior
predictiveScalingMaxCapacityBehavior :: Prelude.Maybe PredictiveScalingMaxCapacityBehavior,
    -- | The predefined load metric to use for predictive scaling. This parameter
    -- or a __CustomizedLoadMetricSpecification__ is required when configuring
    -- predictive scaling, and cannot be used otherwise.
    ScalingInstruction -> Maybe PredefinedLoadMetricSpecification
predefinedLoadMetricSpecification :: Prelude.Maybe PredefinedLoadMetricSpecification,
    -- | The namespace of the AWS service.
    ScalingInstruction -> ServiceNamespace
serviceNamespace :: ServiceNamespace,
    -- | The ID of the resource. This string consists of the resource type and
    -- unique identifier.
    --
    -- -   Auto Scaling group - The resource type is @autoScalingGroup@ and the
    --     unique identifier is the name of the Auto Scaling group. Example:
    --     @autoScalingGroup\/my-asg@.
    --
    -- -   ECS service - The resource type is @service@ and the unique
    --     identifier is the cluster name and service name. Example:
    --     @service\/default\/sample-webapp@.
    --
    -- -   Spot Fleet request - The resource type is @spot-fleet-request@ and
    --     the unique identifier is the Spot Fleet request ID. Example:
    --     @spot-fleet-request\/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE@.
    --
    -- -   DynamoDB table - The resource type is @table@ and the unique
    --     identifier is the resource ID. Example: @table\/my-table@.
    --
    -- -   DynamoDB global secondary index - The resource type is @index@ and
    --     the unique identifier is the resource ID. Example:
    --     @table\/my-table\/index\/my-table-index@.
    --
    -- -   Aurora DB cluster - The resource type is @cluster@ and the unique
    --     identifier is the cluster name. Example: @cluster:my-db-cluster@.
    ScalingInstruction -> Text
resourceId :: Prelude.Text,
    -- | The scalable dimension associated with the resource.
    --
    -- -   @autoscaling:autoScalingGroup:DesiredCapacity@ - The desired
    --     capacity of an Auto Scaling group.
    --
    -- -   @ecs:service:DesiredCount@ - The desired task count of an ECS
    --     service.
    --
    -- -   @ec2:spot-fleet-request:TargetCapacity@ - The target capacity of a
    --     Spot Fleet request.
    --
    -- -   @dynamodb:table:ReadCapacityUnits@ - The provisioned read capacity
    --     for a DynamoDB table.
    --
    -- -   @dynamodb:table:WriteCapacityUnits@ - The provisioned write capacity
    --     for a DynamoDB table.
    --
    -- -   @dynamodb:index:ReadCapacityUnits@ - The provisioned read capacity
    --     for a DynamoDB global secondary index.
    --
    -- -   @dynamodb:index:WriteCapacityUnits@ - The provisioned write capacity
    --     for a DynamoDB global secondary index.
    --
    -- -   @rds:cluster:ReadReplicaCount@ - The count of Aurora Replicas in an
    --     Aurora DB cluster. Available for Aurora MySQL-compatible edition and
    --     Aurora PostgreSQL-compatible edition.
    ScalingInstruction -> ScalableDimension
scalableDimension :: ScalableDimension,
    -- | The minimum capacity of the resource.
    ScalingInstruction -> Int
minCapacity :: Prelude.Int,
    -- | The maximum capacity of the resource. The exception to this upper limit
    -- is if you specify a non-default setting for
    -- __PredictiveScalingMaxCapacityBehavior__.
    ScalingInstruction -> Int
maxCapacity :: Prelude.Int,
    -- | The target tracking configurations (up to 10). Each of these structures
    -- must specify a unique scaling metric and a target value for the metric.
    ScalingInstruction -> [TargetTrackingConfiguration]
targetTrackingConfigurations :: [TargetTrackingConfiguration]
  }
  deriving (ScalingInstruction -> ScalingInstruction -> Bool
(ScalingInstruction -> ScalingInstruction -> Bool)
-> (ScalingInstruction -> ScalingInstruction -> Bool)
-> Eq ScalingInstruction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingInstruction -> ScalingInstruction -> Bool
$c/= :: ScalingInstruction -> ScalingInstruction -> Bool
== :: ScalingInstruction -> ScalingInstruction -> Bool
$c== :: ScalingInstruction -> ScalingInstruction -> Bool
Prelude.Eq, ReadPrec [ScalingInstruction]
ReadPrec ScalingInstruction
Int -> ReadS ScalingInstruction
ReadS [ScalingInstruction]
(Int -> ReadS ScalingInstruction)
-> ReadS [ScalingInstruction]
-> ReadPrec ScalingInstruction
-> ReadPrec [ScalingInstruction]
-> Read ScalingInstruction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingInstruction]
$creadListPrec :: ReadPrec [ScalingInstruction]
readPrec :: ReadPrec ScalingInstruction
$creadPrec :: ReadPrec ScalingInstruction
readList :: ReadS [ScalingInstruction]
$creadList :: ReadS [ScalingInstruction]
readsPrec :: Int -> ReadS ScalingInstruction
$creadsPrec :: Int -> ReadS ScalingInstruction
Prelude.Read, Int -> ScalingInstruction -> ShowS
[ScalingInstruction] -> ShowS
ScalingInstruction -> String
(Int -> ScalingInstruction -> ShowS)
-> (ScalingInstruction -> String)
-> ([ScalingInstruction] -> ShowS)
-> Show ScalingInstruction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingInstruction] -> ShowS
$cshowList :: [ScalingInstruction] -> ShowS
show :: ScalingInstruction -> String
$cshow :: ScalingInstruction -> String
showsPrec :: Int -> ScalingInstruction -> ShowS
$cshowsPrec :: Int -> ScalingInstruction -> ShowS
Prelude.Show, (forall x. ScalingInstruction -> Rep ScalingInstruction x)
-> (forall x. Rep ScalingInstruction x -> ScalingInstruction)
-> Generic ScalingInstruction
forall x. Rep ScalingInstruction x -> ScalingInstruction
forall x. ScalingInstruction -> Rep ScalingInstruction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingInstruction x -> ScalingInstruction
$cfrom :: forall x. ScalingInstruction -> Rep ScalingInstruction x
Prelude.Generic)

-- |
-- Create a value of 'ScalingInstruction' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'scheduledActionBufferTime', 'scalingInstruction_scheduledActionBufferTime' - The amount of time, in seconds, to buffer the run time of scheduled
-- scaling actions when scaling out. For example, if the forecast says to
-- add capacity at 10:00 AM, and the buffer time is 5 minutes, then the run
-- time of the corresponding scheduled scaling action will be 9:55 AM. The
-- intention is to give resources time to be provisioned. For example, it
-- can take a few minutes to launch an EC2 instance. The actual amount of
-- time required depends on several factors, such as the size of the
-- instance and whether there are startup scripts to complete.
--
-- The value must be less than the forecast interval duration of 3600
-- seconds (60 minutes). The default is 300 seconds.
--
-- Only valid when configuring predictive scaling.
--
-- 'predictiveScalingMaxCapacityBuffer', 'scalingInstruction_predictiveScalingMaxCapacityBuffer' - The size of the capacity buffer to use when the forecast capacity is
-- close to or exceeds the maximum capacity. The value is specified as a
-- percentage relative to the forecast capacity. For example, if the buffer
-- is 10, this means a 10 percent buffer, such that if the forecast
-- capacity is 50, and the maximum capacity is 40, then the effective
-- maximum capacity is 55.
--
-- Only valid when configuring predictive scaling. Required if the
-- __PredictiveScalingMaxCapacityBehavior__ is set to
-- @SetMaxCapacityAboveForecastCapacity@, and cannot be used otherwise.
--
-- The range is 1-100.
--
-- 'scalingPolicyUpdateBehavior', 'scalingInstruction_scalingPolicyUpdateBehavior' - Controls whether a resource\'s externally created scaling policies are
-- kept or replaced.
--
-- The default value is @KeepExternalPolicies@. If the parameter is set to
-- @ReplaceExternalPolicies@, any scaling policies that are external to AWS
-- Auto Scaling are deleted and new target tracking scaling policies
-- created.
--
-- Only valid when configuring dynamic scaling.
--
-- Condition: The number of existing policies to be replaced must be less
-- than or equal to 50. If there are more than 50 policies to be replaced,
-- AWS Auto Scaling keeps all existing policies and does not create new
-- ones.
--
-- 'customizedLoadMetricSpecification', 'scalingInstruction_customizedLoadMetricSpecification' - The customized load metric to use for predictive scaling. This parameter
-- or a __PredefinedLoadMetricSpecification__ is required when configuring
-- predictive scaling, and cannot be used otherwise.
--
-- 'predictiveScalingMode', 'scalingInstruction_predictiveScalingMode' - The predictive scaling mode. The default value is @ForecastAndScale@.
-- Otherwise, AWS Auto Scaling forecasts capacity but does not create any
-- scheduled scaling actions based on the capacity forecast.
--
-- 'disableDynamicScaling', 'scalingInstruction_disableDynamicScaling' - Controls whether dynamic scaling by AWS Auto Scaling is disabled. When
-- dynamic scaling is enabled, AWS Auto Scaling creates target tracking
-- scaling policies based on the specified target tracking configurations.
--
-- The default is enabled (@false@).
--
-- 'predictiveScalingMaxCapacityBehavior', 'scalingInstruction_predictiveScalingMaxCapacityBehavior' - Defines the behavior that should be applied if the forecast capacity
-- approaches or exceeds the maximum capacity specified for the resource.
-- The default value is @SetForecastCapacityToMaxCapacity@.
--
-- The following are possible values:
--
-- -   @SetForecastCapacityToMaxCapacity@ - AWS Auto Scaling cannot scale
--     resource capacity higher than the maximum capacity. The maximum
--     capacity is enforced as a hard limit.
--
-- -   @SetMaxCapacityToForecastCapacity@ - AWS Auto Scaling may scale
--     resource capacity higher than the maximum capacity to equal but not
--     exceed forecast capacity.
--
-- -   @SetMaxCapacityAboveForecastCapacity@ - AWS Auto Scaling may scale
--     resource capacity higher than the maximum capacity by a specified
--     buffer value. The intention is to give the target tracking scaling
--     policy extra capacity if unexpected traffic occurs.
--
-- Only valid when configuring predictive scaling.
--
-- 'predefinedLoadMetricSpecification', 'scalingInstruction_predefinedLoadMetricSpecification' - The predefined load metric to use for predictive scaling. This parameter
-- or a __CustomizedLoadMetricSpecification__ is required when configuring
-- predictive scaling, and cannot be used otherwise.
--
-- 'serviceNamespace', 'scalingInstruction_serviceNamespace' - The namespace of the AWS service.
--
-- 'resourceId', 'scalingInstruction_resourceId' - The ID of the resource. This string consists of the resource type and
-- unique identifier.
--
-- -   Auto Scaling group - The resource type is @autoScalingGroup@ and the
--     unique identifier is the name of the Auto Scaling group. Example:
--     @autoScalingGroup\/my-asg@.
--
-- -   ECS service - The resource type is @service@ and the unique
--     identifier is the cluster name and service name. Example:
--     @service\/default\/sample-webapp@.
--
-- -   Spot Fleet request - The resource type is @spot-fleet-request@ and
--     the unique identifier is the Spot Fleet request ID. Example:
--     @spot-fleet-request\/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE@.
--
-- -   DynamoDB table - The resource type is @table@ and the unique
--     identifier is the resource ID. Example: @table\/my-table@.
--
-- -   DynamoDB global secondary index - The resource type is @index@ and
--     the unique identifier is the resource ID. Example:
--     @table\/my-table\/index\/my-table-index@.
--
-- -   Aurora DB cluster - The resource type is @cluster@ and the unique
--     identifier is the cluster name. Example: @cluster:my-db-cluster@.
--
-- 'scalableDimension', 'scalingInstruction_scalableDimension' - The scalable dimension associated with the resource.
--
-- -   @autoscaling:autoScalingGroup:DesiredCapacity@ - The desired
--     capacity of an Auto Scaling group.
--
-- -   @ecs:service:DesiredCount@ - The desired task count of an ECS
--     service.
--
-- -   @ec2:spot-fleet-request:TargetCapacity@ - The target capacity of a
--     Spot Fleet request.
--
-- -   @dynamodb:table:ReadCapacityUnits@ - The provisioned read capacity
--     for a DynamoDB table.
--
-- -   @dynamodb:table:WriteCapacityUnits@ - The provisioned write capacity
--     for a DynamoDB table.
--
-- -   @dynamodb:index:ReadCapacityUnits@ - The provisioned read capacity
--     for a DynamoDB global secondary index.
--
-- -   @dynamodb:index:WriteCapacityUnits@ - The provisioned write capacity
--     for a DynamoDB global secondary index.
--
-- -   @rds:cluster:ReadReplicaCount@ - The count of Aurora Replicas in an
--     Aurora DB cluster. Available for Aurora MySQL-compatible edition and
--     Aurora PostgreSQL-compatible edition.
--
-- 'minCapacity', 'scalingInstruction_minCapacity' - The minimum capacity of the resource.
--
-- 'maxCapacity', 'scalingInstruction_maxCapacity' - The maximum capacity of the resource. The exception to this upper limit
-- is if you specify a non-default setting for
-- __PredictiveScalingMaxCapacityBehavior__.
--
-- 'targetTrackingConfigurations', 'scalingInstruction_targetTrackingConfigurations' - The target tracking configurations (up to 10). Each of these structures
-- must specify a unique scaling metric and a target value for the metric.
newScalingInstruction ::
  -- | 'serviceNamespace'
  ServiceNamespace ->
  -- | 'resourceId'
  Prelude.Text ->
  -- | 'scalableDimension'
  ScalableDimension ->
  -- | 'minCapacity'
  Prelude.Int ->
  -- | 'maxCapacity'
  Prelude.Int ->
  ScalingInstruction
newScalingInstruction :: ServiceNamespace
-> Text -> ScalableDimension -> Int -> Int -> ScalingInstruction
newScalingInstruction
  ServiceNamespace
pServiceNamespace_
  Text
pResourceId_
  ScalableDimension
pScalableDimension_
  Int
pMinCapacity_
  Int
pMaxCapacity_ =
    ScalingInstruction' :: Maybe Natural
-> Maybe Int
-> Maybe ScalingPolicyUpdateBehavior
-> Maybe CustomizedLoadMetricSpecification
-> Maybe PredictiveScalingMode
-> Maybe Bool
-> Maybe PredictiveScalingMaxCapacityBehavior
-> Maybe PredefinedLoadMetricSpecification
-> ServiceNamespace
-> Text
-> ScalableDimension
-> Int
-> Int
-> [TargetTrackingConfiguration]
-> ScalingInstruction
ScalingInstruction'
      { $sel:scheduledActionBufferTime:ScalingInstruction' :: Maybe Natural
scheduledActionBufferTime =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:predictiveScalingMaxCapacityBuffer:ScalingInstruction' :: Maybe Int
predictiveScalingMaxCapacityBuffer = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:scalingPolicyUpdateBehavior:ScalingInstruction' :: Maybe ScalingPolicyUpdateBehavior
scalingPolicyUpdateBehavior = Maybe ScalingPolicyUpdateBehavior
forall a. Maybe a
Prelude.Nothing,
        $sel:customizedLoadMetricSpecification:ScalingInstruction' :: Maybe CustomizedLoadMetricSpecification
customizedLoadMetricSpecification = Maybe CustomizedLoadMetricSpecification
forall a. Maybe a
Prelude.Nothing,
        $sel:predictiveScalingMode:ScalingInstruction' :: Maybe PredictiveScalingMode
predictiveScalingMode = Maybe PredictiveScalingMode
forall a. Maybe a
Prelude.Nothing,
        $sel:disableDynamicScaling:ScalingInstruction' :: Maybe Bool
disableDynamicScaling = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:predictiveScalingMaxCapacityBehavior:ScalingInstruction' :: Maybe PredictiveScalingMaxCapacityBehavior
predictiveScalingMaxCapacityBehavior =
          Maybe PredictiveScalingMaxCapacityBehavior
forall a. Maybe a
Prelude.Nothing,
        $sel:predefinedLoadMetricSpecification:ScalingInstruction' :: Maybe PredefinedLoadMetricSpecification
predefinedLoadMetricSpecification = Maybe PredefinedLoadMetricSpecification
forall a. Maybe a
Prelude.Nothing,
        $sel:serviceNamespace:ScalingInstruction' :: ServiceNamespace
serviceNamespace = ServiceNamespace
pServiceNamespace_,
        $sel:resourceId:ScalingInstruction' :: Text
resourceId = Text
pResourceId_,
        $sel:scalableDimension:ScalingInstruction' :: ScalableDimension
scalableDimension = ScalableDimension
pScalableDimension_,
        $sel:minCapacity:ScalingInstruction' :: Int
minCapacity = Int
pMinCapacity_,
        $sel:maxCapacity:ScalingInstruction' :: Int
maxCapacity = Int
pMaxCapacity_,
        $sel:targetTrackingConfigurations:ScalingInstruction' :: [TargetTrackingConfiguration]
targetTrackingConfigurations = [TargetTrackingConfiguration]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The amount of time, in seconds, to buffer the run time of scheduled
-- scaling actions when scaling out. For example, if the forecast says to
-- add capacity at 10:00 AM, and the buffer time is 5 minutes, then the run
-- time of the corresponding scheduled scaling action will be 9:55 AM. The
-- intention is to give resources time to be provisioned. For example, it
-- can take a few minutes to launch an EC2 instance. The actual amount of
-- time required depends on several factors, such as the size of the
-- instance and whether there are startup scripts to complete.
--
-- The value must be less than the forecast interval duration of 3600
-- seconds (60 minutes). The default is 300 seconds.
--
-- Only valid when configuring predictive scaling.
scalingInstruction_scheduledActionBufferTime :: Lens.Lens' ScalingInstruction (Prelude.Maybe Prelude.Natural)
scalingInstruction_scheduledActionBufferTime :: (Maybe Natural -> f (Maybe Natural))
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_scheduledActionBufferTime = (ScalingInstruction -> Maybe Natural)
-> (ScalingInstruction -> Maybe Natural -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Maybe Natural
scheduledActionBufferTime :: Maybe Natural
$sel:scheduledActionBufferTime:ScalingInstruction' :: ScalingInstruction -> Maybe Natural
scheduledActionBufferTime} -> Maybe Natural
scheduledActionBufferTime) (\s :: ScalingInstruction
s@ScalingInstruction' {} Maybe Natural
a -> ScalingInstruction
s {$sel:scheduledActionBufferTime:ScalingInstruction' :: Maybe Natural
scheduledActionBufferTime = Maybe Natural
a} :: ScalingInstruction)

-- | The size of the capacity buffer to use when the forecast capacity is
-- close to or exceeds the maximum capacity. The value is specified as a
-- percentage relative to the forecast capacity. For example, if the buffer
-- is 10, this means a 10 percent buffer, such that if the forecast
-- capacity is 50, and the maximum capacity is 40, then the effective
-- maximum capacity is 55.
--
-- Only valid when configuring predictive scaling. Required if the
-- __PredictiveScalingMaxCapacityBehavior__ is set to
-- @SetMaxCapacityAboveForecastCapacity@, and cannot be used otherwise.
--
-- The range is 1-100.
scalingInstruction_predictiveScalingMaxCapacityBuffer :: Lens.Lens' ScalingInstruction (Prelude.Maybe Prelude.Int)
scalingInstruction_predictiveScalingMaxCapacityBuffer :: (Maybe Int -> f (Maybe Int))
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_predictiveScalingMaxCapacityBuffer = (ScalingInstruction -> Maybe Int)
-> (ScalingInstruction -> Maybe Int -> ScalingInstruction)
-> Lens
     ScalingInstruction ScalingInstruction (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Maybe Int
predictiveScalingMaxCapacityBuffer :: Maybe Int
$sel:predictiveScalingMaxCapacityBuffer:ScalingInstruction' :: ScalingInstruction -> Maybe Int
predictiveScalingMaxCapacityBuffer} -> Maybe Int
predictiveScalingMaxCapacityBuffer) (\s :: ScalingInstruction
s@ScalingInstruction' {} Maybe Int
a -> ScalingInstruction
s {$sel:predictiveScalingMaxCapacityBuffer:ScalingInstruction' :: Maybe Int
predictiveScalingMaxCapacityBuffer = Maybe Int
a} :: ScalingInstruction)

-- | Controls whether a resource\'s externally created scaling policies are
-- kept or replaced.
--
-- The default value is @KeepExternalPolicies@. If the parameter is set to
-- @ReplaceExternalPolicies@, any scaling policies that are external to AWS
-- Auto Scaling are deleted and new target tracking scaling policies
-- created.
--
-- Only valid when configuring dynamic scaling.
--
-- Condition: The number of existing policies to be replaced must be less
-- than or equal to 50. If there are more than 50 policies to be replaced,
-- AWS Auto Scaling keeps all existing policies and does not create new
-- ones.
scalingInstruction_scalingPolicyUpdateBehavior :: Lens.Lens' ScalingInstruction (Prelude.Maybe ScalingPolicyUpdateBehavior)
scalingInstruction_scalingPolicyUpdateBehavior :: (Maybe ScalingPolicyUpdateBehavior
 -> f (Maybe ScalingPolicyUpdateBehavior))
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_scalingPolicyUpdateBehavior = (ScalingInstruction -> Maybe ScalingPolicyUpdateBehavior)
-> (ScalingInstruction
    -> Maybe ScalingPolicyUpdateBehavior -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     (Maybe ScalingPolicyUpdateBehavior)
     (Maybe ScalingPolicyUpdateBehavior)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Maybe ScalingPolicyUpdateBehavior
scalingPolicyUpdateBehavior :: Maybe ScalingPolicyUpdateBehavior
$sel:scalingPolicyUpdateBehavior:ScalingInstruction' :: ScalingInstruction -> Maybe ScalingPolicyUpdateBehavior
scalingPolicyUpdateBehavior} -> Maybe ScalingPolicyUpdateBehavior
scalingPolicyUpdateBehavior) (\s :: ScalingInstruction
s@ScalingInstruction' {} Maybe ScalingPolicyUpdateBehavior
a -> ScalingInstruction
s {$sel:scalingPolicyUpdateBehavior:ScalingInstruction' :: Maybe ScalingPolicyUpdateBehavior
scalingPolicyUpdateBehavior = Maybe ScalingPolicyUpdateBehavior
a} :: ScalingInstruction)

-- | The customized load metric to use for predictive scaling. This parameter
-- or a __PredefinedLoadMetricSpecification__ is required when configuring
-- predictive scaling, and cannot be used otherwise.
scalingInstruction_customizedLoadMetricSpecification :: Lens.Lens' ScalingInstruction (Prelude.Maybe CustomizedLoadMetricSpecification)
scalingInstruction_customizedLoadMetricSpecification :: (Maybe CustomizedLoadMetricSpecification
 -> f (Maybe CustomizedLoadMetricSpecification))
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_customizedLoadMetricSpecification = (ScalingInstruction -> Maybe CustomizedLoadMetricSpecification)
-> (ScalingInstruction
    -> Maybe CustomizedLoadMetricSpecification -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     (Maybe CustomizedLoadMetricSpecification)
     (Maybe CustomizedLoadMetricSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Maybe CustomizedLoadMetricSpecification
customizedLoadMetricSpecification :: Maybe CustomizedLoadMetricSpecification
$sel:customizedLoadMetricSpecification:ScalingInstruction' :: ScalingInstruction -> Maybe CustomizedLoadMetricSpecification
customizedLoadMetricSpecification} -> Maybe CustomizedLoadMetricSpecification
customizedLoadMetricSpecification) (\s :: ScalingInstruction
s@ScalingInstruction' {} Maybe CustomizedLoadMetricSpecification
a -> ScalingInstruction
s {$sel:customizedLoadMetricSpecification:ScalingInstruction' :: Maybe CustomizedLoadMetricSpecification
customizedLoadMetricSpecification = Maybe CustomizedLoadMetricSpecification
a} :: ScalingInstruction)

-- | The predictive scaling mode. The default value is @ForecastAndScale@.
-- Otherwise, AWS Auto Scaling forecasts capacity but does not create any
-- scheduled scaling actions based on the capacity forecast.
scalingInstruction_predictiveScalingMode :: Lens.Lens' ScalingInstruction (Prelude.Maybe PredictiveScalingMode)
scalingInstruction_predictiveScalingMode :: (Maybe PredictiveScalingMode -> f (Maybe PredictiveScalingMode))
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_predictiveScalingMode = (ScalingInstruction -> Maybe PredictiveScalingMode)
-> (ScalingInstruction
    -> Maybe PredictiveScalingMode -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     (Maybe PredictiveScalingMode)
     (Maybe PredictiveScalingMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Maybe PredictiveScalingMode
predictiveScalingMode :: Maybe PredictiveScalingMode
$sel:predictiveScalingMode:ScalingInstruction' :: ScalingInstruction -> Maybe PredictiveScalingMode
predictiveScalingMode} -> Maybe PredictiveScalingMode
predictiveScalingMode) (\s :: ScalingInstruction
s@ScalingInstruction' {} Maybe PredictiveScalingMode
a -> ScalingInstruction
s {$sel:predictiveScalingMode:ScalingInstruction' :: Maybe PredictiveScalingMode
predictiveScalingMode = Maybe PredictiveScalingMode
a} :: ScalingInstruction)

-- | Controls whether dynamic scaling by AWS Auto Scaling is disabled. When
-- dynamic scaling is enabled, AWS Auto Scaling creates target tracking
-- scaling policies based on the specified target tracking configurations.
--
-- The default is enabled (@false@).
scalingInstruction_disableDynamicScaling :: Lens.Lens' ScalingInstruction (Prelude.Maybe Prelude.Bool)
scalingInstruction_disableDynamicScaling :: (Maybe Bool -> f (Maybe Bool))
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_disableDynamicScaling = (ScalingInstruction -> Maybe Bool)
-> (ScalingInstruction -> Maybe Bool -> ScalingInstruction)
-> Lens
     ScalingInstruction ScalingInstruction (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Maybe Bool
disableDynamicScaling :: Maybe Bool
$sel:disableDynamicScaling:ScalingInstruction' :: ScalingInstruction -> Maybe Bool
disableDynamicScaling} -> Maybe Bool
disableDynamicScaling) (\s :: ScalingInstruction
s@ScalingInstruction' {} Maybe Bool
a -> ScalingInstruction
s {$sel:disableDynamicScaling:ScalingInstruction' :: Maybe Bool
disableDynamicScaling = Maybe Bool
a} :: ScalingInstruction)

-- | Defines the behavior that should be applied if the forecast capacity
-- approaches or exceeds the maximum capacity specified for the resource.
-- The default value is @SetForecastCapacityToMaxCapacity@.
--
-- The following are possible values:
--
-- -   @SetForecastCapacityToMaxCapacity@ - AWS Auto Scaling cannot scale
--     resource capacity higher than the maximum capacity. The maximum
--     capacity is enforced as a hard limit.
--
-- -   @SetMaxCapacityToForecastCapacity@ - AWS Auto Scaling may scale
--     resource capacity higher than the maximum capacity to equal but not
--     exceed forecast capacity.
--
-- -   @SetMaxCapacityAboveForecastCapacity@ - AWS Auto Scaling may scale
--     resource capacity higher than the maximum capacity by a specified
--     buffer value. The intention is to give the target tracking scaling
--     policy extra capacity if unexpected traffic occurs.
--
-- Only valid when configuring predictive scaling.
scalingInstruction_predictiveScalingMaxCapacityBehavior :: Lens.Lens' ScalingInstruction (Prelude.Maybe PredictiveScalingMaxCapacityBehavior)
scalingInstruction_predictiveScalingMaxCapacityBehavior :: (Maybe PredictiveScalingMaxCapacityBehavior
 -> f (Maybe PredictiveScalingMaxCapacityBehavior))
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_predictiveScalingMaxCapacityBehavior = (ScalingInstruction -> Maybe PredictiveScalingMaxCapacityBehavior)
-> (ScalingInstruction
    -> Maybe PredictiveScalingMaxCapacityBehavior
    -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     (Maybe PredictiveScalingMaxCapacityBehavior)
     (Maybe PredictiveScalingMaxCapacityBehavior)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Maybe PredictiveScalingMaxCapacityBehavior
predictiveScalingMaxCapacityBehavior :: Maybe PredictiveScalingMaxCapacityBehavior
$sel:predictiveScalingMaxCapacityBehavior:ScalingInstruction' :: ScalingInstruction -> Maybe PredictiveScalingMaxCapacityBehavior
predictiveScalingMaxCapacityBehavior} -> Maybe PredictiveScalingMaxCapacityBehavior
predictiveScalingMaxCapacityBehavior) (\s :: ScalingInstruction
s@ScalingInstruction' {} Maybe PredictiveScalingMaxCapacityBehavior
a -> ScalingInstruction
s {$sel:predictiveScalingMaxCapacityBehavior:ScalingInstruction' :: Maybe PredictiveScalingMaxCapacityBehavior
predictiveScalingMaxCapacityBehavior = Maybe PredictiveScalingMaxCapacityBehavior
a} :: ScalingInstruction)

-- | The predefined load metric to use for predictive scaling. This parameter
-- or a __CustomizedLoadMetricSpecification__ is required when configuring
-- predictive scaling, and cannot be used otherwise.
scalingInstruction_predefinedLoadMetricSpecification :: Lens.Lens' ScalingInstruction (Prelude.Maybe PredefinedLoadMetricSpecification)
scalingInstruction_predefinedLoadMetricSpecification :: (Maybe PredefinedLoadMetricSpecification
 -> f (Maybe PredefinedLoadMetricSpecification))
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_predefinedLoadMetricSpecification = (ScalingInstruction -> Maybe PredefinedLoadMetricSpecification)
-> (ScalingInstruction
    -> Maybe PredefinedLoadMetricSpecification -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     (Maybe PredefinedLoadMetricSpecification)
     (Maybe PredefinedLoadMetricSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Maybe PredefinedLoadMetricSpecification
predefinedLoadMetricSpecification :: Maybe PredefinedLoadMetricSpecification
$sel:predefinedLoadMetricSpecification:ScalingInstruction' :: ScalingInstruction -> Maybe PredefinedLoadMetricSpecification
predefinedLoadMetricSpecification} -> Maybe PredefinedLoadMetricSpecification
predefinedLoadMetricSpecification) (\s :: ScalingInstruction
s@ScalingInstruction' {} Maybe PredefinedLoadMetricSpecification
a -> ScalingInstruction
s {$sel:predefinedLoadMetricSpecification:ScalingInstruction' :: Maybe PredefinedLoadMetricSpecification
predefinedLoadMetricSpecification = Maybe PredefinedLoadMetricSpecification
a} :: ScalingInstruction)

-- | The namespace of the AWS service.
scalingInstruction_serviceNamespace :: Lens.Lens' ScalingInstruction ServiceNamespace
scalingInstruction_serviceNamespace :: (ServiceNamespace -> f ServiceNamespace)
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_serviceNamespace = (ScalingInstruction -> ServiceNamespace)
-> (ScalingInstruction -> ServiceNamespace -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     ServiceNamespace
     ServiceNamespace
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {ServiceNamespace
serviceNamespace :: ServiceNamespace
$sel:serviceNamespace:ScalingInstruction' :: ScalingInstruction -> ServiceNamespace
serviceNamespace} -> ServiceNamespace
serviceNamespace) (\s :: ScalingInstruction
s@ScalingInstruction' {} ServiceNamespace
a -> ScalingInstruction
s {$sel:serviceNamespace:ScalingInstruction' :: ServiceNamespace
serviceNamespace = ServiceNamespace
a} :: ScalingInstruction)

-- | The ID of the resource. This string consists of the resource type and
-- unique identifier.
--
-- -   Auto Scaling group - The resource type is @autoScalingGroup@ and the
--     unique identifier is the name of the Auto Scaling group. Example:
--     @autoScalingGroup\/my-asg@.
--
-- -   ECS service - The resource type is @service@ and the unique
--     identifier is the cluster name and service name. Example:
--     @service\/default\/sample-webapp@.
--
-- -   Spot Fleet request - The resource type is @spot-fleet-request@ and
--     the unique identifier is the Spot Fleet request ID. Example:
--     @spot-fleet-request\/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE@.
--
-- -   DynamoDB table - The resource type is @table@ and the unique
--     identifier is the resource ID. Example: @table\/my-table@.
--
-- -   DynamoDB global secondary index - The resource type is @index@ and
--     the unique identifier is the resource ID. Example:
--     @table\/my-table\/index\/my-table-index@.
--
-- -   Aurora DB cluster - The resource type is @cluster@ and the unique
--     identifier is the cluster name. Example: @cluster:my-db-cluster@.
scalingInstruction_resourceId :: Lens.Lens' ScalingInstruction Prelude.Text
scalingInstruction_resourceId :: (Text -> f Text) -> ScalingInstruction -> f ScalingInstruction
scalingInstruction_resourceId = (ScalingInstruction -> Text)
-> (ScalingInstruction -> Text -> ScalingInstruction)
-> Lens ScalingInstruction ScalingInstruction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Text
resourceId :: Text
$sel:resourceId:ScalingInstruction' :: ScalingInstruction -> Text
resourceId} -> Text
resourceId) (\s :: ScalingInstruction
s@ScalingInstruction' {} Text
a -> ScalingInstruction
s {$sel:resourceId:ScalingInstruction' :: Text
resourceId = Text
a} :: ScalingInstruction)

-- | The scalable dimension associated with the resource.
--
-- -   @autoscaling:autoScalingGroup:DesiredCapacity@ - The desired
--     capacity of an Auto Scaling group.
--
-- -   @ecs:service:DesiredCount@ - The desired task count of an ECS
--     service.
--
-- -   @ec2:spot-fleet-request:TargetCapacity@ - The target capacity of a
--     Spot Fleet request.
--
-- -   @dynamodb:table:ReadCapacityUnits@ - The provisioned read capacity
--     for a DynamoDB table.
--
-- -   @dynamodb:table:WriteCapacityUnits@ - The provisioned write capacity
--     for a DynamoDB table.
--
-- -   @dynamodb:index:ReadCapacityUnits@ - The provisioned read capacity
--     for a DynamoDB global secondary index.
--
-- -   @dynamodb:index:WriteCapacityUnits@ - The provisioned write capacity
--     for a DynamoDB global secondary index.
--
-- -   @rds:cluster:ReadReplicaCount@ - The count of Aurora Replicas in an
--     Aurora DB cluster. Available for Aurora MySQL-compatible edition and
--     Aurora PostgreSQL-compatible edition.
scalingInstruction_scalableDimension :: Lens.Lens' ScalingInstruction ScalableDimension
scalingInstruction_scalableDimension :: (ScalableDimension -> f ScalableDimension)
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_scalableDimension = (ScalingInstruction -> ScalableDimension)
-> (ScalingInstruction -> ScalableDimension -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     ScalableDimension
     ScalableDimension
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {ScalableDimension
scalableDimension :: ScalableDimension
$sel:scalableDimension:ScalingInstruction' :: ScalingInstruction -> ScalableDimension
scalableDimension} -> ScalableDimension
scalableDimension) (\s :: ScalingInstruction
s@ScalingInstruction' {} ScalableDimension
a -> ScalingInstruction
s {$sel:scalableDimension:ScalingInstruction' :: ScalableDimension
scalableDimension = ScalableDimension
a} :: ScalingInstruction)

-- | The minimum capacity of the resource.
scalingInstruction_minCapacity :: Lens.Lens' ScalingInstruction Prelude.Int
scalingInstruction_minCapacity :: (Int -> f Int) -> ScalingInstruction -> f ScalingInstruction
scalingInstruction_minCapacity = (ScalingInstruction -> Int)
-> (ScalingInstruction -> Int -> ScalingInstruction)
-> Lens ScalingInstruction ScalingInstruction Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Int
minCapacity :: Int
$sel:minCapacity:ScalingInstruction' :: ScalingInstruction -> Int
minCapacity} -> Int
minCapacity) (\s :: ScalingInstruction
s@ScalingInstruction' {} Int
a -> ScalingInstruction
s {$sel:minCapacity:ScalingInstruction' :: Int
minCapacity = Int
a} :: ScalingInstruction)

-- | The maximum capacity of the resource. The exception to this upper limit
-- is if you specify a non-default setting for
-- __PredictiveScalingMaxCapacityBehavior__.
scalingInstruction_maxCapacity :: Lens.Lens' ScalingInstruction Prelude.Int
scalingInstruction_maxCapacity :: (Int -> f Int) -> ScalingInstruction -> f ScalingInstruction
scalingInstruction_maxCapacity = (ScalingInstruction -> Int)
-> (ScalingInstruction -> Int -> ScalingInstruction)
-> Lens ScalingInstruction ScalingInstruction Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {Int
maxCapacity :: Int
$sel:maxCapacity:ScalingInstruction' :: ScalingInstruction -> Int
maxCapacity} -> Int
maxCapacity) (\s :: ScalingInstruction
s@ScalingInstruction' {} Int
a -> ScalingInstruction
s {$sel:maxCapacity:ScalingInstruction' :: Int
maxCapacity = Int
a} :: ScalingInstruction)

-- | The target tracking configurations (up to 10). Each of these structures
-- must specify a unique scaling metric and a target value for the metric.
scalingInstruction_targetTrackingConfigurations :: Lens.Lens' ScalingInstruction [TargetTrackingConfiguration]
scalingInstruction_targetTrackingConfigurations :: ([TargetTrackingConfiguration] -> f [TargetTrackingConfiguration])
-> ScalingInstruction -> f ScalingInstruction
scalingInstruction_targetTrackingConfigurations = (ScalingInstruction -> [TargetTrackingConfiguration])
-> (ScalingInstruction
    -> [TargetTrackingConfiguration] -> ScalingInstruction)
-> Lens
     ScalingInstruction
     ScalingInstruction
     [TargetTrackingConfiguration]
     [TargetTrackingConfiguration]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingInstruction' {[TargetTrackingConfiguration]
targetTrackingConfigurations :: [TargetTrackingConfiguration]
$sel:targetTrackingConfigurations:ScalingInstruction' :: ScalingInstruction -> [TargetTrackingConfiguration]
targetTrackingConfigurations} -> [TargetTrackingConfiguration]
targetTrackingConfigurations) (\s :: ScalingInstruction
s@ScalingInstruction' {} [TargetTrackingConfiguration]
a -> ScalingInstruction
s {$sel:targetTrackingConfigurations:ScalingInstruction' :: [TargetTrackingConfiguration]
targetTrackingConfigurations = [TargetTrackingConfiguration]
a} :: ScalingInstruction) (([TargetTrackingConfiguration] -> f [TargetTrackingConfiguration])
 -> ScalingInstruction -> f ScalingInstruction)
-> (([TargetTrackingConfiguration]
     -> f [TargetTrackingConfiguration])
    -> [TargetTrackingConfiguration]
    -> f [TargetTrackingConfiguration])
-> ([TargetTrackingConfiguration]
    -> f [TargetTrackingConfiguration])
-> ScalingInstruction
-> f ScalingInstruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TargetTrackingConfiguration] -> f [TargetTrackingConfiguration])
-> [TargetTrackingConfiguration] -> f [TargetTrackingConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ScalingInstruction where
  parseJSON :: Value -> Parser ScalingInstruction
parseJSON =
    String
-> (Object -> Parser ScalingInstruction)
-> Value
-> Parser ScalingInstruction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ScalingInstruction"
      ( \Object
x ->
          Maybe Natural
-> Maybe Int
-> Maybe ScalingPolicyUpdateBehavior
-> Maybe CustomizedLoadMetricSpecification
-> Maybe PredictiveScalingMode
-> Maybe Bool
-> Maybe PredictiveScalingMaxCapacityBehavior
-> Maybe PredefinedLoadMetricSpecification
-> ServiceNamespace
-> Text
-> ScalableDimension
-> Int
-> Int
-> [TargetTrackingConfiguration]
-> ScalingInstruction
ScalingInstruction'
            (Maybe Natural
 -> Maybe Int
 -> Maybe ScalingPolicyUpdateBehavior
 -> Maybe CustomizedLoadMetricSpecification
 -> Maybe PredictiveScalingMode
 -> Maybe Bool
 -> Maybe PredictiveScalingMaxCapacityBehavior
 -> Maybe PredefinedLoadMetricSpecification
 -> ServiceNamespace
 -> Text
 -> ScalableDimension
 -> Int
 -> Int
 -> [TargetTrackingConfiguration]
 -> ScalingInstruction)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Int
      -> Maybe ScalingPolicyUpdateBehavior
      -> Maybe CustomizedLoadMetricSpecification
      -> Maybe PredictiveScalingMode
      -> Maybe Bool
      -> Maybe PredictiveScalingMaxCapacityBehavior
      -> Maybe PredefinedLoadMetricSpecification
      -> ServiceNamespace
      -> Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScheduledActionBufferTime")
            Parser
  (Maybe Int
   -> Maybe ScalingPolicyUpdateBehavior
   -> Maybe CustomizedLoadMetricSpecification
   -> Maybe PredictiveScalingMode
   -> Maybe Bool
   -> Maybe PredictiveScalingMaxCapacityBehavior
   -> Maybe PredefinedLoadMetricSpecification
   -> ServiceNamespace
   -> Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser (Maybe Int)
-> Parser
     (Maybe ScalingPolicyUpdateBehavior
      -> Maybe CustomizedLoadMetricSpecification
      -> Maybe PredictiveScalingMode
      -> Maybe Bool
      -> Maybe PredictiveScalingMaxCapacityBehavior
      -> Maybe PredefinedLoadMetricSpecification
      -> ServiceNamespace
      -> Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredictiveScalingMaxCapacityBuffer")
            Parser
  (Maybe ScalingPolicyUpdateBehavior
   -> Maybe CustomizedLoadMetricSpecification
   -> Maybe PredictiveScalingMode
   -> Maybe Bool
   -> Maybe PredictiveScalingMaxCapacityBehavior
   -> Maybe PredefinedLoadMetricSpecification
   -> ServiceNamespace
   -> Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser (Maybe ScalingPolicyUpdateBehavior)
-> Parser
     (Maybe CustomizedLoadMetricSpecification
      -> Maybe PredictiveScalingMode
      -> Maybe Bool
      -> Maybe PredictiveScalingMaxCapacityBehavior
      -> Maybe PredefinedLoadMetricSpecification
      -> ServiceNamespace
      -> Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ScalingPolicyUpdateBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScalingPolicyUpdateBehavior")
            Parser
  (Maybe CustomizedLoadMetricSpecification
   -> Maybe PredictiveScalingMode
   -> Maybe Bool
   -> Maybe PredictiveScalingMaxCapacityBehavior
   -> Maybe PredefinedLoadMetricSpecification
   -> ServiceNamespace
   -> Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser (Maybe CustomizedLoadMetricSpecification)
-> Parser
     (Maybe PredictiveScalingMode
      -> Maybe Bool
      -> Maybe PredictiveScalingMaxCapacityBehavior
      -> Maybe PredefinedLoadMetricSpecification
      -> ServiceNamespace
      -> Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CustomizedLoadMetricSpecification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CustomizedLoadMetricSpecification")
            Parser
  (Maybe PredictiveScalingMode
   -> Maybe Bool
   -> Maybe PredictiveScalingMaxCapacityBehavior
   -> Maybe PredefinedLoadMetricSpecification
   -> ServiceNamespace
   -> Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser (Maybe PredictiveScalingMode)
-> Parser
     (Maybe Bool
      -> Maybe PredictiveScalingMaxCapacityBehavior
      -> Maybe PredefinedLoadMetricSpecification
      -> ServiceNamespace
      -> Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PredictiveScalingMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredictiveScalingMode")
            Parser
  (Maybe Bool
   -> Maybe PredictiveScalingMaxCapacityBehavior
   -> Maybe PredefinedLoadMetricSpecification
   -> ServiceNamespace
   -> Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser (Maybe Bool)
-> Parser
     (Maybe PredictiveScalingMaxCapacityBehavior
      -> Maybe PredefinedLoadMetricSpecification
      -> ServiceNamespace
      -> Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DisableDynamicScaling")
            Parser
  (Maybe PredictiveScalingMaxCapacityBehavior
   -> Maybe PredefinedLoadMetricSpecification
   -> ServiceNamespace
   -> Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser (Maybe PredictiveScalingMaxCapacityBehavior)
-> Parser
     (Maybe PredefinedLoadMetricSpecification
      -> ServiceNamespace
      -> Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe PredictiveScalingMaxCapacityBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredictiveScalingMaxCapacityBehavior")
            Parser
  (Maybe PredefinedLoadMetricSpecification
   -> ServiceNamespace
   -> Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser (Maybe PredefinedLoadMetricSpecification)
-> Parser
     (ServiceNamespace
      -> Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PredefinedLoadMetricSpecification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredefinedLoadMetricSpecification")
            Parser
  (ServiceNamespace
   -> Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser ServiceNamespace
-> Parser
     (Text
      -> ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ServiceNamespace
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ServiceNamespace")
            Parser
  (Text
   -> ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser Text
-> Parser
     (ScalableDimension
      -> Int
      -> Int
      -> [TargetTrackingConfiguration]
      -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceId")
            Parser
  (ScalableDimension
   -> Int
   -> Int
   -> [TargetTrackingConfiguration]
   -> ScalingInstruction)
-> Parser ScalableDimension
-> Parser
     (Int -> Int -> [TargetTrackingConfiguration] -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ScalableDimension
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ScalableDimension")
            Parser
  (Int -> Int -> [TargetTrackingConfiguration] -> ScalingInstruction)
-> Parser Int
-> Parser
     (Int -> [TargetTrackingConfiguration] -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MinCapacity")
            Parser (Int -> [TargetTrackingConfiguration] -> ScalingInstruction)
-> Parser Int
-> Parser ([TargetTrackingConfiguration] -> ScalingInstruction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MaxCapacity")
            Parser ([TargetTrackingConfiguration] -> ScalingInstruction)
-> Parser [TargetTrackingConfiguration]
-> Parser ScalingInstruction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [TargetTrackingConfiguration])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetTrackingConfigurations"
                            Parser (Maybe [TargetTrackingConfiguration])
-> [TargetTrackingConfiguration]
-> Parser [TargetTrackingConfiguration]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [TargetTrackingConfiguration]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ScalingInstruction

instance Prelude.NFData ScalingInstruction

instance Core.ToJSON ScalingInstruction where
  toJSON :: ScalingInstruction -> Value
toJSON ScalingInstruction' {Int
[TargetTrackingConfiguration]
Maybe Bool
Maybe Int
Maybe Natural
Maybe CustomizedLoadMetricSpecification
Maybe PredefinedLoadMetricSpecification
Maybe PredictiveScalingMaxCapacityBehavior
Maybe PredictiveScalingMode
Maybe ScalingPolicyUpdateBehavior
Text
ScalableDimension
ServiceNamespace
targetTrackingConfigurations :: [TargetTrackingConfiguration]
maxCapacity :: Int
minCapacity :: Int
scalableDimension :: ScalableDimension
resourceId :: Text
serviceNamespace :: ServiceNamespace
predefinedLoadMetricSpecification :: Maybe PredefinedLoadMetricSpecification
predictiveScalingMaxCapacityBehavior :: Maybe PredictiveScalingMaxCapacityBehavior
disableDynamicScaling :: Maybe Bool
predictiveScalingMode :: Maybe PredictiveScalingMode
customizedLoadMetricSpecification :: Maybe CustomizedLoadMetricSpecification
scalingPolicyUpdateBehavior :: Maybe ScalingPolicyUpdateBehavior
predictiveScalingMaxCapacityBuffer :: Maybe Int
scheduledActionBufferTime :: Maybe Natural
$sel:targetTrackingConfigurations:ScalingInstruction' :: ScalingInstruction -> [TargetTrackingConfiguration]
$sel:maxCapacity:ScalingInstruction' :: ScalingInstruction -> Int
$sel:minCapacity:ScalingInstruction' :: ScalingInstruction -> Int
$sel:scalableDimension:ScalingInstruction' :: ScalingInstruction -> ScalableDimension
$sel:resourceId:ScalingInstruction' :: ScalingInstruction -> Text
$sel:serviceNamespace:ScalingInstruction' :: ScalingInstruction -> ServiceNamespace
$sel:predefinedLoadMetricSpecification:ScalingInstruction' :: ScalingInstruction -> Maybe PredefinedLoadMetricSpecification
$sel:predictiveScalingMaxCapacityBehavior:ScalingInstruction' :: ScalingInstruction -> Maybe PredictiveScalingMaxCapacityBehavior
$sel:disableDynamicScaling:ScalingInstruction' :: ScalingInstruction -> Maybe Bool
$sel:predictiveScalingMode:ScalingInstruction' :: ScalingInstruction -> Maybe PredictiveScalingMode
$sel:customizedLoadMetricSpecification:ScalingInstruction' :: ScalingInstruction -> Maybe CustomizedLoadMetricSpecification
$sel:scalingPolicyUpdateBehavior:ScalingInstruction' :: ScalingInstruction -> Maybe ScalingPolicyUpdateBehavior
$sel:predictiveScalingMaxCapacityBuffer:ScalingInstruction' :: ScalingInstruction -> Maybe Int
$sel:scheduledActionBufferTime:ScalingInstruction' :: ScalingInstruction -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ScheduledActionBufferTime" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
scheduledActionBufferTime,
            (Text
"PredictiveScalingMaxCapacityBuffer" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
predictiveScalingMaxCapacityBuffer,
            (Text
"ScalingPolicyUpdateBehavior" Text -> ScalingPolicyUpdateBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ScalingPolicyUpdateBehavior -> Pair)
-> Maybe ScalingPolicyUpdateBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScalingPolicyUpdateBehavior
scalingPolicyUpdateBehavior,
            (Text
"CustomizedLoadMetricSpecification" Text -> CustomizedLoadMetricSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CustomizedLoadMetricSpecification -> Pair)
-> Maybe CustomizedLoadMetricSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CustomizedLoadMetricSpecification
customizedLoadMetricSpecification,
            (Text
"PredictiveScalingMode" Text -> PredictiveScalingMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PredictiveScalingMode -> Pair)
-> Maybe PredictiveScalingMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PredictiveScalingMode
predictiveScalingMode,
            (Text
"DisableDynamicScaling" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disableDynamicScaling,
            (Text
"PredictiveScalingMaxCapacityBehavior" Text -> PredictiveScalingMaxCapacityBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PredictiveScalingMaxCapacityBehavior -> Pair)
-> Maybe PredictiveScalingMaxCapacityBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PredictiveScalingMaxCapacityBehavior
predictiveScalingMaxCapacityBehavior,
            (Text
"PredefinedLoadMetricSpecification" Text -> PredefinedLoadMetricSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PredefinedLoadMetricSpecification -> Pair)
-> Maybe PredefinedLoadMetricSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PredefinedLoadMetricSpecification
predefinedLoadMetricSpecification,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ServiceNamespace" Text -> ServiceNamespace -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ServiceNamespace
serviceNamespace),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ScalableDimension" Text -> ScalableDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ScalableDimension
scalableDimension),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MinCapacity" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
minCapacity),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MaxCapacity" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
maxCapacity),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"TargetTrackingConfigurations"
                  Text -> [TargetTrackingConfiguration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [TargetTrackingConfiguration]
targetTrackingConfigurations
              )
          ]
      )