{-# 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.SES.Types.BounceAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data BounceAction = BounceAction'
{
BounceAction -> Maybe Text
topicArn :: Prelude.Maybe Prelude.Text,
BounceAction -> Maybe Text
statusCode :: Prelude.Maybe Prelude.Text,
BounceAction -> Text
smtpReplyCode :: Prelude.Text,
BounceAction -> Text
message :: Prelude.Text,
BounceAction -> Text
sender :: Prelude.Text
}
deriving (BounceAction -> BounceAction -> Bool
(BounceAction -> BounceAction -> Bool)
-> (BounceAction -> BounceAction -> Bool) -> Eq BounceAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BounceAction -> BounceAction -> Bool
$c/= :: BounceAction -> BounceAction -> Bool
== :: BounceAction -> BounceAction -> Bool
$c== :: BounceAction -> BounceAction -> Bool
Prelude.Eq, ReadPrec [BounceAction]
ReadPrec BounceAction
Int -> ReadS BounceAction
ReadS [BounceAction]
(Int -> ReadS BounceAction)
-> ReadS [BounceAction]
-> ReadPrec BounceAction
-> ReadPrec [BounceAction]
-> Read BounceAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BounceAction]
$creadListPrec :: ReadPrec [BounceAction]
readPrec :: ReadPrec BounceAction
$creadPrec :: ReadPrec BounceAction
readList :: ReadS [BounceAction]
$creadList :: ReadS [BounceAction]
readsPrec :: Int -> ReadS BounceAction
$creadsPrec :: Int -> ReadS BounceAction
Prelude.Read, Int -> BounceAction -> ShowS
[BounceAction] -> ShowS
BounceAction -> String
(Int -> BounceAction -> ShowS)
-> (BounceAction -> String)
-> ([BounceAction] -> ShowS)
-> Show BounceAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BounceAction] -> ShowS
$cshowList :: [BounceAction] -> ShowS
show :: BounceAction -> String
$cshow :: BounceAction -> String
showsPrec :: Int -> BounceAction -> ShowS
$cshowsPrec :: Int -> BounceAction -> ShowS
Prelude.Show, (forall x. BounceAction -> Rep BounceAction x)
-> (forall x. Rep BounceAction x -> BounceAction)
-> Generic BounceAction
forall x. Rep BounceAction x -> BounceAction
forall x. BounceAction -> Rep BounceAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BounceAction x -> BounceAction
$cfrom :: forall x. BounceAction -> Rep BounceAction x
Prelude.Generic)
newBounceAction ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
BounceAction
newBounceAction :: Text -> Text -> Text -> BounceAction
newBounceAction Text
pSmtpReplyCode_ Text
pMessage_ Text
pSender_ =
BounceAction' :: Maybe Text -> Maybe Text -> Text -> Text -> Text -> BounceAction
BounceAction'
{ $sel:topicArn:BounceAction' :: Maybe Text
topicArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:statusCode:BounceAction' :: Maybe Text
statusCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:smtpReplyCode:BounceAction' :: Text
smtpReplyCode = Text
pSmtpReplyCode_,
$sel:message:BounceAction' :: Text
message = Text
pMessage_,
$sel:sender:BounceAction' :: Text
sender = Text
pSender_
}
bounceAction_topicArn :: Lens.Lens' BounceAction (Prelude.Maybe Prelude.Text)
bounceAction_topicArn :: (Maybe Text -> f (Maybe Text)) -> BounceAction -> f BounceAction
bounceAction_topicArn = (BounceAction -> Maybe Text)
-> (BounceAction -> Maybe Text -> BounceAction)
-> Lens BounceAction BounceAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BounceAction' {Maybe Text
topicArn :: Maybe Text
$sel:topicArn:BounceAction' :: BounceAction -> Maybe Text
topicArn} -> Maybe Text
topicArn) (\s :: BounceAction
s@BounceAction' {} Maybe Text
a -> BounceAction
s {$sel:topicArn:BounceAction' :: Maybe Text
topicArn = Maybe Text
a} :: BounceAction)
bounceAction_statusCode :: Lens.Lens' BounceAction (Prelude.Maybe Prelude.Text)
bounceAction_statusCode :: (Maybe Text -> f (Maybe Text)) -> BounceAction -> f BounceAction
bounceAction_statusCode = (BounceAction -> Maybe Text)
-> (BounceAction -> Maybe Text -> BounceAction)
-> Lens BounceAction BounceAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BounceAction' {Maybe Text
statusCode :: Maybe Text
$sel:statusCode:BounceAction' :: BounceAction -> Maybe Text
statusCode} -> Maybe Text
statusCode) (\s :: BounceAction
s@BounceAction' {} Maybe Text
a -> BounceAction
s {$sel:statusCode:BounceAction' :: Maybe Text
statusCode = Maybe Text
a} :: BounceAction)
bounceAction_smtpReplyCode :: Lens.Lens' BounceAction Prelude.Text
bounceAction_smtpReplyCode :: (Text -> f Text) -> BounceAction -> f BounceAction
bounceAction_smtpReplyCode = (BounceAction -> Text)
-> (BounceAction -> Text -> BounceAction)
-> Lens BounceAction BounceAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BounceAction' {Text
smtpReplyCode :: Text
$sel:smtpReplyCode:BounceAction' :: BounceAction -> Text
smtpReplyCode} -> Text
smtpReplyCode) (\s :: BounceAction
s@BounceAction' {} Text
a -> BounceAction
s {$sel:smtpReplyCode:BounceAction' :: Text
smtpReplyCode = Text
a} :: BounceAction)
bounceAction_message :: Lens.Lens' BounceAction Prelude.Text
bounceAction_message :: (Text -> f Text) -> BounceAction -> f BounceAction
bounceAction_message = (BounceAction -> Text)
-> (BounceAction -> Text -> BounceAction)
-> Lens BounceAction BounceAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BounceAction' {Text
message :: Text
$sel:message:BounceAction' :: BounceAction -> Text
message} -> Text
message) (\s :: BounceAction
s@BounceAction' {} Text
a -> BounceAction
s {$sel:message:BounceAction' :: Text
message = Text
a} :: BounceAction)
bounceAction_sender :: Lens.Lens' BounceAction Prelude.Text
bounceAction_sender :: (Text -> f Text) -> BounceAction -> f BounceAction
bounceAction_sender = (BounceAction -> Text)
-> (BounceAction -> Text -> BounceAction)
-> Lens BounceAction BounceAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BounceAction' {Text
sender :: Text
$sel:sender:BounceAction' :: BounceAction -> Text
sender} -> Text
sender) (\s :: BounceAction
s@BounceAction' {} Text
a -> BounceAction
s {$sel:sender:BounceAction' :: Text
sender = Text
a} :: BounceAction)
instance Core.FromXML BounceAction where
parseXML :: [Node] -> Either String BounceAction
parseXML [Node]
x =
Maybe Text -> Maybe Text -> Text -> Text -> Text -> BounceAction
BounceAction'
(Maybe Text -> Maybe Text -> Text -> Text -> Text -> BounceAction)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Text -> Text -> Text -> BounceAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TopicArn")
Either String (Maybe Text -> Text -> Text -> Text -> BounceAction)
-> Either String (Maybe Text)
-> Either String (Text -> Text -> Text -> BounceAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StatusCode")
Either String (Text -> Text -> Text -> BounceAction)
-> Either String Text
-> Either String (Text -> Text -> BounceAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"SmtpReplyCode")
Either String (Text -> Text -> BounceAction)
-> Either String Text -> Either String (Text -> BounceAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Message")
Either String (Text -> BounceAction)
-> Either String Text -> Either String BounceAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Sender")
instance Prelude.Hashable BounceAction
instance Prelude.NFData BounceAction
instance Core.ToQuery BounceAction where
toQuery :: BounceAction -> QueryString
toQuery BounceAction' {Maybe Text
Text
sender :: Text
message :: Text
smtpReplyCode :: Text
statusCode :: Maybe Text
topicArn :: Maybe Text
$sel:sender:BounceAction' :: BounceAction -> Text
$sel:message:BounceAction' :: BounceAction -> Text
$sel:smtpReplyCode:BounceAction' :: BounceAction -> Text
$sel:statusCode:BounceAction' :: BounceAction -> Maybe Text
$sel:topicArn:BounceAction' :: BounceAction -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"TopicArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
topicArn,
ByteString
"StatusCode" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
statusCode,
ByteString
"SmtpReplyCode" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
smtpReplyCode,
ByteString
"Message" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
message,
ByteString
"Sender" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sender
]