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