{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_fromEmailAddress,
    sendBulkEmail_fromEmailAddressIdentityArn,
    sendBulkEmail_configurationSetName,
    sendBulkEmail_feedbackForwardingEmailAddress,
    sendBulkEmail_feedbackForwardingEmailAddressIdentityArn,
    sendBulkEmail_defaultEmailTags,
    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.Lens as Lens
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 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 name of the configuration set to use when sending the email.
    SendBulkEmail -> Maybe Text
configurationSetName :: Prelude.Maybe Prelude.Text,
    -- | 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,
    -- | 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 \"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
(SendBulkEmail -> SendBulkEmail -> Bool)
-> (SendBulkEmail -> SendBulkEmail -> Bool) -> Eq SendBulkEmail
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]
(Int -> ReadS SendBulkEmail)
-> ReadS [SendBulkEmail]
-> ReadPrec SendBulkEmail
-> ReadPrec [SendBulkEmail]
-> Read 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
(Int -> SendBulkEmail -> ShowS)
-> (SendBulkEmail -> String)
-> ([SendBulkEmail] -> ShowS)
-> Show SendBulkEmail
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. SendBulkEmail -> Rep SendBulkEmail x)
-> (forall x. Rep SendBulkEmail x -> SendBulkEmail)
-> Generic SendBulkEmail
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:
--
-- '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>.
--
-- 'configurationSetName', 'sendBulkEmail_configurationSetName' - The name of the configuration set to use when sending the email.
--
-- '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>.
--
-- '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.
--
-- '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' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [MessageTag]
-> Maybe [Text]
-> BulkEmailContent
-> [BulkEmailEntry]
-> SendBulkEmail
SendBulkEmail'
    { $sel:fromEmailAddress:SendBulkEmail' :: Maybe Text
fromEmailAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fromEmailAddressIdentityArn:SendBulkEmail' :: Maybe Text
fromEmailAddressIdentityArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationSetName:SendBulkEmail' :: Maybe Text
configurationSetName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:feedbackForwardingEmailAddress:SendBulkEmail' :: Maybe Text
feedbackForwardingEmailAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:feedbackForwardingEmailAddressIdentityArn:SendBulkEmail' :: Maybe Text
feedbackForwardingEmailAddressIdentityArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultEmailTags:SendBulkEmail' :: Maybe [MessageTag]
defaultEmailTags = Maybe [MessageTag]
forall a. Maybe a
Prelude.Nothing,
      $sel:replyToAddresses:SendBulkEmail' :: Maybe [Text]
replyToAddresses = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultContent:SendBulkEmail' :: BulkEmailContent
defaultContent = BulkEmailContent
pDefaultContent_,
      $sel:bulkEmailEntries:SendBulkEmail' :: [BulkEmailEntry]
bulkEmailEntries = [BulkEmailEntry]
forall a. Monoid a => a
Prelude.mempty
    }

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_fromEmailAddress = (SendBulkEmail -> Maybe Text)
-> (SendBulkEmail -> Maybe Text -> SendBulkEmail)
-> Lens SendBulkEmail SendBulkEmail (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_fromEmailAddressIdentityArn = (SendBulkEmail -> Maybe Text)
-> (SendBulkEmail -> Maybe Text -> SendBulkEmail)
-> Lens SendBulkEmail SendBulkEmail (Maybe Text) (Maybe Text)
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 name of the configuration set to use when sending the email.
sendBulkEmail_configurationSetName :: Lens.Lens' SendBulkEmail (Prelude.Maybe Prelude.Text)
sendBulkEmail_configurationSetName :: (Maybe Text -> f (Maybe Text)) -> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_configurationSetName = (SendBulkEmail -> Maybe Text)
-> (SendBulkEmail -> Maybe Text -> SendBulkEmail)
-> Lens SendBulkEmail SendBulkEmail (Maybe Text) (Maybe Text)
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)

-- | The address that you want bounce and complaint notifications to be sent
-- to.
sendBulkEmail_feedbackForwardingEmailAddress :: Lens.Lens' SendBulkEmail (Prelude.Maybe Prelude.Text)
sendBulkEmail_feedbackForwardingEmailAddress :: (Maybe Text -> f (Maybe Text)) -> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_feedbackForwardingEmailAddress = (SendBulkEmail -> Maybe Text)
-> (SendBulkEmail -> Maybe Text -> SendBulkEmail)
-> Lens SendBulkEmail SendBulkEmail (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_feedbackForwardingEmailAddressIdentityArn = (SendBulkEmail -> Maybe Text)
-> (SendBulkEmail -> Maybe Text -> SendBulkEmail)
-> Lens SendBulkEmail SendBulkEmail (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe [MessageTag] -> f (Maybe [MessageTag]))
-> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_defaultEmailTags = (SendBulkEmail -> Maybe [MessageTag])
-> (SendBulkEmail -> Maybe [MessageTag] -> SendBulkEmail)
-> Lens
     SendBulkEmail
     SendBulkEmail
     (Maybe [MessageTag])
     (Maybe [MessageTag])
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) ((Maybe [MessageTag] -> f (Maybe [MessageTag]))
 -> SendBulkEmail -> f SendBulkEmail)
-> ((Maybe [MessageTag] -> f (Maybe [MessageTag]))
    -> Maybe [MessageTag] -> f (Maybe [MessageTag]))
-> (Maybe [MessageTag] -> f (Maybe [MessageTag]))
-> SendBulkEmail
-> f SendBulkEmail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MessageTag] [MessageTag] [MessageTag] [MessageTag]
-> Iso
     (Maybe [MessageTag])
     (Maybe [MessageTag])
     (Maybe [MessageTag])
     (Maybe [MessageTag])
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 AnIso [MessageTag] [MessageTag] [MessageTag] [MessageTag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe [Text] -> f (Maybe [Text]))
-> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_replyToAddresses = (SendBulkEmail -> Maybe [Text])
-> (SendBulkEmail -> Maybe [Text] -> SendBulkEmail)
-> Lens SendBulkEmail SendBulkEmail (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> SendBulkEmail -> f SendBulkEmail)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SendBulkEmail
-> f SendBulkEmail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
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 :: (BulkEmailContent -> f BulkEmailContent)
-> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_defaultContent = (SendBulkEmail -> BulkEmailContent)
-> (SendBulkEmail -> BulkEmailContent -> SendBulkEmail)
-> Lens
     SendBulkEmail SendBulkEmail BulkEmailContent BulkEmailContent
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 :: ([BulkEmailEntry] -> f [BulkEmailEntry])
-> SendBulkEmail -> f SendBulkEmail
sendBulkEmail_bulkEmailEntries = (SendBulkEmail -> [BulkEmailEntry])
-> (SendBulkEmail -> [BulkEmailEntry] -> SendBulkEmail)
-> Lens
     SendBulkEmail SendBulkEmail [BulkEmailEntry] [BulkEmailEntry]
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) (([BulkEmailEntry] -> f [BulkEmailEntry])
 -> SendBulkEmail -> f SendBulkEmail)
-> (([BulkEmailEntry] -> f [BulkEmailEntry])
    -> [BulkEmailEntry] -> f [BulkEmailEntry])
-> ([BulkEmailEntry] -> f [BulkEmailEntry])
-> SendBulkEmail
-> f SendBulkEmail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BulkEmailEntry] -> f [BulkEmailEntry])
-> [BulkEmailEntry] -> f [BulkEmailEntry]
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 :: SendBulkEmail -> Request SendBulkEmail
request = Service -> SendBulkEmail -> Request SendBulkEmail
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SendBulkEmail
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendBulkEmail)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SendBulkEmail))
-> Logger
-> Service
-> Proxy SendBulkEmail
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendBulkEmail)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> [BulkEmailEntryResult] -> SendBulkEmailResponse
SendBulkEmailResponse'
            (Int -> [BulkEmailEntryResult] -> SendBulkEmailResponse)
-> Either String Int
-> Either String ([BulkEmailEntryResult] -> SendBulkEmailResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String ([BulkEmailEntryResult] -> SendBulkEmailResponse)
-> Either String [BulkEmailEntryResult]
-> Either String SendBulkEmailResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [BulkEmailEntryResult])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BulkEmailEntryResults"
                            Either String (Maybe [BulkEmailEntryResult])
-> [BulkEmailEntryResult] -> Either String [BulkEmailEntryResult]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [BulkEmailEntryResult]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable SendBulkEmail

instance Prelude.NFData SendBulkEmail

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

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

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

instance Core.ToQuery SendBulkEmail where
  toQuery :: SendBulkEmail -> QueryString
toQuery = QueryString -> SendBulkEmail -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(SendBulkEmailResponse -> SendBulkEmailResponse -> Bool)
-> (SendBulkEmailResponse -> SendBulkEmailResponse -> Bool)
-> Eq SendBulkEmailResponse
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]
(Int -> ReadS SendBulkEmailResponse)
-> ReadS [SendBulkEmailResponse]
-> ReadPrec SendBulkEmailResponse
-> ReadPrec [SendBulkEmailResponse]
-> Read 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
(Int -> SendBulkEmailResponse -> ShowS)
-> (SendBulkEmailResponse -> String)
-> ([SendBulkEmailResponse] -> ShowS)
-> Show SendBulkEmailResponse
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. SendBulkEmailResponse -> Rep SendBulkEmailResponse x)
-> (forall x. Rep SendBulkEmailResponse x -> SendBulkEmailResponse)
-> Generic SendBulkEmailResponse
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' :: Int -> [BulkEmailEntryResult] -> SendBulkEmailResponse
SendBulkEmailResponse'
    { $sel:httpStatus:SendBulkEmailResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:bulkEmailEntryResults:SendBulkEmailResponse' :: [BulkEmailEntryResult]
bulkEmailEntryResults = [BulkEmailEntryResult]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The response's http status code.
sendBulkEmailResponse_httpStatus :: Lens.Lens' SendBulkEmailResponse Prelude.Int
sendBulkEmailResponse_httpStatus :: (Int -> f Int) -> SendBulkEmailResponse -> f SendBulkEmailResponse
sendBulkEmailResponse_httpStatus = (SendBulkEmailResponse -> Int)
-> (SendBulkEmailResponse -> Int -> SendBulkEmailResponse)
-> Lens SendBulkEmailResponse SendBulkEmailResponse Int Int
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 :: ([BulkEmailEntryResult] -> f [BulkEmailEntryResult])
-> SendBulkEmailResponse -> f SendBulkEmailResponse
sendBulkEmailResponse_bulkEmailEntryResults = (SendBulkEmailResponse -> [BulkEmailEntryResult])
-> (SendBulkEmailResponse
    -> [BulkEmailEntryResult] -> SendBulkEmailResponse)
-> Lens
     SendBulkEmailResponse
     SendBulkEmailResponse
     [BulkEmailEntryResult]
     [BulkEmailEntryResult]
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) (([BulkEmailEntryResult] -> f [BulkEmailEntryResult])
 -> SendBulkEmailResponse -> f SendBulkEmailResponse)
-> (([BulkEmailEntryResult] -> f [BulkEmailEntryResult])
    -> [BulkEmailEntryResult] -> f [BulkEmailEntryResult])
-> ([BulkEmailEntryResult] -> f [BulkEmailEntryResult])
-> SendBulkEmailResponse
-> f SendBulkEmailResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BulkEmailEntryResult] -> f [BulkEmailEntryResult])
-> [BulkEmailEntryResult] -> f [BulkEmailEntryResult]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData SendBulkEmailResponse