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