{-# 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.StepScalingPolicyConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ApplicationAutoScaling.Types.StepScalingPolicyConfiguration where

import Amazonka.ApplicationAutoScaling.Types.AdjustmentType
import Amazonka.ApplicationAutoScaling.Types.MetricAggregationType
import Amazonka.ApplicationAutoScaling.Types.StepAdjustment
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Represents a step scaling policy configuration to use with Application
-- Auto Scaling.
--
-- /See:/ 'newStepScalingPolicyConfiguration' smart constructor.
data StepScalingPolicyConfiguration = StepScalingPolicyConfiguration'
  { -- | Specifies how the @ScalingAdjustment@ value in a
    -- <https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepAdjustment.html StepAdjustment>
    -- is interpreted (for example, an absolute number or a percentage). The
    -- valid values are @ChangeInCapacity@, @ExactCapacity@, and
    -- @PercentChangeInCapacity@.
    --
    -- @AdjustmentType@ is required if you are adding a new step scaling policy
    -- configuration.
    StepScalingPolicyConfiguration -> Maybe AdjustmentType
adjustmentType :: Prelude.Maybe AdjustmentType,
    -- | The amount of time, in seconds, to wait for a previous scaling activity
    -- to take effect.
    --
    -- With scale-out policies, the intention is to continuously (but not
    -- excessively) scale out. After Application Auto Scaling successfully
    -- scales out using a step 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, capacity added by
    -- the initiating scale-out activity is calculated as part of the desired
    -- capacity for the next scale-out activity. For example, when an alarm
    -- triggers a step scaling policy to increase the capacity by 2, the
    -- scaling activity completes successfully, and a cooldown period starts.
    -- If the alarm triggers again during the cooldown period but at a more
    -- aggressive step adjustment of 3, the previous increase of 2 is
    -- considered part of the current capacity. Therefore, only 1 is added to
    -- the capacity.
    --
    -- With scale-in policies, 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 cooldown period after a
    -- scale-in activity, Application Auto Scaling scales out the target
    -- immediately. In this case, the cooldown period for the scale-in activity
    -- 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
    StepScalingPolicyConfiguration -> Maybe Int
cooldown :: Prelude.Maybe Prelude.Int,
    -- | The aggregation type for the CloudWatch metrics. Valid values are
    -- @Minimum@, @Maximum@, and @Average@. If the aggregation type is null,
    -- the value is treated as @Average@.
    StepScalingPolicyConfiguration -> Maybe MetricAggregationType
metricAggregationType :: Prelude.Maybe MetricAggregationType,
    -- | The minimum value to scale by when the adjustment type is
    -- @PercentChangeInCapacity@. For example, suppose that you create a step
    -- scaling policy to scale out an Amazon ECS service by 25 percent and you
    -- specify a @MinAdjustmentMagnitude@ of 2. If the service has 4 tasks and
    -- the scaling policy is performed, 25 percent of 4 is 1. However, because
    -- you specified a @MinAdjustmentMagnitude@ of 2, Application Auto Scaling
    -- scales out the service by 2 tasks.
    StepScalingPolicyConfiguration -> Maybe Int
minAdjustmentMagnitude :: Prelude.Maybe Prelude.Int,
    -- | A set of adjustments that enable you to scale based on the size of the
    -- alarm breach.
    --
    -- At least one step adjustment is required if you are adding a new step
    -- scaling policy configuration.
    StepScalingPolicyConfiguration -> Maybe [StepAdjustment]
stepAdjustments :: Prelude.Maybe [StepAdjustment]
  }
  deriving (StepScalingPolicyConfiguration
-> StepScalingPolicyConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StepScalingPolicyConfiguration
-> StepScalingPolicyConfiguration -> Bool
$c/= :: StepScalingPolicyConfiguration
-> StepScalingPolicyConfiguration -> Bool
== :: StepScalingPolicyConfiguration
-> StepScalingPolicyConfiguration -> Bool
$c== :: StepScalingPolicyConfiguration
-> StepScalingPolicyConfiguration -> Bool
Prelude.Eq, ReadPrec [StepScalingPolicyConfiguration]
ReadPrec StepScalingPolicyConfiguration
Int -> ReadS StepScalingPolicyConfiguration
ReadS [StepScalingPolicyConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StepScalingPolicyConfiguration]
$creadListPrec :: ReadPrec [StepScalingPolicyConfiguration]
readPrec :: ReadPrec StepScalingPolicyConfiguration
$creadPrec :: ReadPrec StepScalingPolicyConfiguration
readList :: ReadS [StepScalingPolicyConfiguration]
$creadList :: ReadS [StepScalingPolicyConfiguration]
readsPrec :: Int -> ReadS StepScalingPolicyConfiguration
$creadsPrec :: Int -> ReadS StepScalingPolicyConfiguration
Prelude.Read, Int -> StepScalingPolicyConfiguration -> ShowS
[StepScalingPolicyConfiguration] -> ShowS
StepScalingPolicyConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StepScalingPolicyConfiguration] -> ShowS
$cshowList :: [StepScalingPolicyConfiguration] -> ShowS
show :: StepScalingPolicyConfiguration -> String
$cshow :: StepScalingPolicyConfiguration -> String
showsPrec :: Int -> StepScalingPolicyConfiguration -> ShowS
$cshowsPrec :: Int -> StepScalingPolicyConfiguration -> ShowS
Prelude.Show, forall x.
Rep StepScalingPolicyConfiguration x
-> StepScalingPolicyConfiguration
forall x.
StepScalingPolicyConfiguration
-> Rep StepScalingPolicyConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StepScalingPolicyConfiguration x
-> StepScalingPolicyConfiguration
$cfrom :: forall x.
StepScalingPolicyConfiguration
-> Rep StepScalingPolicyConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'StepScalingPolicyConfiguration' 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:
--
-- 'adjustmentType', 'stepScalingPolicyConfiguration_adjustmentType' - Specifies how the @ScalingAdjustment@ value in a
-- <https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepAdjustment.html StepAdjustment>
-- is interpreted (for example, an absolute number or a percentage). The
-- valid values are @ChangeInCapacity@, @ExactCapacity@, and
-- @PercentChangeInCapacity@.
--
-- @AdjustmentType@ is required if you are adding a new step scaling policy
-- configuration.
--
-- 'cooldown', 'stepScalingPolicyConfiguration_cooldown' - The amount of time, in seconds, to wait for a previous scaling activity
-- to take effect.
--
-- With scale-out policies, the intention is to continuously (but not
-- excessively) scale out. After Application Auto Scaling successfully
-- scales out using a step 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, capacity added by
-- the initiating scale-out activity is calculated as part of the desired
-- capacity for the next scale-out activity. For example, when an alarm
-- triggers a step scaling policy to increase the capacity by 2, the
-- scaling activity completes successfully, and a cooldown period starts.
-- If the alarm triggers again during the cooldown period but at a more
-- aggressive step adjustment of 3, the previous increase of 2 is
-- considered part of the current capacity. Therefore, only 1 is added to
-- the capacity.
--
-- With scale-in policies, 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 cooldown period after a
-- scale-in activity, Application Auto Scaling scales out the target
-- immediately. In this case, the cooldown period for the scale-in activity
-- 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
--
-- 'metricAggregationType', 'stepScalingPolicyConfiguration_metricAggregationType' - The aggregation type for the CloudWatch metrics. Valid values are
-- @Minimum@, @Maximum@, and @Average@. If the aggregation type is null,
-- the value is treated as @Average@.
--
-- 'minAdjustmentMagnitude', 'stepScalingPolicyConfiguration_minAdjustmentMagnitude' - The minimum value to scale by when the adjustment type is
-- @PercentChangeInCapacity@. For example, suppose that you create a step
-- scaling policy to scale out an Amazon ECS service by 25 percent and you
-- specify a @MinAdjustmentMagnitude@ of 2. If the service has 4 tasks and
-- the scaling policy is performed, 25 percent of 4 is 1. However, because
-- you specified a @MinAdjustmentMagnitude@ of 2, Application Auto Scaling
-- scales out the service by 2 tasks.
--
-- 'stepAdjustments', 'stepScalingPolicyConfiguration_stepAdjustments' - A set of adjustments that enable you to scale based on the size of the
-- alarm breach.
--
-- At least one step adjustment is required if you are adding a new step
-- scaling policy configuration.
newStepScalingPolicyConfiguration ::
  StepScalingPolicyConfiguration
newStepScalingPolicyConfiguration :: StepScalingPolicyConfiguration
newStepScalingPolicyConfiguration =
  StepScalingPolicyConfiguration'
    { $sel:adjustmentType:StepScalingPolicyConfiguration' :: Maybe AdjustmentType
adjustmentType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:cooldown:StepScalingPolicyConfiguration' :: Maybe Int
cooldown = forall a. Maybe a
Prelude.Nothing,
      $sel:metricAggregationType:StepScalingPolicyConfiguration' :: Maybe MetricAggregationType
metricAggregationType = forall a. Maybe a
Prelude.Nothing,
      $sel:minAdjustmentMagnitude:StepScalingPolicyConfiguration' :: Maybe Int
minAdjustmentMagnitude = forall a. Maybe a
Prelude.Nothing,
      $sel:stepAdjustments:StepScalingPolicyConfiguration' :: Maybe [StepAdjustment]
stepAdjustments = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies how the @ScalingAdjustment@ value in a
-- <https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepAdjustment.html StepAdjustment>
-- is interpreted (for example, an absolute number or a percentage). The
-- valid values are @ChangeInCapacity@, @ExactCapacity@, and
-- @PercentChangeInCapacity@.
--
-- @AdjustmentType@ is required if you are adding a new step scaling policy
-- configuration.
stepScalingPolicyConfiguration_adjustmentType :: Lens.Lens' StepScalingPolicyConfiguration (Prelude.Maybe AdjustmentType)
stepScalingPolicyConfiguration_adjustmentType :: Lens' StepScalingPolicyConfiguration (Maybe AdjustmentType)
stepScalingPolicyConfiguration_adjustmentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepScalingPolicyConfiguration' {Maybe AdjustmentType
adjustmentType :: Maybe AdjustmentType
$sel:adjustmentType:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe AdjustmentType
adjustmentType} -> Maybe AdjustmentType
adjustmentType) (\s :: StepScalingPolicyConfiguration
s@StepScalingPolicyConfiguration' {} Maybe AdjustmentType
a -> StepScalingPolicyConfiguration
s {$sel:adjustmentType:StepScalingPolicyConfiguration' :: Maybe AdjustmentType
adjustmentType = Maybe AdjustmentType
a} :: StepScalingPolicyConfiguration)

-- | The amount of time, in seconds, to wait for a previous scaling activity
-- to take effect.
--
-- With scale-out policies, the intention is to continuously (but not
-- excessively) scale out. After Application Auto Scaling successfully
-- scales out using a step 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, capacity added by
-- the initiating scale-out activity is calculated as part of the desired
-- capacity for the next scale-out activity. For example, when an alarm
-- triggers a step scaling policy to increase the capacity by 2, the
-- scaling activity completes successfully, and a cooldown period starts.
-- If the alarm triggers again during the cooldown period but at a more
-- aggressive step adjustment of 3, the previous increase of 2 is
-- considered part of the current capacity. Therefore, only 1 is added to
-- the capacity.
--
-- With scale-in policies, 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 cooldown period after a
-- scale-in activity, Application Auto Scaling scales out the target
-- immediately. In this case, the cooldown period for the scale-in activity
-- 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
stepScalingPolicyConfiguration_cooldown :: Lens.Lens' StepScalingPolicyConfiguration (Prelude.Maybe Prelude.Int)
stepScalingPolicyConfiguration_cooldown :: Lens' StepScalingPolicyConfiguration (Maybe Int)
stepScalingPolicyConfiguration_cooldown = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepScalingPolicyConfiguration' {Maybe Int
cooldown :: Maybe Int
$sel:cooldown:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe Int
cooldown} -> Maybe Int
cooldown) (\s :: StepScalingPolicyConfiguration
s@StepScalingPolicyConfiguration' {} Maybe Int
a -> StepScalingPolicyConfiguration
s {$sel:cooldown:StepScalingPolicyConfiguration' :: Maybe Int
cooldown = Maybe Int
a} :: StepScalingPolicyConfiguration)

-- | The aggregation type for the CloudWatch metrics. Valid values are
-- @Minimum@, @Maximum@, and @Average@. If the aggregation type is null,
-- the value is treated as @Average@.
stepScalingPolicyConfiguration_metricAggregationType :: Lens.Lens' StepScalingPolicyConfiguration (Prelude.Maybe MetricAggregationType)
stepScalingPolicyConfiguration_metricAggregationType :: Lens' StepScalingPolicyConfiguration (Maybe MetricAggregationType)
stepScalingPolicyConfiguration_metricAggregationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepScalingPolicyConfiguration' {Maybe MetricAggregationType
metricAggregationType :: Maybe MetricAggregationType
$sel:metricAggregationType:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe MetricAggregationType
metricAggregationType} -> Maybe MetricAggregationType
metricAggregationType) (\s :: StepScalingPolicyConfiguration
s@StepScalingPolicyConfiguration' {} Maybe MetricAggregationType
a -> StepScalingPolicyConfiguration
s {$sel:metricAggregationType:StepScalingPolicyConfiguration' :: Maybe MetricAggregationType
metricAggregationType = Maybe MetricAggregationType
a} :: StepScalingPolicyConfiguration)

-- | The minimum value to scale by when the adjustment type is
-- @PercentChangeInCapacity@. For example, suppose that you create a step
-- scaling policy to scale out an Amazon ECS service by 25 percent and you
-- specify a @MinAdjustmentMagnitude@ of 2. If the service has 4 tasks and
-- the scaling policy is performed, 25 percent of 4 is 1. However, because
-- you specified a @MinAdjustmentMagnitude@ of 2, Application Auto Scaling
-- scales out the service by 2 tasks.
stepScalingPolicyConfiguration_minAdjustmentMagnitude :: Lens.Lens' StepScalingPolicyConfiguration (Prelude.Maybe Prelude.Int)
stepScalingPolicyConfiguration_minAdjustmentMagnitude :: Lens' StepScalingPolicyConfiguration (Maybe Int)
stepScalingPolicyConfiguration_minAdjustmentMagnitude = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepScalingPolicyConfiguration' {Maybe Int
minAdjustmentMagnitude :: Maybe Int
$sel:minAdjustmentMagnitude:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe Int
minAdjustmentMagnitude} -> Maybe Int
minAdjustmentMagnitude) (\s :: StepScalingPolicyConfiguration
s@StepScalingPolicyConfiguration' {} Maybe Int
a -> StepScalingPolicyConfiguration
s {$sel:minAdjustmentMagnitude:StepScalingPolicyConfiguration' :: Maybe Int
minAdjustmentMagnitude = Maybe Int
a} :: StepScalingPolicyConfiguration)

-- | A set of adjustments that enable you to scale based on the size of the
-- alarm breach.
--
-- At least one step adjustment is required if you are adding a new step
-- scaling policy configuration.
stepScalingPolicyConfiguration_stepAdjustments :: Lens.Lens' StepScalingPolicyConfiguration (Prelude.Maybe [StepAdjustment])
stepScalingPolicyConfiguration_stepAdjustments :: Lens' StepScalingPolicyConfiguration (Maybe [StepAdjustment])
stepScalingPolicyConfiguration_stepAdjustments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StepScalingPolicyConfiguration' {Maybe [StepAdjustment]
stepAdjustments :: Maybe [StepAdjustment]
$sel:stepAdjustments:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe [StepAdjustment]
stepAdjustments} -> Maybe [StepAdjustment]
stepAdjustments) (\s :: StepScalingPolicyConfiguration
s@StepScalingPolicyConfiguration' {} Maybe [StepAdjustment]
a -> StepScalingPolicyConfiguration
s {$sel:stepAdjustments:StepScalingPolicyConfiguration' :: Maybe [StepAdjustment]
stepAdjustments = Maybe [StepAdjustment]
a} :: StepScalingPolicyConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON StepScalingPolicyConfiguration where
  parseJSON :: Value -> Parser StepScalingPolicyConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StepScalingPolicyConfiguration"
      ( \Object
x ->
          Maybe AdjustmentType
-> Maybe Int
-> Maybe MetricAggregationType
-> Maybe Int
-> Maybe [StepAdjustment]
-> StepScalingPolicyConfiguration
StepScalingPolicyConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AdjustmentType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Cooldown")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MetricAggregationType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MinAdjustmentMagnitude")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StepAdjustments"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    StepScalingPolicyConfiguration
  where
  hashWithSalt :: Int -> StepScalingPolicyConfiguration -> Int
hashWithSalt
    Int
_salt
    StepScalingPolicyConfiguration' {Maybe Int
Maybe [StepAdjustment]
Maybe AdjustmentType
Maybe MetricAggregationType
stepAdjustments :: Maybe [StepAdjustment]
minAdjustmentMagnitude :: Maybe Int
metricAggregationType :: Maybe MetricAggregationType
cooldown :: Maybe Int
adjustmentType :: Maybe AdjustmentType
$sel:stepAdjustments:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe [StepAdjustment]
$sel:minAdjustmentMagnitude:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe Int
$sel:metricAggregationType:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe MetricAggregationType
$sel:cooldown:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe Int
$sel:adjustmentType:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe AdjustmentType
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AdjustmentType
adjustmentType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
cooldown
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MetricAggregationType
metricAggregationType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
minAdjustmentMagnitude
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [StepAdjustment]
stepAdjustments

instance
  Prelude.NFData
    StepScalingPolicyConfiguration
  where
  rnf :: StepScalingPolicyConfiguration -> ()
rnf StepScalingPolicyConfiguration' {Maybe Int
Maybe [StepAdjustment]
Maybe AdjustmentType
Maybe MetricAggregationType
stepAdjustments :: Maybe [StepAdjustment]
minAdjustmentMagnitude :: Maybe Int
metricAggregationType :: Maybe MetricAggregationType
cooldown :: Maybe Int
adjustmentType :: Maybe AdjustmentType
$sel:stepAdjustments:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe [StepAdjustment]
$sel:minAdjustmentMagnitude:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe Int
$sel:metricAggregationType:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe MetricAggregationType
$sel:cooldown:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe Int
$sel:adjustmentType:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe AdjustmentType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AdjustmentType
adjustmentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
cooldown
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MetricAggregationType
metricAggregationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
minAdjustmentMagnitude
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [StepAdjustment]
stepAdjustments

instance Data.ToJSON StepScalingPolicyConfiguration where
  toJSON :: StepScalingPolicyConfiguration -> Value
toJSON StepScalingPolicyConfiguration' {Maybe Int
Maybe [StepAdjustment]
Maybe AdjustmentType
Maybe MetricAggregationType
stepAdjustments :: Maybe [StepAdjustment]
minAdjustmentMagnitude :: Maybe Int
metricAggregationType :: Maybe MetricAggregationType
cooldown :: Maybe Int
adjustmentType :: Maybe AdjustmentType
$sel:stepAdjustments:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe [StepAdjustment]
$sel:minAdjustmentMagnitude:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe Int
$sel:metricAggregationType:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe MetricAggregationType
$sel:cooldown:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe Int
$sel:adjustmentType:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe AdjustmentType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AdjustmentType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AdjustmentType
adjustmentType,
            (Key
"Cooldown" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
cooldown,
            (Key
"MetricAggregationType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricAggregationType
metricAggregationType,
            (Key
"MinAdjustmentMagnitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
minAdjustmentMagnitude,
            (Key
"StepAdjustments" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StepAdjustment]
stepAdjustments
          ]
      )