{-# 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.ComputeLimits where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.ComputeLimitsUnitType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ComputeLimits = ComputeLimits'
{
ComputeLimits -> Maybe Int
maximumOnDemandCapacityUnits :: Prelude.Maybe Prelude.Int,
ComputeLimits -> Maybe Int
maximumCoreCapacityUnits :: Prelude.Maybe Prelude.Int,
ComputeLimits -> ComputeLimitsUnitType
unitType :: ComputeLimitsUnitType,
ComputeLimits -> Int
minimumCapacityUnits :: Prelude.Int,
ComputeLimits -> Int
maximumCapacityUnits :: Prelude.Int
}
deriving (ComputeLimits -> ComputeLimits -> Bool
(ComputeLimits -> ComputeLimits -> Bool)
-> (ComputeLimits -> ComputeLimits -> Bool) -> Eq ComputeLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComputeLimits -> ComputeLimits -> Bool
$c/= :: ComputeLimits -> ComputeLimits -> Bool
== :: ComputeLimits -> ComputeLimits -> Bool
$c== :: ComputeLimits -> ComputeLimits -> Bool
Prelude.Eq, ReadPrec [ComputeLimits]
ReadPrec ComputeLimits
Int -> ReadS ComputeLimits
ReadS [ComputeLimits]
(Int -> ReadS ComputeLimits)
-> ReadS [ComputeLimits]
-> ReadPrec ComputeLimits
-> ReadPrec [ComputeLimits]
-> Read ComputeLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComputeLimits]
$creadListPrec :: ReadPrec [ComputeLimits]
readPrec :: ReadPrec ComputeLimits
$creadPrec :: ReadPrec ComputeLimits
readList :: ReadS [ComputeLimits]
$creadList :: ReadS [ComputeLimits]
readsPrec :: Int -> ReadS ComputeLimits
$creadsPrec :: Int -> ReadS ComputeLimits
Prelude.Read, Int -> ComputeLimits -> ShowS
[ComputeLimits] -> ShowS
ComputeLimits -> String
(Int -> ComputeLimits -> ShowS)
-> (ComputeLimits -> String)
-> ([ComputeLimits] -> ShowS)
-> Show ComputeLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComputeLimits] -> ShowS
$cshowList :: [ComputeLimits] -> ShowS
show :: ComputeLimits -> String
$cshow :: ComputeLimits -> String
showsPrec :: Int -> ComputeLimits -> ShowS
$cshowsPrec :: Int -> ComputeLimits -> ShowS
Prelude.Show, (forall x. ComputeLimits -> Rep ComputeLimits x)
-> (forall x. Rep ComputeLimits x -> ComputeLimits)
-> Generic ComputeLimits
forall x. Rep ComputeLimits x -> ComputeLimits
forall x. ComputeLimits -> Rep ComputeLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComputeLimits x -> ComputeLimits
$cfrom :: forall x. ComputeLimits -> Rep ComputeLimits x
Prelude.Generic)
newComputeLimits ::
ComputeLimitsUnitType ->
Prelude.Int ->
Prelude.Int ->
ComputeLimits
newComputeLimits :: ComputeLimitsUnitType -> Int -> Int -> ComputeLimits
newComputeLimits
ComputeLimitsUnitType
pUnitType_
Int
pMinimumCapacityUnits_
Int
pMaximumCapacityUnits_ =
ComputeLimits' :: Maybe Int
-> Maybe Int
-> ComputeLimitsUnitType
-> Int
-> Int
-> ComputeLimits
ComputeLimits'
{ $sel:maximumOnDemandCapacityUnits:ComputeLimits' :: Maybe Int
maximumOnDemandCapacityUnits =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:maximumCoreCapacityUnits:ComputeLimits' :: Maybe Int
maximumCoreCapacityUnits = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:unitType:ComputeLimits' :: ComputeLimitsUnitType
unitType = ComputeLimitsUnitType
pUnitType_,
$sel:minimumCapacityUnits:ComputeLimits' :: Int
minimumCapacityUnits = Int
pMinimumCapacityUnits_,
$sel:maximumCapacityUnits:ComputeLimits' :: Int
maximumCapacityUnits = Int
pMaximumCapacityUnits_
}
computeLimits_maximumOnDemandCapacityUnits :: Lens.Lens' ComputeLimits (Prelude.Maybe Prelude.Int)
computeLimits_maximumOnDemandCapacityUnits :: (Maybe Int -> f (Maybe Int)) -> ComputeLimits -> f ComputeLimits
computeLimits_maximumOnDemandCapacityUnits = (ComputeLimits -> Maybe Int)
-> (ComputeLimits -> Maybe Int -> ComputeLimits)
-> Lens ComputeLimits ComputeLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeLimits' {Maybe Int
maximumOnDemandCapacityUnits :: Maybe Int
$sel:maximumOnDemandCapacityUnits:ComputeLimits' :: ComputeLimits -> Maybe Int
maximumOnDemandCapacityUnits} -> Maybe Int
maximumOnDemandCapacityUnits) (\s :: ComputeLimits
s@ComputeLimits' {} Maybe Int
a -> ComputeLimits
s {$sel:maximumOnDemandCapacityUnits:ComputeLimits' :: Maybe Int
maximumOnDemandCapacityUnits = Maybe Int
a} :: ComputeLimits)
computeLimits_maximumCoreCapacityUnits :: Lens.Lens' ComputeLimits (Prelude.Maybe Prelude.Int)
computeLimits_maximumCoreCapacityUnits :: (Maybe Int -> f (Maybe Int)) -> ComputeLimits -> f ComputeLimits
computeLimits_maximumCoreCapacityUnits = (ComputeLimits -> Maybe Int)
-> (ComputeLimits -> Maybe Int -> ComputeLimits)
-> Lens ComputeLimits ComputeLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeLimits' {Maybe Int
maximumCoreCapacityUnits :: Maybe Int
$sel:maximumCoreCapacityUnits:ComputeLimits' :: ComputeLimits -> Maybe Int
maximumCoreCapacityUnits} -> Maybe Int
maximumCoreCapacityUnits) (\s :: ComputeLimits
s@ComputeLimits' {} Maybe Int
a -> ComputeLimits
s {$sel:maximumCoreCapacityUnits:ComputeLimits' :: Maybe Int
maximumCoreCapacityUnits = Maybe Int
a} :: ComputeLimits)
computeLimits_unitType :: Lens.Lens' ComputeLimits ComputeLimitsUnitType
computeLimits_unitType :: (ComputeLimitsUnitType -> f ComputeLimitsUnitType)
-> ComputeLimits -> f ComputeLimits
computeLimits_unitType = (ComputeLimits -> ComputeLimitsUnitType)
-> (ComputeLimits -> ComputeLimitsUnitType -> ComputeLimits)
-> Lens
ComputeLimits
ComputeLimits
ComputeLimitsUnitType
ComputeLimitsUnitType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeLimits' {ComputeLimitsUnitType
unitType :: ComputeLimitsUnitType
$sel:unitType:ComputeLimits' :: ComputeLimits -> ComputeLimitsUnitType
unitType} -> ComputeLimitsUnitType
unitType) (\s :: ComputeLimits
s@ComputeLimits' {} ComputeLimitsUnitType
a -> ComputeLimits
s {$sel:unitType:ComputeLimits' :: ComputeLimitsUnitType
unitType = ComputeLimitsUnitType
a} :: ComputeLimits)
computeLimits_minimumCapacityUnits :: Lens.Lens' ComputeLimits Prelude.Int
computeLimits_minimumCapacityUnits :: (Int -> f Int) -> ComputeLimits -> f ComputeLimits
computeLimits_minimumCapacityUnits = (ComputeLimits -> Int)
-> (ComputeLimits -> Int -> ComputeLimits)
-> Lens ComputeLimits ComputeLimits Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeLimits' {Int
minimumCapacityUnits :: Int
$sel:minimumCapacityUnits:ComputeLimits' :: ComputeLimits -> Int
minimumCapacityUnits} -> Int
minimumCapacityUnits) (\s :: ComputeLimits
s@ComputeLimits' {} Int
a -> ComputeLimits
s {$sel:minimumCapacityUnits:ComputeLimits' :: Int
minimumCapacityUnits = Int
a} :: ComputeLimits)
computeLimits_maximumCapacityUnits :: Lens.Lens' ComputeLimits Prelude.Int
computeLimits_maximumCapacityUnits :: (Int -> f Int) -> ComputeLimits -> f ComputeLimits
computeLimits_maximumCapacityUnits = (ComputeLimits -> Int)
-> (ComputeLimits -> Int -> ComputeLimits)
-> Lens ComputeLimits ComputeLimits Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeLimits' {Int
maximumCapacityUnits :: Int
$sel:maximumCapacityUnits:ComputeLimits' :: ComputeLimits -> Int
maximumCapacityUnits} -> Int
maximumCapacityUnits) (\s :: ComputeLimits
s@ComputeLimits' {} Int
a -> ComputeLimits
s {$sel:maximumCapacityUnits:ComputeLimits' :: Int
maximumCapacityUnits = Int
a} :: ComputeLimits)
instance Core.FromJSON ComputeLimits where
parseJSON :: Value -> Parser ComputeLimits
parseJSON =
String
-> (Object -> Parser ComputeLimits)
-> Value
-> Parser ComputeLimits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ComputeLimits"
( \Object
x ->
Maybe Int
-> Maybe Int
-> ComputeLimitsUnitType
-> Int
-> Int
-> ComputeLimits
ComputeLimits'
(Maybe Int
-> Maybe Int
-> ComputeLimitsUnitType
-> Int
-> Int
-> ComputeLimits)
-> Parser (Maybe Int)
-> Parser
(Maybe Int -> ComputeLimitsUnitType -> Int -> Int -> ComputeLimits)
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
"MaximumOnDemandCapacityUnits")
Parser
(Maybe Int -> ComputeLimitsUnitType -> Int -> Int -> ComputeLimits)
-> Parser (Maybe Int)
-> Parser (ComputeLimitsUnitType -> Int -> Int -> ComputeLimits)
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
"MaximumCoreCapacityUnits")
Parser (ComputeLimitsUnitType -> Int -> Int -> ComputeLimits)
-> Parser ComputeLimitsUnitType
-> Parser (Int -> Int -> ComputeLimits)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ComputeLimitsUnitType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UnitType")
Parser (Int -> Int -> ComputeLimits)
-> Parser Int -> Parser (Int -> ComputeLimits)
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
"MinimumCapacityUnits")
Parser (Int -> ComputeLimits) -> Parser Int -> Parser ComputeLimits
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
"MaximumCapacityUnits")
)
instance Prelude.Hashable ComputeLimits
instance Prelude.NFData ComputeLimits
instance Core.ToJSON ComputeLimits where
toJSON :: ComputeLimits -> Value
toJSON ComputeLimits' {Int
Maybe Int
ComputeLimitsUnitType
maximumCapacityUnits :: Int
minimumCapacityUnits :: Int
unitType :: ComputeLimitsUnitType
maximumCoreCapacityUnits :: Maybe Int
maximumOnDemandCapacityUnits :: Maybe Int
$sel:maximumCapacityUnits:ComputeLimits' :: ComputeLimits -> Int
$sel:minimumCapacityUnits:ComputeLimits' :: ComputeLimits -> Int
$sel:unitType:ComputeLimits' :: ComputeLimits -> ComputeLimitsUnitType
$sel:maximumCoreCapacityUnits:ComputeLimits' :: ComputeLimits -> Maybe Int
$sel:maximumOnDemandCapacityUnits:ComputeLimits' :: ComputeLimits -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MaximumOnDemandCapacityUnits" 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
maximumOnDemandCapacityUnits,
(Text
"MaximumCoreCapacityUnits" 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
maximumCoreCapacityUnits,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UnitType" Text -> ComputeLimitsUnitType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ComputeLimitsUnitType
unitType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"MinimumCapacityUnits"
Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
minimumCapacityUnits
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"MaximumCapacityUnits"
Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
maximumCapacityUnits
)
]
)