{-# 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.TargetTrackingConfiguration
-- 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.TargetTrackingConfiguration where

import Amazonka.AutoScalingPlans.Types.CustomizedScalingMetricSpecification
import Amazonka.AutoScalingPlans.Types.PredefinedScalingMetricSpecification
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a target tracking configuration to use with AWS Auto Scaling.
-- Used with ScalingInstruction and ScalingPolicy.
--
-- /See:/ 'newTargetTrackingConfiguration' smart constructor.
data TargetTrackingConfiguration = TargetTrackingConfiguration'
  { -- | The estimated time, in seconds, until a newly launched instance can
    -- contribute to the CloudWatch metrics. This value is used only if the
    -- resource is an Auto Scaling group.
    TargetTrackingConfiguration -> Maybe Int
estimatedInstanceWarmup :: Prelude.Maybe Prelude.Int,
    -- | A predefined metric. You can specify either a predefined metric or a
    -- customized metric.
    TargetTrackingConfiguration
-> Maybe PredefinedScalingMetricSpecification
predefinedScalingMetricSpecification :: Prelude.Maybe PredefinedScalingMetricSpecification,
    -- | The amount of time, in seconds, after a scale-in activity completes
    -- before another scale-in activity can start. This property is not used if
    -- the scalable resource is an Auto Scaling group.
    --
    -- 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, Auto Scaling scales out the target immediately. In this
    -- case, the scale-in cooldown period stops and doesn\'t complete.
    TargetTrackingConfiguration -> Maybe Int
scaleInCooldown :: Prelude.Maybe Prelude.Int,
    -- | 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 doesn\'t remove capacity from the scalable
    -- resource. Otherwise, scale in is enabled and the target tracking scaling
    -- policy can remove capacity from the scalable resource.
    --
    -- The default value is @false@.
    TargetTrackingConfiguration -> Maybe Bool
disableScaleIn :: Prelude.Maybe Prelude.Bool,
    -- | A customized metric. You can specify either a predefined metric or a
    -- customized metric.
    TargetTrackingConfiguration
-> Maybe CustomizedScalingMetricSpecification
customizedScalingMetricSpecification :: Prelude.Maybe CustomizedScalingMetricSpecification,
    -- | The amount of time, in seconds, to wait for a previous scale-out
    -- activity to take effect. This property is not used if the scalable
    -- resource is an Auto Scaling group.
    --
    -- With the /scale-out cooldown period/, the intention is to continuously
    -- (but not excessively) scale out. After 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.
    TargetTrackingConfiguration -> 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.
    TargetTrackingConfiguration -> Double
targetValue :: Prelude.Double
  }
  deriving (TargetTrackingConfiguration -> TargetTrackingConfiguration -> Bool
(TargetTrackingConfiguration
 -> TargetTrackingConfiguration -> Bool)
-> (TargetTrackingConfiguration
    -> TargetTrackingConfiguration -> Bool)
-> Eq TargetTrackingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TargetTrackingConfiguration -> TargetTrackingConfiguration -> Bool
$c/= :: TargetTrackingConfiguration -> TargetTrackingConfiguration -> Bool
== :: TargetTrackingConfiguration -> TargetTrackingConfiguration -> Bool
$c== :: TargetTrackingConfiguration -> TargetTrackingConfiguration -> Bool
Prelude.Eq, ReadPrec [TargetTrackingConfiguration]
ReadPrec TargetTrackingConfiguration
Int -> ReadS TargetTrackingConfiguration
ReadS [TargetTrackingConfiguration]
(Int -> ReadS TargetTrackingConfiguration)
-> ReadS [TargetTrackingConfiguration]
-> ReadPrec TargetTrackingConfiguration
-> ReadPrec [TargetTrackingConfiguration]
-> Read TargetTrackingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TargetTrackingConfiguration]
$creadListPrec :: ReadPrec [TargetTrackingConfiguration]
readPrec :: ReadPrec TargetTrackingConfiguration
$creadPrec :: ReadPrec TargetTrackingConfiguration
readList :: ReadS [TargetTrackingConfiguration]
$creadList :: ReadS [TargetTrackingConfiguration]
readsPrec :: Int -> ReadS TargetTrackingConfiguration
$creadsPrec :: Int -> ReadS TargetTrackingConfiguration
Prelude.Read, Int -> TargetTrackingConfiguration -> ShowS
[TargetTrackingConfiguration] -> ShowS
TargetTrackingConfiguration -> String
(Int -> TargetTrackingConfiguration -> ShowS)
-> (TargetTrackingConfiguration -> String)
-> ([TargetTrackingConfiguration] -> ShowS)
-> Show TargetTrackingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TargetTrackingConfiguration] -> ShowS
$cshowList :: [TargetTrackingConfiguration] -> ShowS
show :: TargetTrackingConfiguration -> String
$cshow :: TargetTrackingConfiguration -> String
showsPrec :: Int -> TargetTrackingConfiguration -> ShowS
$cshowsPrec :: Int -> TargetTrackingConfiguration -> ShowS
Prelude.Show, (forall x.
 TargetTrackingConfiguration -> Rep TargetTrackingConfiguration x)
-> (forall x.
    Rep TargetTrackingConfiguration x -> TargetTrackingConfiguration)
-> Generic TargetTrackingConfiguration
forall x.
Rep TargetTrackingConfiguration x -> TargetTrackingConfiguration
forall x.
TargetTrackingConfiguration -> Rep TargetTrackingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TargetTrackingConfiguration x -> TargetTrackingConfiguration
$cfrom :: forall x.
TargetTrackingConfiguration -> Rep TargetTrackingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TargetTrackingConfiguration' 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:
--
-- 'estimatedInstanceWarmup', 'targetTrackingConfiguration_estimatedInstanceWarmup' - The estimated time, in seconds, until a newly launched instance can
-- contribute to the CloudWatch metrics. This value is used only if the
-- resource is an Auto Scaling group.
--
-- 'predefinedScalingMetricSpecification', 'targetTrackingConfiguration_predefinedScalingMetricSpecification' - A predefined metric. You can specify either a predefined metric or a
-- customized metric.
--
-- 'scaleInCooldown', 'targetTrackingConfiguration_scaleInCooldown' - The amount of time, in seconds, after a scale-in activity completes
-- before another scale-in activity can start. This property is not used if
-- the scalable resource is an Auto Scaling group.
--
-- 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, Auto Scaling scales out the target immediately. In this
-- case, the scale-in cooldown period stops and doesn\'t complete.
--
-- 'disableScaleIn', 'targetTrackingConfiguration_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 doesn\'t remove capacity from the scalable
-- resource. Otherwise, scale in is enabled and the target tracking scaling
-- policy can remove capacity from the scalable resource.
--
-- The default value is @false@.
--
-- 'customizedScalingMetricSpecification', 'targetTrackingConfiguration_customizedScalingMetricSpecification' - A customized metric. You can specify either a predefined metric or a
-- customized metric.
--
-- 'scaleOutCooldown', 'targetTrackingConfiguration_scaleOutCooldown' - The amount of time, in seconds, to wait for a previous scale-out
-- activity to take effect. This property is not used if the scalable
-- resource is an Auto Scaling group.
--
-- With the /scale-out cooldown period/, the intention is to continuously
-- (but not excessively) scale out. After 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.
--
-- 'targetValue', 'targetTrackingConfiguration_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.
newTargetTrackingConfiguration ::
  -- | 'targetValue'
  Prelude.Double ->
  TargetTrackingConfiguration
newTargetTrackingConfiguration :: Double -> TargetTrackingConfiguration
newTargetTrackingConfiguration Double
pTargetValue_ =
  TargetTrackingConfiguration' :: Maybe Int
-> Maybe PredefinedScalingMetricSpecification
-> Maybe Int
-> Maybe Bool
-> Maybe CustomizedScalingMetricSpecification
-> Maybe Int
-> Double
-> TargetTrackingConfiguration
TargetTrackingConfiguration'
    { $sel:estimatedInstanceWarmup:TargetTrackingConfiguration' :: Maybe Int
estimatedInstanceWarmup =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:predefinedScalingMetricSpecification:TargetTrackingConfiguration' :: Maybe PredefinedScalingMetricSpecification
predefinedScalingMetricSpecification =
        Maybe PredefinedScalingMetricSpecification
forall a. Maybe a
Prelude.Nothing,
      $sel:scaleInCooldown:TargetTrackingConfiguration' :: Maybe Int
scaleInCooldown = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:disableScaleIn:TargetTrackingConfiguration' :: Maybe Bool
disableScaleIn = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:customizedScalingMetricSpecification:TargetTrackingConfiguration' :: Maybe CustomizedScalingMetricSpecification
customizedScalingMetricSpecification =
        Maybe CustomizedScalingMetricSpecification
forall a. Maybe a
Prelude.Nothing,
      $sel:scaleOutCooldown:TargetTrackingConfiguration' :: Maybe Int
scaleOutCooldown = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:targetValue:TargetTrackingConfiguration' :: Double
targetValue = Double
pTargetValue_
    }

-- | The estimated time, in seconds, until a newly launched instance can
-- contribute to the CloudWatch metrics. This value is used only if the
-- resource is an Auto Scaling group.
targetTrackingConfiguration_estimatedInstanceWarmup :: Lens.Lens' TargetTrackingConfiguration (Prelude.Maybe Prelude.Int)
targetTrackingConfiguration_estimatedInstanceWarmup :: (Maybe Int -> f (Maybe Int))
-> TargetTrackingConfiguration -> f TargetTrackingConfiguration
targetTrackingConfiguration_estimatedInstanceWarmup = (TargetTrackingConfiguration -> Maybe Int)
-> (TargetTrackingConfiguration
    -> Maybe Int -> TargetTrackingConfiguration)
-> Lens
     TargetTrackingConfiguration
     TargetTrackingConfiguration
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingConfiguration' {Maybe Int
estimatedInstanceWarmup :: Maybe Int
$sel:estimatedInstanceWarmup:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Maybe Int
estimatedInstanceWarmup} -> Maybe Int
estimatedInstanceWarmup) (\s :: TargetTrackingConfiguration
s@TargetTrackingConfiguration' {} Maybe Int
a -> TargetTrackingConfiguration
s {$sel:estimatedInstanceWarmup:TargetTrackingConfiguration' :: Maybe Int
estimatedInstanceWarmup = Maybe Int
a} :: TargetTrackingConfiguration)

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

-- | The amount of time, in seconds, after a scale-in activity completes
-- before another scale-in activity can start. This property is not used if
-- the scalable resource is an Auto Scaling group.
--
-- 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, Auto Scaling scales out the target immediately. In this
-- case, the scale-in cooldown period stops and doesn\'t complete.
targetTrackingConfiguration_scaleInCooldown :: Lens.Lens' TargetTrackingConfiguration (Prelude.Maybe Prelude.Int)
targetTrackingConfiguration_scaleInCooldown :: (Maybe Int -> f (Maybe Int))
-> TargetTrackingConfiguration -> f TargetTrackingConfiguration
targetTrackingConfiguration_scaleInCooldown = (TargetTrackingConfiguration -> Maybe Int)
-> (TargetTrackingConfiguration
    -> Maybe Int -> TargetTrackingConfiguration)
-> Lens
     TargetTrackingConfiguration
     TargetTrackingConfiguration
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingConfiguration' {Maybe Int
scaleInCooldown :: Maybe Int
$sel:scaleInCooldown:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Maybe Int
scaleInCooldown} -> Maybe Int
scaleInCooldown) (\s :: TargetTrackingConfiguration
s@TargetTrackingConfiguration' {} Maybe Int
a -> TargetTrackingConfiguration
s {$sel:scaleInCooldown:TargetTrackingConfiguration' :: Maybe Int
scaleInCooldown = Maybe Int
a} :: TargetTrackingConfiguration)

-- | 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 doesn\'t remove capacity from the scalable
-- resource. Otherwise, scale in is enabled and the target tracking scaling
-- policy can remove capacity from the scalable resource.
--
-- The default value is @false@.
targetTrackingConfiguration_disableScaleIn :: Lens.Lens' TargetTrackingConfiguration (Prelude.Maybe Prelude.Bool)
targetTrackingConfiguration_disableScaleIn :: (Maybe Bool -> f (Maybe Bool))
-> TargetTrackingConfiguration -> f TargetTrackingConfiguration
targetTrackingConfiguration_disableScaleIn = (TargetTrackingConfiguration -> Maybe Bool)
-> (TargetTrackingConfiguration
    -> Maybe Bool -> TargetTrackingConfiguration)
-> Lens
     TargetTrackingConfiguration
     TargetTrackingConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingConfiguration' {Maybe Bool
disableScaleIn :: Maybe Bool
$sel:disableScaleIn:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Maybe Bool
disableScaleIn} -> Maybe Bool
disableScaleIn) (\s :: TargetTrackingConfiguration
s@TargetTrackingConfiguration' {} Maybe Bool
a -> TargetTrackingConfiguration
s {$sel:disableScaleIn:TargetTrackingConfiguration' :: Maybe Bool
disableScaleIn = Maybe Bool
a} :: TargetTrackingConfiguration)

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

-- | The amount of time, in seconds, to wait for a previous scale-out
-- activity to take effect. This property is not used if the scalable
-- resource is an Auto Scaling group.
--
-- With the /scale-out cooldown period/, the intention is to continuously
-- (but not excessively) scale out. After 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.
targetTrackingConfiguration_scaleOutCooldown :: Lens.Lens' TargetTrackingConfiguration (Prelude.Maybe Prelude.Int)
targetTrackingConfiguration_scaleOutCooldown :: (Maybe Int -> f (Maybe Int))
-> TargetTrackingConfiguration -> f TargetTrackingConfiguration
targetTrackingConfiguration_scaleOutCooldown = (TargetTrackingConfiguration -> Maybe Int)
-> (TargetTrackingConfiguration
    -> Maybe Int -> TargetTrackingConfiguration)
-> Lens
     TargetTrackingConfiguration
     TargetTrackingConfiguration
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingConfiguration' {Maybe Int
scaleOutCooldown :: Maybe Int
$sel:scaleOutCooldown:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Maybe Int
scaleOutCooldown} -> Maybe Int
scaleOutCooldown) (\s :: TargetTrackingConfiguration
s@TargetTrackingConfiguration' {} Maybe Int
a -> TargetTrackingConfiguration
s {$sel:scaleOutCooldown:TargetTrackingConfiguration' :: Maybe Int
scaleOutCooldown = Maybe Int
a} :: TargetTrackingConfiguration)

-- | 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.
targetTrackingConfiguration_targetValue :: Lens.Lens' TargetTrackingConfiguration Prelude.Double
targetTrackingConfiguration_targetValue :: (Double -> f Double)
-> TargetTrackingConfiguration -> f TargetTrackingConfiguration
targetTrackingConfiguration_targetValue = (TargetTrackingConfiguration -> Double)
-> (TargetTrackingConfiguration
    -> Double -> TargetTrackingConfiguration)
-> Lens
     TargetTrackingConfiguration
     TargetTrackingConfiguration
     Double
     Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetTrackingConfiguration' {Double
targetValue :: Double
$sel:targetValue:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Double
targetValue} -> Double
targetValue) (\s :: TargetTrackingConfiguration
s@TargetTrackingConfiguration' {} Double
a -> TargetTrackingConfiguration
s {$sel:targetValue:TargetTrackingConfiguration' :: Double
targetValue = Double
a} :: TargetTrackingConfiguration)

instance Core.FromJSON TargetTrackingConfiguration where
  parseJSON :: Value -> Parser TargetTrackingConfiguration
parseJSON =
    String
-> (Object -> Parser TargetTrackingConfiguration)
-> Value
-> Parser TargetTrackingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TargetTrackingConfiguration"
      ( \Object
x ->
          Maybe Int
-> Maybe PredefinedScalingMetricSpecification
-> Maybe Int
-> Maybe Bool
-> Maybe CustomizedScalingMetricSpecification
-> Maybe Int
-> Double
-> TargetTrackingConfiguration
TargetTrackingConfiguration'
            (Maybe Int
 -> Maybe PredefinedScalingMetricSpecification
 -> Maybe Int
 -> Maybe Bool
 -> Maybe CustomizedScalingMetricSpecification
 -> Maybe Int
 -> Double
 -> TargetTrackingConfiguration)
-> Parser (Maybe Int)
-> Parser
     (Maybe PredefinedScalingMetricSpecification
      -> Maybe Int
      -> Maybe Bool
      -> Maybe CustomizedScalingMetricSpecification
      -> Maybe Int
      -> Double
      -> TargetTrackingConfiguration)
forall (f :: * -> *) a b. Functor 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
"EstimatedInstanceWarmup")
            Parser
  (Maybe PredefinedScalingMetricSpecification
   -> Maybe Int
   -> Maybe Bool
   -> Maybe CustomizedScalingMetricSpecification
   -> Maybe Int
   -> Double
   -> TargetTrackingConfiguration)
-> Parser (Maybe PredefinedScalingMetricSpecification)
-> Parser
     (Maybe Int
      -> Maybe Bool
      -> Maybe CustomizedScalingMetricSpecification
      -> Maybe Int
      -> Double
      -> TargetTrackingConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe PredefinedScalingMetricSpecification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PredefinedScalingMetricSpecification")
            Parser
  (Maybe Int
   -> Maybe Bool
   -> Maybe CustomizedScalingMetricSpecification
   -> Maybe Int
   -> Double
   -> TargetTrackingConfiguration)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe CustomizedScalingMetricSpecification
      -> Maybe Int
      -> Double
      -> TargetTrackingConfiguration)
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 Bool
   -> Maybe CustomizedScalingMetricSpecification
   -> Maybe Int
   -> Double
   -> TargetTrackingConfiguration)
-> Parser (Maybe Bool)
-> Parser
     (Maybe CustomizedScalingMetricSpecification
      -> Maybe Int -> Double -> TargetTrackingConfiguration)
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 CustomizedScalingMetricSpecification
   -> Maybe Int -> Double -> TargetTrackingConfiguration)
-> Parser (Maybe CustomizedScalingMetricSpecification)
-> Parser (Maybe Int -> Double -> TargetTrackingConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe CustomizedScalingMetricSpecification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CustomizedScalingMetricSpecification")
            Parser (Maybe Int -> Double -> TargetTrackingConfiguration)
-> Parser (Maybe Int)
-> Parser (Double -> TargetTrackingConfiguration)
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 -> TargetTrackingConfiguration)
-> Parser Double -> Parser TargetTrackingConfiguration
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 TargetTrackingConfiguration

instance Prelude.NFData TargetTrackingConfiguration

instance Core.ToJSON TargetTrackingConfiguration where
  toJSON :: TargetTrackingConfiguration -> Value
toJSON TargetTrackingConfiguration' {Double
Maybe Bool
Maybe Int
Maybe CustomizedScalingMetricSpecification
Maybe PredefinedScalingMetricSpecification
targetValue :: Double
scaleOutCooldown :: Maybe Int
customizedScalingMetricSpecification :: Maybe CustomizedScalingMetricSpecification
disableScaleIn :: Maybe Bool
scaleInCooldown :: Maybe Int
predefinedScalingMetricSpecification :: Maybe PredefinedScalingMetricSpecification
estimatedInstanceWarmup :: Maybe Int
$sel:targetValue:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Double
$sel:scaleOutCooldown:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Maybe Int
$sel:customizedScalingMetricSpecification:TargetTrackingConfiguration' :: TargetTrackingConfiguration
-> Maybe CustomizedScalingMetricSpecification
$sel:disableScaleIn:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Maybe Bool
$sel:scaleInCooldown:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Maybe Int
$sel:predefinedScalingMetricSpecification:TargetTrackingConfiguration' :: TargetTrackingConfiguration
-> Maybe PredefinedScalingMetricSpecification
$sel:estimatedInstanceWarmup:TargetTrackingConfiguration' :: TargetTrackingConfiguration -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EstimatedInstanceWarmup" 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
estimatedInstanceWarmup,
            (Text
"PredefinedScalingMetricSpecification" Text -> PredefinedScalingMetricSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PredefinedScalingMetricSpecification -> Pair)
-> Maybe PredefinedScalingMetricSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PredefinedScalingMetricSpecification
predefinedScalingMetricSpecification,
            (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
"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
"CustomizedScalingMetricSpecification" Text -> CustomizedScalingMetricSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CustomizedScalingMetricSpecification -> Pair)
-> Maybe CustomizedScalingMetricSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CustomizedScalingMetricSpecification
customizedScalingMetricSpecification,
            (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)
          ]
      )