{-# 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.ApplicationAutoScaling.Types.TargetTrackingScalingPolicyConfiguration
-- 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.ApplicationAutoScaling.Types.TargetTrackingScalingPolicyConfiguration where

import Amazonka.ApplicationAutoScaling.Types.CustomizedMetricSpecification
import Amazonka.ApplicationAutoScaling.Types.PredefinedMetricSpecification
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a target tracking scaling policy configuration to use with
-- Application Auto Scaling.
--
-- /See:/ 'newTargetTrackingScalingPolicyConfiguration' smart constructor.
data TargetTrackingScalingPolicyConfiguration = TargetTrackingScalingPolicyConfiguration'
  { -- | A predefined metric. You can specify either a predefined metric or a
    -- customized metric.
    TargetTrackingScalingPolicyConfiguration
-> Maybe PredefinedMetricSpecification
predefinedMetricSpecification :: Prelude.Maybe PredefinedMetricSpecification,
    -- | The amount of time, in seconds, after a scale-in activity completes
    -- before another scale-in activity can start.
    --
    -- With the /scale-in cooldown period/, the intention is to scale in
    -- conservatively to protect your application’s availability, so scale-in
    -- activities are blocked until the cooldown period has expired. However,
    -- if another alarm triggers a scale-out activity during the scale-in
    -- cooldown period, Application Auto Scaling scales out the target
    -- immediately. In this case, the scale-in cooldown period stops and
    -- doesn\'t complete.
    --
    -- Application Auto Scaling provides a default value of 600 for Amazon
    -- ElastiCache replication groups and a default value of 300 for the
    -- following scalable targets:
    --
    -- -   AppStream 2.0 fleets
    --
    -- -   Aurora DB clusters
    --
    -- -   ECS services
    --
    -- -   EMR clusters
    --
    -- -   Neptune clusters
    --
    -- -   SageMaker endpoint variants
    --
    -- -   Spot Fleets
    --
    -- -   Custom resources
    --
    -- For all other scalable targets, the default value is 0:
    --
    -- -   Amazon Comprehend document classification and entity recognizer
    --     endpoints
    --
    -- -   DynamoDB tables and global secondary indexes
    --
    -- -   Amazon Keyspaces tables
    --
    -- -   Lambda provisioned concurrency
    --
    -- -   Amazon MSK broker storage
    TargetTrackingScalingPolicyConfiguration -> Maybe Int
scaleInCooldown :: Prelude.Maybe Prelude.Int,
    -- | A customized metric. You can specify either a predefined metric or a
    -- customized metric.
    TargetTrackingScalingPolicyConfiguration
-> Maybe CustomizedMetricSpecification
customizedMetricSpecification :: Prelude.Maybe CustomizedMetricSpecification,
    -- | Indicates whether scale in by the target tracking scaling policy is
    -- disabled. If the value is @true@, scale in is disabled and the target
    -- tracking scaling policy won\'t remove capacity from the scalable target.
    -- Otherwise, scale in is enabled and the target tracking scaling policy
    -- can remove capacity from the scalable target. The default value is
    -- @false@.
    TargetTrackingScalingPolicyConfiguration -> Maybe Bool
disableScaleIn :: Prelude.Maybe Prelude.Bool,
    -- | The amount of time, in seconds, to wait for a previous scale-out
    -- activity to take effect.
    --
    -- With the /scale-out cooldown period/, the intention is to continuously
    -- (but not excessively) scale out. After Application Auto Scaling
    -- successfully scales out using a target tracking scaling policy, it
    -- starts to calculate the cooldown time. The scaling policy won\'t
    -- increase the desired capacity again unless either a larger scale out is
    -- triggered or the cooldown period ends. While the cooldown period is in
    -- effect, the capacity added by the initiating scale-out activity is
    -- calculated as part of the desired capacity for the next scale-out
    -- activity.
    --
    -- Application Auto Scaling provides a default value of 600 for Amazon
    -- ElastiCache replication groups and a default value of 300 for the
    -- following scalable targets:
    --
    -- -   AppStream 2.0 fleets
    --
    -- -   Aurora DB clusters
    --
    -- -   ECS services
    --
    -- -   EMR clusters
    --
    -- -   Neptune clusters
    --
    -- -   SageMaker endpoint variants
    --
    -- -   Spot Fleets
    --
    -- -   Custom resources
    --
    -- For all other scalable targets, the default value is 0:
    --
    -- -   Amazon Comprehend document classification and entity recognizer
    --     endpoints
    --
    -- -   DynamoDB tables and global secondary indexes
    --
    -- -   Amazon Keyspaces tables
    --
    -- -   Lambda provisioned concurrency
    --
    -- -   Amazon MSK broker storage
    TargetTrackingScalingPolicyConfiguration -> Maybe Int
scaleOutCooldown :: Prelude.Maybe Prelude.Int,
    -- | The target value for the metric. Although this property accepts numbers
    -- of type Double, it won\'t accept values that are either too small or too
    -- large. Values must be in the range of -2^360 to 2^360. The value must be
    -- a valid number based on the choice of metric. For example, if the metric
    -- is CPU utilization, then the target value is a percent value that
    -- represents how much of the CPU can be used before scaling out.
    TargetTrackingScalingPolicyConfiguration -> Double
targetValue :: Prelude.Double
  }
  deriving (TargetTrackingScalingPolicyConfiguration
-> TargetTrackingScalingPolicyConfiguration -> Bool
(TargetTrackingScalingPolicyConfiguration
 -> TargetTrackingScalingPolicyConfiguration -> Bool)
-> (TargetTrackingScalingPolicyConfiguration
    -> TargetTrackingScalingPolicyConfiguration -> Bool)
-> Eq TargetTrackingScalingPolicyConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TargetTrackingScalingPolicyConfiguration
-> TargetTrackingScalingPolicyConfiguration -> Bool
$c/= :: TargetTrackingScalingPolicyConfiguration
-> TargetTrackingScalingPolicyConfiguration -> Bool
== :: TargetTrackingScalingPolicyConfiguration
-> TargetTrackingScalingPolicyConfiguration -> Bool
$c== :: TargetTrackingScalingPolicyConfiguration
-> TargetTrackingScalingPolicyConfiguration -> Bool
Prelude.Eq, ReadPrec [TargetTrackingScalingPolicyConfiguration]
ReadPrec TargetTrackingScalingPolicyConfiguration
Int -> ReadS TargetTrackingScalingPolicyConfiguration
ReadS [TargetTrackingScalingPolicyConfiguration]
(Int -> ReadS TargetTrackingScalingPolicyConfiguration)
-> ReadS [TargetTrackingScalingPolicyConfiguration]
-> ReadPrec TargetTrackingScalingPolicyConfiguration
-> ReadPrec [TargetTrackingScalingPolicyConfiguration]
-> Read TargetTrackingScalingPolicyConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TargetTrackingScalingPolicyConfiguration]
$creadListPrec :: ReadPrec [TargetTrackingScalingPolicyConfiguration]
readPrec :: ReadPrec TargetTrackingScalingPolicyConfiguration
$creadPrec :: ReadPrec TargetTrackingScalingPolicyConfiguration
readList :: ReadS [TargetTrackingScalingPolicyConfiguration]
$creadList :: ReadS [TargetTrackingScalingPolicyConfiguration]
readsPrec :: Int -> ReadS TargetTrackingScalingPolicyConfiguration
$creadsPrec :: Int -> ReadS TargetTrackingScalingPolicyConfiguration
Prelude.Read, Int -> TargetTrackingScalingPolicyConfiguration -> ShowS
[TargetTrackingScalingPolicyConfiguration] -> ShowS
TargetTrackingScalingPolicyConfiguration -> String
(Int -> TargetTrackingScalingPolicyConfiguration -> ShowS)
-> (TargetTrackingScalingPolicyConfiguration -> String)
-> ([TargetTrackingScalingPolicyConfiguration] -> ShowS)
-> Show TargetTrackingScalingPolicyConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TargetTrackingScalingPolicyConfiguration] -> ShowS
$cshowList :: [TargetTrackingScalingPolicyConfiguration] -> ShowS
show :: TargetTrackingScalingPolicyConfiguration -> String
$cshow :: TargetTrackingScalingPolicyConfiguration -> String
showsPrec :: Int -> TargetTrackingScalingPolicyConfiguration -> ShowS
$cshowsPrec :: Int -> TargetTrackingScalingPolicyConfiguration -> ShowS
Prelude.Show, (forall x.
 TargetTrackingScalingPolicyConfiguration
 -> Rep TargetTrackingScalingPolicyConfiguration x)
-> (forall x.
    Rep TargetTrackingScalingPolicyConfiguration x
    -> TargetTrackingScalingPolicyConfiguration)
-> Generic TargetTrackingScalingPolicyConfiguration
forall x.
Rep TargetTrackingScalingPolicyConfiguration x
-> TargetTrackingScalingPolicyConfiguration
forall x.
TargetTrackingScalingPolicyConfiguration
-> Rep TargetTrackingScalingPolicyConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TargetTrackingScalingPolicyConfiguration x
-> TargetTrackingScalingPolicyConfiguration
$cfrom :: forall x.
TargetTrackingScalingPolicyConfiguration
-> Rep TargetTrackingScalingPolicyConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TargetTrackingScalingPolicyConfiguration' 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:
--
-- 'predefinedMetricSpecification', 'targetTrackingScalingPolicyConfiguration_predefinedMetricSpecification' - A predefined metric. You can specify either a predefined metric or a
-- customized metric.
--
-- 'scaleInCooldown', 'targetTrackingScalingPolicyConfiguration_scaleInCooldown' - The amount of time, in seconds, after a scale-in activity completes
-- before another scale-in activity can start.
--
-- With the /scale-in cooldown period/, the intention is to scale in
-- conservatively to protect your application’s availability, so scale-in
-- activities are blocked until the cooldown period has expired. However,
-- if another alarm triggers a scale-out activity during the scale-in
-- cooldown period, Application Auto Scaling scales out the target
-- immediately. In this case, the scale-in cooldown period stops and
-- doesn\'t complete.
--
-- Application Auto Scaling provides a default value of 600 for Amazon
-- ElastiCache replication groups and a default value of 300 for the
-- following scalable targets:
--
-- -   AppStream 2.0 fleets
--
-- -   Aurora DB clusters
--
-- -   ECS services
--
-- -   EMR clusters
--
-- -   Neptune clusters
--
-- -   SageMaker endpoint variants
--
-- -   Spot Fleets
--
-- -   Custom resources
--
-- For all other scalable targets, the default value is 0:
--
-- -   Amazon Comprehend document classification and entity recognizer
--     endpoints
--
-- -   DynamoDB tables and global secondary indexes
--
-- -   Amazon Keyspaces tables
--
-- -   Lambda provisioned concurrency
--
-- -   Amazon MSK broker storage
--
-- 'customizedMetricSpecification', 'targetTrackingScalingPolicyConfiguration_customizedMetricSpecification' - A customized metric. You can specify either a predefined metric or a
-- customized metric.
--
-- 'disableScaleIn', 'targetTrackingScalingPolicyConfiguration_disableScaleIn' - Indicates whether scale in by the target tracking scaling policy is
-- disabled. If the value is @true@, scale in is disabled and the target
-- tracking scaling policy won\'t remove capacity from the scalable target.
-- Otherwise, scale in is enabled and the target tracking scaling policy
-- can remove capacity from the scalable target. The default value is
-- @false@.
--
-- 'scaleOutCooldown', 'targetTrackingScalingPolicyConfiguration_scaleOutCooldown' - The amount of time, in seconds, to wait for a previous scale-out
-- activity to take effect.
--
-- With the /scale-out cooldown period/, the intention is to continuously
-- (but not excessively) scale out. After Application Auto Scaling
-- successfully scales out using a target tracking scaling policy, it
-- starts to calculate the cooldown time. The scaling policy won\'t
-- increase the desired capacity again unless either a larger scale out is
-- triggered or the cooldown period ends. While the cooldown period is in
-- effect, the capacity added by the initiating scale-out activity is
-- calculated as part of the desired capacity for the next scale-out
-- activity.
--
-- Application Auto Scaling provides a default value of 600 for Amazon
-- ElastiCache replication groups and a default value of 300 for the
-- following scalable targets:
--
-- -   AppStream 2.0 fleets
--
-- -   Aurora DB clusters
--
-- -   ECS services
--
-- -   EMR clusters
--
-- -   Neptune clusters
--
-- -   SageMaker endpoint variants
--
-- -   Spot Fleets
--
-- -   Custom resources
--
-- For all other scalable targets, the default value is 0:
--
-- -   Amazon Comprehend document classification and entity recognizer
--     endpoints
--
-- -   DynamoDB tables and global secondary indexes
--
-- -   Amazon Keyspaces tables
--
-- -   Lambda provisioned concurrency
--
-- -   Amazon MSK broker storage
--
-- 'targetValue', 'targetTrackingScalingPolicyConfiguration_targetValue' - The target value for the metric. Although this property accepts numbers
-- of type Double, it won\'t accept values that are either too small or too
-- large. Values must be in the range of -2^360 to 2^360. The value must be
-- a valid number based on the choice of metric. For example, if the metric
-- is CPU utilization, then the target value is a percent value that
-- represents how much of the CPU can be used before scaling out.
newTargetTrackingScalingPolicyConfiguration ::
  -- | 'targetValue'
  Prelude.Double ->
  TargetTrackingScalingPolicyConfiguration
newTargetTrackingScalingPolicyConfiguration :: Double -> TargetTrackingScalingPolicyConfiguration
newTargetTrackingScalingPolicyConfiguration
  Double
pTargetValue_ =
    TargetTrackingScalingPolicyConfiguration' :: Maybe PredefinedMetricSpecification
-> Maybe Int
-> Maybe CustomizedMetricSpecification
-> Maybe Bool
-> Maybe Int
-> Double
-> TargetTrackingScalingPolicyConfiguration
TargetTrackingScalingPolicyConfiguration'
      { $sel:predefinedMetricSpecification:TargetTrackingScalingPolicyConfiguration' :: Maybe PredefinedMetricSpecification
predefinedMetricSpecification =
          Maybe PredefinedMetricSpecification
forall a. Maybe a
Prelude.Nothing,
        $sel:scaleInCooldown:TargetTrackingScalingPolicyConfiguration' :: Maybe Int
scaleInCooldown = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:customizedMetricSpecification:TargetTrackingScalingPolicyConfiguration' :: Maybe CustomizedMetricSpecification
customizedMetricSpecification =
          Maybe CustomizedMetricSpecification
forall a. Maybe a
Prelude.Nothing,
        $sel:disableScaleIn:TargetTrackingScalingPolicyConfiguration' :: Maybe Bool
disableScaleIn = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:scaleOutCooldown:TargetTrackingScalingPolicyConfiguration' :: Maybe Int
scaleOutCooldown =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:targetValue:TargetTrackingScalingPolicyConfiguration' :: Double
targetValue = Double
pTargetValue_
      }

-- | A predefined metric. You can specify either a predefined metric or a
-- customized metric.
targetTrackingScalingPolicyConfiguration_predefinedMetricSpecification :: Lens.Lens' TargetTrackingScalingPolicyConfiguration (Prelude.Maybe PredefinedMetricSpecification)
targetTrackingScalingPolicyConfiguration_predefinedMetricSpecification :: (Maybe PredefinedMetricSpecification
 -> f (Maybe PredefinedMetricSpecification))
-> TargetTrackingScalingPolicyConfiguration
-> f TargetTrackingScalingPolicyConfiguration
targetTrackingScalingPolicyConfiguration_predefinedMetricSpecification = (TargetTrackingScalingPolicyConfiguration
 -> Maybe PredefinedMetricSpecification)
-> (TargetTrackingScalingPolicyConfiguration
    -> Maybe PredefinedMetricSpecification
    -> TargetTrackingScalingPolicyConfiguration)
-> Lens
     TargetTrackingScalingPolicyConfiguration
     TargetTrackingScalingPolicyConfiguration
     (Maybe PredefinedMetricSpecification)
     (Maybe PredefinedMetricSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingScalingPolicyConfiguration' {Maybe PredefinedMetricSpecification
predefinedMetricSpecification :: Maybe PredefinedMetricSpecification
$sel:predefinedMetricSpecification:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration
-> Maybe PredefinedMetricSpecification
predefinedMetricSpecification} -> Maybe PredefinedMetricSpecification
predefinedMetricSpecification) (\s :: TargetTrackingScalingPolicyConfiguration
s@TargetTrackingScalingPolicyConfiguration' {} Maybe PredefinedMetricSpecification
a -> TargetTrackingScalingPolicyConfiguration
s {$sel:predefinedMetricSpecification:TargetTrackingScalingPolicyConfiguration' :: Maybe PredefinedMetricSpecification
predefinedMetricSpecification = Maybe PredefinedMetricSpecification
a} :: TargetTrackingScalingPolicyConfiguration)

-- | The amount of time, in seconds, after a scale-in activity completes
-- before another scale-in activity can start.
--
-- With the /scale-in cooldown period/, the intention is to scale in
-- conservatively to protect your application’s availability, so scale-in
-- activities are blocked until the cooldown period has expired. However,
-- if another alarm triggers a scale-out activity during the scale-in
-- cooldown period, Application Auto Scaling scales out the target
-- immediately. In this case, the scale-in cooldown period stops and
-- doesn\'t complete.
--
-- Application Auto Scaling provides a default value of 600 for Amazon
-- ElastiCache replication groups and a default value of 300 for the
-- following scalable targets:
--
-- -   AppStream 2.0 fleets
--
-- -   Aurora DB clusters
--
-- -   ECS services
--
-- -   EMR clusters
--
-- -   Neptune clusters
--
-- -   SageMaker endpoint variants
--
-- -   Spot Fleets
--
-- -   Custom resources
--
-- For all other scalable targets, the default value is 0:
--
-- -   Amazon Comprehend document classification and entity recognizer
--     endpoints
--
-- -   DynamoDB tables and global secondary indexes
--
-- -   Amazon Keyspaces tables
--
-- -   Lambda provisioned concurrency
--
-- -   Amazon MSK broker storage
targetTrackingScalingPolicyConfiguration_scaleInCooldown :: Lens.Lens' TargetTrackingScalingPolicyConfiguration (Prelude.Maybe Prelude.Int)
targetTrackingScalingPolicyConfiguration_scaleInCooldown :: (Maybe Int -> f (Maybe Int))
-> TargetTrackingScalingPolicyConfiguration
-> f TargetTrackingScalingPolicyConfiguration
targetTrackingScalingPolicyConfiguration_scaleInCooldown = (TargetTrackingScalingPolicyConfiguration -> Maybe Int)
-> (TargetTrackingScalingPolicyConfiguration
    -> Maybe Int -> TargetTrackingScalingPolicyConfiguration)
-> Lens
     TargetTrackingScalingPolicyConfiguration
     TargetTrackingScalingPolicyConfiguration
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingScalingPolicyConfiguration' {Maybe Int
scaleInCooldown :: Maybe Int
$sel:scaleInCooldown:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration -> Maybe Int
scaleInCooldown} -> Maybe Int
scaleInCooldown) (\s :: TargetTrackingScalingPolicyConfiguration
s@TargetTrackingScalingPolicyConfiguration' {} Maybe Int
a -> TargetTrackingScalingPolicyConfiguration
s {$sel:scaleInCooldown:TargetTrackingScalingPolicyConfiguration' :: Maybe Int
scaleInCooldown = Maybe Int
a} :: TargetTrackingScalingPolicyConfiguration)

-- | A customized metric. You can specify either a predefined metric or a
-- customized metric.
targetTrackingScalingPolicyConfiguration_customizedMetricSpecification :: Lens.Lens' TargetTrackingScalingPolicyConfiguration (Prelude.Maybe CustomizedMetricSpecification)
targetTrackingScalingPolicyConfiguration_customizedMetricSpecification :: (Maybe CustomizedMetricSpecification
 -> f (Maybe CustomizedMetricSpecification))
-> TargetTrackingScalingPolicyConfiguration
-> f TargetTrackingScalingPolicyConfiguration
targetTrackingScalingPolicyConfiguration_customizedMetricSpecification = (TargetTrackingScalingPolicyConfiguration
 -> Maybe CustomizedMetricSpecification)
-> (TargetTrackingScalingPolicyConfiguration
    -> Maybe CustomizedMetricSpecification
    -> TargetTrackingScalingPolicyConfiguration)
-> Lens
     TargetTrackingScalingPolicyConfiguration
     TargetTrackingScalingPolicyConfiguration
     (Maybe CustomizedMetricSpecification)
     (Maybe CustomizedMetricSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingScalingPolicyConfiguration' {Maybe CustomizedMetricSpecification
customizedMetricSpecification :: Maybe CustomizedMetricSpecification
$sel:customizedMetricSpecification:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration
-> Maybe CustomizedMetricSpecification
customizedMetricSpecification} -> Maybe CustomizedMetricSpecification
customizedMetricSpecification) (\s :: TargetTrackingScalingPolicyConfiguration
s@TargetTrackingScalingPolicyConfiguration' {} Maybe CustomizedMetricSpecification
a -> TargetTrackingScalingPolicyConfiguration
s {$sel:customizedMetricSpecification:TargetTrackingScalingPolicyConfiguration' :: Maybe CustomizedMetricSpecification
customizedMetricSpecification = Maybe CustomizedMetricSpecification
a} :: TargetTrackingScalingPolicyConfiguration)

-- | Indicates whether scale in by the target tracking scaling policy is
-- disabled. If the value is @true@, scale in is disabled and the target
-- tracking scaling policy won\'t remove capacity from the scalable target.
-- Otherwise, scale in is enabled and the target tracking scaling policy
-- can remove capacity from the scalable target. The default value is
-- @false@.
targetTrackingScalingPolicyConfiguration_disableScaleIn :: Lens.Lens' TargetTrackingScalingPolicyConfiguration (Prelude.Maybe Prelude.Bool)
targetTrackingScalingPolicyConfiguration_disableScaleIn :: (Maybe Bool -> f (Maybe Bool))
-> TargetTrackingScalingPolicyConfiguration
-> f TargetTrackingScalingPolicyConfiguration
targetTrackingScalingPolicyConfiguration_disableScaleIn = (TargetTrackingScalingPolicyConfiguration -> Maybe Bool)
-> (TargetTrackingScalingPolicyConfiguration
    -> Maybe Bool -> TargetTrackingScalingPolicyConfiguration)
-> Lens
     TargetTrackingScalingPolicyConfiguration
     TargetTrackingScalingPolicyConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingScalingPolicyConfiguration' {Maybe Bool
disableScaleIn :: Maybe Bool
$sel:disableScaleIn:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration -> Maybe Bool
disableScaleIn} -> Maybe Bool
disableScaleIn) (\s :: TargetTrackingScalingPolicyConfiguration
s@TargetTrackingScalingPolicyConfiguration' {} Maybe Bool
a -> TargetTrackingScalingPolicyConfiguration
s {$sel:disableScaleIn:TargetTrackingScalingPolicyConfiguration' :: Maybe Bool
disableScaleIn = Maybe Bool
a} :: TargetTrackingScalingPolicyConfiguration)

-- | The amount of time, in seconds, to wait for a previous scale-out
-- activity to take effect.
--
-- With the /scale-out cooldown period/, the intention is to continuously
-- (but not excessively) scale out. After Application Auto Scaling
-- successfully scales out using a target tracking scaling policy, it
-- starts to calculate the cooldown time. The scaling policy won\'t
-- increase the desired capacity again unless either a larger scale out is
-- triggered or the cooldown period ends. While the cooldown period is in
-- effect, the capacity added by the initiating scale-out activity is
-- calculated as part of the desired capacity for the next scale-out
-- activity.
--
-- Application Auto Scaling provides a default value of 600 for Amazon
-- ElastiCache replication groups and a default value of 300 for the
-- following scalable targets:
--
-- -   AppStream 2.0 fleets
--
-- -   Aurora DB clusters
--
-- -   ECS services
--
-- -   EMR clusters
--
-- -   Neptune clusters
--
-- -   SageMaker endpoint variants
--
-- -   Spot Fleets
--
-- -   Custom resources
--
-- For all other scalable targets, the default value is 0:
--
-- -   Amazon Comprehend document classification and entity recognizer
--     endpoints
--
-- -   DynamoDB tables and global secondary indexes
--
-- -   Amazon Keyspaces tables
--
-- -   Lambda provisioned concurrency
--
-- -   Amazon MSK broker storage
targetTrackingScalingPolicyConfiguration_scaleOutCooldown :: Lens.Lens' TargetTrackingScalingPolicyConfiguration (Prelude.Maybe Prelude.Int)
targetTrackingScalingPolicyConfiguration_scaleOutCooldown :: (Maybe Int -> f (Maybe Int))
-> TargetTrackingScalingPolicyConfiguration
-> f TargetTrackingScalingPolicyConfiguration
targetTrackingScalingPolicyConfiguration_scaleOutCooldown = (TargetTrackingScalingPolicyConfiguration -> Maybe Int)
-> (TargetTrackingScalingPolicyConfiguration
    -> Maybe Int -> TargetTrackingScalingPolicyConfiguration)
-> Lens
     TargetTrackingScalingPolicyConfiguration
     TargetTrackingScalingPolicyConfiguration
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingScalingPolicyConfiguration' {Maybe Int
scaleOutCooldown :: Maybe Int
$sel:scaleOutCooldown:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration -> Maybe Int
scaleOutCooldown} -> Maybe Int
scaleOutCooldown) (\s :: TargetTrackingScalingPolicyConfiguration
s@TargetTrackingScalingPolicyConfiguration' {} Maybe Int
a -> TargetTrackingScalingPolicyConfiguration
s {$sel:scaleOutCooldown:TargetTrackingScalingPolicyConfiguration' :: Maybe Int
scaleOutCooldown = Maybe Int
a} :: TargetTrackingScalingPolicyConfiguration)

-- | The target value for the metric. Although this property accepts numbers
-- of type Double, it won\'t accept values that are either too small or too
-- large. Values must be in the range of -2^360 to 2^360. The value must be
-- a valid number based on the choice of metric. For example, if the metric
-- is CPU utilization, then the target value is a percent value that
-- represents how much of the CPU can be used before scaling out.
targetTrackingScalingPolicyConfiguration_targetValue :: Lens.Lens' TargetTrackingScalingPolicyConfiguration Prelude.Double
targetTrackingScalingPolicyConfiguration_targetValue :: (Double -> f Double)
-> TargetTrackingScalingPolicyConfiguration
-> f TargetTrackingScalingPolicyConfiguration
targetTrackingScalingPolicyConfiguration_targetValue = (TargetTrackingScalingPolicyConfiguration -> Double)
-> (TargetTrackingScalingPolicyConfiguration
    -> Double -> TargetTrackingScalingPolicyConfiguration)
-> Lens
     TargetTrackingScalingPolicyConfiguration
     TargetTrackingScalingPolicyConfiguration
     Double
     Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingScalingPolicyConfiguration' {Double
targetValue :: Double
$sel:targetValue:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration -> Double
targetValue} -> Double
targetValue) (\s :: TargetTrackingScalingPolicyConfiguration
s@TargetTrackingScalingPolicyConfiguration' {} Double
a -> TargetTrackingScalingPolicyConfiguration
s {$sel:targetValue:TargetTrackingScalingPolicyConfiguration' :: Double
targetValue = Double
a} :: TargetTrackingScalingPolicyConfiguration)

instance
  Core.FromJSON
    TargetTrackingScalingPolicyConfiguration
  where
  parseJSON :: Value -> Parser TargetTrackingScalingPolicyConfiguration
parseJSON =
    String
-> (Object -> Parser TargetTrackingScalingPolicyConfiguration)
-> Value
-> Parser TargetTrackingScalingPolicyConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TargetTrackingScalingPolicyConfiguration"
      ( \Object
x ->
          Maybe PredefinedMetricSpecification
-> Maybe Int
-> Maybe CustomizedMetricSpecification
-> Maybe Bool
-> Maybe Int
-> Double
-> TargetTrackingScalingPolicyConfiguration
TargetTrackingScalingPolicyConfiguration'
            (Maybe PredefinedMetricSpecification
 -> Maybe Int
 -> Maybe CustomizedMetricSpecification
 -> Maybe Bool
 -> Maybe Int
 -> Double
 -> TargetTrackingScalingPolicyConfiguration)
-> Parser (Maybe PredefinedMetricSpecification)
-> Parser
     (Maybe Int
      -> Maybe CustomizedMetricSpecification
      -> Maybe Bool
      -> Maybe Int
      -> Double
      -> TargetTrackingScalingPolicyConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PredefinedMetricSpecification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredefinedMetricSpecification")
            Parser
  (Maybe Int
   -> Maybe CustomizedMetricSpecification
   -> Maybe Bool
   -> Maybe Int
   -> Double
   -> TargetTrackingScalingPolicyConfiguration)
-> Parser (Maybe Int)
-> Parser
     (Maybe CustomizedMetricSpecification
      -> Maybe Bool
      -> Maybe Int
      -> Double
      -> TargetTrackingScalingPolicyConfiguration)
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
"ScaleInCooldown")
            Parser
  (Maybe CustomizedMetricSpecification
   -> Maybe Bool
   -> Maybe Int
   -> Double
   -> TargetTrackingScalingPolicyConfiguration)
-> Parser (Maybe CustomizedMetricSpecification)
-> Parser
     (Maybe Bool
      -> Maybe Int -> Double -> TargetTrackingScalingPolicyConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CustomizedMetricSpecification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CustomizedMetricSpecification")
            Parser
  (Maybe Bool
   -> Maybe Int -> Double -> TargetTrackingScalingPolicyConfiguration)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Int -> Double -> TargetTrackingScalingPolicyConfiguration)
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
"DisableScaleIn")
            Parser
  (Maybe Int -> Double -> TargetTrackingScalingPolicyConfiguration)
-> Parser (Maybe Int)
-> Parser (Double -> TargetTrackingScalingPolicyConfiguration)
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
"ScaleOutCooldown")
            Parser (Double -> TargetTrackingScalingPolicyConfiguration)
-> Parser Double -> Parser TargetTrackingScalingPolicyConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TargetValue")
      )

instance
  Prelude.Hashable
    TargetTrackingScalingPolicyConfiguration

instance
  Prelude.NFData
    TargetTrackingScalingPolicyConfiguration

instance
  Core.ToJSON
    TargetTrackingScalingPolicyConfiguration
  where
  toJSON :: TargetTrackingScalingPolicyConfiguration -> Value
toJSON TargetTrackingScalingPolicyConfiguration' {Double
Maybe Bool
Maybe Int
Maybe CustomizedMetricSpecification
Maybe PredefinedMetricSpecification
targetValue :: Double
scaleOutCooldown :: Maybe Int
disableScaleIn :: Maybe Bool
customizedMetricSpecification :: Maybe CustomizedMetricSpecification
scaleInCooldown :: Maybe Int
predefinedMetricSpecification :: Maybe PredefinedMetricSpecification
$sel:targetValue:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration -> Double
$sel:scaleOutCooldown:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration -> Maybe Int
$sel:disableScaleIn:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration -> Maybe Bool
$sel:customizedMetricSpecification:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration
-> Maybe CustomizedMetricSpecification
$sel:scaleInCooldown:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration -> Maybe Int
$sel:predefinedMetricSpecification:TargetTrackingScalingPolicyConfiguration' :: TargetTrackingScalingPolicyConfiguration
-> Maybe PredefinedMetricSpecification
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PredefinedMetricSpecification" Text -> PredefinedMetricSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PredefinedMetricSpecification -> Pair)
-> Maybe PredefinedMetricSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PredefinedMetricSpecification
predefinedMetricSpecification,
            (Text
"ScaleInCooldown" 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
scaleInCooldown,
            (Text
"CustomizedMetricSpecification" Text -> CustomizedMetricSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CustomizedMetricSpecification -> Pair)
-> Maybe CustomizedMetricSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CustomizedMetricSpecification
customizedMetricSpecification,
            (Text
"DisableScaleIn" 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
disableScaleIn,
            (Text
"ScaleOutCooldown" 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
scaleOutCooldown,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TargetValue" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Double
targetValue)
          ]
      )