{-# 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 #-}
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
data StepScalingPolicyConfiguration = StepScalingPolicyConfiguration'
{
StepScalingPolicyConfiguration -> Maybe AdjustmentType
adjustmentType :: Prelude.Maybe AdjustmentType,
StepScalingPolicyConfiguration -> Maybe Int
cooldown :: Prelude.Maybe Prelude.Int,
StepScalingPolicyConfiguration -> Maybe MetricAggregationType
metricAggregationType :: Prelude.Maybe MetricAggregationType,
StepScalingPolicyConfiguration -> Maybe Int
minAdjustmentMagnitude :: Prelude.Maybe Prelude.Int,
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)
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
}
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)
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)
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)
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)
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
]
)