{-# 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.IncidentTemplate 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
import Amazonka.SSMIncidents.Types.NotificationTargetItem
data IncidentTemplate = IncidentTemplate'
{
IncidentTemplate -> Maybe Text
dedupeString :: Prelude.Maybe Prelude.Text,
IncidentTemplate -> Maybe (HashMap Text Text)
incidentTags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
IncidentTemplate -> Maybe [NotificationTargetItem]
notificationTargets :: Prelude.Maybe [NotificationTargetItem],
IncidentTemplate -> Maybe Text
summary :: Prelude.Maybe Prelude.Text,
IncidentTemplate -> Natural
impact :: Prelude.Natural,
IncidentTemplate -> Text
title :: Prelude.Text
}
deriving (IncidentTemplate -> IncidentTemplate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IncidentTemplate -> IncidentTemplate -> Bool
$c/= :: IncidentTemplate -> IncidentTemplate -> Bool
== :: IncidentTemplate -> IncidentTemplate -> Bool
$c== :: IncidentTemplate -> IncidentTemplate -> Bool
Prelude.Eq, ReadPrec [IncidentTemplate]
ReadPrec IncidentTemplate
Int -> ReadS IncidentTemplate
ReadS [IncidentTemplate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IncidentTemplate]
$creadListPrec :: ReadPrec [IncidentTemplate]
readPrec :: ReadPrec IncidentTemplate
$creadPrec :: ReadPrec IncidentTemplate
readList :: ReadS [IncidentTemplate]
$creadList :: ReadS [IncidentTemplate]
readsPrec :: Int -> ReadS IncidentTemplate
$creadsPrec :: Int -> ReadS IncidentTemplate
Prelude.Read, Int -> IncidentTemplate -> ShowS
[IncidentTemplate] -> ShowS
IncidentTemplate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IncidentTemplate] -> ShowS
$cshowList :: [IncidentTemplate] -> ShowS
show :: IncidentTemplate -> String
$cshow :: IncidentTemplate -> String
showsPrec :: Int -> IncidentTemplate -> ShowS
$cshowsPrec :: Int -> IncidentTemplate -> ShowS
Prelude.Show, forall x. Rep IncidentTemplate x -> IncidentTemplate
forall x. IncidentTemplate -> Rep IncidentTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IncidentTemplate x -> IncidentTemplate
$cfrom :: forall x. IncidentTemplate -> Rep IncidentTemplate x
Prelude.Generic)
newIncidentTemplate ::
Prelude.Natural ->
Prelude.Text ->
IncidentTemplate
newIncidentTemplate :: Natural -> Text -> IncidentTemplate
newIncidentTemplate Natural
pImpact_ Text
pTitle_ =
IncidentTemplate'
{ $sel:dedupeString:IncidentTemplate' :: Maybe Text
dedupeString = forall a. Maybe a
Prelude.Nothing,
$sel:incidentTags:IncidentTemplate' :: Maybe (HashMap Text Text)
incidentTags = forall a. Maybe a
Prelude.Nothing,
$sel:notificationTargets:IncidentTemplate' :: Maybe [NotificationTargetItem]
notificationTargets = forall a. Maybe a
Prelude.Nothing,
$sel:summary:IncidentTemplate' :: Maybe Text
summary = forall a. Maybe a
Prelude.Nothing,
$sel:impact:IncidentTemplate' :: Natural
impact = Natural
pImpact_,
$sel:title:IncidentTemplate' :: Text
title = Text
pTitle_
}
incidentTemplate_dedupeString :: Lens.Lens' IncidentTemplate (Prelude.Maybe Prelude.Text)
incidentTemplate_dedupeString :: Lens' IncidentTemplate (Maybe Text)
incidentTemplate_dedupeString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentTemplate' {Maybe Text
dedupeString :: Maybe Text
$sel:dedupeString:IncidentTemplate' :: IncidentTemplate -> Maybe Text
dedupeString} -> Maybe Text
dedupeString) (\s :: IncidentTemplate
s@IncidentTemplate' {} Maybe Text
a -> IncidentTemplate
s {$sel:dedupeString:IncidentTemplate' :: Maybe Text
dedupeString = Maybe Text
a} :: IncidentTemplate)
incidentTemplate_incidentTags :: Lens.Lens' IncidentTemplate (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
incidentTemplate_incidentTags :: Lens' IncidentTemplate (Maybe (HashMap Text Text))
incidentTemplate_incidentTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentTemplate' {Maybe (HashMap Text Text)
incidentTags :: Maybe (HashMap Text Text)
$sel:incidentTags:IncidentTemplate' :: IncidentTemplate -> Maybe (HashMap Text Text)
incidentTags} -> Maybe (HashMap Text Text)
incidentTags) (\s :: IncidentTemplate
s@IncidentTemplate' {} Maybe (HashMap Text Text)
a -> IncidentTemplate
s {$sel:incidentTags:IncidentTemplate' :: Maybe (HashMap Text Text)
incidentTags = Maybe (HashMap Text Text)
a} :: IncidentTemplate) 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
incidentTemplate_notificationTargets :: Lens.Lens' IncidentTemplate (Prelude.Maybe [NotificationTargetItem])
incidentTemplate_notificationTargets :: Lens' IncidentTemplate (Maybe [NotificationTargetItem])
incidentTemplate_notificationTargets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentTemplate' {Maybe [NotificationTargetItem]
notificationTargets :: Maybe [NotificationTargetItem]
$sel:notificationTargets:IncidentTemplate' :: IncidentTemplate -> Maybe [NotificationTargetItem]
notificationTargets} -> Maybe [NotificationTargetItem]
notificationTargets) (\s :: IncidentTemplate
s@IncidentTemplate' {} Maybe [NotificationTargetItem]
a -> IncidentTemplate
s {$sel:notificationTargets:IncidentTemplate' :: Maybe [NotificationTargetItem]
notificationTargets = Maybe [NotificationTargetItem]
a} :: IncidentTemplate) 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
incidentTemplate_summary :: Lens.Lens' IncidentTemplate (Prelude.Maybe Prelude.Text)
incidentTemplate_summary :: Lens' IncidentTemplate (Maybe Text)
incidentTemplate_summary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentTemplate' {Maybe Text
summary :: Maybe Text
$sel:summary:IncidentTemplate' :: IncidentTemplate -> Maybe Text
summary} -> Maybe Text
summary) (\s :: IncidentTemplate
s@IncidentTemplate' {} Maybe Text
a -> IncidentTemplate
s {$sel:summary:IncidentTemplate' :: Maybe Text
summary = Maybe Text
a} :: IncidentTemplate)
incidentTemplate_impact :: Lens.Lens' IncidentTemplate Prelude.Natural
incidentTemplate_impact :: Lens' IncidentTemplate Natural
incidentTemplate_impact = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentTemplate' {Natural
impact :: Natural
$sel:impact:IncidentTemplate' :: IncidentTemplate -> Natural
impact} -> Natural
impact) (\s :: IncidentTemplate
s@IncidentTemplate' {} Natural
a -> IncidentTemplate
s {$sel:impact:IncidentTemplate' :: Natural
impact = Natural
a} :: IncidentTemplate)
incidentTemplate_title :: Lens.Lens' IncidentTemplate Prelude.Text
incidentTemplate_title :: Lens' IncidentTemplate Text
incidentTemplate_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentTemplate' {Text
title :: Text
$sel:title:IncidentTemplate' :: IncidentTemplate -> Text
title} -> Text
title) (\s :: IncidentTemplate
s@IncidentTemplate' {} Text
a -> IncidentTemplate
s {$sel:title:IncidentTemplate' :: Text
title = Text
a} :: IncidentTemplate)
instance Data.FromJSON IncidentTemplate where
parseJSON :: Value -> Parser IncidentTemplate
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"IncidentTemplate"
( \Object
x ->
Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [NotificationTargetItem]
-> Maybe Text
-> Natural
-> Text
-> IncidentTemplate
IncidentTemplate'
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
"dedupeString")
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
"incidentTags" 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
"notificationTargets"
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
"summary")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"impact")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"title")
)
instance Prelude.Hashable IncidentTemplate where
hashWithSalt :: Int -> IncidentTemplate -> Int
hashWithSalt Int
_salt IncidentTemplate' {Natural
Maybe [NotificationTargetItem]
Maybe Text
Maybe (HashMap Text Text)
Text
title :: Text
impact :: Natural
summary :: Maybe Text
notificationTargets :: Maybe [NotificationTargetItem]
incidentTags :: Maybe (HashMap Text Text)
dedupeString :: Maybe Text
$sel:title:IncidentTemplate' :: IncidentTemplate -> Text
$sel:impact:IncidentTemplate' :: IncidentTemplate -> Natural
$sel:summary:IncidentTemplate' :: IncidentTemplate -> Maybe Text
$sel:notificationTargets:IncidentTemplate' :: IncidentTemplate -> Maybe [NotificationTargetItem]
$sel:incidentTags:IncidentTemplate' :: IncidentTemplate -> Maybe (HashMap Text Text)
$sel:dedupeString:IncidentTemplate' :: IncidentTemplate -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dedupeString
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
incidentTags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [NotificationTargetItem]
notificationTargets
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
summary
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
impact
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title
instance Prelude.NFData IncidentTemplate where
rnf :: IncidentTemplate -> ()
rnf IncidentTemplate' {Natural
Maybe [NotificationTargetItem]
Maybe Text
Maybe (HashMap Text Text)
Text
title :: Text
impact :: Natural
summary :: Maybe Text
notificationTargets :: Maybe [NotificationTargetItem]
incidentTags :: Maybe (HashMap Text Text)
dedupeString :: Maybe Text
$sel:title:IncidentTemplate' :: IncidentTemplate -> Text
$sel:impact:IncidentTemplate' :: IncidentTemplate -> Natural
$sel:summary:IncidentTemplate' :: IncidentTemplate -> Maybe Text
$sel:notificationTargets:IncidentTemplate' :: IncidentTemplate -> Maybe [NotificationTargetItem]
$sel:incidentTags:IncidentTemplate' :: IncidentTemplate -> Maybe (HashMap Text Text)
$sel:dedupeString:IncidentTemplate' :: IncidentTemplate -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dedupeString
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
incidentTags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [NotificationTargetItem]
notificationTargets
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
summary
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
impact
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
title
instance Data.ToJSON IncidentTemplate where
toJSON :: IncidentTemplate -> Value
toJSON IncidentTemplate' {Natural
Maybe [NotificationTargetItem]
Maybe Text
Maybe (HashMap Text Text)
Text
title :: Text
impact :: Natural
summary :: Maybe Text
notificationTargets :: Maybe [NotificationTargetItem]
incidentTags :: Maybe (HashMap Text Text)
dedupeString :: Maybe Text
$sel:title:IncidentTemplate' :: IncidentTemplate -> Text
$sel:impact:IncidentTemplate' :: IncidentTemplate -> Natural
$sel:summary:IncidentTemplate' :: IncidentTemplate -> Maybe Text
$sel:notificationTargets:IncidentTemplate' :: IncidentTemplate -> Maybe [NotificationTargetItem]
$sel:incidentTags:IncidentTemplate' :: IncidentTemplate -> Maybe (HashMap Text Text)
$sel:dedupeString:IncidentTemplate' :: IncidentTemplate -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"dedupeString" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
dedupeString,
(Key
"incidentTags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
incidentTags,
(Key
"notificationTargets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [NotificationTargetItem]
notificationTargets,
(Key
"summary" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
summary,
forall a. a -> Maybe a
Prelude.Just (Key
"impact" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
impact),
forall a. a -> Maybe a
Prelude.Just (Key
"title" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
title)
]
)