{-# 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.ECS.Types.ManagedScaling where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.ManagedScalingStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ManagedScaling = ManagedScaling'
{
ManagedScaling -> Maybe ManagedScalingStatus
status :: Prelude.Maybe ManagedScalingStatus,
ManagedScaling -> Maybe Natural
maximumScalingStepSize :: Prelude.Maybe Prelude.Natural,
ManagedScaling -> Maybe Natural
targetCapacity :: Prelude.Maybe Prelude.Natural,
ManagedScaling -> Maybe Natural
minimumScalingStepSize :: Prelude.Maybe Prelude.Natural,
ManagedScaling -> Maybe Natural
instanceWarmupPeriod :: Prelude.Maybe Prelude.Natural
}
deriving (ManagedScaling -> ManagedScaling -> Bool
(ManagedScaling -> ManagedScaling -> Bool)
-> (ManagedScaling -> ManagedScaling -> Bool) -> Eq ManagedScaling
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManagedScaling -> ManagedScaling -> Bool
$c/= :: ManagedScaling -> ManagedScaling -> Bool
== :: ManagedScaling -> ManagedScaling -> Bool
$c== :: ManagedScaling -> ManagedScaling -> Bool
Prelude.Eq, ReadPrec [ManagedScaling]
ReadPrec ManagedScaling
Int -> ReadS ManagedScaling
ReadS [ManagedScaling]
(Int -> ReadS ManagedScaling)
-> ReadS [ManagedScaling]
-> ReadPrec ManagedScaling
-> ReadPrec [ManagedScaling]
-> Read ManagedScaling
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManagedScaling]
$creadListPrec :: ReadPrec [ManagedScaling]
readPrec :: ReadPrec ManagedScaling
$creadPrec :: ReadPrec ManagedScaling
readList :: ReadS [ManagedScaling]
$creadList :: ReadS [ManagedScaling]
readsPrec :: Int -> ReadS ManagedScaling
$creadsPrec :: Int -> ReadS ManagedScaling
Prelude.Read, Int -> ManagedScaling -> ShowS
[ManagedScaling] -> ShowS
ManagedScaling -> String
(Int -> ManagedScaling -> ShowS)
-> (ManagedScaling -> String)
-> ([ManagedScaling] -> ShowS)
-> Show ManagedScaling
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManagedScaling] -> ShowS
$cshowList :: [ManagedScaling] -> ShowS
show :: ManagedScaling -> String
$cshow :: ManagedScaling -> String
showsPrec :: Int -> ManagedScaling -> ShowS
$cshowsPrec :: Int -> ManagedScaling -> ShowS
Prelude.Show, (forall x. ManagedScaling -> Rep ManagedScaling x)
-> (forall x. Rep ManagedScaling x -> ManagedScaling)
-> Generic ManagedScaling
forall x. Rep ManagedScaling x -> ManagedScaling
forall x. ManagedScaling -> Rep ManagedScaling x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManagedScaling x -> ManagedScaling
$cfrom :: forall x. ManagedScaling -> Rep ManagedScaling x
Prelude.Generic)
newManagedScaling ::
ManagedScaling
newManagedScaling :: ManagedScaling
newManagedScaling =
ManagedScaling' :: Maybe ManagedScalingStatus
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ManagedScaling
ManagedScaling'
{ $sel:status:ManagedScaling' :: Maybe ManagedScalingStatus
status = Maybe ManagedScalingStatus
forall a. Maybe a
Prelude.Nothing,
$sel:maximumScalingStepSize:ManagedScaling' :: Maybe Natural
maximumScalingStepSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:targetCapacity:ManagedScaling' :: Maybe Natural
targetCapacity = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:minimumScalingStepSize:ManagedScaling' :: Maybe Natural
minimumScalingStepSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:instanceWarmupPeriod:ManagedScaling' :: Maybe Natural
instanceWarmupPeriod = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
managedScaling_status :: Lens.Lens' ManagedScaling (Prelude.Maybe ManagedScalingStatus)
managedScaling_status :: (Maybe ManagedScalingStatus -> f (Maybe ManagedScalingStatus))
-> ManagedScaling -> f ManagedScaling
managedScaling_status = (ManagedScaling -> Maybe ManagedScalingStatus)
-> (ManagedScaling -> Maybe ManagedScalingStatus -> ManagedScaling)
-> Lens
ManagedScaling
ManagedScaling
(Maybe ManagedScalingStatus)
(Maybe ManagedScalingStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedScaling' {Maybe ManagedScalingStatus
status :: Maybe ManagedScalingStatus
$sel:status:ManagedScaling' :: ManagedScaling -> Maybe ManagedScalingStatus
status} -> Maybe ManagedScalingStatus
status) (\s :: ManagedScaling
s@ManagedScaling' {} Maybe ManagedScalingStatus
a -> ManagedScaling
s {$sel:status:ManagedScaling' :: Maybe ManagedScalingStatus
status = Maybe ManagedScalingStatus
a} :: ManagedScaling)
managedScaling_maximumScalingStepSize :: Lens.Lens' ManagedScaling (Prelude.Maybe Prelude.Natural)
managedScaling_maximumScalingStepSize :: (Maybe Natural -> f (Maybe Natural))
-> ManagedScaling -> f ManagedScaling
managedScaling_maximumScalingStepSize = (ManagedScaling -> Maybe Natural)
-> (ManagedScaling -> Maybe Natural -> ManagedScaling)
-> Lens
ManagedScaling ManagedScaling (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedScaling' {Maybe Natural
maximumScalingStepSize :: Maybe Natural
$sel:maximumScalingStepSize:ManagedScaling' :: ManagedScaling -> Maybe Natural
maximumScalingStepSize} -> Maybe Natural
maximumScalingStepSize) (\s :: ManagedScaling
s@ManagedScaling' {} Maybe Natural
a -> ManagedScaling
s {$sel:maximumScalingStepSize:ManagedScaling' :: Maybe Natural
maximumScalingStepSize = Maybe Natural
a} :: ManagedScaling)
managedScaling_targetCapacity :: Lens.Lens' ManagedScaling (Prelude.Maybe Prelude.Natural)
managedScaling_targetCapacity :: (Maybe Natural -> f (Maybe Natural))
-> ManagedScaling -> f ManagedScaling
managedScaling_targetCapacity = (ManagedScaling -> Maybe Natural)
-> (ManagedScaling -> Maybe Natural -> ManagedScaling)
-> Lens
ManagedScaling ManagedScaling (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedScaling' {Maybe Natural
targetCapacity :: Maybe Natural
$sel:targetCapacity:ManagedScaling' :: ManagedScaling -> Maybe Natural
targetCapacity} -> Maybe Natural
targetCapacity) (\s :: ManagedScaling
s@ManagedScaling' {} Maybe Natural
a -> ManagedScaling
s {$sel:targetCapacity:ManagedScaling' :: Maybe Natural
targetCapacity = Maybe Natural
a} :: ManagedScaling)
managedScaling_minimumScalingStepSize :: Lens.Lens' ManagedScaling (Prelude.Maybe Prelude.Natural)
managedScaling_minimumScalingStepSize :: (Maybe Natural -> f (Maybe Natural))
-> ManagedScaling -> f ManagedScaling
managedScaling_minimumScalingStepSize = (ManagedScaling -> Maybe Natural)
-> (ManagedScaling -> Maybe Natural -> ManagedScaling)
-> Lens
ManagedScaling ManagedScaling (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedScaling' {Maybe Natural
minimumScalingStepSize :: Maybe Natural
$sel:minimumScalingStepSize:ManagedScaling' :: ManagedScaling -> Maybe Natural
minimumScalingStepSize} -> Maybe Natural
minimumScalingStepSize) (\s :: ManagedScaling
s@ManagedScaling' {} Maybe Natural
a -> ManagedScaling
s {$sel:minimumScalingStepSize:ManagedScaling' :: Maybe Natural
minimumScalingStepSize = Maybe Natural
a} :: ManagedScaling)
managedScaling_instanceWarmupPeriod :: Lens.Lens' ManagedScaling (Prelude.Maybe Prelude.Natural)
managedScaling_instanceWarmupPeriod :: (Maybe Natural -> f (Maybe Natural))
-> ManagedScaling -> f ManagedScaling
managedScaling_instanceWarmupPeriod = (ManagedScaling -> Maybe Natural)
-> (ManagedScaling -> Maybe Natural -> ManagedScaling)
-> Lens
ManagedScaling ManagedScaling (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedScaling' {Maybe Natural
instanceWarmupPeriod :: Maybe Natural
$sel:instanceWarmupPeriod:ManagedScaling' :: ManagedScaling -> Maybe Natural
instanceWarmupPeriod} -> Maybe Natural
instanceWarmupPeriod) (\s :: ManagedScaling
s@ManagedScaling' {} Maybe Natural
a -> ManagedScaling
s {$sel:instanceWarmupPeriod:ManagedScaling' :: Maybe Natural
instanceWarmupPeriod = Maybe Natural
a} :: ManagedScaling)
instance Core.FromJSON ManagedScaling where
parseJSON :: Value -> Parser ManagedScaling
parseJSON =
String
-> (Object -> Parser ManagedScaling)
-> Value
-> Parser ManagedScaling
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ManagedScaling"
( \Object
x ->
Maybe ManagedScalingStatus
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ManagedScaling
ManagedScaling'
(Maybe ManagedScalingStatus
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ManagedScaling)
-> Parser (Maybe ManagedScalingStatus)
-> Parser
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ManagedScaling)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ManagedScalingStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
Parser
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ManagedScaling)
-> Parser (Maybe Natural)
-> Parser
(Maybe Natural -> Maybe Natural -> Maybe Natural -> ManagedScaling)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"maximumScalingStepSize")
Parser
(Maybe Natural -> Maybe Natural -> Maybe Natural -> ManagedScaling)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> ManagedScaling)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"targetCapacity")
Parser (Maybe Natural -> Maybe Natural -> ManagedScaling)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> ManagedScaling)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"minimumScalingStepSize")
Parser (Maybe Natural -> ManagedScaling)
-> Parser (Maybe Natural) -> Parser ManagedScaling
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"instanceWarmupPeriod")
)
instance Prelude.Hashable ManagedScaling
instance Prelude.NFData ManagedScaling
instance Core.ToJSON ManagedScaling where
toJSON :: ManagedScaling -> Value
toJSON ManagedScaling' {Maybe Natural
Maybe ManagedScalingStatus
instanceWarmupPeriod :: Maybe Natural
minimumScalingStepSize :: Maybe Natural
targetCapacity :: Maybe Natural
maximumScalingStepSize :: Maybe Natural
status :: Maybe ManagedScalingStatus
$sel:instanceWarmupPeriod:ManagedScaling' :: ManagedScaling -> Maybe Natural
$sel:minimumScalingStepSize:ManagedScaling' :: ManagedScaling -> Maybe Natural
$sel:targetCapacity:ManagedScaling' :: ManagedScaling -> Maybe Natural
$sel:maximumScalingStepSize:ManagedScaling' :: ManagedScaling -> Maybe Natural
$sel:status:ManagedScaling' :: ManagedScaling -> Maybe ManagedScalingStatus
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"status" Text -> ManagedScalingStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ManagedScalingStatus -> Pair)
-> Maybe ManagedScalingStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ManagedScalingStatus
status,
(Text
"maximumScalingStepSize" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maximumScalingStepSize,
(Text
"targetCapacity" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
targetCapacity,
(Text
"minimumScalingStepSize" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
minimumScalingStepSize,
(Text
"instanceWarmupPeriod" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
instanceWarmupPeriod
]
)