{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.SESV2.Types.BulkEmailEntryResult
-- 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)
module Amazonka.SESV2.Types.BulkEmailEntryResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.BulkEmailStatus

-- | The result of the @SendBulkEmail@ operation of each specified
-- @BulkEmailEntry@.
--
-- /See:/ 'newBulkEmailEntryResult' smart constructor.
data BulkEmailEntryResult = BulkEmailEntryResult'
  { -- | The status of a message sent using the @SendBulkTemplatedEmail@
    -- operation.
    --
    -- Possible values for this parameter include:
    --
    -- -   SUCCESS: Amazon SES accepted the message, and will attempt to
    --     deliver it to the recipients.
    --
    -- -   MESSAGE_REJECTED: The message was rejected because it contained a
    --     virus.
    --
    -- -   MAIL_FROM_DOMAIN_NOT_VERIFIED: The sender\'s email address or domain
    --     was not verified.
    --
    -- -   CONFIGURATION_SET_DOES_NOT_EXIST: The configuration set you
    --     specified does not exist.
    --
    -- -   TEMPLATE_DOES_NOT_EXIST: The template you specified does not exist.
    --
    -- -   ACCOUNT_SUSPENDED: Your account has been shut down because of issues
    --     related to your email sending practices.
    --
    -- -   ACCOUNT_THROTTLED: The number of emails you can send has been
    --     reduced because your account has exceeded its allocated sending
    --     limit.
    --
    -- -   ACCOUNT_DAILY_QUOTA_EXCEEDED: You have reached or exceeded the
    --     maximum number of emails you can send from your account in a 24-hour
    --     period.
    --
    -- -   INVALID_SENDING_POOL_NAME: The configuration set you specified
    --     refers to an IP pool that does not exist.
    --
    -- -   ACCOUNT_SENDING_PAUSED: Email sending for the Amazon SES account was
    --     disabled using the
    --     <https://docs.aws.amazon.com/ses/latest/APIReference/API_UpdateAccountSendingEnabled.html UpdateAccountSendingEnabled>
    --     operation.
    --
    -- -   CONFIGURATION_SET_SENDING_PAUSED: Email sending for this
    --     configuration set was disabled using the
    --     <https://docs.aws.amazon.com/ses/latest/APIReference/API_UpdateConfigurationSetSendingEnabled.html UpdateConfigurationSetSendingEnabled>
    --     operation.
    --
    -- -   INVALID_PARAMETER_VALUE: One or more of the parameters you specified
    --     when calling this operation was invalid. See the error message for
    --     additional information.
    --
    -- -   TRANSIENT_FAILURE: Amazon SES was unable to process your request
    --     because of a temporary issue.
    --
    -- -   FAILED: Amazon SES was unable to process your request. See the error
    --     message for additional information.
    BulkEmailEntryResult -> Maybe BulkEmailStatus
status :: Prelude.Maybe BulkEmailStatus,
    -- | A description of an error that prevented a message being sent using the
    -- @SendBulkTemplatedEmail@ operation.
    BulkEmailEntryResult -> Maybe Text
error :: Prelude.Maybe Prelude.Text,
    -- | The unique message identifier returned from the @SendBulkTemplatedEmail@
    -- operation.
    BulkEmailEntryResult -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text
  }
  deriving (BulkEmailEntryResult -> BulkEmailEntryResult -> Bool
(BulkEmailEntryResult -> BulkEmailEntryResult -> Bool)
-> (BulkEmailEntryResult -> BulkEmailEntryResult -> Bool)
-> Eq BulkEmailEntryResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BulkEmailEntryResult -> BulkEmailEntryResult -> Bool
$c/= :: BulkEmailEntryResult -> BulkEmailEntryResult -> Bool
== :: BulkEmailEntryResult -> BulkEmailEntryResult -> Bool
$c== :: BulkEmailEntryResult -> BulkEmailEntryResult -> Bool
Prelude.Eq, ReadPrec [BulkEmailEntryResult]
ReadPrec BulkEmailEntryResult
Int -> ReadS BulkEmailEntryResult
ReadS [BulkEmailEntryResult]
(Int -> ReadS BulkEmailEntryResult)
-> ReadS [BulkEmailEntryResult]
-> ReadPrec BulkEmailEntryResult
-> ReadPrec [BulkEmailEntryResult]
-> Read BulkEmailEntryResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BulkEmailEntryResult]
$creadListPrec :: ReadPrec [BulkEmailEntryResult]
readPrec :: ReadPrec BulkEmailEntryResult
$creadPrec :: ReadPrec BulkEmailEntryResult
readList :: ReadS [BulkEmailEntryResult]
$creadList :: ReadS [BulkEmailEntryResult]
readsPrec :: Int -> ReadS BulkEmailEntryResult
$creadsPrec :: Int -> ReadS BulkEmailEntryResult
Prelude.Read, Int -> BulkEmailEntryResult -> ShowS
[BulkEmailEntryResult] -> ShowS
BulkEmailEntryResult -> String
(Int -> BulkEmailEntryResult -> ShowS)
-> (BulkEmailEntryResult -> String)
-> ([BulkEmailEntryResult] -> ShowS)
-> Show BulkEmailEntryResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BulkEmailEntryResult] -> ShowS
$cshowList :: [BulkEmailEntryResult] -> ShowS
show :: BulkEmailEntryResult -> String
$cshow :: BulkEmailEntryResult -> String
showsPrec :: Int -> BulkEmailEntryResult -> ShowS
$cshowsPrec :: Int -> BulkEmailEntryResult -> ShowS
Prelude.Show, (forall x. BulkEmailEntryResult -> Rep BulkEmailEntryResult x)
-> (forall x. Rep BulkEmailEntryResult x -> BulkEmailEntryResult)
-> Generic BulkEmailEntryResult
forall x. Rep BulkEmailEntryResult x -> BulkEmailEntryResult
forall x. BulkEmailEntryResult -> Rep BulkEmailEntryResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BulkEmailEntryResult x -> BulkEmailEntryResult
$cfrom :: forall x. BulkEmailEntryResult -> Rep BulkEmailEntryResult x
Prelude.Generic)

-- |
-- Create a value of 'BulkEmailEntryResult' 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:
--
-- 'status', 'bulkEmailEntryResult_status' - The status of a message sent using the @SendBulkTemplatedEmail@
-- operation.
--
-- Possible values for this parameter include:
--
-- -   SUCCESS: Amazon SES accepted the message, and will attempt to
--     deliver it to the recipients.
--
-- -   MESSAGE_REJECTED: The message was rejected because it contained a
--     virus.
--
-- -   MAIL_FROM_DOMAIN_NOT_VERIFIED: The sender\'s email address or domain
--     was not verified.
--
-- -   CONFIGURATION_SET_DOES_NOT_EXIST: The configuration set you
--     specified does not exist.
--
-- -   TEMPLATE_DOES_NOT_EXIST: The template you specified does not exist.
--
-- -   ACCOUNT_SUSPENDED: Your account has been shut down because of issues
--     related to your email sending practices.
--
-- -   ACCOUNT_THROTTLED: The number of emails you can send has been
--     reduced because your account has exceeded its allocated sending
--     limit.
--
-- -   ACCOUNT_DAILY_QUOTA_EXCEEDED: You have reached or exceeded the
--     maximum number of emails you can send from your account in a 24-hour
--     period.
--
-- -   INVALID_SENDING_POOL_NAME: The configuration set you specified
--     refers to an IP pool that does not exist.
--
-- -   ACCOUNT_SENDING_PAUSED: Email sending for the Amazon SES account was
--     disabled using the
--     <https://docs.aws.amazon.com/ses/latest/APIReference/API_UpdateAccountSendingEnabled.html UpdateAccountSendingEnabled>
--     operation.
--
-- -   CONFIGURATION_SET_SENDING_PAUSED: Email sending for this
--     configuration set was disabled using the
--     <https://docs.aws.amazon.com/ses/latest/APIReference/API_UpdateConfigurationSetSendingEnabled.html UpdateConfigurationSetSendingEnabled>
--     operation.
--
-- -   INVALID_PARAMETER_VALUE: One or more of the parameters you specified
--     when calling this operation was invalid. See the error message for
--     additional information.
--
-- -   TRANSIENT_FAILURE: Amazon SES was unable to process your request
--     because of a temporary issue.
--
-- -   FAILED: Amazon SES was unable to process your request. See the error
--     message for additional information.
--
-- 'error', 'bulkEmailEntryResult_error' - A description of an error that prevented a message being sent using the
-- @SendBulkTemplatedEmail@ operation.
--
-- 'messageId', 'bulkEmailEntryResult_messageId' - The unique message identifier returned from the @SendBulkTemplatedEmail@
-- operation.
newBulkEmailEntryResult ::
  BulkEmailEntryResult
newBulkEmailEntryResult :: BulkEmailEntryResult
newBulkEmailEntryResult =
  BulkEmailEntryResult' :: Maybe BulkEmailStatus
-> Maybe Text -> Maybe Text -> BulkEmailEntryResult
BulkEmailEntryResult'
    { $sel:status:BulkEmailEntryResult' :: Maybe BulkEmailStatus
status = Maybe BulkEmailStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:error:BulkEmailEntryResult' :: Maybe Text
error = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:messageId:BulkEmailEntryResult' :: Maybe Text
messageId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of a message sent using the @SendBulkTemplatedEmail@
-- operation.
--
-- Possible values for this parameter include:
--
-- -   SUCCESS: Amazon SES accepted the message, and will attempt to
--     deliver it to the recipients.
--
-- -   MESSAGE_REJECTED: The message was rejected because it contained a
--     virus.
--
-- -   MAIL_FROM_DOMAIN_NOT_VERIFIED: The sender\'s email address or domain
--     was not verified.
--
-- -   CONFIGURATION_SET_DOES_NOT_EXIST: The configuration set you
--     specified does not exist.
--
-- -   TEMPLATE_DOES_NOT_EXIST: The template you specified does not exist.
--
-- -   ACCOUNT_SUSPENDED: Your account has been shut down because of issues
--     related to your email sending practices.
--
-- -   ACCOUNT_THROTTLED: The number of emails you can send has been
--     reduced because your account has exceeded its allocated sending
--     limit.
--
-- -   ACCOUNT_DAILY_QUOTA_EXCEEDED: You have reached or exceeded the
--     maximum number of emails you can send from your account in a 24-hour
--     period.
--
-- -   INVALID_SENDING_POOL_NAME: The configuration set you specified
--     refers to an IP pool that does not exist.
--
-- -   ACCOUNT_SENDING_PAUSED: Email sending for the Amazon SES account was
--     disabled using the
--     <https://docs.aws.amazon.com/ses/latest/APIReference/API_UpdateAccountSendingEnabled.html UpdateAccountSendingEnabled>
--     operation.
--
-- -   CONFIGURATION_SET_SENDING_PAUSED: Email sending for this
--     configuration set was disabled using the
--     <https://docs.aws.amazon.com/ses/latest/APIReference/API_UpdateConfigurationSetSendingEnabled.html UpdateConfigurationSetSendingEnabled>
--     operation.
--
-- -   INVALID_PARAMETER_VALUE: One or more of the parameters you specified
--     when calling this operation was invalid. See the error message for
--     additional information.
--
-- -   TRANSIENT_FAILURE: Amazon SES was unable to process your request
--     because of a temporary issue.
--
-- -   FAILED: Amazon SES was unable to process your request. See the error
--     message for additional information.
bulkEmailEntryResult_status :: Lens.Lens' BulkEmailEntryResult (Prelude.Maybe BulkEmailStatus)
bulkEmailEntryResult_status :: (Maybe BulkEmailStatus -> f (Maybe BulkEmailStatus))
-> BulkEmailEntryResult -> f BulkEmailEntryResult
bulkEmailEntryResult_status = (BulkEmailEntryResult -> Maybe BulkEmailStatus)
-> (BulkEmailEntryResult
    -> Maybe BulkEmailStatus -> BulkEmailEntryResult)
-> Lens
     BulkEmailEntryResult
     BulkEmailEntryResult
     (Maybe BulkEmailStatus)
     (Maybe BulkEmailStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkEmailEntryResult' {Maybe BulkEmailStatus
status :: Maybe BulkEmailStatus
$sel:status:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe BulkEmailStatus
status} -> Maybe BulkEmailStatus
status) (\s :: BulkEmailEntryResult
s@BulkEmailEntryResult' {} Maybe BulkEmailStatus
a -> BulkEmailEntryResult
s {$sel:status:BulkEmailEntryResult' :: Maybe BulkEmailStatus
status = Maybe BulkEmailStatus
a} :: BulkEmailEntryResult)

-- | A description of an error that prevented a message being sent using the
-- @SendBulkTemplatedEmail@ operation.
bulkEmailEntryResult_error :: Lens.Lens' BulkEmailEntryResult (Prelude.Maybe Prelude.Text)
bulkEmailEntryResult_error :: (Maybe Text -> f (Maybe Text))
-> BulkEmailEntryResult -> f BulkEmailEntryResult
bulkEmailEntryResult_error = (BulkEmailEntryResult -> Maybe Text)
-> (BulkEmailEntryResult -> Maybe Text -> BulkEmailEntryResult)
-> Lens
     BulkEmailEntryResult BulkEmailEntryResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkEmailEntryResult' {Maybe Text
error :: Maybe Text
$sel:error:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe Text
error} -> Maybe Text
error) (\s :: BulkEmailEntryResult
s@BulkEmailEntryResult' {} Maybe Text
a -> BulkEmailEntryResult
s {$sel:error:BulkEmailEntryResult' :: Maybe Text
error = Maybe Text
a} :: BulkEmailEntryResult)

-- | The unique message identifier returned from the @SendBulkTemplatedEmail@
-- operation.
bulkEmailEntryResult_messageId :: Lens.Lens' BulkEmailEntryResult (Prelude.Maybe Prelude.Text)
bulkEmailEntryResult_messageId :: (Maybe Text -> f (Maybe Text))
-> BulkEmailEntryResult -> f BulkEmailEntryResult
bulkEmailEntryResult_messageId = (BulkEmailEntryResult -> Maybe Text)
-> (BulkEmailEntryResult -> Maybe Text -> BulkEmailEntryResult)
-> Lens
     BulkEmailEntryResult BulkEmailEntryResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkEmailEntryResult' {Maybe Text
messageId :: Maybe Text
$sel:messageId:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe Text
messageId} -> Maybe Text
messageId) (\s :: BulkEmailEntryResult
s@BulkEmailEntryResult' {} Maybe Text
a -> BulkEmailEntryResult
s {$sel:messageId:BulkEmailEntryResult' :: Maybe Text
messageId = Maybe Text
a} :: BulkEmailEntryResult)

instance Core.FromJSON BulkEmailEntryResult where
  parseJSON :: Value -> Parser BulkEmailEntryResult
parseJSON =
    String
-> (Object -> Parser BulkEmailEntryResult)
-> Value
-> Parser BulkEmailEntryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BulkEmailEntryResult"
      ( \Object
x ->
          Maybe BulkEmailStatus
-> Maybe Text -> Maybe Text -> BulkEmailEntryResult
BulkEmailEntryResult'
            (Maybe BulkEmailStatus
 -> Maybe Text -> Maybe Text -> BulkEmailEntryResult)
-> Parser (Maybe BulkEmailStatus)
-> Parser (Maybe Text -> Maybe Text -> BulkEmailEntryResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe BulkEmailStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser (Maybe Text -> Maybe Text -> BulkEmailEntryResult)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> BulkEmailEntryResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Error")
            Parser (Maybe Text -> BulkEmailEntryResult)
-> Parser (Maybe Text) -> Parser BulkEmailEntryResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MessageId")
      )

instance Prelude.Hashable BulkEmailEntryResult

instance Prelude.NFData BulkEmailEntryResult