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