{-# 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.Snowball.Types.Notification 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.Snowball.Types.JobState
data Notification = Notification'
{
Notification -> Maybe [JobState]
jobStatesToNotify :: Prelude.Maybe [JobState],
Notification -> Maybe Bool
notifyAll :: Prelude.Maybe Prelude.Bool,
Notification -> Maybe Text
snsTopicARN :: Prelude.Maybe Prelude.Text
}
deriving (Notification -> Notification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Notification -> Notification -> Bool
$c/= :: Notification -> Notification -> Bool
== :: Notification -> Notification -> Bool
$c== :: Notification -> Notification -> Bool
Prelude.Eq, ReadPrec [Notification]
ReadPrec Notification
Int -> ReadS Notification
ReadS [Notification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Notification]
$creadListPrec :: ReadPrec [Notification]
readPrec :: ReadPrec Notification
$creadPrec :: ReadPrec Notification
readList :: ReadS [Notification]
$creadList :: ReadS [Notification]
readsPrec :: Int -> ReadS Notification
$creadsPrec :: Int -> ReadS Notification
Prelude.Read, Int -> Notification -> ShowS
[Notification] -> ShowS
Notification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Notification] -> ShowS
$cshowList :: [Notification] -> ShowS
show :: Notification -> String
$cshow :: Notification -> String
showsPrec :: Int -> Notification -> ShowS
$cshowsPrec :: Int -> Notification -> ShowS
Prelude.Show, forall x. Rep Notification x -> Notification
forall x. Notification -> Rep Notification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Notification x -> Notification
$cfrom :: forall x. Notification -> Rep Notification x
Prelude.Generic)
newNotification ::
Notification
newNotification :: Notification
newNotification =
Notification'
{ $sel:jobStatesToNotify:Notification' :: Maybe [JobState]
jobStatesToNotify = forall a. Maybe a
Prelude.Nothing,
$sel:notifyAll:Notification' :: Maybe Bool
notifyAll = forall a. Maybe a
Prelude.Nothing,
$sel:snsTopicARN:Notification' :: Maybe Text
snsTopicARN = forall a. Maybe a
Prelude.Nothing
}
notification_jobStatesToNotify :: Lens.Lens' Notification (Prelude.Maybe [JobState])
notification_jobStatesToNotify :: Lens' Notification (Maybe [JobState])
notification_jobStatesToNotify = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe [JobState]
jobStatesToNotify :: Maybe [JobState]
$sel:jobStatesToNotify:Notification' :: Notification -> Maybe [JobState]
jobStatesToNotify} -> Maybe [JobState]
jobStatesToNotify) (\s :: Notification
s@Notification' {} Maybe [JobState]
a -> Notification
s {$sel:jobStatesToNotify:Notification' :: Maybe [JobState]
jobStatesToNotify = Maybe [JobState]
a} :: Notification) 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
notification_notifyAll :: Lens.Lens' Notification (Prelude.Maybe Prelude.Bool)
notification_notifyAll :: Lens' Notification (Maybe Bool)
notification_notifyAll = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Bool
notifyAll :: Maybe Bool
$sel:notifyAll:Notification' :: Notification -> Maybe Bool
notifyAll} -> Maybe Bool
notifyAll) (\s :: Notification
s@Notification' {} Maybe Bool
a -> Notification
s {$sel:notifyAll:Notification' :: Maybe Bool
notifyAll = Maybe Bool
a} :: Notification)
notification_snsTopicARN :: Lens.Lens' Notification (Prelude.Maybe Prelude.Text)
notification_snsTopicARN :: Lens' Notification (Maybe Text)
notification_snsTopicARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Notification' {Maybe Text
snsTopicARN :: Maybe Text
$sel:snsTopicARN:Notification' :: Notification -> Maybe Text
snsTopicARN} -> Maybe Text
snsTopicARN) (\s :: Notification
s@Notification' {} Maybe Text
a -> Notification
s {$sel:snsTopicARN:Notification' :: Maybe Text
snsTopicARN = Maybe Text
a} :: Notification)
instance Data.FromJSON Notification where
parseJSON :: Value -> Parser Notification
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Notification"
( \Object
x ->
Maybe [JobState] -> Maybe Bool -> Maybe Text -> Notification
Notification'
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
"JobStatesToNotify"
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
"NotifyAll")
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
"SnsTopicARN")
)
instance Prelude.Hashable Notification where
hashWithSalt :: Int -> Notification -> Int
hashWithSalt Int
_salt Notification' {Maybe Bool
Maybe [JobState]
Maybe Text
snsTopicARN :: Maybe Text
notifyAll :: Maybe Bool
jobStatesToNotify :: Maybe [JobState]
$sel:snsTopicARN:Notification' :: Notification -> Maybe Text
$sel:notifyAll:Notification' :: Notification -> Maybe Bool
$sel:jobStatesToNotify:Notification' :: Notification -> Maybe [JobState]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [JobState]
jobStatesToNotify
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
notifyAll
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snsTopicARN
instance Prelude.NFData Notification where
rnf :: Notification -> ()
rnf Notification' {Maybe Bool
Maybe [JobState]
Maybe Text
snsTopicARN :: Maybe Text
notifyAll :: Maybe Bool
jobStatesToNotify :: Maybe [JobState]
$sel:snsTopicARN:Notification' :: Notification -> Maybe Text
$sel:notifyAll:Notification' :: Notification -> Maybe Bool
$sel:jobStatesToNotify:Notification' :: Notification -> Maybe [JobState]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [JobState]
jobStatesToNotify
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
notifyAll
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snsTopicARN
instance Data.ToJSON Notification where
toJSON :: Notification -> Value
toJSON Notification' {Maybe Bool
Maybe [JobState]
Maybe Text
snsTopicARN :: Maybe Text
notifyAll :: Maybe Bool
jobStatesToNotify :: Maybe [JobState]
$sel:snsTopicARN:Notification' :: Notification -> Maybe Text
$sel:notifyAll:Notification' :: Notification -> Maybe Bool
$sel:jobStatesToNotify:Notification' :: Notification -> Maybe [JobState]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"JobStatesToNotify" 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 [JobState]
jobStatesToNotify,
(Key
"NotifyAll" 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 Bool
notifyAll,
(Key
"SnsTopicARN" 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
snsTopicARN
]
)