{-# 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.OpsWorks.Types.DeploymentCommand where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types.DeploymentCommandName
import qualified Amazonka.Prelude as Prelude
data DeploymentCommand = DeploymentCommand'
{
DeploymentCommand -> Maybe (HashMap Text [Text])
args :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
DeploymentCommand -> DeploymentCommandName
name :: DeploymentCommandName
}
deriving (DeploymentCommand -> DeploymentCommand -> Bool
(DeploymentCommand -> DeploymentCommand -> Bool)
-> (DeploymentCommand -> DeploymentCommand -> Bool)
-> Eq DeploymentCommand
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentCommand -> DeploymentCommand -> Bool
$c/= :: DeploymentCommand -> DeploymentCommand -> Bool
== :: DeploymentCommand -> DeploymentCommand -> Bool
$c== :: DeploymentCommand -> DeploymentCommand -> Bool
Prelude.Eq, ReadPrec [DeploymentCommand]
ReadPrec DeploymentCommand
Int -> ReadS DeploymentCommand
ReadS [DeploymentCommand]
(Int -> ReadS DeploymentCommand)
-> ReadS [DeploymentCommand]
-> ReadPrec DeploymentCommand
-> ReadPrec [DeploymentCommand]
-> Read DeploymentCommand
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentCommand]
$creadListPrec :: ReadPrec [DeploymentCommand]
readPrec :: ReadPrec DeploymentCommand
$creadPrec :: ReadPrec DeploymentCommand
readList :: ReadS [DeploymentCommand]
$creadList :: ReadS [DeploymentCommand]
readsPrec :: Int -> ReadS DeploymentCommand
$creadsPrec :: Int -> ReadS DeploymentCommand
Prelude.Read, Int -> DeploymentCommand -> ShowS
[DeploymentCommand] -> ShowS
DeploymentCommand -> String
(Int -> DeploymentCommand -> ShowS)
-> (DeploymentCommand -> String)
-> ([DeploymentCommand] -> ShowS)
-> Show DeploymentCommand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentCommand] -> ShowS
$cshowList :: [DeploymentCommand] -> ShowS
show :: DeploymentCommand -> String
$cshow :: DeploymentCommand -> String
showsPrec :: Int -> DeploymentCommand -> ShowS
$cshowsPrec :: Int -> DeploymentCommand -> ShowS
Prelude.Show, (forall x. DeploymentCommand -> Rep DeploymentCommand x)
-> (forall x. Rep DeploymentCommand x -> DeploymentCommand)
-> Generic DeploymentCommand
forall x. Rep DeploymentCommand x -> DeploymentCommand
forall x. DeploymentCommand -> Rep DeploymentCommand x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentCommand x -> DeploymentCommand
$cfrom :: forall x. DeploymentCommand -> Rep DeploymentCommand x
Prelude.Generic)
newDeploymentCommand ::
DeploymentCommandName ->
DeploymentCommand
newDeploymentCommand :: DeploymentCommandName -> DeploymentCommand
newDeploymentCommand DeploymentCommandName
pName_ =
DeploymentCommand' :: Maybe (HashMap Text [Text])
-> DeploymentCommandName -> DeploymentCommand
DeploymentCommand'
{ $sel:args:DeploymentCommand' :: Maybe (HashMap Text [Text])
args = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
$sel:name:DeploymentCommand' :: DeploymentCommandName
name = DeploymentCommandName
pName_
}
deploymentCommand_args :: Lens.Lens' DeploymentCommand (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
deploymentCommand_args :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> DeploymentCommand -> f DeploymentCommand
deploymentCommand_args = (DeploymentCommand -> Maybe (HashMap Text [Text]))
-> (DeploymentCommand
-> Maybe (HashMap Text [Text]) -> DeploymentCommand)
-> Lens
DeploymentCommand
DeploymentCommand
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentCommand' {Maybe (HashMap Text [Text])
args :: Maybe (HashMap Text [Text])
$sel:args:DeploymentCommand' :: DeploymentCommand -> Maybe (HashMap Text [Text])
args} -> Maybe (HashMap Text [Text])
args) (\s :: DeploymentCommand
s@DeploymentCommand' {} Maybe (HashMap Text [Text])
a -> DeploymentCommand
s {$sel:args:DeploymentCommand' :: Maybe (HashMap Text [Text])
args = Maybe (HashMap Text [Text])
a} :: DeploymentCommand) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> DeploymentCommand -> f DeploymentCommand)
-> ((Maybe (HashMap Text [Text])
-> f (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> DeploymentCommand
-> f DeploymentCommand
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
-> Iso
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
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 AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
deploymentCommand_name :: Lens.Lens' DeploymentCommand DeploymentCommandName
deploymentCommand_name :: (DeploymentCommandName -> f DeploymentCommandName)
-> DeploymentCommand -> f DeploymentCommand
deploymentCommand_name = (DeploymentCommand -> DeploymentCommandName)
-> (DeploymentCommand
-> DeploymentCommandName -> DeploymentCommand)
-> Lens
DeploymentCommand
DeploymentCommand
DeploymentCommandName
DeploymentCommandName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentCommand' {DeploymentCommandName
name :: DeploymentCommandName
$sel:name:DeploymentCommand' :: DeploymentCommand -> DeploymentCommandName
name} -> DeploymentCommandName
name) (\s :: DeploymentCommand
s@DeploymentCommand' {} DeploymentCommandName
a -> DeploymentCommand
s {$sel:name:DeploymentCommand' :: DeploymentCommandName
name = DeploymentCommandName
a} :: DeploymentCommand)
instance Core.FromJSON DeploymentCommand where
parseJSON :: Value -> Parser DeploymentCommand
parseJSON =
String
-> (Object -> Parser DeploymentCommand)
-> Value
-> Parser DeploymentCommand
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DeploymentCommand"
( \Object
x ->
Maybe (HashMap Text [Text])
-> DeploymentCommandName -> DeploymentCommand
DeploymentCommand'
(Maybe (HashMap Text [Text])
-> DeploymentCommandName -> DeploymentCommand)
-> Parser (Maybe (HashMap Text [Text]))
-> Parser (DeploymentCommandName -> DeploymentCommand)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text [Text])))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Args" Parser (Maybe (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text])
-> Parser (Maybe (HashMap Text [Text]))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text [Text])
forall a. Monoid a => a
Prelude.mempty)
Parser (DeploymentCommandName -> DeploymentCommand)
-> Parser DeploymentCommandName -> Parser DeploymentCommand
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DeploymentCommandName
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
)
instance Prelude.Hashable DeploymentCommand
instance Prelude.NFData DeploymentCommand
instance Core.ToJSON DeploymentCommand where
toJSON :: DeploymentCommand -> Value
toJSON DeploymentCommand' {Maybe (HashMap Text [Text])
DeploymentCommandName
name :: DeploymentCommandName
args :: Maybe (HashMap Text [Text])
$sel:name:DeploymentCommand' :: DeploymentCommand -> DeploymentCommandName
$sel:args:DeploymentCommand' :: DeploymentCommand -> Maybe (HashMap Text [Text])
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Args" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
args,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> DeploymentCommandName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DeploymentCommandName
name)
]
)