{-# 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.EMRServerless.Types.WorkerResourceConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data WorkerResourceConfig = WorkerResourceConfig'
{
WorkerResourceConfig -> Maybe Text
disk :: Prelude.Maybe Prelude.Text,
WorkerResourceConfig -> Text
cpu :: Prelude.Text,
WorkerResourceConfig -> Text
memory :: Prelude.Text
}
deriving (WorkerResourceConfig -> WorkerResourceConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkerResourceConfig -> WorkerResourceConfig -> Bool
$c/= :: WorkerResourceConfig -> WorkerResourceConfig -> Bool
== :: WorkerResourceConfig -> WorkerResourceConfig -> Bool
$c== :: WorkerResourceConfig -> WorkerResourceConfig -> Bool
Prelude.Eq, ReadPrec [WorkerResourceConfig]
ReadPrec WorkerResourceConfig
Int -> ReadS WorkerResourceConfig
ReadS [WorkerResourceConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkerResourceConfig]
$creadListPrec :: ReadPrec [WorkerResourceConfig]
readPrec :: ReadPrec WorkerResourceConfig
$creadPrec :: ReadPrec WorkerResourceConfig
readList :: ReadS [WorkerResourceConfig]
$creadList :: ReadS [WorkerResourceConfig]
readsPrec :: Int -> ReadS WorkerResourceConfig
$creadsPrec :: Int -> ReadS WorkerResourceConfig
Prelude.Read, Int -> WorkerResourceConfig -> ShowS
[WorkerResourceConfig] -> ShowS
WorkerResourceConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkerResourceConfig] -> ShowS
$cshowList :: [WorkerResourceConfig] -> ShowS
show :: WorkerResourceConfig -> String
$cshow :: WorkerResourceConfig -> String
showsPrec :: Int -> WorkerResourceConfig -> ShowS
$cshowsPrec :: Int -> WorkerResourceConfig -> ShowS
Prelude.Show, forall x. Rep WorkerResourceConfig x -> WorkerResourceConfig
forall x. WorkerResourceConfig -> Rep WorkerResourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkerResourceConfig x -> WorkerResourceConfig
$cfrom :: forall x. WorkerResourceConfig -> Rep WorkerResourceConfig x
Prelude.Generic)
newWorkerResourceConfig ::
Prelude.Text ->
Prelude.Text ->
WorkerResourceConfig
newWorkerResourceConfig :: Text -> Text -> WorkerResourceConfig
newWorkerResourceConfig Text
pCpu_ Text
pMemory_ =
WorkerResourceConfig'
{ $sel:disk:WorkerResourceConfig' :: Maybe Text
disk = forall a. Maybe a
Prelude.Nothing,
$sel:cpu:WorkerResourceConfig' :: Text
cpu = Text
pCpu_,
$sel:memory:WorkerResourceConfig' :: Text
memory = Text
pMemory_
}
workerResourceConfig_disk :: Lens.Lens' WorkerResourceConfig (Prelude.Maybe Prelude.Text)
workerResourceConfig_disk :: Lens' WorkerResourceConfig (Maybe Text)
workerResourceConfig_disk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerResourceConfig' {Maybe Text
disk :: Maybe Text
$sel:disk:WorkerResourceConfig' :: WorkerResourceConfig -> Maybe Text
disk} -> Maybe Text
disk) (\s :: WorkerResourceConfig
s@WorkerResourceConfig' {} Maybe Text
a -> WorkerResourceConfig
s {$sel:disk:WorkerResourceConfig' :: Maybe Text
disk = Maybe Text
a} :: WorkerResourceConfig)
workerResourceConfig_cpu :: Lens.Lens' WorkerResourceConfig Prelude.Text
workerResourceConfig_cpu :: Lens' WorkerResourceConfig Text
workerResourceConfig_cpu = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerResourceConfig' {Text
cpu :: Text
$sel:cpu:WorkerResourceConfig' :: WorkerResourceConfig -> Text
cpu} -> Text
cpu) (\s :: WorkerResourceConfig
s@WorkerResourceConfig' {} Text
a -> WorkerResourceConfig
s {$sel:cpu:WorkerResourceConfig' :: Text
cpu = Text
a} :: WorkerResourceConfig)
workerResourceConfig_memory :: Lens.Lens' WorkerResourceConfig Prelude.Text
workerResourceConfig_memory :: Lens' WorkerResourceConfig Text
workerResourceConfig_memory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerResourceConfig' {Text
memory :: Text
$sel:memory:WorkerResourceConfig' :: WorkerResourceConfig -> Text
memory} -> Text
memory) (\s :: WorkerResourceConfig
s@WorkerResourceConfig' {} Text
a -> WorkerResourceConfig
s {$sel:memory:WorkerResourceConfig' :: Text
memory = Text
a} :: WorkerResourceConfig)
instance Data.FromJSON WorkerResourceConfig where
parseJSON :: Value -> Parser WorkerResourceConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"WorkerResourceConfig"
( \Object
x ->
Maybe Text -> Text -> Text -> WorkerResourceConfig
WorkerResourceConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"disk")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"cpu")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"memory")
)
instance Prelude.Hashable WorkerResourceConfig where
hashWithSalt :: Int -> WorkerResourceConfig -> Int
hashWithSalt Int
_salt WorkerResourceConfig' {Maybe Text
Text
memory :: Text
cpu :: Text
disk :: Maybe Text
$sel:memory:WorkerResourceConfig' :: WorkerResourceConfig -> Text
$sel:cpu:WorkerResourceConfig' :: WorkerResourceConfig -> Text
$sel:disk:WorkerResourceConfig' :: WorkerResourceConfig -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
disk
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
cpu
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
memory
instance Prelude.NFData WorkerResourceConfig where
rnf :: WorkerResourceConfig -> ()
rnf WorkerResourceConfig' {Maybe Text
Text
memory :: Text
cpu :: Text
disk :: Maybe Text
$sel:memory:WorkerResourceConfig' :: WorkerResourceConfig -> Text
$sel:cpu:WorkerResourceConfig' :: WorkerResourceConfig -> Text
$sel:disk:WorkerResourceConfig' :: WorkerResourceConfig -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
disk
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
cpu
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
memory
instance Data.ToJSON WorkerResourceConfig where
toJSON :: WorkerResourceConfig -> Value
toJSON WorkerResourceConfig' {Maybe Text
Text
memory :: Text
cpu :: Text
disk :: Maybe Text
$sel:memory:WorkerResourceConfig' :: WorkerResourceConfig -> Text
$sel:cpu:WorkerResourceConfig' :: WorkerResourceConfig -> Text
$sel:disk:WorkerResourceConfig' :: WorkerResourceConfig -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"disk" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
disk,
forall a. a -> Maybe a
Prelude.Just (Key
"cpu" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
cpu),
forall a. a -> Maybe a
Prelude.Just (Key
"memory" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
memory)
]
)