{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SESV2.Types.BulkEmailEntryResult 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 Amazonka.SESV2.Types.BulkEmailStatus

-- | The result of the @SendBulkEmail@ operation of each specified
-- @BulkEmailEntry@.
--
-- /See:/ 'newBulkEmailEntryResult' smart constructor.
data BulkEmailEntryResult = BulkEmailEntryResult'
  { -- | 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,
    -- | 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
  }
  deriving (BulkEmailEntryResult -> BulkEmailEntryResult -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
newBulkEmailEntryResult ::
  BulkEmailEntryResult
newBulkEmailEntryResult :: BulkEmailEntryResult
newBulkEmailEntryResult =
  BulkEmailEntryResult'
    { $sel:error:BulkEmailEntryResult' :: Maybe Text
error = forall a. Maybe a
Prelude.Nothing,
      $sel:messageId:BulkEmailEntryResult' :: Maybe Text
messageId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:BulkEmailEntryResult' :: Maybe BulkEmailStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' BulkEmailEntryResult (Maybe Text)
bulkEmailEntryResult_error = 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 :: Lens' BulkEmailEntryResult (Maybe Text)
bulkEmailEntryResult_messageId = 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)

-- | 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 :: Lens' BulkEmailEntryResult (Maybe BulkEmailStatus)
bulkEmailEntryResult_status = 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)

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

instance Prelude.Hashable BulkEmailEntryResult where
  hashWithSalt :: Int -> BulkEmailEntryResult -> Int
hashWithSalt Int
_salt BulkEmailEntryResult' {Maybe Text
Maybe BulkEmailStatus
status :: Maybe BulkEmailStatus
messageId :: Maybe Text
error :: Maybe Text
$sel:status:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe BulkEmailStatus
$sel:messageId:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe Text
$sel:error:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
error
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
messageId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BulkEmailStatus
status

instance Prelude.NFData BulkEmailEntryResult where
  rnf :: BulkEmailEntryResult -> ()
rnf BulkEmailEntryResult' {Maybe Text
Maybe BulkEmailStatus
status :: Maybe BulkEmailStatus
messageId :: Maybe Text
error :: Maybe Text
$sel:status:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe BulkEmailStatus
$sel:messageId:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe Text
$sel:error:BulkEmailEntryResult' :: BulkEmailEntryResult -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
error
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messageId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BulkEmailStatus
status