{-# 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.Command 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 Command = Command'
{
Command -> Maybe [Text]
args :: Prelude.Maybe [Prelude.Text],
Command -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Command -> Maybe Text
scriptPath :: Prelude.Maybe Prelude.Text
}
deriving (Command -> Command -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Command -> Command -> Bool
$c/= :: Command -> Command -> Bool
== :: Command -> Command -> Bool
$c== :: Command -> Command -> Bool
Prelude.Eq, ReadPrec [Command]
ReadPrec Command
Int -> ReadS Command
ReadS [Command]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Command]
$creadListPrec :: ReadPrec [Command]
readPrec :: ReadPrec Command
$creadPrec :: ReadPrec Command
readList :: ReadS [Command]
$creadList :: ReadS [Command]
readsPrec :: Int -> ReadS Command
$creadsPrec :: Int -> ReadS Command
Prelude.Read, Int -> Command -> ShowS
[Command] -> ShowS
Command -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Command] -> ShowS
$cshowList :: [Command] -> ShowS
show :: Command -> String
$cshow :: Command -> String
showsPrec :: Int -> Command -> ShowS
$cshowsPrec :: Int -> Command -> ShowS
Prelude.Show, forall x. Rep Command x -> Command
forall x. Command -> Rep Command x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Command x -> Command
$cfrom :: forall x. Command -> Rep Command x
Prelude.Generic)
newCommand ::
Command
newCommand :: Command
newCommand =
Command'
{ $sel:args:Command' :: Maybe [Text]
args = forall a. Maybe a
Prelude.Nothing,
$sel:name:Command' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:scriptPath:Command' :: Maybe Text
scriptPath = forall a. Maybe a
Prelude.Nothing
}
command_args :: Lens.Lens' Command (Prelude.Maybe [Prelude.Text])
command_args :: Lens' Command (Maybe [Text])
command_args = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Command' {Maybe [Text]
args :: Maybe [Text]
$sel:args:Command' :: Command -> Maybe [Text]
args} -> Maybe [Text]
args) (\s :: Command
s@Command' {} Maybe [Text]
a -> Command
s {$sel:args:Command' :: Maybe [Text]
args = Maybe [Text]
a} :: Command) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
command_name :: Lens.Lens' Command (Prelude.Maybe Prelude.Text)
command_name :: Lens' Command (Maybe Text)
command_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Command' {Maybe Text
name :: Maybe Text
$sel:name:Command' :: Command -> Maybe Text
name} -> Maybe Text
name) (\s :: Command
s@Command' {} Maybe Text
a -> Command
s {$sel:name:Command' :: Maybe Text
name = Maybe Text
a} :: Command)
command_scriptPath :: Lens.Lens' Command (Prelude.Maybe Prelude.Text)
command_scriptPath :: Lens' Command (Maybe Text)
command_scriptPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Command' {Maybe Text
scriptPath :: Maybe Text
$sel:scriptPath:Command' :: Command -> Maybe Text
scriptPath} -> Maybe Text
scriptPath) (\s :: Command
s@Command' {} Maybe Text
a -> Command
s {$sel:scriptPath:Command' :: Maybe Text
scriptPath = Maybe Text
a} :: Command)
instance Data.FromJSON Command where
parseJSON :: Value -> Parser Command
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Command"
( \Object
x ->
Maybe [Text] -> Maybe Text -> Maybe Text -> Command
Command'
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
"Args" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ScriptPath")
)
instance Prelude.Hashable Command where
hashWithSalt :: Int -> Command -> Int
hashWithSalt Int
_salt Command' {Maybe [Text]
Maybe Text
scriptPath :: Maybe Text
name :: Maybe Text
args :: Maybe [Text]
$sel:scriptPath:Command' :: Command -> Maybe Text
$sel:name:Command' :: Command -> Maybe Text
$sel:args:Command' :: Command -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
args
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scriptPath
instance Prelude.NFData Command where
rnf :: Command -> ()
rnf Command' {Maybe [Text]
Maybe Text
scriptPath :: Maybe Text
name :: Maybe Text
args :: Maybe [Text]
$sel:scriptPath:Command' :: Command -> Maybe Text
$sel:name:Command' :: Command -> Maybe Text
$sel:args:Command' :: Command -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
args
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scriptPath