{-# 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.SSMIncidents.Types.SsmAutomation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSMIncidents.Types.SsmTargetAccount
data SsmAutomation = SsmAutomation'
{
SsmAutomation -> Maybe SsmTargetAccount
targetAccount :: Prelude.Maybe SsmTargetAccount,
SsmAutomation -> Maybe (HashMap Text [Text])
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
SsmAutomation -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
SsmAutomation -> Text
documentName :: Prelude.Text,
SsmAutomation -> Text
roleArn :: Prelude.Text
}
deriving (SsmAutomation -> SsmAutomation -> Bool
(SsmAutomation -> SsmAutomation -> Bool)
-> (SsmAutomation -> SsmAutomation -> Bool) -> Eq SsmAutomation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SsmAutomation -> SsmAutomation -> Bool
$c/= :: SsmAutomation -> SsmAutomation -> Bool
== :: SsmAutomation -> SsmAutomation -> Bool
$c== :: SsmAutomation -> SsmAutomation -> Bool
Prelude.Eq, ReadPrec [SsmAutomation]
ReadPrec SsmAutomation
Int -> ReadS SsmAutomation
ReadS [SsmAutomation]
(Int -> ReadS SsmAutomation)
-> ReadS [SsmAutomation]
-> ReadPrec SsmAutomation
-> ReadPrec [SsmAutomation]
-> Read SsmAutomation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SsmAutomation]
$creadListPrec :: ReadPrec [SsmAutomation]
readPrec :: ReadPrec SsmAutomation
$creadPrec :: ReadPrec SsmAutomation
readList :: ReadS [SsmAutomation]
$creadList :: ReadS [SsmAutomation]
readsPrec :: Int -> ReadS SsmAutomation
$creadsPrec :: Int -> ReadS SsmAutomation
Prelude.Read, Int -> SsmAutomation -> ShowS
[SsmAutomation] -> ShowS
SsmAutomation -> String
(Int -> SsmAutomation -> ShowS)
-> (SsmAutomation -> String)
-> ([SsmAutomation] -> ShowS)
-> Show SsmAutomation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SsmAutomation] -> ShowS
$cshowList :: [SsmAutomation] -> ShowS
show :: SsmAutomation -> String
$cshow :: SsmAutomation -> String
showsPrec :: Int -> SsmAutomation -> ShowS
$cshowsPrec :: Int -> SsmAutomation -> ShowS
Prelude.Show, (forall x. SsmAutomation -> Rep SsmAutomation x)
-> (forall x. Rep SsmAutomation x -> SsmAutomation)
-> Generic SsmAutomation
forall x. Rep SsmAutomation x -> SsmAutomation
forall x. SsmAutomation -> Rep SsmAutomation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SsmAutomation x -> SsmAutomation
$cfrom :: forall x. SsmAutomation -> Rep SsmAutomation x
Prelude.Generic)
newSsmAutomation ::
Prelude.Text ->
Prelude.Text ->
SsmAutomation
newSsmAutomation :: Text -> Text -> SsmAutomation
newSsmAutomation Text
pDocumentName_ Text
pRoleArn_ =
SsmAutomation' :: Maybe SsmTargetAccount
-> Maybe (HashMap Text [Text])
-> Maybe Text
-> Text
-> Text
-> SsmAutomation
SsmAutomation'
{ $sel:targetAccount:SsmAutomation' :: Maybe SsmTargetAccount
targetAccount = Maybe SsmTargetAccount
forall a. Maybe a
Prelude.Nothing,
$sel:parameters:SsmAutomation' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
$sel:documentVersion:SsmAutomation' :: Maybe Text
documentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:documentName:SsmAutomation' :: Text
documentName = Text
pDocumentName_,
$sel:roleArn:SsmAutomation' :: Text
roleArn = Text
pRoleArn_
}
ssmAutomation_targetAccount :: Lens.Lens' SsmAutomation (Prelude.Maybe SsmTargetAccount)
ssmAutomation_targetAccount :: (Maybe SsmTargetAccount -> f (Maybe SsmTargetAccount))
-> SsmAutomation -> f SsmAutomation
ssmAutomation_targetAccount = (SsmAutomation -> Maybe SsmTargetAccount)
-> (SsmAutomation -> Maybe SsmTargetAccount -> SsmAutomation)
-> Lens
SsmAutomation
SsmAutomation
(Maybe SsmTargetAccount)
(Maybe SsmTargetAccount)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SsmAutomation' {Maybe SsmTargetAccount
targetAccount :: Maybe SsmTargetAccount
$sel:targetAccount:SsmAutomation' :: SsmAutomation -> Maybe SsmTargetAccount
targetAccount} -> Maybe SsmTargetAccount
targetAccount) (\s :: SsmAutomation
s@SsmAutomation' {} Maybe SsmTargetAccount
a -> SsmAutomation
s {$sel:targetAccount:SsmAutomation' :: Maybe SsmTargetAccount
targetAccount = Maybe SsmTargetAccount
a} :: SsmAutomation)
ssmAutomation_parameters :: Lens.Lens' SsmAutomation (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
ssmAutomation_parameters :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> SsmAutomation -> f SsmAutomation
ssmAutomation_parameters = (SsmAutomation -> Maybe (HashMap Text [Text]))
-> (SsmAutomation -> Maybe (HashMap Text [Text]) -> SsmAutomation)
-> Lens
SsmAutomation
SsmAutomation
(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 (\SsmAutomation' {Maybe (HashMap Text [Text])
parameters :: Maybe (HashMap Text [Text])
$sel:parameters:SsmAutomation' :: SsmAutomation -> Maybe (HashMap Text [Text])
parameters} -> Maybe (HashMap Text [Text])
parameters) (\s :: SsmAutomation
s@SsmAutomation' {} Maybe (HashMap Text [Text])
a -> SsmAutomation
s {$sel:parameters:SsmAutomation' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
a} :: SsmAutomation) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> SsmAutomation -> f SsmAutomation)
-> ((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])))
-> SsmAutomation
-> f SsmAutomation
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
ssmAutomation_documentVersion :: Lens.Lens' SsmAutomation (Prelude.Maybe Prelude.Text)
ssmAutomation_documentVersion :: (Maybe Text -> f (Maybe Text)) -> SsmAutomation -> f SsmAutomation
ssmAutomation_documentVersion = (SsmAutomation -> Maybe Text)
-> (SsmAutomation -> Maybe Text -> SsmAutomation)
-> Lens SsmAutomation SsmAutomation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SsmAutomation' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:SsmAutomation' :: SsmAutomation -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: SsmAutomation
s@SsmAutomation' {} Maybe Text
a -> SsmAutomation
s {$sel:documentVersion:SsmAutomation' :: Maybe Text
documentVersion = Maybe Text
a} :: SsmAutomation)
ssmAutomation_documentName :: Lens.Lens' SsmAutomation Prelude.Text
ssmAutomation_documentName :: (Text -> f Text) -> SsmAutomation -> f SsmAutomation
ssmAutomation_documentName = (SsmAutomation -> Text)
-> (SsmAutomation -> Text -> SsmAutomation)
-> Lens SsmAutomation SsmAutomation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SsmAutomation' {Text
documentName :: Text
$sel:documentName:SsmAutomation' :: SsmAutomation -> Text
documentName} -> Text
documentName) (\s :: SsmAutomation
s@SsmAutomation' {} Text
a -> SsmAutomation
s {$sel:documentName:SsmAutomation' :: Text
documentName = Text
a} :: SsmAutomation)
ssmAutomation_roleArn :: Lens.Lens' SsmAutomation Prelude.Text
ssmAutomation_roleArn :: (Text -> f Text) -> SsmAutomation -> f SsmAutomation
ssmAutomation_roleArn = (SsmAutomation -> Text)
-> (SsmAutomation -> Text -> SsmAutomation)
-> Lens SsmAutomation SsmAutomation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SsmAutomation' {Text
roleArn :: Text
$sel:roleArn:SsmAutomation' :: SsmAutomation -> Text
roleArn} -> Text
roleArn) (\s :: SsmAutomation
s@SsmAutomation' {} Text
a -> SsmAutomation
s {$sel:roleArn:SsmAutomation' :: Text
roleArn = Text
a} :: SsmAutomation)
instance Core.FromJSON SsmAutomation where
parseJSON :: Value -> Parser SsmAutomation
parseJSON =
String
-> (Object -> Parser SsmAutomation)
-> Value
-> Parser SsmAutomation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SsmAutomation"
( \Object
x ->
Maybe SsmTargetAccount
-> Maybe (HashMap Text [Text])
-> Maybe Text
-> Text
-> Text
-> SsmAutomation
SsmAutomation'
(Maybe SsmTargetAccount
-> Maybe (HashMap Text [Text])
-> Maybe Text
-> Text
-> Text
-> SsmAutomation)
-> Parser (Maybe SsmTargetAccount)
-> Parser
(Maybe (HashMap Text [Text])
-> Maybe Text -> Text -> Text -> SsmAutomation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SsmTargetAccount)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"targetAccount")
Parser
(Maybe (HashMap Text [Text])
-> Maybe Text -> Text -> Text -> SsmAutomation)
-> Parser (Maybe (HashMap Text [Text]))
-> Parser (Maybe Text -> Text -> Text -> SsmAutomation)
forall (f :: * -> *) a b. Applicative f => 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
"parameters" 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 (Maybe Text -> Text -> Text -> SsmAutomation)
-> Parser (Maybe Text) -> Parser (Text -> Text -> SsmAutomation)
forall (f :: * -> *) a b. Applicative f => 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
"documentVersion")
Parser (Text -> Text -> SsmAutomation)
-> Parser Text -> Parser (Text -> SsmAutomation)
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
"documentName")
Parser (Text -> SsmAutomation)
-> Parser Text -> Parser SsmAutomation
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
"roleArn")
)
instance Prelude.Hashable SsmAutomation
instance Prelude.NFData SsmAutomation
instance Core.ToJSON SsmAutomation where
toJSON :: SsmAutomation -> Value
toJSON SsmAutomation' {Maybe Text
Maybe (HashMap Text [Text])
Maybe SsmTargetAccount
Text
roleArn :: Text
documentName :: Text
documentVersion :: Maybe Text
parameters :: Maybe (HashMap Text [Text])
targetAccount :: Maybe SsmTargetAccount
$sel:roleArn:SsmAutomation' :: SsmAutomation -> Text
$sel:documentName:SsmAutomation' :: SsmAutomation -> Text
$sel:documentVersion:SsmAutomation' :: SsmAutomation -> Maybe Text
$sel:parameters:SsmAutomation' :: SsmAutomation -> Maybe (HashMap Text [Text])
$sel:targetAccount:SsmAutomation' :: SsmAutomation -> Maybe SsmTargetAccount
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"targetAccount" Text -> SsmTargetAccount -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SsmTargetAccount -> Pair) -> Maybe SsmTargetAccount -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SsmTargetAccount
targetAccount,
(Text
"parameters" 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])
parameters,
(Text
"documentVersion" 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
documentVersion,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"documentName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
documentName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)