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