{-# 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.SQS.Types.SendMessageBatchResultEntry
-- 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.SQS.Types.SendMessageBatchResultEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Encloses a @MessageId@ for a successfully-enqueued message in a
-- @ SendMessageBatch.@
--
-- /See:/ 'newSendMessageBatchResultEntry' smart constructor.
data SendMessageBatchResultEntry = SendMessageBatchResultEntry'
  { -- | This parameter applies only to FIFO (first-in-first-out) queues.
    --
    -- The large, non-consecutive number that Amazon SQS assigns to each
    -- message.
    --
    -- The length of @SequenceNumber@ is 128 bits. As @SequenceNumber@
    -- continues to increase for a particular @MessageGroupId@.
    SendMessageBatchResultEntry -> Maybe Text
sequenceNumber :: Prelude.Maybe Prelude.Text,
    -- | An MD5 digest of the non-URL-encoded message system attribute string.
    -- You can use this attribute to verify that Amazon SQS received the
    -- message correctly. Amazon SQS URL-decodes the message before creating
    -- the MD5 digest. For information about MD5, see
    -- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
    SendMessageBatchResultEntry -> Maybe Text
mD5OfMessageSystemAttributes :: Prelude.Maybe Prelude.Text,
    -- | An MD5 digest of the non-URL-encoded message attribute string. You can
    -- use this attribute to verify that Amazon SQS received the message
    -- correctly. Amazon SQS URL-decodes the message before creating the MD5
    -- digest. For information about MD5, see
    -- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
    SendMessageBatchResultEntry -> Maybe Text
mD5OfMessageAttributes :: Prelude.Maybe Prelude.Text,
    -- | An identifier for the message in this batch.
    SendMessageBatchResultEntry -> Text
id :: Prelude.Text,
    -- | An identifier for the message.
    SendMessageBatchResultEntry -> Text
messageId :: Prelude.Text,
    -- | An MD5 digest of the non-URL-encoded message body string. You can use
    -- this attribute to verify that Amazon SQS received the message correctly.
    -- Amazon SQS URL-decodes the message before creating the MD5 digest. For
    -- information about MD5, see
    -- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
    SendMessageBatchResultEntry -> Text
mD5OfMessageBody :: Prelude.Text
  }
  deriving (SendMessageBatchResultEntry -> SendMessageBatchResultEntry -> Bool
(SendMessageBatchResultEntry
 -> SendMessageBatchResultEntry -> Bool)
-> (SendMessageBatchResultEntry
    -> SendMessageBatchResultEntry -> Bool)
-> Eq SendMessageBatchResultEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendMessageBatchResultEntry -> SendMessageBatchResultEntry -> Bool
$c/= :: SendMessageBatchResultEntry -> SendMessageBatchResultEntry -> Bool
== :: SendMessageBatchResultEntry -> SendMessageBatchResultEntry -> Bool
$c== :: SendMessageBatchResultEntry -> SendMessageBatchResultEntry -> Bool
Prelude.Eq, ReadPrec [SendMessageBatchResultEntry]
ReadPrec SendMessageBatchResultEntry
Int -> ReadS SendMessageBatchResultEntry
ReadS [SendMessageBatchResultEntry]
(Int -> ReadS SendMessageBatchResultEntry)
-> ReadS [SendMessageBatchResultEntry]
-> ReadPrec SendMessageBatchResultEntry
-> ReadPrec [SendMessageBatchResultEntry]
-> Read SendMessageBatchResultEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendMessageBatchResultEntry]
$creadListPrec :: ReadPrec [SendMessageBatchResultEntry]
readPrec :: ReadPrec SendMessageBatchResultEntry
$creadPrec :: ReadPrec SendMessageBatchResultEntry
readList :: ReadS [SendMessageBatchResultEntry]
$creadList :: ReadS [SendMessageBatchResultEntry]
readsPrec :: Int -> ReadS SendMessageBatchResultEntry
$creadsPrec :: Int -> ReadS SendMessageBatchResultEntry
Prelude.Read, Int -> SendMessageBatchResultEntry -> ShowS
[SendMessageBatchResultEntry] -> ShowS
SendMessageBatchResultEntry -> String
(Int -> SendMessageBatchResultEntry -> ShowS)
-> (SendMessageBatchResultEntry -> String)
-> ([SendMessageBatchResultEntry] -> ShowS)
-> Show SendMessageBatchResultEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendMessageBatchResultEntry] -> ShowS
$cshowList :: [SendMessageBatchResultEntry] -> ShowS
show :: SendMessageBatchResultEntry -> String
$cshow :: SendMessageBatchResultEntry -> String
showsPrec :: Int -> SendMessageBatchResultEntry -> ShowS
$cshowsPrec :: Int -> SendMessageBatchResultEntry -> ShowS
Prelude.Show, (forall x.
 SendMessageBatchResultEntry -> Rep SendMessageBatchResultEntry x)
-> (forall x.
    Rep SendMessageBatchResultEntry x -> SendMessageBatchResultEntry)
-> Generic SendMessageBatchResultEntry
forall x.
Rep SendMessageBatchResultEntry x -> SendMessageBatchResultEntry
forall x.
SendMessageBatchResultEntry -> Rep SendMessageBatchResultEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SendMessageBatchResultEntry x -> SendMessageBatchResultEntry
$cfrom :: forall x.
SendMessageBatchResultEntry -> Rep SendMessageBatchResultEntry x
Prelude.Generic)

-- |
-- Create a value of 'SendMessageBatchResultEntry' 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:
--
-- 'sequenceNumber', 'sendMessageBatchResultEntry_sequenceNumber' - This parameter applies only to FIFO (first-in-first-out) queues.
--
-- The large, non-consecutive number that Amazon SQS assigns to each
-- message.
--
-- The length of @SequenceNumber@ is 128 bits. As @SequenceNumber@
-- continues to increase for a particular @MessageGroupId@.
--
-- 'mD5OfMessageSystemAttributes', 'sendMessageBatchResultEntry_mD5OfMessageSystemAttributes' - An MD5 digest of the non-URL-encoded message system attribute string.
-- You can use this attribute to verify that Amazon SQS received the
-- message correctly. Amazon SQS URL-decodes the message before creating
-- the MD5 digest. For information about MD5, see
-- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
--
-- 'mD5OfMessageAttributes', 'sendMessageBatchResultEntry_mD5OfMessageAttributes' - An MD5 digest of the non-URL-encoded message attribute string. You can
-- use this attribute to verify that Amazon SQS received the message
-- correctly. Amazon SQS URL-decodes the message before creating the MD5
-- digest. For information about MD5, see
-- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
--
-- 'id', 'sendMessageBatchResultEntry_id' - An identifier for the message in this batch.
--
-- 'messageId', 'sendMessageBatchResultEntry_messageId' - An identifier for the message.
--
-- 'mD5OfMessageBody', 'sendMessageBatchResultEntry_mD5OfMessageBody' - An MD5 digest of the non-URL-encoded message body string. You can use
-- this attribute to verify that Amazon SQS received the message correctly.
-- Amazon SQS URL-decodes the message before creating the MD5 digest. For
-- information about MD5, see
-- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
newSendMessageBatchResultEntry ::
  -- | 'id'
  Prelude.Text ->
  -- | 'messageId'
  Prelude.Text ->
  -- | 'mD5OfMessageBody'
  Prelude.Text ->
  SendMessageBatchResultEntry
newSendMessageBatchResultEntry :: Text -> Text -> Text -> SendMessageBatchResultEntry
newSendMessageBatchResultEntry
  Text
pId_
  Text
pMessageId_
  Text
pMD5OfMessageBody_ =
    SendMessageBatchResultEntry' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> SendMessageBatchResultEntry
SendMessageBatchResultEntry'
      { $sel:sequenceNumber:SendMessageBatchResultEntry' :: Maybe Text
sequenceNumber =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:mD5OfMessageSystemAttributes:SendMessageBatchResultEntry' :: Maybe Text
mD5OfMessageSystemAttributes = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:mD5OfMessageAttributes:SendMessageBatchResultEntry' :: Maybe Text
mD5OfMessageAttributes = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:id:SendMessageBatchResultEntry' :: Text
id = Text
pId_,
        $sel:messageId:SendMessageBatchResultEntry' :: Text
messageId = Text
pMessageId_,
        $sel:mD5OfMessageBody:SendMessageBatchResultEntry' :: Text
mD5OfMessageBody = Text
pMD5OfMessageBody_
      }

-- | This parameter applies only to FIFO (first-in-first-out) queues.
--
-- The large, non-consecutive number that Amazon SQS assigns to each
-- message.
--
-- The length of @SequenceNumber@ is 128 bits. As @SequenceNumber@
-- continues to increase for a particular @MessageGroupId@.
sendMessageBatchResultEntry_sequenceNumber :: Lens.Lens' SendMessageBatchResultEntry (Prelude.Maybe Prelude.Text)
sendMessageBatchResultEntry_sequenceNumber :: (Maybe Text -> f (Maybe Text))
-> SendMessageBatchResultEntry -> f SendMessageBatchResultEntry
sendMessageBatchResultEntry_sequenceNumber = (SendMessageBatchResultEntry -> Maybe Text)
-> (SendMessageBatchResultEntry
    -> Maybe Text -> SendMessageBatchResultEntry)
-> Lens
     SendMessageBatchResultEntry
     SendMessageBatchResultEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResultEntry' {Maybe Text
sequenceNumber :: Maybe Text
$sel:sequenceNumber:SendMessageBatchResultEntry' :: SendMessageBatchResultEntry -> Maybe Text
sequenceNumber} -> Maybe Text
sequenceNumber) (\s :: SendMessageBatchResultEntry
s@SendMessageBatchResultEntry' {} Maybe Text
a -> SendMessageBatchResultEntry
s {$sel:sequenceNumber:SendMessageBatchResultEntry' :: Maybe Text
sequenceNumber = Maybe Text
a} :: SendMessageBatchResultEntry)

-- | An MD5 digest of the non-URL-encoded message system attribute string.
-- You can use this attribute to verify that Amazon SQS received the
-- message correctly. Amazon SQS URL-decodes the message before creating
-- the MD5 digest. For information about MD5, see
-- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
sendMessageBatchResultEntry_mD5OfMessageSystemAttributes :: Lens.Lens' SendMessageBatchResultEntry (Prelude.Maybe Prelude.Text)
sendMessageBatchResultEntry_mD5OfMessageSystemAttributes :: (Maybe Text -> f (Maybe Text))
-> SendMessageBatchResultEntry -> f SendMessageBatchResultEntry
sendMessageBatchResultEntry_mD5OfMessageSystemAttributes = (SendMessageBatchResultEntry -> Maybe Text)
-> (SendMessageBatchResultEntry
    -> Maybe Text -> SendMessageBatchResultEntry)
-> Lens
     SendMessageBatchResultEntry
     SendMessageBatchResultEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResultEntry' {Maybe Text
mD5OfMessageSystemAttributes :: Maybe Text
$sel:mD5OfMessageSystemAttributes:SendMessageBatchResultEntry' :: SendMessageBatchResultEntry -> Maybe Text
mD5OfMessageSystemAttributes} -> Maybe Text
mD5OfMessageSystemAttributes) (\s :: SendMessageBatchResultEntry
s@SendMessageBatchResultEntry' {} Maybe Text
a -> SendMessageBatchResultEntry
s {$sel:mD5OfMessageSystemAttributes:SendMessageBatchResultEntry' :: Maybe Text
mD5OfMessageSystemAttributes = Maybe Text
a} :: SendMessageBatchResultEntry)

-- | An MD5 digest of the non-URL-encoded message attribute string. You can
-- use this attribute to verify that Amazon SQS received the message
-- correctly. Amazon SQS URL-decodes the message before creating the MD5
-- digest. For information about MD5, see
-- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
sendMessageBatchResultEntry_mD5OfMessageAttributes :: Lens.Lens' SendMessageBatchResultEntry (Prelude.Maybe Prelude.Text)
sendMessageBatchResultEntry_mD5OfMessageAttributes :: (Maybe Text -> f (Maybe Text))
-> SendMessageBatchResultEntry -> f SendMessageBatchResultEntry
sendMessageBatchResultEntry_mD5OfMessageAttributes = (SendMessageBatchResultEntry -> Maybe Text)
-> (SendMessageBatchResultEntry
    -> Maybe Text -> SendMessageBatchResultEntry)
-> Lens
     SendMessageBatchResultEntry
     SendMessageBatchResultEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResultEntry' {Maybe Text
mD5OfMessageAttributes :: Maybe Text
$sel:mD5OfMessageAttributes:SendMessageBatchResultEntry' :: SendMessageBatchResultEntry -> Maybe Text
mD5OfMessageAttributes} -> Maybe Text
mD5OfMessageAttributes) (\s :: SendMessageBatchResultEntry
s@SendMessageBatchResultEntry' {} Maybe Text
a -> SendMessageBatchResultEntry
s {$sel:mD5OfMessageAttributes:SendMessageBatchResultEntry' :: Maybe Text
mD5OfMessageAttributes = Maybe Text
a} :: SendMessageBatchResultEntry)

-- | An identifier for the message in this batch.
sendMessageBatchResultEntry_id :: Lens.Lens' SendMessageBatchResultEntry Prelude.Text
sendMessageBatchResultEntry_id :: (Text -> f Text)
-> SendMessageBatchResultEntry -> f SendMessageBatchResultEntry
sendMessageBatchResultEntry_id = (SendMessageBatchResultEntry -> Text)
-> (SendMessageBatchResultEntry
    -> Text -> SendMessageBatchResultEntry)
-> Lens
     SendMessageBatchResultEntry SendMessageBatchResultEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResultEntry' {Text
id :: Text
$sel:id:SendMessageBatchResultEntry' :: SendMessageBatchResultEntry -> Text
id} -> Text
id) (\s :: SendMessageBatchResultEntry
s@SendMessageBatchResultEntry' {} Text
a -> SendMessageBatchResultEntry
s {$sel:id:SendMessageBatchResultEntry' :: Text
id = Text
a} :: SendMessageBatchResultEntry)

-- | An identifier for the message.
sendMessageBatchResultEntry_messageId :: Lens.Lens' SendMessageBatchResultEntry Prelude.Text
sendMessageBatchResultEntry_messageId :: (Text -> f Text)
-> SendMessageBatchResultEntry -> f SendMessageBatchResultEntry
sendMessageBatchResultEntry_messageId = (SendMessageBatchResultEntry -> Text)
-> (SendMessageBatchResultEntry
    -> Text -> SendMessageBatchResultEntry)
-> Lens
     SendMessageBatchResultEntry SendMessageBatchResultEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResultEntry' {Text
messageId :: Text
$sel:messageId:SendMessageBatchResultEntry' :: SendMessageBatchResultEntry -> Text
messageId} -> Text
messageId) (\s :: SendMessageBatchResultEntry
s@SendMessageBatchResultEntry' {} Text
a -> SendMessageBatchResultEntry
s {$sel:messageId:SendMessageBatchResultEntry' :: Text
messageId = Text
a} :: SendMessageBatchResultEntry)

-- | An MD5 digest of the non-URL-encoded message body string. You can use
-- this attribute to verify that Amazon SQS received the message correctly.
-- Amazon SQS URL-decodes the message before creating the MD5 digest. For
-- information about MD5, see
-- <https://www.ietf.org/rfc/rfc1321.txt RFC1321>.
sendMessageBatchResultEntry_mD5OfMessageBody :: Lens.Lens' SendMessageBatchResultEntry Prelude.Text
sendMessageBatchResultEntry_mD5OfMessageBody :: (Text -> f Text)
-> SendMessageBatchResultEntry -> f SendMessageBatchResultEntry
sendMessageBatchResultEntry_mD5OfMessageBody = (SendMessageBatchResultEntry -> Text)
-> (SendMessageBatchResultEntry
    -> Text -> SendMessageBatchResultEntry)
-> Lens
     SendMessageBatchResultEntry SendMessageBatchResultEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageBatchResultEntry' {Text
mD5OfMessageBody :: Text
$sel:mD5OfMessageBody:SendMessageBatchResultEntry' :: SendMessageBatchResultEntry -> Text
mD5OfMessageBody} -> Text
mD5OfMessageBody) (\s :: SendMessageBatchResultEntry
s@SendMessageBatchResultEntry' {} Text
a -> SendMessageBatchResultEntry
s {$sel:mD5OfMessageBody:SendMessageBatchResultEntry' :: Text
mD5OfMessageBody = Text
a} :: SendMessageBatchResultEntry)

instance Core.FromXML SendMessageBatchResultEntry where
  parseXML :: [Node] -> Either String SendMessageBatchResultEntry
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> SendMessageBatchResultEntry
SendMessageBatchResultEntry'
      (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> Text
 -> Text
 -> SendMessageBatchResultEntry)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> SendMessageBatchResultEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SequenceNumber")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> SendMessageBatchResultEntry)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Text -> Text -> Text -> SendMessageBatchResultEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MD5OfMessageSystemAttributes")
      Either
  String
  (Maybe Text -> Text -> Text -> Text -> SendMessageBatchResultEntry)
-> Either String (Maybe Text)
-> Either
     String (Text -> Text -> Text -> SendMessageBatchResultEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MD5OfMessageAttributes")
      Either String (Text -> Text -> Text -> SendMessageBatchResultEntry)
-> Either String Text
-> Either String (Text -> Text -> SendMessageBatchResultEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
      Either String (Text -> Text -> SendMessageBatchResultEntry)
-> Either String Text
-> Either String (Text -> SendMessageBatchResultEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"MessageId")
      Either String (Text -> SendMessageBatchResultEntry)
-> Either String Text -> Either String SendMessageBatchResultEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"MD5OfMessageBody")

instance Prelude.Hashable SendMessageBatchResultEntry

instance Prelude.NFData SendMessageBatchResultEntry