{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SES.SendBounce
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Generates and sends a bounce message to the sender of an email you
-- received through Amazon SES. You can only use this API on an email up to
-- 24 hours after you receive it.
--
-- You cannot use this API to send generic bounces for mail that was not
-- received by Amazon SES.
--
-- For information about receiving email through Amazon SES, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email.html Amazon SES Developer Guide>.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.SendBounce
  ( -- * Creating a Request
    SendBounce (..),
    newSendBounce,

    -- * Request Lenses
    sendBounce_bounceSenderArn,
    sendBounce_explanation,
    sendBounce_messageDsn,
    sendBounce_originalMessageId,
    sendBounce_bounceSender,
    sendBounce_bouncedRecipientInfoList,

    -- * Destructuring the Response
    SendBounceResponse (..),
    newSendBounceResponse,

    -- * Response Lenses
    sendBounceResponse_messageId,
    sendBounceResponse_httpStatus,
  )
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SES.Types

-- | Represents a request to send a bounce message to the sender of an email
-- you received through Amazon SES.
--
-- /See:/ 'newSendBounce' smart constructor.
data SendBounce = SendBounce'
  { -- | This parameter is used only for sending authorization. It is the ARN of
    -- the identity that is associated with the sending authorization policy
    -- that permits you to use the address in the \"From\" header of the
    -- bounce. For more information about sending authorization, see the
    -- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
    SendBounce -> Maybe Text
bounceSenderArn :: Prelude.Maybe Prelude.Text,
    -- | Human-readable text for the bounce message to explain the failure. If
    -- not specified, the text will be auto-generated based on the bounced
    -- recipient information.
    SendBounce -> Maybe Text
explanation :: Prelude.Maybe Prelude.Text,
    -- | Message-related DSN fields. If not specified, Amazon SES will choose the
    -- values.
    SendBounce -> Maybe MessageDsn
messageDsn :: Prelude.Maybe MessageDsn,
    -- | The message ID of the message to be bounced.
    SendBounce -> Text
originalMessageId :: Prelude.Text,
    -- | The address to use in the \"From\" header of the bounce message. This
    -- must be an identity that you have verified with Amazon SES.
    SendBounce -> Text
bounceSender :: Prelude.Text,
    -- | A list of recipients of the bounced message, including the information
    -- required to create the Delivery Status Notifications (DSNs) for the
    -- recipients. You must specify at least one @BouncedRecipientInfo@ in the
    -- list.
    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
$c== :: SendBounce -> SendBounce -> Bool
== :: SendBounce -> SendBounce -> Bool
$c/= :: SendBounce -> SendBounce -> Bool
/= :: 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
$creadsPrec :: Int -> ReadS SendBounce
readsPrec :: Int -> ReadS SendBounce
$creadList :: ReadS [SendBounce]
readList :: ReadS [SendBounce]
$creadPrec :: ReadPrec SendBounce
readPrec :: ReadPrec SendBounce
$creadListPrec :: ReadPrec [SendBounce]
readListPrec :: ReadPrec [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
$cshowsPrec :: Int -> SendBounce -> ShowS
showsPrec :: Int -> SendBounce -> ShowS
$cshow :: SendBounce -> String
show :: SendBounce -> String
$cshowList :: [SendBounce] -> ShowS
showList :: [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
$cfrom :: forall x. SendBounce -> Rep SendBounce x
from :: forall x. SendBounce -> Rep SendBounce x
$cto :: forall x. Rep SendBounce x -> SendBounce
to :: forall x. Rep SendBounce x -> SendBounce
Prelude.Generic)

-- |
-- Create a value of 'SendBounce' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'bounceSenderArn', 'sendBounce_bounceSenderArn' - This parameter is used only for sending authorization. It is the ARN of
-- the identity that is associated with the sending authorization policy
-- that permits you to use the address in the \"From\" header of the
-- bounce. For more information about sending authorization, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
--
-- 'explanation', 'sendBounce_explanation' - Human-readable text for the bounce message to explain the failure. If
-- not specified, the text will be auto-generated based on the bounced
-- recipient information.
--
-- 'messageDsn', 'sendBounce_messageDsn' - Message-related DSN fields. If not specified, Amazon SES will choose the
-- values.
--
-- 'originalMessageId', 'sendBounce_originalMessageId' - The message ID of the message to be bounced.
--
-- 'bounceSender', 'sendBounce_bounceSender' - The address to use in the \"From\" header of the bounce message. This
-- must be an identity that you have verified with Amazon SES.
--
-- 'bouncedRecipientInfoList', 'sendBounce_bouncedRecipientInfoList' - A list of recipients of the bounced message, including the information
-- required to create the Delivery Status Notifications (DSNs) for the
-- recipients. You must specify at least one @BouncedRecipientInfo@ in the
-- list.
newSendBounce ::
  -- | 'originalMessageId'
  Prelude.Text ->
  -- | 'bounceSender'
  Prelude.Text ->
  SendBounce
newSendBounce :: Text -> Text -> SendBounce
newSendBounce Text
pOriginalMessageId_ Text
pBounceSender_ =
  SendBounce'
    { $sel:bounceSenderArn:SendBounce' :: Maybe Text
bounceSenderArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:explanation:SendBounce' :: Maybe Text
explanation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:messageDsn:SendBounce' :: Maybe MessageDsn
messageDsn = Maybe MessageDsn
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
    }

-- | This parameter is used only for sending authorization. It is the ARN of
-- the identity that is associated with the sending authorization policy
-- that permits you to use the address in the \"From\" header of the
-- bounce. For more information about sending authorization, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
sendBounce_bounceSenderArn :: Lens.Lens' SendBounce (Prelude.Maybe Prelude.Text)
sendBounce_bounceSenderArn :: Lens' SendBounce (Maybe Text)
sendBounce_bounceSenderArn = (SendBounce -> Maybe Text)
-> (SendBounce -> Maybe Text -> SendBounce)
-> Lens' SendBounce (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Maybe Text
$sel:bounceSenderArn:SendBounce' :: SendBounce -> Maybe Text
bounceSenderArn :: Maybe Text
bounceSenderArn} -> Maybe Text
bounceSenderArn) (\s :: SendBounce
s@SendBounce' {} Maybe Text
a -> SendBounce
s {bounceSenderArn = a} :: SendBounce)

-- | Human-readable text for the bounce message to explain the failure. If
-- not specified, the text will be auto-generated based on the bounced
-- recipient information.
sendBounce_explanation :: Lens.Lens' SendBounce (Prelude.Maybe Prelude.Text)
sendBounce_explanation :: Lens' SendBounce (Maybe Text)
sendBounce_explanation = (SendBounce -> Maybe Text)
-> (SendBounce -> Maybe Text -> SendBounce)
-> Lens' SendBounce (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Maybe Text
$sel:explanation:SendBounce' :: SendBounce -> Maybe Text
explanation :: Maybe Text
explanation} -> Maybe Text
explanation) (\s :: SendBounce
s@SendBounce' {} Maybe Text
a -> SendBounce
s {explanation = a} :: SendBounce)

-- | Message-related DSN fields. If not specified, Amazon SES will choose the
-- values.
sendBounce_messageDsn :: Lens.Lens' SendBounce (Prelude.Maybe MessageDsn)
sendBounce_messageDsn :: Lens' SendBounce (Maybe MessageDsn)
sendBounce_messageDsn = (SendBounce -> Maybe MessageDsn)
-> (SendBounce -> Maybe MessageDsn -> SendBounce)
-> Lens' SendBounce (Maybe MessageDsn)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Maybe MessageDsn
$sel:messageDsn:SendBounce' :: SendBounce -> Maybe MessageDsn
messageDsn :: Maybe MessageDsn
messageDsn} -> Maybe MessageDsn
messageDsn) (\s :: SendBounce
s@SendBounce' {} Maybe MessageDsn
a -> SendBounce
s {messageDsn = a} :: SendBounce)

-- | The message ID of the message to be bounced.
sendBounce_originalMessageId :: Lens.Lens' SendBounce Prelude.Text
sendBounce_originalMessageId :: Lens' SendBounce Text
sendBounce_originalMessageId = (SendBounce -> Text)
-> (SendBounce -> Text -> SendBounce) -> Lens' SendBounce Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Text
$sel:originalMessageId:SendBounce' :: SendBounce -> Text
originalMessageId :: Text
originalMessageId} -> Text
originalMessageId) (\s :: SendBounce
s@SendBounce' {} Text
a -> SendBounce
s {originalMessageId = a} :: SendBounce)

-- | The address to use in the \"From\" header of the bounce message. This
-- must be an identity that you have verified with Amazon SES.
sendBounce_bounceSender :: Lens.Lens' SendBounce Prelude.Text
sendBounce_bounceSender :: Lens' SendBounce Text
sendBounce_bounceSender = (SendBounce -> Text)
-> (SendBounce -> Text -> SendBounce) -> Lens' SendBounce Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {Text
$sel:bounceSender:SendBounce' :: SendBounce -> Text
bounceSender :: Text
bounceSender} -> Text
bounceSender) (\s :: SendBounce
s@SendBounce' {} Text
a -> SendBounce
s {bounceSender = a} :: SendBounce)

-- | A list of recipients of the bounced message, including the information
-- required to create the Delivery Status Notifications (DSNs) for the
-- recipients. You must specify at least one @BouncedRecipientInfo@ in the
-- list.
sendBounce_bouncedRecipientInfoList :: Lens.Lens' SendBounce [BouncedRecipientInfo]
sendBounce_bouncedRecipientInfoList :: Lens' SendBounce [BouncedRecipientInfo]
sendBounce_bouncedRecipientInfoList = (SendBounce -> [BouncedRecipientInfo])
-> (SendBounce -> [BouncedRecipientInfo] -> SendBounce)
-> Lens' SendBounce [BouncedRecipientInfo]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounce' {[BouncedRecipientInfo]
$sel:bouncedRecipientInfoList:SendBounce' :: SendBounce -> [BouncedRecipientInfo]
bouncedRecipientInfoList :: [BouncedRecipientInfo]
bouncedRecipientInfoList} -> [BouncedRecipientInfo]
bouncedRecipientInfoList) (\s :: SendBounce
s@SendBounce' {} [BouncedRecipientInfo]
a -> SendBounce
s {bouncedRecipientInfoList = 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
Iso
  [BouncedRecipientInfo]
  [BouncedRecipientInfo]
  [BouncedRecipientInfo]
  [BouncedRecipientInfo]
Lens.coerced

instance Core.AWSRequest SendBounce where
  type AWSResponse SendBounce = SendBounceResponse
  request :: (Service -> Service) -> SendBounce -> Request SendBounce
request Service -> Service
overrides =
    Service -> SendBounce -> Request SendBounce
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SendBounce
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendBounce)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse SendBounce))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SendBounce
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendBounce)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> 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)
Data..@? Text
"MessageId")
            Either String (Int -> SendBounceResponse)
-> Either String Int -> Either String SendBounceResponse
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall a. a -> Either String a
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 where
  hashWithSalt :: Int -> SendBounce -> Int
hashWithSalt Int
_salt SendBounce' {[BouncedRecipientInfo]
Maybe Text
Maybe MessageDsn
Text
$sel:bounceSenderArn:SendBounce' :: SendBounce -> Maybe Text
$sel:explanation:SendBounce' :: SendBounce -> Maybe Text
$sel:messageDsn:SendBounce' :: SendBounce -> Maybe MessageDsn
$sel:originalMessageId:SendBounce' :: SendBounce -> Text
$sel:bounceSender:SendBounce' :: SendBounce -> Text
$sel:bouncedRecipientInfoList:SendBounce' :: SendBounce -> [BouncedRecipientInfo]
bounceSenderArn :: Maybe Text
explanation :: Maybe Text
messageDsn :: Maybe MessageDsn
originalMessageId :: Text
bounceSender :: Text
bouncedRecipientInfoList :: [BouncedRecipientInfo]
..} =
    Int
_salt
      Int -> Maybe Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
bounceSenderArn
      Int -> Maybe Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
explanation
      Int -> Maybe MessageDsn -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MessageDsn
messageDsn
      Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
originalMessageId
      Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bounceSender
      Int -> [BouncedRecipientInfo] -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [BouncedRecipientInfo]
bouncedRecipientInfoList

instance Prelude.NFData SendBounce where
  rnf :: SendBounce -> ()
rnf SendBounce' {[BouncedRecipientInfo]
Maybe Text
Maybe MessageDsn
Text
$sel:bounceSenderArn:SendBounce' :: SendBounce -> Maybe Text
$sel:explanation:SendBounce' :: SendBounce -> Maybe Text
$sel:messageDsn:SendBounce' :: SendBounce -> Maybe MessageDsn
$sel:originalMessageId:SendBounce' :: SendBounce -> Text
$sel:bounceSender:SendBounce' :: SendBounce -> Text
$sel:bouncedRecipientInfoList:SendBounce' :: SendBounce -> [BouncedRecipientInfo]
bounceSenderArn :: Maybe Text
explanation :: Maybe Text
messageDsn :: Maybe MessageDsn
originalMessageId :: Text
bounceSender :: Text
bouncedRecipientInfoList :: [BouncedRecipientInfo]
..} =
    Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
bounceSenderArn
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
explanation
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe MessageDsn -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe MessageDsn
messageDsn
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Text
originalMessageId
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Text
bounceSender
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` [BouncedRecipientInfo] -> ()
forall a. NFData a => a -> ()
Prelude.rnf [BouncedRecipientInfo]
bouncedRecipientInfoList

instance Data.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 Data.ToPath SendBounce where
  toPath :: SendBounce -> ByteString
toPath = ByteString -> SendBounce -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery SendBounce where
  toQuery :: SendBounce -> QueryString
toQuery SendBounce' {[BouncedRecipientInfo]
Maybe Text
Maybe MessageDsn
Text
$sel:bounceSenderArn:SendBounce' :: SendBounce -> Maybe Text
$sel:explanation:SendBounce' :: SendBounce -> Maybe Text
$sel:messageDsn:SendBounce' :: SendBounce -> Maybe MessageDsn
$sel:originalMessageId:SendBounce' :: SendBounce -> Text
$sel:bounceSender:SendBounce' :: SendBounce -> Text
$sel:bouncedRecipientInfoList:SendBounce' :: SendBounce -> [BouncedRecipientInfo]
bounceSenderArn :: Maybe Text
explanation :: Maybe Text
messageDsn :: Maybe MessageDsn
originalMessageId :: Text
bounceSender :: Text
bouncedRecipientInfoList :: [BouncedRecipientInfo]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"SendBounce" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"BounceSenderArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
bounceSenderArn,
        ByteString
"Explanation" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
explanation,
        ByteString
"MessageDsn" ByteString -> Maybe MessageDsn -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe MessageDsn
messageDsn,
        ByteString
"OriginalMessageId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
originalMessageId,
        ByteString
"BounceSender" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
bounceSender,
        ByteString
"BouncedRecipientInfoList"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ByteString -> [BouncedRecipientInfo] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" [BouncedRecipientInfo]
bouncedRecipientInfoList
      ]

-- | Represents a unique message ID.
--
-- /See:/ 'newSendBounceResponse' smart constructor.
data SendBounceResponse = SendBounceResponse'
  { -- | The message ID of the bounce message.
    SendBounceResponse -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    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
$c== :: SendBounceResponse -> SendBounceResponse -> Bool
== :: SendBounceResponse -> SendBounceResponse -> Bool
$c/= :: SendBounceResponse -> SendBounceResponse -> Bool
/= :: 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
$creadsPrec :: Int -> ReadS SendBounceResponse
readsPrec :: Int -> ReadS SendBounceResponse
$creadList :: ReadS [SendBounceResponse]
readList :: ReadS [SendBounceResponse]
$creadPrec :: ReadPrec SendBounceResponse
readPrec :: ReadPrec SendBounceResponse
$creadListPrec :: ReadPrec [SendBounceResponse]
readListPrec :: ReadPrec [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
$cshowsPrec :: Int -> SendBounceResponse -> ShowS
showsPrec :: Int -> SendBounceResponse -> ShowS
$cshow :: SendBounceResponse -> String
show :: SendBounceResponse -> String
$cshowList :: [SendBounceResponse] -> ShowS
showList :: [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
$cfrom :: forall x. SendBounceResponse -> Rep SendBounceResponse x
from :: forall x. SendBounceResponse -> Rep SendBounceResponse x
$cto :: forall x. Rep SendBounceResponse x -> SendBounceResponse
to :: forall x. Rep SendBounceResponse x -> SendBounceResponse
Prelude.Generic)

-- |
-- Create a value of 'SendBounceResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'messageId', 'sendBounceResponse_messageId' - The message ID of the bounce message.
--
-- 'httpStatus', 'sendBounceResponse_httpStatus' - The response's http status code.
newSendBounceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SendBounceResponse
newSendBounceResponse :: Int -> SendBounceResponse
newSendBounceResponse Int
pHttpStatus_ =
  SendBounceResponse'
    { $sel:messageId:SendBounceResponse' :: Maybe Text
messageId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SendBounceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The message ID of the bounce message.
sendBounceResponse_messageId :: Lens.Lens' SendBounceResponse (Prelude.Maybe Prelude.Text)
sendBounceResponse_messageId :: Lens' SendBounceResponse (Maybe Text)
sendBounceResponse_messageId = (SendBounceResponse -> Maybe Text)
-> (SendBounceResponse -> Maybe Text -> SendBounceResponse)
-> Lens' SendBounceResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounceResponse' {Maybe Text
$sel:messageId:SendBounceResponse' :: SendBounceResponse -> Maybe Text
messageId :: Maybe Text
messageId} -> Maybe Text
messageId) (\s :: SendBounceResponse
s@SendBounceResponse' {} Maybe Text
a -> SendBounceResponse
s {messageId = a} :: SendBounceResponse)

-- | The response's http status code.
sendBounceResponse_httpStatus :: Lens.Lens' SendBounceResponse Prelude.Int
sendBounceResponse_httpStatus :: Lens' SendBounceResponse Int
sendBounceResponse_httpStatus = (SendBounceResponse -> Int)
-> (SendBounceResponse -> Int -> SendBounceResponse)
-> Lens' SendBounceResponse Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBounceResponse' {Int
$sel:httpStatus:SendBounceResponse' :: SendBounceResponse -> Int
httpStatus :: Int
httpStatus} -> Int
httpStatus) (\s :: SendBounceResponse
s@SendBounceResponse' {} Int
a -> SendBounceResponse
s {httpStatus = a} :: SendBounceResponse)

instance Prelude.NFData SendBounceResponse where
  rnf :: SendBounceResponse -> ()
rnf SendBounceResponse' {Int
Maybe Text
$sel:messageId:SendBounceResponse' :: SendBounceResponse -> Maybe Text
$sel:httpStatus:SendBounceResponse' :: SendBounceResponse -> Int
messageId :: Maybe Text
httpStatus :: Int
..} =
    Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messageId
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus