{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data StepScalingPolicyConfiguration = StepScalingPolicyConfiguration'
{
StepScalingPolicyConfiguration -> Maybe [StepAdjustment]
stepAdjustments :: Prelude.Maybe [StepAdjustment],
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
}
deriving (StepScalingPolicyConfiguration
-> StepScalingPolicyConfiguration -> Bool
(StepScalingPolicyConfiguration
-> StepScalingPolicyConfiguration -> Bool)
-> (StepScalingPolicyConfiguration
-> StepScalingPolicyConfiguration -> Bool)
-> Eq StepScalingPolicyConfiguration
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]
(Int -> ReadS StepScalingPolicyConfiguration)
-> ReadS [StepScalingPolicyConfiguration]
-> ReadPrec StepScalingPolicyConfiguration
-> ReadPrec [StepScalingPolicyConfiguration]
-> Read 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
(Int -> StepScalingPolicyConfiguration -> ShowS)
-> (StepScalingPolicyConfiguration -> String)
-> ([StepScalingPolicyConfiguration] -> ShowS)
-> Show StepScalingPolicyConfiguration
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.
StepScalingPolicyConfiguration
-> Rep StepScalingPolicyConfiguration x)
-> (forall x.
Rep StepScalingPolicyConfiguration x
-> StepScalingPolicyConfiguration)
-> Generic StepScalingPolicyConfiguration
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' :: Maybe [StepAdjustment]
-> Maybe AdjustmentType
-> Maybe Int
-> Maybe MetricAggregationType
-> Maybe Int
-> StepScalingPolicyConfiguration
StepScalingPolicyConfiguration'
{ $sel:stepAdjustments:StepScalingPolicyConfiguration' :: Maybe [StepAdjustment]
stepAdjustments =
Maybe [StepAdjustment]
forall a. Maybe a
Prelude.Nothing,
$sel:adjustmentType:StepScalingPolicyConfiguration' :: Maybe AdjustmentType
adjustmentType = Maybe AdjustmentType
forall a. Maybe a
Prelude.Nothing,
$sel:cooldown:StepScalingPolicyConfiguration' :: Maybe Int
cooldown = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:metricAggregationType:StepScalingPolicyConfiguration' :: Maybe MetricAggregationType
metricAggregationType = Maybe MetricAggregationType
forall a. Maybe a
Prelude.Nothing,
$sel:minAdjustmentMagnitude:StepScalingPolicyConfiguration' :: Maybe Int
minAdjustmentMagnitude = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
stepScalingPolicyConfiguration_stepAdjustments :: Lens.Lens' StepScalingPolicyConfiguration (Prelude.Maybe [StepAdjustment])
stepScalingPolicyConfiguration_stepAdjustments :: (Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
-> StepScalingPolicyConfiguration
-> f StepScalingPolicyConfiguration
stepScalingPolicyConfiguration_stepAdjustments = (StepScalingPolicyConfiguration -> Maybe [StepAdjustment])
-> (StepScalingPolicyConfiguration
-> Maybe [StepAdjustment] -> StepScalingPolicyConfiguration)
-> Lens
StepScalingPolicyConfiguration
StepScalingPolicyConfiguration
(Maybe [StepAdjustment])
(Maybe [StepAdjustment])
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) ((Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
-> StepScalingPolicyConfiguration
-> f StepScalingPolicyConfiguration)
-> ((Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
-> Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
-> (Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
-> StepScalingPolicyConfiguration
-> f StepScalingPolicyConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[StepAdjustment] [StepAdjustment] [StepAdjustment] [StepAdjustment]
-> Iso
(Maybe [StepAdjustment])
(Maybe [StepAdjustment])
(Maybe [StepAdjustment])
(Maybe [StepAdjustment])
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 AnIso
[StepAdjustment] [StepAdjustment] [StepAdjustment] [StepAdjustment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
stepScalingPolicyConfiguration_adjustmentType :: Lens.Lens' StepScalingPolicyConfiguration (Prelude.Maybe AdjustmentType)
stepScalingPolicyConfiguration_adjustmentType :: (Maybe AdjustmentType -> f (Maybe AdjustmentType))
-> StepScalingPolicyConfiguration
-> f StepScalingPolicyConfiguration
stepScalingPolicyConfiguration_adjustmentType = (StepScalingPolicyConfiguration -> Maybe AdjustmentType)
-> (StepScalingPolicyConfiguration
-> Maybe AdjustmentType -> StepScalingPolicyConfiguration)
-> Lens
StepScalingPolicyConfiguration
StepScalingPolicyConfiguration
(Maybe AdjustmentType)
(Maybe 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 :: (Maybe Int -> f (Maybe Int))
-> StepScalingPolicyConfiguration
-> f StepScalingPolicyConfiguration
stepScalingPolicyConfiguration_cooldown = (StepScalingPolicyConfiguration -> Maybe Int)
-> (StepScalingPolicyConfiguration
-> Maybe Int -> StepScalingPolicyConfiguration)
-> Lens
StepScalingPolicyConfiguration
StepScalingPolicyConfiguration
(Maybe Int)
(Maybe Int)
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 :: (Maybe MetricAggregationType -> f (Maybe MetricAggregationType))
-> StepScalingPolicyConfiguration
-> f StepScalingPolicyConfiguration
stepScalingPolicyConfiguration_metricAggregationType = (StepScalingPolicyConfiguration -> Maybe MetricAggregationType)
-> (StepScalingPolicyConfiguration
-> Maybe MetricAggregationType -> StepScalingPolicyConfiguration)
-> Lens
StepScalingPolicyConfiguration
StepScalingPolicyConfiguration
(Maybe MetricAggregationType)
(Maybe 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 :: (Maybe Int -> f (Maybe Int))
-> StepScalingPolicyConfiguration
-> f StepScalingPolicyConfiguration
stepScalingPolicyConfiguration_minAdjustmentMagnitude = (StepScalingPolicyConfiguration -> Maybe Int)
-> (StepScalingPolicyConfiguration
-> Maybe Int -> StepScalingPolicyConfiguration)
-> Lens
StepScalingPolicyConfiguration
StepScalingPolicyConfiguration
(Maybe Int)
(Maybe Int)
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)
instance Core.FromJSON StepScalingPolicyConfiguration where
parseJSON :: Value -> Parser StepScalingPolicyConfiguration
parseJSON =
String
-> (Object -> Parser StepScalingPolicyConfiguration)
-> Value
-> Parser StepScalingPolicyConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"StepScalingPolicyConfiguration"
( \Object
x ->
Maybe [StepAdjustment]
-> Maybe AdjustmentType
-> Maybe Int
-> Maybe MetricAggregationType
-> Maybe Int
-> StepScalingPolicyConfiguration
StepScalingPolicyConfiguration'
(Maybe [StepAdjustment]
-> Maybe AdjustmentType
-> Maybe Int
-> Maybe MetricAggregationType
-> Maybe Int
-> StepScalingPolicyConfiguration)
-> Parser (Maybe [StepAdjustment])
-> Parser
(Maybe AdjustmentType
-> Maybe Int
-> Maybe MetricAggregationType
-> Maybe Int
-> StepScalingPolicyConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [StepAdjustment]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StepAdjustments"
Parser (Maybe (Maybe [StepAdjustment]))
-> Maybe [StepAdjustment] -> Parser (Maybe [StepAdjustment])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [StepAdjustment]
forall a. Monoid a => a
Prelude.mempty
)
Parser
(Maybe AdjustmentType
-> Maybe Int
-> Maybe MetricAggregationType
-> Maybe Int
-> StepScalingPolicyConfiguration)
-> Parser (Maybe AdjustmentType)
-> Parser
(Maybe Int
-> Maybe MetricAggregationType
-> Maybe Int
-> StepScalingPolicyConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AdjustmentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AdjustmentType")
Parser
(Maybe Int
-> Maybe MetricAggregationType
-> Maybe Int
-> StepScalingPolicyConfiguration)
-> Parser (Maybe Int)
-> Parser
(Maybe MetricAggregationType
-> Maybe Int -> StepScalingPolicyConfiguration)
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
"Cooldown")
Parser
(Maybe MetricAggregationType
-> Maybe Int -> StepScalingPolicyConfiguration)
-> Parser (Maybe MetricAggregationType)
-> Parser (Maybe Int -> StepScalingPolicyConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MetricAggregationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MetricAggregationType")
Parser (Maybe Int -> StepScalingPolicyConfiguration)
-> Parser (Maybe Int) -> Parser StepScalingPolicyConfiguration
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
"MinAdjustmentMagnitude")
)
instance
Prelude.Hashable
StepScalingPolicyConfiguration
instance
Prelude.NFData
StepScalingPolicyConfiguration
instance Core.ToJSON StepScalingPolicyConfiguration where
toJSON :: StepScalingPolicyConfiguration -> Value
toJSON StepScalingPolicyConfiguration' {Maybe Int
Maybe [StepAdjustment]
Maybe AdjustmentType
Maybe MetricAggregationType
minAdjustmentMagnitude :: Maybe Int
metricAggregationType :: Maybe MetricAggregationType
cooldown :: Maybe Int
adjustmentType :: Maybe AdjustmentType
stepAdjustments :: 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
$sel:stepAdjustments:StepScalingPolicyConfiguration' :: StepScalingPolicyConfiguration -> Maybe [StepAdjustment]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"StepAdjustments" Text -> [StepAdjustment] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([StepAdjustment] -> Pair) -> Maybe [StepAdjustment] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StepAdjustment]
stepAdjustments,
(Text
"AdjustmentType" Text -> AdjustmentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AdjustmentType -> Pair) -> Maybe AdjustmentType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AdjustmentType
adjustmentType,
(Text
"Cooldown" 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
cooldown,
(Text
"MetricAggregationType" Text -> MetricAggregationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(MetricAggregationType -> Pair)
-> Maybe MetricAggregationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricAggregationType
metricAggregationType,
(Text
"MinAdjustmentMagnitude" 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
minAdjustmentMagnitude
]
)