{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.NotificationEvent
import Amazonka.SSM.Types.NotificationType
data NotificationConfig = NotificationConfig'
{
NotificationConfig -> Maybe Text
notificationArn :: Prelude.Maybe Prelude.Text,
NotificationConfig -> Maybe [NotificationEvent]
notificationEvents :: Prelude.Maybe [NotificationEvent],
NotificationConfig -> Maybe NotificationType
notificationType :: Prelude.Maybe NotificationType
}
deriving (NotificationConfig -> NotificationConfig -> Bool
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]
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
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. 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'
{ $sel:notificationArn:NotificationConfig' :: Maybe Text
notificationArn =
forall a. Maybe a
Prelude.Nothing,
$sel:notificationEvents:NotificationConfig' :: Maybe [NotificationEvent]
notificationEvents = forall a. Maybe a
Prelude.Nothing,
$sel:notificationType:NotificationConfig' :: Maybe NotificationType
notificationType = forall a. Maybe a
Prelude.Nothing
}
notificationConfig_notificationArn :: Lens.Lens' NotificationConfig (Prelude.Maybe Prelude.Text)
notificationConfig_notificationArn :: Lens' NotificationConfig (Maybe Text)
notificationConfig_notificationArn = 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)
notificationConfig_notificationEvents :: Lens.Lens' NotificationConfig (Prelude.Maybe [NotificationEvent])
notificationConfig_notificationEvents :: Lens' NotificationConfig (Maybe [NotificationEvent])
notificationConfig_notificationEvents = 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) 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
notificationConfig_notificationType :: Lens.Lens' NotificationConfig (Prelude.Maybe NotificationType)
notificationConfig_notificationType :: Lens' NotificationConfig (Maybe NotificationType)
notificationConfig_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)
instance Data.FromJSON NotificationConfig where
parseJSON :: Value -> Parser NotificationConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"NotificationConfig"
( \Object
x ->
Maybe Text
-> Maybe [NotificationEvent]
-> Maybe NotificationType
-> NotificationConfig
NotificationConfig'
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
"NotificationArn")
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
"NotificationEvents"
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
"NotificationType")
)
instance Prelude.Hashable NotificationConfig where
hashWithSalt :: Int -> NotificationConfig -> Int
hashWithSalt Int
_salt NotificationConfig' {Maybe [NotificationEvent]
Maybe Text
Maybe NotificationType
notificationType :: Maybe NotificationType
notificationEvents :: Maybe [NotificationEvent]
notificationArn :: Maybe Text
$sel:notificationType:NotificationConfig' :: NotificationConfig -> Maybe NotificationType
$sel:notificationEvents:NotificationConfig' :: NotificationConfig -> Maybe [NotificationEvent]
$sel:notificationArn:NotificationConfig' :: NotificationConfig -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
notificationArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [NotificationEvent]
notificationEvents
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotificationType
notificationType
instance Prelude.NFData NotificationConfig where
rnf :: NotificationConfig -> ()
rnf NotificationConfig' {Maybe [NotificationEvent]
Maybe Text
Maybe NotificationType
notificationType :: Maybe NotificationType
notificationEvents :: Maybe [NotificationEvent]
notificationArn :: Maybe Text
$sel:notificationType:NotificationConfig' :: NotificationConfig -> Maybe NotificationType
$sel:notificationEvents:NotificationConfig' :: NotificationConfig -> Maybe [NotificationEvent]
$sel:notificationArn:NotificationConfig' :: NotificationConfig -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
notificationArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [NotificationEvent]
notificationEvents
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NotificationType
notificationType
instance Data.ToJSON NotificationConfig where
toJSON :: NotificationConfig -> Value
toJSON NotificationConfig' {Maybe [NotificationEvent]
Maybe Text
Maybe NotificationType
notificationType :: Maybe NotificationType
notificationEvents :: Maybe [NotificationEvent]
notificationArn :: Maybe Text
$sel:notificationType:NotificationConfig' :: NotificationConfig -> Maybe NotificationType
$sel:notificationEvents:NotificationConfig' :: NotificationConfig -> Maybe [NotificationEvent]
$sel:notificationArn:NotificationConfig' :: NotificationConfig -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"NotificationArn" 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
notificationArn,
(Key
"NotificationEvents" 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 [NotificationEvent]
notificationEvents,
(Key
"NotificationType" 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 NotificationType
notificationType
]
)