{-# 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.PinpointEmail.Types.SnsDestination where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SnsDestination = SnsDestination'
{
SnsDestination -> Text
topicArn :: Prelude.Text
}
deriving (SnsDestination -> SnsDestination -> Bool
(SnsDestination -> SnsDestination -> Bool)
-> (SnsDestination -> SnsDestination -> Bool) -> Eq SnsDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnsDestination -> SnsDestination -> Bool
$c/= :: SnsDestination -> SnsDestination -> Bool
== :: SnsDestination -> SnsDestination -> Bool
$c== :: SnsDestination -> SnsDestination -> Bool
Prelude.Eq, ReadPrec [SnsDestination]
ReadPrec SnsDestination
Int -> ReadS SnsDestination
ReadS [SnsDestination]
(Int -> ReadS SnsDestination)
-> ReadS [SnsDestination]
-> ReadPrec SnsDestination
-> ReadPrec [SnsDestination]
-> Read SnsDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnsDestination]
$creadListPrec :: ReadPrec [SnsDestination]
readPrec :: ReadPrec SnsDestination
$creadPrec :: ReadPrec SnsDestination
readList :: ReadS [SnsDestination]
$creadList :: ReadS [SnsDestination]
readsPrec :: Int -> ReadS SnsDestination
$creadsPrec :: Int -> ReadS SnsDestination
Prelude.Read, Int -> SnsDestination -> ShowS
[SnsDestination] -> ShowS
SnsDestination -> String
(Int -> SnsDestination -> ShowS)
-> (SnsDestination -> String)
-> ([SnsDestination] -> ShowS)
-> Show SnsDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnsDestination] -> ShowS
$cshowList :: [SnsDestination] -> ShowS
show :: SnsDestination -> String
$cshow :: SnsDestination -> String
showsPrec :: Int -> SnsDestination -> ShowS
$cshowsPrec :: Int -> SnsDestination -> ShowS
Prelude.Show, (forall x. SnsDestination -> Rep SnsDestination x)
-> (forall x. Rep SnsDestination x -> SnsDestination)
-> Generic SnsDestination
forall x. Rep SnsDestination x -> SnsDestination
forall x. SnsDestination -> Rep SnsDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SnsDestination x -> SnsDestination
$cfrom :: forall x. SnsDestination -> Rep SnsDestination x
Prelude.Generic)
newSnsDestination ::
Prelude.Text ->
SnsDestination
newSnsDestination :: Text -> SnsDestination
newSnsDestination Text
pTopicArn_ =
SnsDestination' :: Text -> SnsDestination
SnsDestination' {$sel:topicArn:SnsDestination' :: Text
topicArn = Text
pTopicArn_}
snsDestination_topicArn :: Lens.Lens' SnsDestination Prelude.Text
snsDestination_topicArn :: (Text -> f Text) -> SnsDestination -> f SnsDestination
snsDestination_topicArn = (SnsDestination -> Text)
-> (SnsDestination -> Text -> SnsDestination)
-> Lens SnsDestination SnsDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnsDestination' {Text
topicArn :: Text
$sel:topicArn:SnsDestination' :: SnsDestination -> Text
topicArn} -> Text
topicArn) (\s :: SnsDestination
s@SnsDestination' {} Text
a -> SnsDestination
s {$sel:topicArn:SnsDestination' :: Text
topicArn = Text
a} :: SnsDestination)
instance Core.FromJSON SnsDestination where
parseJSON :: Value -> Parser SnsDestination
parseJSON =
String
-> (Object -> Parser SnsDestination)
-> Value
-> Parser SnsDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SnsDestination"
( \Object
x ->
Text -> SnsDestination
SnsDestination' (Text -> SnsDestination) -> Parser Text -> Parser SnsDestination
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TopicArn")
)
instance Prelude.Hashable SnsDestination
instance Prelude.NFData SnsDestination
instance Core.ToJSON SnsDestination where
toJSON :: SnsDestination -> Value
toJSON SnsDestination' {Text
topicArn :: Text
$sel:topicArn:SnsDestination' :: SnsDestination -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TopicArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
topicArn)]
)