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