{-# 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.ScalableTargetAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ScalableTargetAction = ScalableTargetAction'
{
ScalableTargetAction -> Maybe Int
maxCapacity :: Prelude.Maybe Prelude.Int,
ScalableTargetAction -> Maybe Int
minCapacity :: Prelude.Maybe Prelude.Int
}
deriving (ScalableTargetAction -> ScalableTargetAction -> Bool
(ScalableTargetAction -> ScalableTargetAction -> Bool)
-> (ScalableTargetAction -> ScalableTargetAction -> Bool)
-> Eq ScalableTargetAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalableTargetAction -> ScalableTargetAction -> Bool
$c/= :: ScalableTargetAction -> ScalableTargetAction -> Bool
== :: ScalableTargetAction -> ScalableTargetAction -> Bool
$c== :: ScalableTargetAction -> ScalableTargetAction -> Bool
Prelude.Eq, ReadPrec [ScalableTargetAction]
ReadPrec ScalableTargetAction
Int -> ReadS ScalableTargetAction
ReadS [ScalableTargetAction]
(Int -> ReadS ScalableTargetAction)
-> ReadS [ScalableTargetAction]
-> ReadPrec ScalableTargetAction
-> ReadPrec [ScalableTargetAction]
-> Read ScalableTargetAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalableTargetAction]
$creadListPrec :: ReadPrec [ScalableTargetAction]
readPrec :: ReadPrec ScalableTargetAction
$creadPrec :: ReadPrec ScalableTargetAction
readList :: ReadS [ScalableTargetAction]
$creadList :: ReadS [ScalableTargetAction]
readsPrec :: Int -> ReadS ScalableTargetAction
$creadsPrec :: Int -> ReadS ScalableTargetAction
Prelude.Read, Int -> ScalableTargetAction -> ShowS
[ScalableTargetAction] -> ShowS
ScalableTargetAction -> String
(Int -> ScalableTargetAction -> ShowS)
-> (ScalableTargetAction -> String)
-> ([ScalableTargetAction] -> ShowS)
-> Show ScalableTargetAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalableTargetAction] -> ShowS
$cshowList :: [ScalableTargetAction] -> ShowS
show :: ScalableTargetAction -> String
$cshow :: ScalableTargetAction -> String
showsPrec :: Int -> ScalableTargetAction -> ShowS
$cshowsPrec :: Int -> ScalableTargetAction -> ShowS
Prelude.Show, (forall x. ScalableTargetAction -> Rep ScalableTargetAction x)
-> (forall x. Rep ScalableTargetAction x -> ScalableTargetAction)
-> Generic ScalableTargetAction
forall x. Rep ScalableTargetAction x -> ScalableTargetAction
forall x. ScalableTargetAction -> Rep ScalableTargetAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalableTargetAction x -> ScalableTargetAction
$cfrom :: forall x. ScalableTargetAction -> Rep ScalableTargetAction x
Prelude.Generic)
newScalableTargetAction ::
ScalableTargetAction
newScalableTargetAction :: ScalableTargetAction
newScalableTargetAction =
ScalableTargetAction' :: Maybe Int -> Maybe Int -> ScalableTargetAction
ScalableTargetAction'
{ $sel:maxCapacity:ScalableTargetAction' :: Maybe Int
maxCapacity =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:minCapacity:ScalableTargetAction' :: Maybe Int
minCapacity = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
scalableTargetAction_maxCapacity :: Lens.Lens' ScalableTargetAction (Prelude.Maybe Prelude.Int)
scalableTargetAction_maxCapacity :: (Maybe Int -> f (Maybe Int))
-> ScalableTargetAction -> f ScalableTargetAction
scalableTargetAction_maxCapacity = (ScalableTargetAction -> Maybe Int)
-> (ScalableTargetAction -> Maybe Int -> ScalableTargetAction)
-> Lens
ScalableTargetAction ScalableTargetAction (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalableTargetAction' {Maybe Int
maxCapacity :: Maybe Int
$sel:maxCapacity:ScalableTargetAction' :: ScalableTargetAction -> Maybe Int
maxCapacity} -> Maybe Int
maxCapacity) (\s :: ScalableTargetAction
s@ScalableTargetAction' {} Maybe Int
a -> ScalableTargetAction
s {$sel:maxCapacity:ScalableTargetAction' :: Maybe Int
maxCapacity = Maybe Int
a} :: ScalableTargetAction)
scalableTargetAction_minCapacity :: Lens.Lens' ScalableTargetAction (Prelude.Maybe Prelude.Int)
scalableTargetAction_minCapacity :: (Maybe Int -> f (Maybe Int))
-> ScalableTargetAction -> f ScalableTargetAction
scalableTargetAction_minCapacity = (ScalableTargetAction -> Maybe Int)
-> (ScalableTargetAction -> Maybe Int -> ScalableTargetAction)
-> Lens
ScalableTargetAction ScalableTargetAction (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalableTargetAction' {Maybe Int
minCapacity :: Maybe Int
$sel:minCapacity:ScalableTargetAction' :: ScalableTargetAction -> Maybe Int
minCapacity} -> Maybe Int
minCapacity) (\s :: ScalableTargetAction
s@ScalableTargetAction' {} Maybe Int
a -> ScalableTargetAction
s {$sel:minCapacity:ScalableTargetAction' :: Maybe Int
minCapacity = Maybe Int
a} :: ScalableTargetAction)
instance Core.FromJSON ScalableTargetAction where
parseJSON :: Value -> Parser ScalableTargetAction
parseJSON =
String
-> (Object -> Parser ScalableTargetAction)
-> Value
-> Parser ScalableTargetAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ScalableTargetAction"
( \Object
x ->
Maybe Int -> Maybe Int -> ScalableTargetAction
ScalableTargetAction'
(Maybe Int -> Maybe Int -> ScalableTargetAction)
-> Parser (Maybe Int) -> Parser (Maybe Int -> ScalableTargetAction)
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
"MaxCapacity")
Parser (Maybe Int -> ScalableTargetAction)
-> Parser (Maybe Int) -> Parser ScalableTargetAction
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
"MinCapacity")
)
instance Prelude.Hashable ScalableTargetAction
instance Prelude.NFData ScalableTargetAction
instance Core.ToJSON ScalableTargetAction where
toJSON :: ScalableTargetAction -> Value
toJSON ScalableTargetAction' {Maybe Int
minCapacity :: Maybe Int
maxCapacity :: Maybe Int
$sel:minCapacity:ScalableTargetAction' :: ScalableTargetAction -> Maybe Int
$sel:maxCapacity:ScalableTargetAction' :: ScalableTargetAction -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MaxCapacity" 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
maxCapacity,
(Text
"MinCapacity" 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
minCapacity
]
)