{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.SES.SendBounce
(
SendBounce (..),
newSendBounce,
sendBounce_messageDsn,
sendBounce_explanation,
sendBounce_bounceSenderArn,
sendBounce_originalMessageId,
sendBounce_bounceSender,
sendBounce_bouncedRecipientInfoList,
SendBounceResponse (..),
newSendBounceResponse,
sendBounceResponse_messageId,
sendBounceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SES.Types
data SendBounce = SendBounce'
{
SendBounce -> Maybe MessageDsn
messageDsn :: Prelude.Maybe MessageDsn,
SendBounce -> Maybe Text
explanation :: Prelude.Maybe Prelude.Text,
SendBounce -> Maybe Text
bounceSenderArn :: Prelude.Maybe Prelude.Text,
SendBounce -> Text
originalMessageId :: Prelude.Text,
SendBounce -> Text
bounceSender :: Prelude.Text,
SendBounce -> [BouncedRecipientInfo]
bouncedRecipientInfoList :: [BouncedRecipientInfo]
}
deriving (SendBounce -> SendBounce -> Bool
(SendBounce -> SendBounce -> Bool)
-> (SendBounce -> SendBounce -> Bool) -> Eq SendBounce
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendBounce -> SendBounce -> Bool
$c/= :: SendBounce -> SendBounce -> Bool
== :: SendBounce -> SendBounce -> Bool
$c== :: SendBounce -> SendBounce -> Bool
Prelude.Eq, ReadPrec [SendBounce]
ReadPrec SendBounce
Int -> ReadS SendBounce
ReadS [SendBounce]
(Int -> ReadS SendBounce)
-> ReadS [SendBounce]
-> ReadPrec SendBounce
-> ReadPrec [SendBounce]
-> Read SendBounce
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendBounce]
$creadListPrec :: ReadPrec [SendBounce]
readPrec :: ReadPrec SendBounce
$creadPrec :: ReadPrec SendBounce
readList :: ReadS [SendBounce]
$creadList :: ReadS [SendBounce]
readsPrec :: Int -> ReadS SendBounce
$creadsPrec :: Int -> ReadS SendBounce
Prelude.Read, Int -> SendBounce -> ShowS
[SendBounce] -> ShowS
SendBounce -> String
(Int -> SendBounce -> ShowS)
-> (SendBounce -> String)
-> ([SendBounce] -> ShowS)
-> Show SendBounce
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendBounce] -> ShowS
$cshowList :: [SendBounce] -> ShowS
show :: SendBounce -> String
$cshow :: SendBounce -> String
showsPrec :: Int -> SendBounce -> ShowS
$cshowsPrec :: Int -> SendBounce -> ShowS
Prelude.Show, (forall x. SendBounce -> Rep SendBounce x)
-> (forall x. Rep SendBounce x -> SendBounce) -> Generic SendBounce
forall x. Rep SendBounce x -> SendBounce
forall x. SendBounce -> Rep SendBounce x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendBounce x -> SendBounce
$cfrom :: forall x. SendBounce -> Rep SendBounce x
Prelude.Generic)
newSendBounce ::
Prelude.Text ->
Prelude.Text ->
SendBounce
newSendBounce :: Text -> Text -> SendBounce
newSendBounce Text
pOriginalMessageId_ Text
pBounceSender_ =
SendBounce' :: Maybe MessageDsn
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> [BouncedRecipientInfo]
-> SendBounce
SendBounce'
{ $sel:messageDsn:SendBounce' :: Maybe MessageDsn
messageDsn = Maybe MessageDsn
forall a. Maybe a
Prelude.Nothing,
$sel:explanation:SendBounce' :: Maybe Text
explanation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bounceSenderArn:SendBounce' :: Maybe Text
bounceSenderArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:originalMessageId:SendBounce' :: Text
originalMessageId = Text
pOriginalMessageId_,
$sel:bounceSender:SendBounce' :: Text
bounceSender = Text
pBounceSender_,
$sel:bouncedRecipientInfoList:SendBounce' :: [BouncedRecipientInfo]
bouncedRecipientInfoList = [BouncedRecipientInfo]
forall a. Monoid a => a
Prelude.mempty
}
sendBounce_messageDsn :: Lens.Lens' SendBounce (Prelude.Maybe MessageDsn)
sendBounce_messageDsn :: (Maybe MessageDsn -> f (Maybe MessageDsn))
-> SendBounce -> f SendBounce
sendBounce_messageDsn = (SendBounce -> Maybe MessageDsn)
-> (SendBounce -> Maybe MessageDsn -> SendBounce)
-> Lens SendBounce SendBounce (Maybe MessageDsn) (Maybe MessageDsn)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Maybe MessageDsn
messageDsn :: Maybe MessageDsn
$sel:messageDsn:SendBounce' :: SendBounce -> Maybe MessageDsn
messageDsn} -> Maybe MessageDsn
messageDsn) (\s :: SendBounce
s@SendBounce' {} Maybe MessageDsn
a -> SendBounce
s {$sel:messageDsn:SendBounce' :: Maybe MessageDsn
messageDsn = Maybe MessageDsn
a} :: SendBounce)
sendBounce_explanation :: Lens.Lens' SendBounce (Prelude.Maybe Prelude.Text)
sendBounce_explanation :: (Maybe Text -> f (Maybe Text)) -> SendBounce -> f SendBounce
sendBounce_explanation = (SendBounce -> Maybe Text)
-> (SendBounce -> Maybe Text -> SendBounce)
-> Lens SendBounce SendBounce (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Maybe Text
explanation :: Maybe Text
$sel:explanation:SendBounce' :: SendBounce -> Maybe Text
explanation} -> Maybe Text
explanation) (\s :: SendBounce
s@SendBounce' {} Maybe Text
a -> SendBounce
s {$sel:explanation:SendBounce' :: Maybe Text
explanation = Maybe Text
a} :: SendBounce)
sendBounce_bounceSenderArn :: Lens.Lens' SendBounce (Prelude.Maybe Prelude.Text)
sendBounce_bounceSenderArn :: (Maybe Text -> f (Maybe Text)) -> SendBounce -> f SendBounce
sendBounce_bounceSenderArn = (SendBounce -> Maybe Text)
-> (SendBounce -> Maybe Text -> SendBounce)
-> Lens SendBounce SendBounce (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Maybe Text
bounceSenderArn :: Maybe Text
$sel:bounceSenderArn:SendBounce' :: SendBounce -> Maybe Text
bounceSenderArn} -> Maybe Text
bounceSenderArn) (\s :: SendBounce
s@SendBounce' {} Maybe Text
a -> SendBounce
s {$sel:bounceSenderArn:SendBounce' :: Maybe Text
bounceSenderArn = Maybe Text
a} :: SendBounce)
sendBounce_originalMessageId :: Lens.Lens' SendBounce Prelude.Text
sendBounce_originalMessageId :: (Text -> f Text) -> SendBounce -> f SendBounce
sendBounce_originalMessageId = (SendBounce -> Text)
-> (SendBounce -> Text -> SendBounce)
-> Lens SendBounce SendBounce Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Text
originalMessageId :: Text
$sel:originalMessageId:SendBounce' :: SendBounce -> Text
originalMessageId} -> Text
originalMessageId) (\s :: SendBounce
s@SendBounce' {} Text
a -> SendBounce
s {$sel:originalMessageId:SendBounce' :: Text
originalMessageId = Text
a} :: SendBounce)
sendBounce_bounceSender :: Lens.Lens' SendBounce Prelude.Text
sendBounce_bounceSender :: (Text -> f Text) -> SendBounce -> f SendBounce
sendBounce_bounceSender = (SendBounce -> Text)
-> (SendBounce -> Text -> SendBounce)
-> Lens SendBounce SendBounce Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Text
bounceSender :: Text
$sel:bounceSender:SendBounce' :: SendBounce -> Text
bounceSender} -> Text
bounceSender) (\s :: SendBounce
s@SendBounce' {} Text
a -> SendBounce
s {$sel:bounceSender:SendBounce' :: Text
bounceSender = Text
a} :: SendBounce)
sendBounce_bouncedRecipientInfoList :: Lens.Lens' SendBounce [BouncedRecipientInfo]
sendBounce_bouncedRecipientInfoList :: ([BouncedRecipientInfo] -> f [BouncedRecipientInfo])
-> SendBounce -> f SendBounce
sendBounce_bouncedRecipientInfoList = (SendBounce -> [BouncedRecipientInfo])
-> (SendBounce -> [BouncedRecipientInfo] -> SendBounce)
-> Lens
SendBounce SendBounce [BouncedRecipientInfo] [BouncedRecipientInfo]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {[BouncedRecipientInfo]
bouncedRecipientInfoList :: [BouncedRecipientInfo]
$sel:bouncedRecipientInfoList:SendBounce' :: SendBounce -> [BouncedRecipientInfo]
bouncedRecipientInfoList} -> [BouncedRecipientInfo]
bouncedRecipientInfoList) (\s :: SendBounce
s@SendBounce' {} [BouncedRecipientInfo]
a -> SendBounce
s {$sel:bouncedRecipientInfoList:SendBounce' :: [BouncedRecipientInfo]
bouncedRecipientInfoList = [BouncedRecipientInfo]
a} :: SendBounce) (([BouncedRecipientInfo] -> f [BouncedRecipientInfo])
-> SendBounce -> f SendBounce)
-> (([BouncedRecipientInfo] -> f [BouncedRecipientInfo])
-> [BouncedRecipientInfo] -> f [BouncedRecipientInfo])
-> ([BouncedRecipientInfo] -> f [BouncedRecipientInfo])
-> SendBounce
-> f SendBounce
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BouncedRecipientInfo] -> f [BouncedRecipientInfo])
-> [BouncedRecipientInfo] -> f [BouncedRecipientInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest SendBounce where
type AWSResponse SendBounce = SendBounceResponse
request :: SendBounce -> Request SendBounce
request = Service -> SendBounce -> Request SendBounce
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy SendBounce
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendBounce)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse SendBounce))
-> Logger
-> Service
-> Proxy SendBounce
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendBounce)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"SendBounceResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Int -> SendBounceResponse
SendBounceResponse'
(Maybe Text -> Int -> SendBounceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> SendBounceResponse)
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
"MessageId")
Either String (Int -> SendBounceResponse)
-> Either String Int -> Either String SendBounceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable SendBounce
instance Prelude.NFData SendBounce
instance Core.ToHeaders SendBounce where
toHeaders :: SendBounce -> ResponseHeaders
toHeaders = ResponseHeaders -> SendBounce -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath SendBounce where
toPath :: SendBounce -> ByteString
toPath = ByteString -> SendBounce -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SendBounce where
toQuery :: SendBounce -> QueryString
toQuery SendBounce' {[BouncedRecipientInfo]
Maybe Text
Maybe MessageDsn
Text
bouncedRecipientInfoList :: [BouncedRecipientInfo]
bounceSender :: Text
originalMessageId :: Text
bounceSenderArn :: Maybe Text
explanation :: Maybe Text
messageDsn :: Maybe MessageDsn
$sel:bouncedRecipientInfoList:SendBounce' :: SendBounce -> [BouncedRecipientInfo]
$sel:bounceSender:SendBounce' :: SendBounce -> Text
$sel:originalMessageId:SendBounce' :: SendBounce -> Text
$sel:bounceSenderArn:SendBounce' :: SendBounce -> Maybe Text
$sel:explanation:SendBounce' :: SendBounce -> Maybe Text
$sel:messageDsn:SendBounce' :: SendBounce -> Maybe MessageDsn
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"SendBounce" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
ByteString
"MessageDsn" ByteString -> Maybe MessageDsn -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe MessageDsn
messageDsn,
ByteString
"Explanation" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
explanation,
ByteString
"BounceSenderArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
bounceSenderArn,
ByteString
"OriginalMessageId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
originalMessageId,
ByteString
"BounceSender" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
bounceSender,
ByteString
"BouncedRecipientInfoList"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [BouncedRecipientInfo] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [BouncedRecipientInfo]
bouncedRecipientInfoList
]
data SendBounceResponse = SendBounceResponse'
{
SendBounceResponse -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text,
SendBounceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SendBounceResponse -> SendBounceResponse -> Bool
(SendBounceResponse -> SendBounceResponse -> Bool)
-> (SendBounceResponse -> SendBounceResponse -> Bool)
-> Eq SendBounceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendBounceResponse -> SendBounceResponse -> Bool
$c/= :: SendBounceResponse -> SendBounceResponse -> Bool
== :: SendBounceResponse -> SendBounceResponse -> Bool
$c== :: SendBounceResponse -> SendBounceResponse -> Bool
Prelude.Eq, ReadPrec [SendBounceResponse]
ReadPrec SendBounceResponse
Int -> ReadS SendBounceResponse
ReadS [SendBounceResponse]
(Int -> ReadS SendBounceResponse)
-> ReadS [SendBounceResponse]
-> ReadPrec SendBounceResponse
-> ReadPrec [SendBounceResponse]
-> Read SendBounceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendBounceResponse]
$creadListPrec :: ReadPrec [SendBounceResponse]
readPrec :: ReadPrec SendBounceResponse
$creadPrec :: ReadPrec SendBounceResponse
readList :: ReadS [SendBounceResponse]
$creadList :: ReadS [SendBounceResponse]
readsPrec :: Int -> ReadS SendBounceResponse
$creadsPrec :: Int -> ReadS SendBounceResponse
Prelude.Read, Int -> SendBounceResponse -> ShowS
[SendBounceResponse] -> ShowS
SendBounceResponse -> String
(Int -> SendBounceResponse -> ShowS)
-> (SendBounceResponse -> String)
-> ([SendBounceResponse] -> ShowS)
-> Show SendBounceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendBounceResponse] -> ShowS
$cshowList :: [SendBounceResponse] -> ShowS
show :: SendBounceResponse -> String
$cshow :: SendBounceResponse -> String
showsPrec :: Int -> SendBounceResponse -> ShowS
$cshowsPrec :: Int -> SendBounceResponse -> ShowS
Prelude.Show, (forall x. SendBounceResponse -> Rep SendBounceResponse x)
-> (forall x. Rep SendBounceResponse x -> SendBounceResponse)
-> Generic SendBounceResponse
forall x. Rep SendBounceResponse x -> SendBounceResponse
forall x. SendBounceResponse -> Rep SendBounceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendBounceResponse x -> SendBounceResponse
$cfrom :: forall x. SendBounceResponse -> Rep SendBounceResponse x
Prelude.Generic)
newSendBounceResponse ::
Prelude.Int ->
SendBounceResponse
newSendBounceResponse :: Int -> SendBounceResponse
newSendBounceResponse Int
pHttpStatus_ =
SendBounceResponse' :: Maybe Text -> Int -> SendBounceResponse
SendBounceResponse'
{ $sel:messageId:SendBounceResponse' :: Maybe Text
messageId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SendBounceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
sendBounceResponse_messageId :: Lens.Lens' SendBounceResponse (Prelude.Maybe Prelude.Text)
sendBounceResponse_messageId :: (Maybe Text -> f (Maybe Text))
-> SendBounceResponse -> f SendBounceResponse
sendBounceResponse_messageId = (SendBounceResponse -> Maybe Text)
-> (SendBounceResponse -> Maybe Text -> SendBounceResponse)
-> Lens
SendBounceResponse SendBounceResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounceResponse' {Maybe Text
messageId :: Maybe Text
$sel:messageId:SendBounceResponse' :: SendBounceResponse -> Maybe Text
messageId} -> Maybe Text
messageId) (\s :: SendBounceResponse
s@SendBounceResponse' {} Maybe Text
a -> SendBounceResponse
s {$sel:messageId:SendBounceResponse' :: Maybe Text
messageId = Maybe Text
a} :: SendBounceResponse)
sendBounceResponse_httpStatus :: Lens.Lens' SendBounceResponse Prelude.Int
sendBounceResponse_httpStatus :: (Int -> f Int) -> SendBounceResponse -> f SendBounceResponse
sendBounceResponse_httpStatus = (SendBounceResponse -> Int)
-> (SendBounceResponse -> Int -> SendBounceResponse)
-> Lens SendBounceResponse SendBounceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounceResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendBounceResponse' :: SendBounceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SendBounceResponse
s@SendBounceResponse' {} Int
a -> SendBounceResponse
s {$sel:httpStatus:SendBounceResponse' :: Int
httpStatus = Int
a} :: SendBounceResponse)
instance Prelude.NFData SendBounceResponse