{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Snowball.Types.JobState
data Notification = Notification'
{
Notification -> Maybe Bool
notifyAll :: Prelude.Maybe Prelude.Bool,
Notification -> Maybe Text
snsTopicARN :: Prelude.Maybe Prelude.Text,
Notification -> Maybe [JobState]
jobStatesToNotify :: Prelude.Maybe [JobState]
}
deriving (Notification -> Notification -> Bool
(Notification -> Notification -> Bool)
-> (Notification -> Notification -> Bool) -> Eq Notification
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]
(Int -> ReadS Notification)
-> ReadS [Notification]
-> ReadPrec Notification
-> ReadPrec [Notification]
-> Read 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
(Int -> Notification -> ShowS)
-> (Notification -> String)
-> ([Notification] -> ShowS)
-> Show Notification
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. Notification -> Rep Notification x)
-> (forall x. Rep Notification x -> Notification)
-> Generic Notification
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' :: Maybe Bool -> Maybe Text -> Maybe [JobState] -> Notification
Notification'
{ $sel:notifyAll:Notification' :: Maybe Bool
notifyAll = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:snsTopicARN:Notification' :: Maybe Text
snsTopicARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:jobStatesToNotify:Notification' :: Maybe [JobState]
jobStatesToNotify = Maybe [JobState]
forall a. Maybe a
Prelude.Nothing
}
notification_notifyAll :: Lens.Lens' Notification (Prelude.Maybe Prelude.Bool)
notification_notifyAll :: (Maybe Bool -> f (Maybe Bool)) -> Notification -> f Notification
notification_notifyAll = (Notification -> Maybe Bool)
-> (Notification -> Maybe Bool -> Notification)
-> Lens Notification Notification (Maybe Bool) (Maybe Bool)
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 :: (Maybe Text -> f (Maybe Text)) -> Notification -> f Notification
notification_snsTopicARN = (Notification -> Maybe Text)
-> (Notification -> Maybe Text -> Notification)
-> Lens Notification Notification (Maybe Text) (Maybe Text)
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)
notification_jobStatesToNotify :: Lens.Lens' Notification (Prelude.Maybe [JobState])
notification_jobStatesToNotify :: (Maybe [JobState] -> f (Maybe [JobState]))
-> Notification -> f Notification
notification_jobStatesToNotify = (Notification -> Maybe [JobState])
-> (Notification -> Maybe [JobState] -> Notification)
-> Lens
Notification Notification (Maybe [JobState]) (Maybe [JobState])
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) ((Maybe [JobState] -> f (Maybe [JobState]))
-> Notification -> f Notification)
-> ((Maybe [JobState] -> f (Maybe [JobState]))
-> Maybe [JobState] -> f (Maybe [JobState]))
-> (Maybe [JobState] -> f (Maybe [JobState]))
-> Notification
-> f Notification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [JobState] [JobState] [JobState] [JobState]
-> Iso
(Maybe [JobState])
(Maybe [JobState])
(Maybe [JobState])
(Maybe [JobState])
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 [JobState] [JobState] [JobState] [JobState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Notification where
parseJSON :: Value -> Parser Notification
parseJSON =
String
-> (Object -> Parser Notification) -> Value -> Parser Notification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Notification"
( \Object
x ->
Maybe Bool -> Maybe Text -> Maybe [JobState] -> Notification
Notification'
(Maybe Bool -> Maybe Text -> Maybe [JobState] -> Notification)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe [JobState] -> Notification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NotifyAll")
Parser (Maybe Text -> Maybe [JobState] -> Notification)
-> Parser (Maybe Text) -> Parser (Maybe [JobState] -> Notification)
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
"SnsTopicARN")
Parser (Maybe [JobState] -> Notification)
-> Parser (Maybe [JobState]) -> Parser Notification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [JobState]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobStatesToNotify"
Parser (Maybe (Maybe [JobState]))
-> Maybe [JobState] -> Parser (Maybe [JobState])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [JobState]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable Notification
instance Prelude.NFData Notification
instance Core.ToJSON Notification where
toJSON :: Notification -> Value
toJSON Notification' {Maybe Bool
Maybe [JobState]
Maybe Text
jobStatesToNotify :: Maybe [JobState]
snsTopicARN :: Maybe Text
notifyAll :: Maybe Bool
$sel:jobStatesToNotify:Notification' :: Notification -> Maybe [JobState]
$sel:snsTopicARN:Notification' :: Notification -> Maybe Text
$sel:notifyAll:Notification' :: Notification -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NotifyAll" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
notifyAll,
(Text
"SnsTopicARN" 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
snsTopicARN,
(Text
"JobStatesToNotify" Text -> [JobState] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([JobState] -> Pair) -> Maybe [JobState] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [JobState]
jobStatesToNotify
]
)