{-# 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.EMR.Types.ScalingAction where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.MarketType
import Amazonka.EMR.Types.SimpleScalingPolicyConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ScalingAction = ScalingAction'
{
ScalingAction -> Maybe MarketType
market :: Prelude.Maybe MarketType,
ScalingAction -> SimpleScalingPolicyConfiguration
simpleScalingPolicyConfiguration :: SimpleScalingPolicyConfiguration
}
deriving (ScalingAction -> ScalingAction -> Bool
(ScalingAction -> ScalingAction -> Bool)
-> (ScalingAction -> ScalingAction -> Bool) -> Eq ScalingAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingAction -> ScalingAction -> Bool
$c/= :: ScalingAction -> ScalingAction -> Bool
== :: ScalingAction -> ScalingAction -> Bool
$c== :: ScalingAction -> ScalingAction -> Bool
Prelude.Eq, ReadPrec [ScalingAction]
ReadPrec ScalingAction
Int -> ReadS ScalingAction
ReadS [ScalingAction]
(Int -> ReadS ScalingAction)
-> ReadS [ScalingAction]
-> ReadPrec ScalingAction
-> ReadPrec [ScalingAction]
-> Read ScalingAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingAction]
$creadListPrec :: ReadPrec [ScalingAction]
readPrec :: ReadPrec ScalingAction
$creadPrec :: ReadPrec ScalingAction
readList :: ReadS [ScalingAction]
$creadList :: ReadS [ScalingAction]
readsPrec :: Int -> ReadS ScalingAction
$creadsPrec :: Int -> ReadS ScalingAction
Prelude.Read, Int -> ScalingAction -> ShowS
[ScalingAction] -> ShowS
ScalingAction -> String
(Int -> ScalingAction -> ShowS)
-> (ScalingAction -> String)
-> ([ScalingAction] -> ShowS)
-> Show ScalingAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingAction] -> ShowS
$cshowList :: [ScalingAction] -> ShowS
show :: ScalingAction -> String
$cshow :: ScalingAction -> String
showsPrec :: Int -> ScalingAction -> ShowS
$cshowsPrec :: Int -> ScalingAction -> ShowS
Prelude.Show, (forall x. ScalingAction -> Rep ScalingAction x)
-> (forall x. Rep ScalingAction x -> ScalingAction)
-> Generic ScalingAction
forall x. Rep ScalingAction x -> ScalingAction
forall x. ScalingAction -> Rep ScalingAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingAction x -> ScalingAction
$cfrom :: forall x. ScalingAction -> Rep ScalingAction x
Prelude.Generic)
newScalingAction ::
SimpleScalingPolicyConfiguration ->
ScalingAction
newScalingAction :: SimpleScalingPolicyConfiguration -> ScalingAction
newScalingAction SimpleScalingPolicyConfiguration
pSimpleScalingPolicyConfiguration_ =
ScalingAction' :: Maybe MarketType
-> SimpleScalingPolicyConfiguration -> ScalingAction
ScalingAction'
{ $sel:market:ScalingAction' :: Maybe MarketType
market = Maybe MarketType
forall a. Maybe a
Prelude.Nothing,
$sel:simpleScalingPolicyConfiguration:ScalingAction' :: SimpleScalingPolicyConfiguration
simpleScalingPolicyConfiguration =
SimpleScalingPolicyConfiguration
pSimpleScalingPolicyConfiguration_
}
scalingAction_market :: Lens.Lens' ScalingAction (Prelude.Maybe MarketType)
scalingAction_market :: (Maybe MarketType -> f (Maybe MarketType))
-> ScalingAction -> f ScalingAction
scalingAction_market = (ScalingAction -> Maybe MarketType)
-> (ScalingAction -> Maybe MarketType -> ScalingAction)
-> Lens
ScalingAction ScalingAction (Maybe MarketType) (Maybe MarketType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingAction' {Maybe MarketType
market :: Maybe MarketType
$sel:market:ScalingAction' :: ScalingAction -> Maybe MarketType
market} -> Maybe MarketType
market) (\s :: ScalingAction
s@ScalingAction' {} Maybe MarketType
a -> ScalingAction
s {$sel:market:ScalingAction' :: Maybe MarketType
market = Maybe MarketType
a} :: ScalingAction)
scalingAction_simpleScalingPolicyConfiguration :: Lens.Lens' ScalingAction SimpleScalingPolicyConfiguration
scalingAction_simpleScalingPolicyConfiguration :: (SimpleScalingPolicyConfiguration
-> f SimpleScalingPolicyConfiguration)
-> ScalingAction -> f ScalingAction
scalingAction_simpleScalingPolicyConfiguration = (ScalingAction -> SimpleScalingPolicyConfiguration)
-> (ScalingAction
-> SimpleScalingPolicyConfiguration -> ScalingAction)
-> Lens
ScalingAction
ScalingAction
SimpleScalingPolicyConfiguration
SimpleScalingPolicyConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingAction' {SimpleScalingPolicyConfiguration
simpleScalingPolicyConfiguration :: SimpleScalingPolicyConfiguration
$sel:simpleScalingPolicyConfiguration:ScalingAction' :: ScalingAction -> SimpleScalingPolicyConfiguration
simpleScalingPolicyConfiguration} -> SimpleScalingPolicyConfiguration
simpleScalingPolicyConfiguration) (\s :: ScalingAction
s@ScalingAction' {} SimpleScalingPolicyConfiguration
a -> ScalingAction
s {$sel:simpleScalingPolicyConfiguration:ScalingAction' :: SimpleScalingPolicyConfiguration
simpleScalingPolicyConfiguration = SimpleScalingPolicyConfiguration
a} :: ScalingAction)
instance Core.FromJSON ScalingAction where
parseJSON :: Value -> Parser ScalingAction
parseJSON =
String
-> (Object -> Parser ScalingAction)
-> Value
-> Parser ScalingAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ScalingAction"
( \Object
x ->
Maybe MarketType
-> SimpleScalingPolicyConfiguration -> ScalingAction
ScalingAction'
(Maybe MarketType
-> SimpleScalingPolicyConfiguration -> ScalingAction)
-> Parser (Maybe MarketType)
-> Parser (SimpleScalingPolicyConfiguration -> ScalingAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MarketType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Market")
Parser (SimpleScalingPolicyConfiguration -> ScalingAction)
-> Parser SimpleScalingPolicyConfiguration -> Parser ScalingAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SimpleScalingPolicyConfiguration
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SimpleScalingPolicyConfiguration")
)
instance Prelude.Hashable ScalingAction
instance Prelude.NFData ScalingAction
instance Core.ToJSON ScalingAction where
toJSON :: ScalingAction -> Value
toJSON ScalingAction' {Maybe MarketType
SimpleScalingPolicyConfiguration
simpleScalingPolicyConfiguration :: SimpleScalingPolicyConfiguration
market :: Maybe MarketType
$sel:simpleScalingPolicyConfiguration:ScalingAction' :: ScalingAction -> SimpleScalingPolicyConfiguration
$sel:market:ScalingAction' :: ScalingAction -> Maybe MarketType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Market" Text -> MarketType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MarketType -> Pair) -> Maybe MarketType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MarketType
market,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"SimpleScalingPolicyConfiguration"
Text -> SimpleScalingPolicyConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SimpleScalingPolicyConfiguration
simpleScalingPolicyConfiguration
)
]
)