{-# 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.SESV2.SendBulkEmail
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Composes an email message to multiple destinations.
module Amazonka.SESV2.SendBulkEmail
  ( -- * Creating a Request
    SendBulkEmail (..),
    newSendBulkEmail,

    -- * Request Lenses
    sendBulkEmail_configurationSetName,
    sendBulkEmail_defaultEmailTags,
    sendBulkEmail_feedbackForwardingEmailAddress,
    sendBulkEmail_feedbackForwardingEmailAddressIdentityArn,
    sendBulkEmail_fromEmailAddress,
    sendBulkEmail_fromEmailAddressIdentityArn,
    sendBulkEmail_replyToAddresses,
    sendBulkEmail_defaultContent,
    sendBulkEmail_bulkEmailEntries,

    -- * Destructuring the Response
    SendBulkEmailResponse (..),
    newSendBulkEmailResponse,

    -- * Response Lenses
    sendBulkEmailResponse_httpStatus,
    sendBulkEmailResponse_bulkEmailEntryResults,
  )
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.SESV2.Types

-- | Represents a request to send email messages to multiple destinations
-- using Amazon SES. For more information, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-personalized-email-api.html Amazon SES Developer Guide>.
--
-- /See:/ 'newSendBulkEmail' smart constructor.
data SendBulkEmail = SendBulkEmail'
  { -- | The name of the configuration set to use when sending the email.
    SendBulkEmail -> Maybe Text
configurationSetName :: Prelude.Maybe Prelude.Text,
    -- | A list of tags, in the form of name\/value pairs, to apply to an email
    -- that you send using the @SendEmail@ operation. Tags correspond to
    -- characteristics of the email that you define, so that you can publish
    -- email sending events.
    SendBulkEmail -> Maybe [MessageTag]
defaultEmailTags :: Prelude.Maybe [MessageTag],
    -- | The address that you want bounce and complaint notifications to be sent
    -- to.
    SendBulkEmail -> Maybe Text
feedbackForwardingEmailAddress :: Prelude.Maybe Prelude.Text,
    -- | 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 email address specified in the
    -- @FeedbackForwardingEmailAddress@ parameter.
    --
    -- For example, if the owner of example.com (which has ARN
    -- arn:aws:ses:us-east-1:123456789012:identity\/example.com) attaches a
    -- policy to it that authorizes you to use feedback\@example.com, then you
    -- would specify the @FeedbackForwardingEmailAddressIdentityArn@ to be
    -- arn:aws:ses:us-east-1:123456789012:identity\/example.com, and the
    -- @FeedbackForwardingEmailAddress@ to be feedback\@example.com.
    --
    -- For more information about sending authorization, see the
    -- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
    SendBulkEmail -> Maybe Text
feedbackForwardingEmailAddressIdentityArn :: Prelude.Maybe Prelude.Text,
    -- | The email address to use as the \"From\" address for the email. The
    -- address that you specify has to be verified.
    SendBulkEmail -> Maybe Text
fromEmailAddress :: Prelude.Maybe Prelude.Text,
    -- | 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 email address specified in the
    -- @FromEmailAddress@ parameter.
    --
    -- For example, if the owner of example.com (which has ARN
    -- arn:aws:ses:us-east-1:123456789012:identity\/example.com) attaches a
    -- policy to it that authorizes you to use sender\@example.com, then you
    -- would specify the @FromEmailAddressIdentityArn@ to be
    -- arn:aws:ses:us-east-1:123456789012:identity\/example.com, and the
    -- @FromEmailAddress@ to be sender\@example.com.
    --
    -- For more information about sending authorization, see the
    -- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
    SendBulkEmail -> Maybe Text
fromEmailAddressIdentityArn :: Prelude.Maybe Prelude.Text,
    -- | The \"Reply-to\" email addresses for the message. When the recipient
    -- replies to the message, each Reply-to address receives the reply.
    SendBulkEmail -> Maybe [Text]
replyToAddresses :: Prelude.Maybe [Prelude.Text],
    -- | An object that contains the body of the message. You can specify a
    -- template message.
    SendBulkEmail -> BulkEmailContent
defaultContent :: BulkEmailContent,
    -- | The list of bulk email entry objects.
    SendBulkEmail -> [BulkEmailEntry]
bulkEmailEntries :: [BulkEmailEntry]
  }
  deriving (SendBulkEmail -> SendBulkEmail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendBulkEmail -> SendBulkEmail -> Bool
$c/= :: SendBulkEmail -> SendBulkEmail -> Bool
== :: SendBulkEmail -> SendBulkEmail -> Bool
$c== :: SendBulkEmail -> SendBulkEmail -> Bool
Prelude.Eq, ReadPrec [SendBulkEmail]
ReadPrec SendBulkEmail
Int -> ReadS SendBulkEmail
ReadS [SendBulkEmail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendBulkEmail]
$creadListPrec :: ReadPrec [SendBulkEmail]
readPrec :: ReadPrec SendBulkEmail
$creadPrec :: ReadPrec SendBulkEmail
readList :: ReadS [SendBulkEmail]
$creadList :: ReadS [SendBulkEmail]
readsPrec :: Int -> ReadS SendBulkEmail
$creadsPrec :: Int -> ReadS SendBulkEmail
Prelude.Read, Int -> SendBulkEmail -> ShowS
[SendBulkEmail] -> ShowS
SendBulkEmail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendBulkEmail] -> ShowS
$cshowList :: [SendBulkEmail] -> ShowS
show :: SendBulkEmail -> String
$cshow :: SendBulkEmail -> String
showsPrec :: Int -> SendBulkEmail -> ShowS
$cshowsPrec :: Int -> SendBulkEmail -> ShowS
Prelude.Show, forall x. Rep SendBulkEmail x -> SendBulkEmail
forall x. SendBulkEmail -> Rep SendBulkEmail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendBulkEmail x -> SendBulkEmail
$cfrom :: forall x. SendBulkEmail -> Rep SendBulkEmail x
Prelude.Generic)

-- |
-- Create a value of 'SendBulkEmail' 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:
--
-- 'configurationSetName', 'sendBulkEmail_configurationSetName' - The name of the configuration set to use when sending the email.
--
-- 'defaultEmailTags', 'sendBulkEmail_defaultEmailTags' - A list of tags, in the form of name\/value pairs, to apply to an email
-- that you send using the @SendEmail@ operation. Tags correspond to
-- characteristics of the email that you define, so that you can publish
-- email sending events.
--
-- 'feedbackForwardingEmailAddress', 'sendBulkEmail_feedbackForwardingEmailAddress' - The address that you want bounce and complaint notifications to be sent
-- to.
--
-- 'feedbackForwardingEmailAddressIdentityArn', 'sendBulkEmail_feedbackForwardingEmailAddressIdentityArn' - 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 email address specified in the
-- @FeedbackForwardingEmailAddress@ parameter.
--
-- For example, if the owner of example.com (which has ARN
-- arn:aws:ses:us-east-1:123456789012:identity\/example.com) attaches a
-- policy to it that authorizes you to use feedback\@example.com, then you
-- would specify the @FeedbackForwardingEmailAddressIdentityArn@ to be
-- arn:aws:ses:us-east-1:123456789012:identity\/example.com, and the
-- @FeedbackForwardingEmailAddress@ to be feedback\@example.com.
--
-- For more information about sending authorization, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
--
-- 'fromEmailAddress', 'sendBulkEmail_fromEmailAddress' - The email address to use as the \"From\" address for the email. The
-- address that you specify has to be verified.
--
-- 'fromEmailAddressIdentityArn', 'sendBulkEmail_fromEmailAddressIdentityArn' - 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 email address specified in the
-- @FromEmailAddress@ parameter.
--
-- For example, if the owner of example.com (which has ARN
-- arn:aws:ses:us-east-1:123456789012:identity\/example.com) attaches a
-- policy to it that authorizes you to use sender\@example.com, then you
-- would specify the @FromEmailAddressIdentityArn@ to be
-- arn:aws:ses:us-east-1:123456789012:identity\/example.com, and the
-- @FromEmailAddress@ to be sender\@example.com.
--
-- For more information about sending authorization, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
--
-- 'replyToAddresses', 'sendBulkEmail_replyToAddresses' - The \"Reply-to\" email addresses for the message. When the recipient
-- replies to the message, each Reply-to address receives the reply.
--
-- 'defaultContent', 'sendBulkEmail_defaultContent' - An object that contains the body of the message. You can specify a
-- template message.
--
-- 'bulkEmailEntries', 'sendBulkEmail_bulkEmailEntries' - The list of bulk email entry objects.
newSendBulkEmail ::
  -- | 'defaultContent'
  BulkEmailContent ->
  SendBulkEmail
newSendBulkEmail :: BulkEmailContent -> SendBulkEmail
newSendBulkEmail BulkEmailContent
pDefaultContent_ =
  SendBulkEmail'
    { $sel:configurationSetName:SendBulkEmail' :: Maybe Text
configurationSetName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:defaultEmailTags:SendBulkEmail' :: Maybe [MessageTag]
defaultEmailTags = forall a. Maybe a
Prelude.Nothing,
      $sel:feedbackForwardingEmailAddress:SendBulkEmail' :: Maybe Text
feedbackForwardingEmailAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:feedbackForwardingEmailAddressIdentityArn:SendBulkEmail' :: Maybe Text
feedbackForwardingEmailAddressIdentityArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:fromEmailAddress:SendBulkEmail' :: Maybe Text
fromEmailAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:fromEmailAddressIdentityArn:SendBulkEmail' :: Maybe Text
fromEmailAddressIdentityArn = forall a. Maybe a
Prelude.Nothing,
      $sel:replyToAddresses:SendBulkEmail' :: Maybe [Text]
replyToAddresses = forall a. Maybe a
Prelude.Nothing,
      $sel:defaultContent:SendBulkEmail' :: BulkEmailContent
defaultContent = BulkEmailContent
pDefaultContent_,
      $sel:bulkEmailEntries:SendBulkEmail' :: [BulkEmailEntry]
bulkEmailEntries = forall a. Monoid a => a
Prelude.mempty
    }

-- | The name of the configuration set to use when sending the email.
sendBulkEmail_configurationSetName :: Lens.Lens' SendBulkEmail (Prelude.Maybe Prelude.Text)
sendBulkEmail_configurationSetName :: Lens' SendBulkEmail (Maybe Text)
sendBulkEmail_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {Maybe Text
configurationSetName :: Maybe Text
$sel:configurationSetName:SendBulkEmail' :: SendBulkEmail -> Maybe Text
configurationSetName} -> Maybe Text
configurationSetName) (\s :: SendBulkEmail
s@SendBulkEmail' {} Maybe Text
a -> SendBulkEmail
s {$sel:configurationSetName:SendBulkEmail' :: Maybe Text
configurationSetName = Maybe Text
a} :: SendBulkEmail)

-- | A list of tags, in the form of name\/value pairs, to apply to an email
-- that you send using the @SendEmail@ operation. Tags correspond to
-- characteristics of the email that you define, so that you can publish
-- email sending events.
sendBulkEmail_defaultEmailTags :: Lens.Lens' SendBulkEmail (Prelude.Maybe [MessageTag])
sendBulkEmail_defaultEmailTags :: Lens' SendBulkEmail (Maybe [MessageTag])
sendBulkEmail_defaultEmailTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {Maybe [MessageTag]
defaultEmailTags :: Maybe [MessageTag]
$sel:defaultEmailTags:SendBulkEmail' :: SendBulkEmail -> Maybe [MessageTag]
defaultEmailTags} -> Maybe [MessageTag]
defaultEmailTags) (\s :: SendBulkEmail
s@SendBulkEmail' {} Maybe [MessageTag]
a -> SendBulkEmail
s {$sel:defaultEmailTags:SendBulkEmail' :: Maybe [MessageTag]
defaultEmailTags = Maybe [MessageTag]
a} :: SendBulkEmail) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The address that you want bounce and complaint notifications to be sent
-- to.
sendBulkEmail_feedbackForwardingEmailAddress :: Lens.Lens' SendBulkEmail (Prelude.Maybe Prelude.Text)
sendBulkEmail_feedbackForwardingEmailAddress :: Lens' SendBulkEmail (Maybe Text)
sendBulkEmail_feedbackForwardingEmailAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {Maybe Text
feedbackForwardingEmailAddress :: Maybe Text
$sel:feedbackForwardingEmailAddress:SendBulkEmail' :: SendBulkEmail -> Maybe Text
feedbackForwardingEmailAddress} -> Maybe Text
feedbackForwardingEmailAddress) (\s :: SendBulkEmail
s@SendBulkEmail' {} Maybe Text
a -> SendBulkEmail
s {$sel:feedbackForwardingEmailAddress:SendBulkEmail' :: Maybe Text
feedbackForwardingEmailAddress = Maybe Text
a} :: SendBulkEmail)

-- | 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 email address specified in the
-- @FeedbackForwardingEmailAddress@ parameter.
--
-- For example, if the owner of example.com (which has ARN
-- arn:aws:ses:us-east-1:123456789012:identity\/example.com) attaches a
-- policy to it that authorizes you to use feedback\@example.com, then you
-- would specify the @FeedbackForwardingEmailAddressIdentityArn@ to be
-- arn:aws:ses:us-east-1:123456789012:identity\/example.com, and the
-- @FeedbackForwardingEmailAddress@ to be feedback\@example.com.
--
-- For more information about sending authorization, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
sendBulkEmail_feedbackForwardingEmailAddressIdentityArn :: Lens.Lens' SendBulkEmail (Prelude.Maybe Prelude.Text)
sendBulkEmail_feedbackForwardingEmailAddressIdentityArn :: Lens' SendBulkEmail (Maybe Text)
sendBulkEmail_feedbackForwardingEmailAddressIdentityArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {Maybe Text
feedbackForwardingEmailAddressIdentityArn :: Maybe Text
$sel:feedbackForwardingEmailAddressIdentityArn:SendBulkEmail' :: SendBulkEmail -> Maybe Text
feedbackForwardingEmailAddressIdentityArn} -> Maybe Text
feedbackForwardingEmailAddressIdentityArn) (\s :: SendBulkEmail
s@SendBulkEmail' {} Maybe Text
a -> SendBulkEmail
s {$sel:feedbackForwardingEmailAddressIdentityArn:SendBulkEmail' :: Maybe Text
feedbackForwardingEmailAddressIdentityArn = Maybe Text
a} :: SendBulkEmail)

-- | The email address to use as the \"From\" address for the email. The
-- address that you specify has to be verified.
sendBulkEmail_fromEmailAddress :: Lens.Lens' SendBulkEmail (Prelude.Maybe Prelude.Text)
sendBulkEmail_fromEmailAddress :: Lens' SendBulkEmail (Maybe Text)
sendBulkEmail_fromEmailAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {Maybe Text
fromEmailAddress :: Maybe Text
$sel:fromEmailAddress:SendBulkEmail' :: SendBulkEmail -> Maybe Text
fromEmailAddress} -> Maybe Text
fromEmailAddress) (\s :: SendBulkEmail
s@SendBulkEmail' {} Maybe Text
a -> SendBulkEmail
s {$sel:fromEmailAddress:SendBulkEmail' :: Maybe Text
fromEmailAddress = Maybe Text
a} :: SendBulkEmail)

-- | 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 email address specified in the
-- @FromEmailAddress@ parameter.
--
-- For example, if the owner of example.com (which has ARN
-- arn:aws:ses:us-east-1:123456789012:identity\/example.com) attaches a
-- policy to it that authorizes you to use sender\@example.com, then you
-- would specify the @FromEmailAddressIdentityArn@ to be
-- arn:aws:ses:us-east-1:123456789012:identity\/example.com, and the
-- @FromEmailAddress@ to be sender\@example.com.
--
-- For more information about sending authorization, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html Amazon SES Developer Guide>.
sendBulkEmail_fromEmailAddressIdentityArn :: Lens.Lens' SendBulkEmail (Prelude.Maybe Prelude.Text)
sendBulkEmail_fromEmailAddressIdentityArn :: Lens' SendBulkEmail (Maybe Text)
sendBulkEmail_fromEmailAddressIdentityArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {Maybe Text
fromEmailAddressIdentityArn :: Maybe Text
$sel:fromEmailAddressIdentityArn:SendBulkEmail' :: SendBulkEmail -> Maybe Text
fromEmailAddressIdentityArn} -> Maybe Text
fromEmailAddressIdentityArn) (\s :: SendBulkEmail
s@SendBulkEmail' {} Maybe Text
a -> SendBulkEmail
s {$sel:fromEmailAddressIdentityArn:SendBulkEmail' :: Maybe Text
fromEmailAddressIdentityArn = Maybe Text
a} :: SendBulkEmail)

-- | The \"Reply-to\" email addresses for the message. When the recipient
-- replies to the message, each Reply-to address receives the reply.
sendBulkEmail_replyToAddresses :: Lens.Lens' SendBulkEmail (Prelude.Maybe [Prelude.Text])
sendBulkEmail_replyToAddresses :: Lens' SendBulkEmail (Maybe [Text])
sendBulkEmail_replyToAddresses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {Maybe [Text]
replyToAddresses :: Maybe [Text]
$sel:replyToAddresses:SendBulkEmail' :: SendBulkEmail -> Maybe [Text]
replyToAddresses} -> Maybe [Text]
replyToAddresses) (\s :: SendBulkEmail
s@SendBulkEmail' {} Maybe [Text]
a -> SendBulkEmail
s {$sel:replyToAddresses:SendBulkEmail' :: Maybe [Text]
replyToAddresses = Maybe [Text]
a} :: SendBulkEmail) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An object that contains the body of the message. You can specify a
-- template message.
sendBulkEmail_defaultContent :: Lens.Lens' SendBulkEmail BulkEmailContent
sendBulkEmail_defaultContent :: Lens' SendBulkEmail BulkEmailContent
sendBulkEmail_defaultContent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {BulkEmailContent
defaultContent :: BulkEmailContent
$sel:defaultContent:SendBulkEmail' :: SendBulkEmail -> BulkEmailContent
defaultContent} -> BulkEmailContent
defaultContent) (\s :: SendBulkEmail
s@SendBulkEmail' {} BulkEmailContent
a -> SendBulkEmail
s {$sel:defaultContent:SendBulkEmail' :: BulkEmailContent
defaultContent = BulkEmailContent
a} :: SendBulkEmail)

-- | The list of bulk email entry objects.
sendBulkEmail_bulkEmailEntries :: Lens.Lens' SendBulkEmail [BulkEmailEntry]
sendBulkEmail_bulkEmailEntries :: Lens' SendBulkEmail [BulkEmailEntry]
sendBulkEmail_bulkEmailEntries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmail' {[BulkEmailEntry]
bulkEmailEntries :: [BulkEmailEntry]
$sel:bulkEmailEntries:SendBulkEmail' :: SendBulkEmail -> [BulkEmailEntry]
bulkEmailEntries} -> [BulkEmailEntry]
bulkEmailEntries) (\s :: SendBulkEmail
s@SendBulkEmail' {} [BulkEmailEntry]
a -> SendBulkEmail
s {$sel:bulkEmailEntries:SendBulkEmail' :: [BulkEmailEntry]
bulkEmailEntries = [BulkEmailEntry]
a} :: SendBulkEmail) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest SendBulkEmail where
  type
    AWSResponse SendBulkEmail =
      SendBulkEmailResponse
  request :: (Service -> Service) -> SendBulkEmail -> Request SendBulkEmail
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SendBulkEmail
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendBulkEmail)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> [BulkEmailEntryResult] -> SendBulkEmailResponse
SendBulkEmailResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"BulkEmailEntryResults"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable SendBulkEmail where
  hashWithSalt :: Int -> SendBulkEmail -> Int
hashWithSalt Int
_salt SendBulkEmail' {[BulkEmailEntry]
Maybe [Text]
Maybe [MessageTag]
Maybe Text
BulkEmailContent
bulkEmailEntries :: [BulkEmailEntry]
defaultContent :: BulkEmailContent
replyToAddresses :: Maybe [Text]
fromEmailAddressIdentityArn :: Maybe Text
fromEmailAddress :: Maybe Text
feedbackForwardingEmailAddressIdentityArn :: Maybe Text
feedbackForwardingEmailAddress :: Maybe Text
defaultEmailTags :: Maybe [MessageTag]
configurationSetName :: Maybe Text
$sel:bulkEmailEntries:SendBulkEmail' :: SendBulkEmail -> [BulkEmailEntry]
$sel:defaultContent:SendBulkEmail' :: SendBulkEmail -> BulkEmailContent
$sel:replyToAddresses:SendBulkEmail' :: SendBulkEmail -> Maybe [Text]
$sel:fromEmailAddressIdentityArn:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:fromEmailAddress:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:feedbackForwardingEmailAddressIdentityArn:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:feedbackForwardingEmailAddress:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:defaultEmailTags:SendBulkEmail' :: SendBulkEmail -> Maybe [MessageTag]
$sel:configurationSetName:SendBulkEmail' :: SendBulkEmail -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configurationSetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MessageTag]
defaultEmailTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
feedbackForwardingEmailAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
feedbackForwardingEmailAddressIdentityArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fromEmailAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fromEmailAddressIdentityArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
replyToAddresses
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BulkEmailContent
defaultContent
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [BulkEmailEntry]
bulkEmailEntries

instance Prelude.NFData SendBulkEmail where
  rnf :: SendBulkEmail -> ()
rnf SendBulkEmail' {[BulkEmailEntry]
Maybe [Text]
Maybe [MessageTag]
Maybe Text
BulkEmailContent
bulkEmailEntries :: [BulkEmailEntry]
defaultContent :: BulkEmailContent
replyToAddresses :: Maybe [Text]
fromEmailAddressIdentityArn :: Maybe Text
fromEmailAddress :: Maybe Text
feedbackForwardingEmailAddressIdentityArn :: Maybe Text
feedbackForwardingEmailAddress :: Maybe Text
defaultEmailTags :: Maybe [MessageTag]
configurationSetName :: Maybe Text
$sel:bulkEmailEntries:SendBulkEmail' :: SendBulkEmail -> [BulkEmailEntry]
$sel:defaultContent:SendBulkEmail' :: SendBulkEmail -> BulkEmailContent
$sel:replyToAddresses:SendBulkEmail' :: SendBulkEmail -> Maybe [Text]
$sel:fromEmailAddressIdentityArn:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:fromEmailAddress:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:feedbackForwardingEmailAddressIdentityArn:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:feedbackForwardingEmailAddress:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:defaultEmailTags:SendBulkEmail' :: SendBulkEmail -> Maybe [MessageTag]
$sel:configurationSetName:SendBulkEmail' :: SendBulkEmail -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MessageTag]
defaultEmailTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
feedbackForwardingEmailAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
feedbackForwardingEmailAddressIdentityArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fromEmailAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fromEmailAddressIdentityArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
replyToAddresses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BulkEmailContent
defaultContent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BulkEmailEntry]
bulkEmailEntries

instance Data.ToHeaders SendBulkEmail where
  toHeaders :: SendBulkEmail -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON SendBulkEmail where
  toJSON :: SendBulkEmail -> Value
toJSON SendBulkEmail' {[BulkEmailEntry]
Maybe [Text]
Maybe [MessageTag]
Maybe Text
BulkEmailContent
bulkEmailEntries :: [BulkEmailEntry]
defaultContent :: BulkEmailContent
replyToAddresses :: Maybe [Text]
fromEmailAddressIdentityArn :: Maybe Text
fromEmailAddress :: Maybe Text
feedbackForwardingEmailAddressIdentityArn :: Maybe Text
feedbackForwardingEmailAddress :: Maybe Text
defaultEmailTags :: Maybe [MessageTag]
configurationSetName :: Maybe Text
$sel:bulkEmailEntries:SendBulkEmail' :: SendBulkEmail -> [BulkEmailEntry]
$sel:defaultContent:SendBulkEmail' :: SendBulkEmail -> BulkEmailContent
$sel:replyToAddresses:SendBulkEmail' :: SendBulkEmail -> Maybe [Text]
$sel:fromEmailAddressIdentityArn:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:fromEmailAddress:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:feedbackForwardingEmailAddressIdentityArn:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:feedbackForwardingEmailAddress:SendBulkEmail' :: SendBulkEmail -> Maybe Text
$sel:defaultEmailTags:SendBulkEmail' :: SendBulkEmail -> Maybe [MessageTag]
$sel:configurationSetName:SendBulkEmail' :: SendBulkEmail -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ConfigurationSetName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
configurationSetName,
            (Key
"DefaultEmailTags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MessageTag]
defaultEmailTags,
            (Key
"FeedbackForwardingEmailAddress" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
feedbackForwardingEmailAddress,
            (Key
"FeedbackForwardingEmailAddressIdentityArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
feedbackForwardingEmailAddressIdentityArn,
            (Key
"FromEmailAddress" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
fromEmailAddress,
            (Key
"FromEmailAddressIdentityArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
fromEmailAddressIdentityArn,
            (Key
"ReplyToAddresses" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
replyToAddresses,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DefaultContent" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= BulkEmailContent
defaultContent),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"BulkEmailEntries" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [BulkEmailEntry]
bulkEmailEntries)
          ]
      )

instance Data.ToPath SendBulkEmail where
  toPath :: SendBulkEmail -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const ByteString
"/v2/email/outbound-bulk-emails"

instance Data.ToQuery SendBulkEmail where
  toQuery :: SendBulkEmail -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | The following data is returned in JSON format by the service.
--
-- /See:/ 'newSendBulkEmailResponse' smart constructor.
data SendBulkEmailResponse = SendBulkEmailResponse'
  { -- | The response's http status code.
    SendBulkEmailResponse -> Int
httpStatus :: Prelude.Int,
    -- | One object per intended recipient. Check each response object and retry
    -- any messages with a failure status.
    SendBulkEmailResponse -> [BulkEmailEntryResult]
bulkEmailEntryResults :: [BulkEmailEntryResult]
  }
  deriving (SendBulkEmailResponse -> SendBulkEmailResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendBulkEmailResponse -> SendBulkEmailResponse -> Bool
$c/= :: SendBulkEmailResponse -> SendBulkEmailResponse -> Bool
== :: SendBulkEmailResponse -> SendBulkEmailResponse -> Bool
$c== :: SendBulkEmailResponse -> SendBulkEmailResponse -> Bool
Prelude.Eq, ReadPrec [SendBulkEmailResponse]
ReadPrec SendBulkEmailResponse
Int -> ReadS SendBulkEmailResponse
ReadS [SendBulkEmailResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendBulkEmailResponse]
$creadListPrec :: ReadPrec [SendBulkEmailResponse]
readPrec :: ReadPrec SendBulkEmailResponse
$creadPrec :: ReadPrec SendBulkEmailResponse
readList :: ReadS [SendBulkEmailResponse]
$creadList :: ReadS [SendBulkEmailResponse]
readsPrec :: Int -> ReadS SendBulkEmailResponse
$creadsPrec :: Int -> ReadS SendBulkEmailResponse
Prelude.Read, Int -> SendBulkEmailResponse -> ShowS
[SendBulkEmailResponse] -> ShowS
SendBulkEmailResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendBulkEmailResponse] -> ShowS
$cshowList :: [SendBulkEmailResponse] -> ShowS
show :: SendBulkEmailResponse -> String
$cshow :: SendBulkEmailResponse -> String
showsPrec :: Int -> SendBulkEmailResponse -> ShowS
$cshowsPrec :: Int -> SendBulkEmailResponse -> ShowS
Prelude.Show, forall x. Rep SendBulkEmailResponse x -> SendBulkEmailResponse
forall x. SendBulkEmailResponse -> Rep SendBulkEmailResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendBulkEmailResponse x -> SendBulkEmailResponse
$cfrom :: forall x. SendBulkEmailResponse -> Rep SendBulkEmailResponse x
Prelude.Generic)

-- |
-- Create a value of 'SendBulkEmailResponse' 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:
--
-- 'httpStatus', 'sendBulkEmailResponse_httpStatus' - The response's http status code.
--
-- 'bulkEmailEntryResults', 'sendBulkEmailResponse_bulkEmailEntryResults' - One object per intended recipient. Check each response object and retry
-- any messages with a failure status.
newSendBulkEmailResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SendBulkEmailResponse
newSendBulkEmailResponse :: Int -> SendBulkEmailResponse
newSendBulkEmailResponse Int
pHttpStatus_ =
  SendBulkEmailResponse'
    { $sel:httpStatus:SendBulkEmailResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:bulkEmailEntryResults:SendBulkEmailResponse' :: [BulkEmailEntryResult]
bulkEmailEntryResults = forall a. Monoid a => a
Prelude.mempty
    }

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

-- | One object per intended recipient. Check each response object and retry
-- any messages with a failure status.
sendBulkEmailResponse_bulkEmailEntryResults :: Lens.Lens' SendBulkEmailResponse [BulkEmailEntryResult]
sendBulkEmailResponse_bulkEmailEntryResults :: Lens' SendBulkEmailResponse [BulkEmailEntryResult]
sendBulkEmailResponse_bulkEmailEntryResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendBulkEmailResponse' {[BulkEmailEntryResult]
bulkEmailEntryResults :: [BulkEmailEntryResult]
$sel:bulkEmailEntryResults:SendBulkEmailResponse' :: SendBulkEmailResponse -> [BulkEmailEntryResult]
bulkEmailEntryResults} -> [BulkEmailEntryResult]
bulkEmailEntryResults) (\s :: SendBulkEmailResponse
s@SendBulkEmailResponse' {} [BulkEmailEntryResult]
a -> SendBulkEmailResponse
s {$sel:bulkEmailEntryResults:SendBulkEmailResponse' :: [BulkEmailEntryResult]
bulkEmailEntryResults = [BulkEmailEntryResult]
a} :: SendBulkEmailResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData SendBulkEmailResponse where
  rnf :: SendBulkEmailResponse -> ()
rnf SendBulkEmailResponse' {Int
[BulkEmailEntryResult]
bulkEmailEntryResults :: [BulkEmailEntryResult]
httpStatus :: Int
$sel:bulkEmailEntryResults:SendBulkEmailResponse' :: SendBulkEmailResponse -> [BulkEmailEntryResult]
$sel:httpStatus:SendBulkEmailResponse' :: SendBulkEmailResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BulkEmailEntryResult]
bulkEmailEntryResults