{-# 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.RobOMaker.Types.Tool where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.ExitBehavior
data Tool = Tool'
{
Tool -> Maybe Bool
streamOutputToCloudWatch :: Prelude.Maybe Prelude.Bool,
Tool -> Maybe ExitBehavior
exitBehavior :: Prelude.Maybe ExitBehavior,
Tool -> Maybe Bool
streamUI :: Prelude.Maybe Prelude.Bool,
Tool -> Text
name :: Prelude.Text,
Tool -> Text
command :: Prelude.Text
}
deriving (Tool -> Tool -> Bool
(Tool -> Tool -> Bool) -> (Tool -> Tool -> Bool) -> Eq Tool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Tool -> Tool -> Bool
$c/= :: Tool -> Tool -> Bool
== :: Tool -> Tool -> Bool
$c== :: Tool -> Tool -> Bool
Prelude.Eq, ReadPrec [Tool]
ReadPrec Tool
Int -> ReadS Tool
ReadS [Tool]
(Int -> ReadS Tool)
-> ReadS [Tool] -> ReadPrec Tool -> ReadPrec [Tool] -> Read Tool
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Tool]
$creadListPrec :: ReadPrec [Tool]
readPrec :: ReadPrec Tool
$creadPrec :: ReadPrec Tool
readList :: ReadS [Tool]
$creadList :: ReadS [Tool]
readsPrec :: Int -> ReadS Tool
$creadsPrec :: Int -> ReadS Tool
Prelude.Read, Int -> Tool -> ShowS
[Tool] -> ShowS
Tool -> String
(Int -> Tool -> ShowS)
-> (Tool -> String) -> ([Tool] -> ShowS) -> Show Tool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Tool] -> ShowS
$cshowList :: [Tool] -> ShowS
show :: Tool -> String
$cshow :: Tool -> String
showsPrec :: Int -> Tool -> ShowS
$cshowsPrec :: Int -> Tool -> ShowS
Prelude.Show, (forall x. Tool -> Rep Tool x)
-> (forall x. Rep Tool x -> Tool) -> Generic Tool
forall x. Rep Tool x -> Tool
forall x. Tool -> Rep Tool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Tool x -> Tool
$cfrom :: forall x. Tool -> Rep Tool x
Prelude.Generic)
newTool ::
Prelude.Text ->
Prelude.Text ->
Tool
newTool :: Text -> Text -> Tool
newTool Text
pName_ Text
pCommand_ =
Tool' :: Maybe Bool
-> Maybe ExitBehavior -> Maybe Bool -> Text -> Text -> Tool
Tool'
{ $sel:streamOutputToCloudWatch:Tool' :: Maybe Bool
streamOutputToCloudWatch = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:exitBehavior:Tool' :: Maybe ExitBehavior
exitBehavior = Maybe ExitBehavior
forall a. Maybe a
Prelude.Nothing,
$sel:streamUI:Tool' :: Maybe Bool
streamUI = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:name:Tool' :: Text
name = Text
pName_,
$sel:command:Tool' :: Text
command = Text
pCommand_
}
tool_streamOutputToCloudWatch :: Lens.Lens' Tool (Prelude.Maybe Prelude.Bool)
tool_streamOutputToCloudWatch :: (Maybe Bool -> f (Maybe Bool)) -> Tool -> f Tool
tool_streamOutputToCloudWatch = (Tool -> Maybe Bool)
-> (Tool -> Maybe Bool -> Tool)
-> Lens Tool Tool (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Tool' {Maybe Bool
streamOutputToCloudWatch :: Maybe Bool
$sel:streamOutputToCloudWatch:Tool' :: Tool -> Maybe Bool
streamOutputToCloudWatch} -> Maybe Bool
streamOutputToCloudWatch) (\s :: Tool
s@Tool' {} Maybe Bool
a -> Tool
s {$sel:streamOutputToCloudWatch:Tool' :: Maybe Bool
streamOutputToCloudWatch = Maybe Bool
a} :: Tool)
tool_exitBehavior :: Lens.Lens' Tool (Prelude.Maybe ExitBehavior)
tool_exitBehavior :: (Maybe ExitBehavior -> f (Maybe ExitBehavior)) -> Tool -> f Tool
tool_exitBehavior = (Tool -> Maybe ExitBehavior)
-> (Tool -> Maybe ExitBehavior -> Tool)
-> Lens Tool Tool (Maybe ExitBehavior) (Maybe ExitBehavior)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Tool' {Maybe ExitBehavior
exitBehavior :: Maybe ExitBehavior
$sel:exitBehavior:Tool' :: Tool -> Maybe ExitBehavior
exitBehavior} -> Maybe ExitBehavior
exitBehavior) (\s :: Tool
s@Tool' {} Maybe ExitBehavior
a -> Tool
s {$sel:exitBehavior:Tool' :: Maybe ExitBehavior
exitBehavior = Maybe ExitBehavior
a} :: Tool)
tool_streamUI :: Lens.Lens' Tool (Prelude.Maybe Prelude.Bool)
tool_streamUI :: (Maybe Bool -> f (Maybe Bool)) -> Tool -> f Tool
tool_streamUI = (Tool -> Maybe Bool)
-> (Tool -> Maybe Bool -> Tool)
-> Lens Tool Tool (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Tool' {Maybe Bool
streamUI :: Maybe Bool
$sel:streamUI:Tool' :: Tool -> Maybe Bool
streamUI} -> Maybe Bool
streamUI) (\s :: Tool
s@Tool' {} Maybe Bool
a -> Tool
s {$sel:streamUI:Tool' :: Maybe Bool
streamUI = Maybe Bool
a} :: Tool)
tool_name :: Lens.Lens' Tool Prelude.Text
tool_name :: (Text -> f Text) -> Tool -> f Tool
tool_name = (Tool -> Text)
-> (Tool -> Text -> Tool) -> Lens Tool Tool Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Tool' {Text
name :: Text
$sel:name:Tool' :: Tool -> Text
name} -> Text
name) (\s :: Tool
s@Tool' {} Text
a -> Tool
s {$sel:name:Tool' :: Text
name = Text
a} :: Tool)
tool_command :: Lens.Lens' Tool Prelude.Text
tool_command :: (Text -> f Text) -> Tool -> f Tool
tool_command = (Tool -> Text)
-> (Tool -> Text -> Tool) -> Lens Tool Tool Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Tool' {Text
command :: Text
$sel:command:Tool' :: Tool -> Text
command} -> Text
command) (\s :: Tool
s@Tool' {} Text
a -> Tool
s {$sel:command:Tool' :: Text
command = Text
a} :: Tool)
instance Core.FromJSON Tool where
parseJSON :: Value -> Parser Tool
parseJSON =
String -> (Object -> Parser Tool) -> Value -> Parser Tool
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Tool"
( \Object
x ->
Maybe Bool
-> Maybe ExitBehavior -> Maybe Bool -> Text -> Text -> Tool
Tool'
(Maybe Bool
-> Maybe ExitBehavior -> Maybe Bool -> Text -> Text -> Tool)
-> Parser (Maybe Bool)
-> Parser
(Maybe ExitBehavior -> Maybe Bool -> Text -> Text -> Tool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"streamOutputToCloudWatch")
Parser (Maybe ExitBehavior -> Maybe Bool -> Text -> Text -> Tool)
-> Parser (Maybe ExitBehavior)
-> Parser (Maybe Bool -> Text -> Text -> Tool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ExitBehavior)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"exitBehavior")
Parser (Maybe Bool -> Text -> Text -> Tool)
-> Parser (Maybe Bool) -> Parser (Text -> Text -> Tool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"streamUI")
Parser (Text -> Text -> Tool)
-> Parser Text -> Parser (Text -> Tool)
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
"name")
Parser (Text -> Tool) -> Parser Text -> Parser Tool
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
"command")
)
instance Prelude.Hashable Tool
instance Prelude.NFData Tool
instance Core.ToJSON Tool where
toJSON :: Tool -> Value
toJSON Tool' {Maybe Bool
Maybe ExitBehavior
Text
command :: Text
name :: Text
streamUI :: Maybe Bool
exitBehavior :: Maybe ExitBehavior
streamOutputToCloudWatch :: Maybe Bool
$sel:command:Tool' :: Tool -> Text
$sel:name:Tool' :: Tool -> Text
$sel:streamUI:Tool' :: Tool -> Maybe Bool
$sel:exitBehavior:Tool' :: Tool -> Maybe ExitBehavior
$sel:streamOutputToCloudWatch:Tool' :: Tool -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"streamOutputToCloudWatch" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
streamOutputToCloudWatch,
(Text
"exitBehavior" Text -> ExitBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ExitBehavior -> Pair) -> Maybe ExitBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExitBehavior
exitBehavior,
(Text
"streamUI" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
streamUI,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"command" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
command)
]
)