{-# 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.SQS.SendMessage
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delivers a message to the specified queue.
--
-- A message can include only XML, JSON, and unformatted text. The
-- following Unicode characters are allowed:
--
-- @#x9@ | @#xA@ | @#xD@ | @#x20@ to @#xD7FF@ | @#xE000@ to @#xFFFD@ |
-- @#x10000@ to @#x10FFFF@
--
-- Any characters not included in this list will be rejected. For more
-- information, see the
-- <http://www.w3.org/TR/REC-xml/#charsets W3C specification for characters>.
module Amazonka.SQS.SendMessage
  ( -- * Creating a Request
    SendMessage (..),
    newSendMessage,

    -- * Request Lenses
    sendMessage_delaySeconds,
    sendMessage_messageAttributes,
    sendMessage_messageDeduplicationId,
    sendMessage_messageGroupId,
    sendMessage_messageSystemAttributes,
    sendMessage_queueUrl,
    sendMessage_messageBody,

    -- * Destructuring the Response
    SendMessageResponse (..),
    newSendMessageResponse,

    -- * Response Lenses
    sendMessageResponse_mD5OfMessageAttributes,
    sendMessageResponse_mD5OfMessageBody,
    sendMessageResponse_mD5OfMessageSystemAttributes,
    sendMessageResponse_messageId,
    sendMessageResponse_sequenceNumber,
    sendMessageResponse_httpStatus,
  )
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.SQS.Types

-- |
--
-- /See:/ 'newSendMessage' smart constructor.
data SendMessage = SendMessage'
  { -- | The length of time, in seconds, for which to delay a specific message.
    -- Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive
    -- @DelaySeconds@ value become available for processing after the delay
    -- period is finished. If you don\'t specify a value, the default value for
    -- the queue applies.
    --
    -- When you set @FifoQueue@, you can\'t set @DelaySeconds@ per message. You
    -- can set this parameter only on a queue level.
    SendMessage -> Maybe Int
delaySeconds :: Prelude.Maybe Prelude.Int,
    -- | Each message attribute consists of a @Name@, @Type@, and @Value@. For
    -- more information, see
    -- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-metadata.html#sqs-message-attributes Amazon SQS message attributes>
    -- in the /Amazon SQS Developer Guide/.
    SendMessage -> Maybe (HashMap Text MessageAttributeValue)
messageAttributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text MessageAttributeValue),
    -- | This parameter applies only to FIFO (first-in-first-out) queues.
    --
    -- The token used for deduplication of sent messages. If a message with a
    -- particular @MessageDeduplicationId@ is sent successfully, any messages
    -- sent with the same @MessageDeduplicationId@ are accepted successfully
    -- but aren\'t delivered during the 5-minute deduplication interval. For
    -- more information, see
    -- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html Exactly-once processing>
    -- in the /Amazon SQS Developer Guide/.
    --
    -- -   Every message must have a unique @MessageDeduplicationId@,
    --
    --     -   You may provide a @MessageDeduplicationId@ explicitly.
    --
    --     -   If you aren\'t able to provide a @MessageDeduplicationId@ and
    --         you enable @ContentBasedDeduplication@ for your queue, Amazon
    --         SQS uses a SHA-256 hash to generate the @MessageDeduplicationId@
    --         using the body of the message (but not the attributes of the
    --         message).
    --
    --     -   If you don\'t provide a @MessageDeduplicationId@ and the queue
    --         doesn\'t have @ContentBasedDeduplication@ set, the action fails
    --         with an error.
    --
    --     -   If the queue has @ContentBasedDeduplication@ set, your
    --         @MessageDeduplicationId@ overrides the generated one.
    --
    -- -   When @ContentBasedDeduplication@ is in effect, messages with
    --     identical content sent within the deduplication interval are treated
    --     as duplicates and only one copy of the message is delivered.
    --
    -- -   If you send one message with @ContentBasedDeduplication@ enabled and
    --     then another message with a @MessageDeduplicationId@ that is the
    --     same as the one generated for the first @MessageDeduplicationId@,
    --     the two messages are treated as duplicates and only one copy of the
    --     message is delivered.
    --
    -- The @MessageDeduplicationId@ is available to the consumer of the message
    -- (this can be useful for troubleshooting delivery issues).
    --
    -- If a message is sent successfully but the acknowledgement is lost and
    -- the message is resent with the same @MessageDeduplicationId@ after the
    -- deduplication interval, Amazon SQS can\'t detect duplicate messages.
    --
    -- Amazon SQS continues to keep track of the message deduplication ID even
    -- after the message is received and deleted.
    --
    -- The maximum length of @MessageDeduplicationId@ is 128 characters.
    -- @MessageDeduplicationId@ can contain alphanumeric characters (@a-z@,
    -- @A-Z@, @0-9@) and punctuation
    -- (@!\"#$%&\'()*+,-.\/:;\<=>?\@[\\]^_\`{|}~@).
    --
    -- For best practices of using @MessageDeduplicationId@, see
    -- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagededuplicationid-property.html Using the MessageDeduplicationId Property>
    -- in the /Amazon SQS Developer Guide/.
    SendMessage -> Maybe Text
messageDeduplicationId :: Prelude.Maybe Prelude.Text,
    -- | This parameter applies only to FIFO (first-in-first-out) queues.
    --
    -- The tag that specifies that a message belongs to a specific message
    -- group. Messages that belong to the same message group are processed in a
    -- FIFO manner (however, messages in different message groups might be
    -- processed out of order). To interleave multiple ordered streams within a
    -- single queue, use @MessageGroupId@ values (for example, session data for
    -- multiple users). In this scenario, multiple consumers can process the
    -- queue, but the session data of each user is processed in a FIFO fashion.
    --
    -- -   You must associate a non-empty @MessageGroupId@ with a message. If
    --     you don\'t provide a @MessageGroupId@, the action fails.
    --
    -- -   @ReceiveMessage@ might return messages with multiple
    --     @MessageGroupId@ values. For each @MessageGroupId@, the messages are
    --     sorted by time sent. The caller can\'t specify a @MessageGroupId@.
    --
    -- The length of @MessageGroupId@ is 128 characters. Valid values:
    -- alphanumeric characters and punctuation
    -- @(!\"#$%&\'()*+,-.\/:;\<=>?\@[\\]^_\`{|}~)@.
    --
    -- For best practices of using @MessageGroupId@, see
    -- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagegroupid-property.html Using the MessageGroupId Property>
    -- in the /Amazon SQS Developer Guide/.
    --
    -- @MessageGroupId@ is required for FIFO queues. You can\'t use it for
    -- Standard queues.
    SendMessage -> Maybe Text
messageGroupId :: Prelude.Maybe Prelude.Text,
    -- | The message system attribute to send. Each message system attribute
    -- consists of a @Name@, @Type@, and @Value@.
    --
    -- -   Currently, the only supported message system attribute is
    --     @AWSTraceHeader@. Its type must be @String@ and its value must be a
    --     correctly formatted X-Ray trace header string.
    --
    -- -   The size of a message system attribute doesn\'t count towards the
    --     total size of a message.
    SendMessage
-> Maybe
     (HashMap
        MessageSystemAttributeNameForSends MessageSystemAttributeValue)
messageSystemAttributes :: Prelude.Maybe (Prelude.HashMap MessageSystemAttributeNameForSends MessageSystemAttributeValue),
    -- | The URL of the Amazon SQS queue to which a message is sent.
    --
    -- Queue URLs and names are case-sensitive.
    SendMessage -> Text
queueUrl :: Prelude.Text,
    -- | The message to send. The minimum size is one character. The maximum size
    -- is 256 KB.
    --
    -- A message can include only XML, JSON, and unformatted text. The
    -- following Unicode characters are allowed:
    --
    -- @#x9@ | @#xA@ | @#xD@ | @#x20@ to @#xD7FF@ | @#xE000@ to @#xFFFD@ |
    -- @#x10000@ to @#x10FFFF@
    --
    -- Any characters not included in this list will be rejected. For more
    -- information, see the
    -- <http://www.w3.org/TR/REC-xml/#charsets W3C specification for characters>.
    SendMessage -> Text
messageBody :: Prelude.Text
  }
  deriving (SendMessage -> SendMessage -> Bool
(SendMessage -> SendMessage -> Bool)
-> (SendMessage -> SendMessage -> Bool) -> Eq SendMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendMessage -> SendMessage -> Bool
== :: SendMessage -> SendMessage -> Bool
$c/= :: SendMessage -> SendMessage -> Bool
/= :: SendMessage -> SendMessage -> Bool
Prelude.Eq, ReadPrec [SendMessage]
ReadPrec SendMessage
Int -> ReadS SendMessage
ReadS [SendMessage]
(Int -> ReadS SendMessage)
-> ReadS [SendMessage]
-> ReadPrec SendMessage
-> ReadPrec [SendMessage]
-> Read SendMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SendMessage
readsPrec :: Int -> ReadS SendMessage
$creadList :: ReadS [SendMessage]
readList :: ReadS [SendMessage]
$creadPrec :: ReadPrec SendMessage
readPrec :: ReadPrec SendMessage
$creadListPrec :: ReadPrec [SendMessage]
readListPrec :: ReadPrec [SendMessage]
Prelude.Read, Int -> SendMessage -> ShowS
[SendMessage] -> ShowS
SendMessage -> String
(Int -> SendMessage -> ShowS)
-> (SendMessage -> String)
-> ([SendMessage] -> ShowS)
-> Show SendMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendMessage -> ShowS
showsPrec :: Int -> SendMessage -> ShowS
$cshow :: SendMessage -> String
show :: SendMessage -> String
$cshowList :: [SendMessage] -> ShowS
showList :: [SendMessage] -> ShowS
Prelude.Show, (forall x. SendMessage -> Rep SendMessage x)
-> (forall x. Rep SendMessage x -> SendMessage)
-> Generic SendMessage
forall x. Rep SendMessage x -> SendMessage
forall x. SendMessage -> Rep SendMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SendMessage -> Rep SendMessage x
from :: forall x. SendMessage -> Rep SendMessage x
$cto :: forall x. Rep SendMessage x -> SendMessage
to :: forall x. Rep SendMessage x -> SendMessage
Prelude.Generic)

-- |
-- Create a value of 'SendMessage' 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:
--
-- 'delaySeconds', 'sendMessage_delaySeconds' - The length of time, in seconds, for which to delay a specific message.
-- Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive
-- @DelaySeconds@ value become available for processing after the delay
-- period is finished. If you don\'t specify a value, the default value for
-- the queue applies.
--
-- When you set @FifoQueue@, you can\'t set @DelaySeconds@ per message. You
-- can set this parameter only on a queue level.
--
-- 'messageAttributes', 'sendMessage_messageAttributes' - Each message attribute consists of a @Name@, @Type@, and @Value@. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-metadata.html#sqs-message-attributes Amazon SQS message attributes>
-- in the /Amazon SQS Developer Guide/.
--
-- 'messageDeduplicationId', 'sendMessage_messageDeduplicationId' - This parameter applies only to FIFO (first-in-first-out) queues.
--
-- The token used for deduplication of sent messages. If a message with a
-- particular @MessageDeduplicationId@ is sent successfully, any messages
-- sent with the same @MessageDeduplicationId@ are accepted successfully
-- but aren\'t delivered during the 5-minute deduplication interval. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html Exactly-once processing>
-- in the /Amazon SQS Developer Guide/.
--
-- -   Every message must have a unique @MessageDeduplicationId@,
--
--     -   You may provide a @MessageDeduplicationId@ explicitly.
--
--     -   If you aren\'t able to provide a @MessageDeduplicationId@ and
--         you enable @ContentBasedDeduplication@ for your queue, Amazon
--         SQS uses a SHA-256 hash to generate the @MessageDeduplicationId@
--         using the body of the message (but not the attributes of the
--         message).
--
--     -   If you don\'t provide a @MessageDeduplicationId@ and the queue
--         doesn\'t have @ContentBasedDeduplication@ set, the action fails
--         with an error.
--
--     -   If the queue has @ContentBasedDeduplication@ set, your
--         @MessageDeduplicationId@ overrides the generated one.
--
-- -   When @ContentBasedDeduplication@ is in effect, messages with
--     identical content sent within the deduplication interval are treated
--     as duplicates and only one copy of the message is delivered.
--
-- -   If you send one message with @ContentBasedDeduplication@ enabled and
--     then another message with a @MessageDeduplicationId@ that is the
--     same as the one generated for the first @MessageDeduplicationId@,
--     the two messages are treated as duplicates and only one copy of the
--     message is delivered.
--
-- The @MessageDeduplicationId@ is available to the consumer of the message
-- (this can be useful for troubleshooting delivery issues).
--
-- If a message is sent successfully but the acknowledgement is lost and
-- the message is resent with the same @MessageDeduplicationId@ after the
-- deduplication interval, Amazon SQS can\'t detect duplicate messages.
--
-- Amazon SQS continues to keep track of the message deduplication ID even
-- after the message is received and deleted.
--
-- The maximum length of @MessageDeduplicationId@ is 128 characters.
-- @MessageDeduplicationId@ can contain alphanumeric characters (@a-z@,
-- @A-Z@, @0-9@) and punctuation
-- (@!\"#$%&\'()*+,-.\/:;\<=>?\@[\\]^_\`{|}~@).
--
-- For best practices of using @MessageDeduplicationId@, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagededuplicationid-property.html Using the MessageDeduplicationId Property>
-- in the /Amazon SQS Developer Guide/.
--
-- 'messageGroupId', 'sendMessage_messageGroupId' - This parameter applies only to FIFO (first-in-first-out) queues.
--
-- The tag that specifies that a message belongs to a specific message
-- group. Messages that belong to the same message group are processed in a
-- FIFO manner (however, messages in different message groups might be
-- processed out of order). To interleave multiple ordered streams within a
-- single queue, use @MessageGroupId@ values (for example, session data for
-- multiple users). In this scenario, multiple consumers can process the
-- queue, but the session data of each user is processed in a FIFO fashion.
--
-- -   You must associate a non-empty @MessageGroupId@ with a message. If
--     you don\'t provide a @MessageGroupId@, the action fails.
--
-- -   @ReceiveMessage@ might return messages with multiple
--     @MessageGroupId@ values. For each @MessageGroupId@, the messages are
--     sorted by time sent. The caller can\'t specify a @MessageGroupId@.
--
-- The length of @MessageGroupId@ is 128 characters. Valid values:
-- alphanumeric characters and punctuation
-- @(!\"#$%&\'()*+,-.\/:;\<=>?\@[\\]^_\`{|}~)@.
--
-- For best practices of using @MessageGroupId@, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagegroupid-property.html Using the MessageGroupId Property>
-- in the /Amazon SQS Developer Guide/.
--
-- @MessageGroupId@ is required for FIFO queues. You can\'t use it for
-- Standard queues.
--
-- 'messageSystemAttributes', 'sendMessage_messageSystemAttributes' - The message system attribute to send. Each message system attribute
-- consists of a @Name@, @Type@, and @Value@.
--
-- -   Currently, the only supported message system attribute is
--     @AWSTraceHeader@. Its type must be @String@ and its value must be a
--     correctly formatted X-Ray trace header string.
--
-- -   The size of a message system attribute doesn\'t count towards the
--     total size of a message.
--
-- 'queueUrl', 'sendMessage_queueUrl' - The URL of the Amazon SQS queue to which a message is sent.
--
-- Queue URLs and names are case-sensitive.
--
-- 'messageBody', 'sendMessage_messageBody' - The message to send. The minimum size is one character. The maximum size
-- is 256 KB.
--
-- A message can include only XML, JSON, and unformatted text. The
-- following Unicode characters are allowed:
--
-- @#x9@ | @#xA@ | @#xD@ | @#x20@ to @#xD7FF@ | @#xE000@ to @#xFFFD@ |
-- @#x10000@ to @#x10FFFF@
--
-- Any characters not included in this list will be rejected. For more
-- information, see the
-- <http://www.w3.org/TR/REC-xml/#charsets W3C specification for characters>.
newSendMessage ::
  -- | 'queueUrl'
  Prelude.Text ->
  -- | 'messageBody'
  Prelude.Text ->
  SendMessage
newSendMessage :: Text -> Text -> SendMessage
newSendMessage Text
pQueueUrl_ Text
pMessageBody_ =
  SendMessage'
    { $sel:delaySeconds:SendMessage' :: Maybe Int
delaySeconds = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:messageAttributes:SendMessage' :: Maybe (HashMap Text MessageAttributeValue)
messageAttributes = Maybe (HashMap Text MessageAttributeValue)
forall a. Maybe a
Prelude.Nothing,
      $sel:messageDeduplicationId:SendMessage' :: Maybe Text
messageDeduplicationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:messageGroupId:SendMessage' :: Maybe Text
messageGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:messageSystemAttributes:SendMessage' :: Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
messageSystemAttributes = Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
forall a. Maybe a
Prelude.Nothing,
      $sel:queueUrl:SendMessage' :: Text
queueUrl = Text
pQueueUrl_,
      $sel:messageBody:SendMessage' :: Text
messageBody = Text
pMessageBody_
    }

-- | The length of time, in seconds, for which to delay a specific message.
-- Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive
-- @DelaySeconds@ value become available for processing after the delay
-- period is finished. If you don\'t specify a value, the default value for
-- the queue applies.
--
-- When you set @FifoQueue@, you can\'t set @DelaySeconds@ per message. You
-- can set this parameter only on a queue level.
sendMessage_delaySeconds :: Lens.Lens' SendMessage (Prelude.Maybe Prelude.Int)
sendMessage_delaySeconds :: Lens' SendMessage (Maybe Int)
sendMessage_delaySeconds = (SendMessage -> Maybe Int)
-> (SendMessage -> Maybe Int -> SendMessage)
-> Lens' SendMessage (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessage' {Maybe Int
$sel:delaySeconds:SendMessage' :: SendMessage -> Maybe Int
delaySeconds :: Maybe Int
delaySeconds} -> Maybe Int
delaySeconds) (\s :: SendMessage
s@SendMessage' {} Maybe Int
a -> SendMessage
s {delaySeconds = a} :: SendMessage)

-- | Each message attribute consists of a @Name@, @Type@, and @Value@. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-metadata.html#sqs-message-attributes Amazon SQS message attributes>
-- in the /Amazon SQS Developer Guide/.
sendMessage_messageAttributes :: Lens.Lens' SendMessage (Prelude.Maybe (Prelude.HashMap Prelude.Text MessageAttributeValue))
sendMessage_messageAttributes :: Lens' SendMessage (Maybe (HashMap Text MessageAttributeValue))
sendMessage_messageAttributes = (SendMessage -> Maybe (HashMap Text MessageAttributeValue))
-> (SendMessage
    -> Maybe (HashMap Text MessageAttributeValue) -> SendMessage)
-> Lens' SendMessage (Maybe (HashMap Text MessageAttributeValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessage' {Maybe (HashMap Text MessageAttributeValue)
$sel:messageAttributes:SendMessage' :: SendMessage -> Maybe (HashMap Text MessageAttributeValue)
messageAttributes :: Maybe (HashMap Text MessageAttributeValue)
messageAttributes} -> Maybe (HashMap Text MessageAttributeValue)
messageAttributes) (\s :: SendMessage
s@SendMessage' {} Maybe (HashMap Text MessageAttributeValue)
a -> SendMessage
s {messageAttributes = a} :: SendMessage) ((Maybe (HashMap Text MessageAttributeValue)
  -> f (Maybe (HashMap Text MessageAttributeValue)))
 -> SendMessage -> f SendMessage)
-> ((Maybe (HashMap Text MessageAttributeValue)
     -> f (Maybe (HashMap Text MessageAttributeValue)))
    -> Maybe (HashMap Text MessageAttributeValue)
    -> f (Maybe (HashMap Text MessageAttributeValue)))
-> (Maybe (HashMap Text MessageAttributeValue)
    -> f (Maybe (HashMap Text MessageAttributeValue)))
-> SendMessage
-> f SendMessage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
-> Iso
     (Maybe (HashMap Text MessageAttributeValue))
     (Maybe (HashMap Text MessageAttributeValue))
     (Maybe (HashMap Text MessageAttributeValue))
     (Maybe (HashMap Text MessageAttributeValue))
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
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Iso
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
  (HashMap Text MessageAttributeValue)
Lens.coerced

-- | This parameter applies only to FIFO (first-in-first-out) queues.
--
-- The token used for deduplication of sent messages. If a message with a
-- particular @MessageDeduplicationId@ is sent successfully, any messages
-- sent with the same @MessageDeduplicationId@ are accepted successfully
-- but aren\'t delivered during the 5-minute deduplication interval. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html Exactly-once processing>
-- in the /Amazon SQS Developer Guide/.
--
-- -   Every message must have a unique @MessageDeduplicationId@,
--
--     -   You may provide a @MessageDeduplicationId@ explicitly.
--
--     -   If you aren\'t able to provide a @MessageDeduplicationId@ and
--         you enable @ContentBasedDeduplication@ for your queue, Amazon
--         SQS uses a SHA-256 hash to generate the @MessageDeduplicationId@
--         using the body of the message (but not the attributes of the
--         message).
--
--     -   If you don\'t provide a @MessageDeduplicationId@ and the queue
--         doesn\'t have @ContentBasedDeduplication@ set, the action fails
--         with an error.
--
--     -   If the queue has @ContentBasedDeduplication@ set, your
--         @MessageDeduplicationId@ overrides the generated one.
--
-- -   When @ContentBasedDeduplication@ is in effect, messages with
--     identical content sent within the deduplication interval are treated
--     as duplicates and only one copy of the message is delivered.
--
-- -   If you send one message with @ContentBasedDeduplication@ enabled and
--     then another message with a @MessageDeduplicationId@ that is the
--     same as the one generated for the first @MessageDeduplicationId@,
--     the two messages are treated as duplicates and only one copy of the
--     message is delivered.
--
-- The @MessageDeduplicationId@ is available to the consumer of the message
-- (this can be useful for troubleshooting delivery issues).
--
-- If a message is sent successfully but the acknowledgement is lost and
-- the message is resent with the same @MessageDeduplicationId@ after the
-- deduplication interval, Amazon SQS can\'t detect duplicate messages.
--
-- Amazon SQS continues to keep track of the message deduplication ID even
-- after the message is received and deleted.
--
-- The maximum length of @MessageDeduplicationId@ is 128 characters.
-- @MessageDeduplicationId@ can contain alphanumeric characters (@a-z@,
-- @A-Z@, @0-9@) and punctuation
-- (@!\"#$%&\'()*+,-.\/:;\<=>?\@[\\]^_\`{|}~@).
--
-- For best practices of using @MessageDeduplicationId@, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagededuplicationid-property.html Using the MessageDeduplicationId Property>
-- in the /Amazon SQS Developer Guide/.
sendMessage_messageDeduplicationId :: Lens.Lens' SendMessage (Prelude.Maybe Prelude.Text)
sendMessage_messageDeduplicationId :: Lens' SendMessage (Maybe Text)
sendMessage_messageDeduplicationId = (SendMessage -> Maybe Text)
-> (SendMessage -> Maybe Text -> SendMessage)
-> Lens' SendMessage (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessage' {Maybe Text
$sel:messageDeduplicationId:SendMessage' :: SendMessage -> Maybe Text
messageDeduplicationId :: Maybe Text
messageDeduplicationId} -> Maybe Text
messageDeduplicationId) (\s :: SendMessage
s@SendMessage' {} Maybe Text
a -> SendMessage
s {messageDeduplicationId = a} :: SendMessage)

-- | This parameter applies only to FIFO (first-in-first-out) queues.
--
-- The tag that specifies that a message belongs to a specific message
-- group. Messages that belong to the same message group are processed in a
-- FIFO manner (however, messages in different message groups might be
-- processed out of order). To interleave multiple ordered streams within a
-- single queue, use @MessageGroupId@ values (for example, session data for
-- multiple users). In this scenario, multiple consumers can process the
-- queue, but the session data of each user is processed in a FIFO fashion.
--
-- -   You must associate a non-empty @MessageGroupId@ with a message. If
--     you don\'t provide a @MessageGroupId@, the action fails.
--
-- -   @ReceiveMessage@ might return messages with multiple
--     @MessageGroupId@ values. For each @MessageGroupId@, the messages are
--     sorted by time sent. The caller can\'t specify a @MessageGroupId@.
--
-- The length of @MessageGroupId@ is 128 characters. Valid values:
-- alphanumeric characters and punctuation
-- @(!\"#$%&\'()*+,-.\/:;\<=>?\@[\\]^_\`{|}~)@.
--
-- For best practices of using @MessageGroupId@, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagegroupid-property.html Using the MessageGroupId Property>
-- in the /Amazon SQS Developer Guide/.
--
-- @MessageGroupId@ is required for FIFO queues. You can\'t use it for
-- Standard queues.
sendMessage_messageGroupId :: Lens.Lens' SendMessage (Prelude.Maybe Prelude.Text)
sendMessage_messageGroupId :: Lens' SendMessage (Maybe Text)
sendMessage_messageGroupId = (SendMessage -> Maybe Text)
-> (SendMessage -> Maybe Text -> SendMessage)
-> Lens' SendMessage (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessage' {Maybe Text
$sel:messageGroupId:SendMessage' :: SendMessage -> Maybe Text
messageGroupId :: Maybe Text
messageGroupId} -> Maybe Text
messageGroupId) (\s :: SendMessage
s@SendMessage' {} Maybe Text
a -> SendMessage
s {messageGroupId = a} :: SendMessage)

-- | The message system attribute to send. Each message system attribute
-- consists of a @Name@, @Type@, and @Value@.
--
-- -   Currently, the only supported message system attribute is
--     @AWSTraceHeader@. Its type must be @String@ and its value must be a
--     correctly formatted X-Ray trace header string.
--
-- -   The size of a message system attribute doesn\'t count towards the
--     total size of a message.
sendMessage_messageSystemAttributes :: Lens.Lens' SendMessage (Prelude.Maybe (Prelude.HashMap MessageSystemAttributeNameForSends MessageSystemAttributeValue))
sendMessage_messageSystemAttributes :: Lens'
  SendMessage
  (Maybe
     (HashMap
        MessageSystemAttributeNameForSends MessageSystemAttributeValue))
sendMessage_messageSystemAttributes = (SendMessage
 -> Maybe
      (HashMap
         MessageSystemAttributeNameForSends MessageSystemAttributeValue))
-> (SendMessage
    -> Maybe
         (HashMap
            MessageSystemAttributeNameForSends MessageSystemAttributeValue)
    -> SendMessage)
-> Lens'
     SendMessage
     (Maybe
        (HashMap
           MessageSystemAttributeNameForSends MessageSystemAttributeValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessage' {Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
$sel:messageSystemAttributes:SendMessage' :: SendMessage
-> Maybe
     (HashMap
        MessageSystemAttributeNameForSends MessageSystemAttributeValue)
messageSystemAttributes :: Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
messageSystemAttributes} -> Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
messageSystemAttributes) (\s :: SendMessage
s@SendMessage' {} Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
a -> SendMessage
s {messageSystemAttributes = a} :: SendMessage) ((Maybe
    (HashMap
       MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  -> f (Maybe
          (HashMap
             MessageSystemAttributeNameForSends MessageSystemAttributeValue)))
 -> SendMessage -> f SendMessage)
-> ((Maybe
       (HashMap
          MessageSystemAttributeNameForSends MessageSystemAttributeValue)
     -> f (Maybe
             (HashMap
                MessageSystemAttributeNameForSends MessageSystemAttributeValue)))
    -> Maybe
         (HashMap
            MessageSystemAttributeNameForSends MessageSystemAttributeValue)
    -> f (Maybe
            (HashMap
               MessageSystemAttributeNameForSends MessageSystemAttributeValue)))
-> (Maybe
      (HashMap
         MessageSystemAttributeNameForSends MessageSystemAttributeValue)
    -> f (Maybe
            (HashMap
               MessageSystemAttributeNameForSends MessageSystemAttributeValue)))
-> SendMessage
-> f SendMessage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
-> Iso
     (Maybe
        (HashMap
           MessageSystemAttributeNameForSends MessageSystemAttributeValue))
     (Maybe
        (HashMap
           MessageSystemAttributeNameForSends MessageSystemAttributeValue))
     (Maybe
        (HashMap
           MessageSystemAttributeNameForSends MessageSystemAttributeValue))
     (Maybe
        (HashMap
           MessageSystemAttributeNameForSends MessageSystemAttributeValue))
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
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Iso
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
Lens.coerced

-- | The URL of the Amazon SQS queue to which a message is sent.
--
-- Queue URLs and names are case-sensitive.
sendMessage_queueUrl :: Lens.Lens' SendMessage Prelude.Text
sendMessage_queueUrl :: Lens' SendMessage Text
sendMessage_queueUrl = (SendMessage -> Text)
-> (SendMessage -> Text -> SendMessage) -> Lens' SendMessage Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessage' {Text
$sel:queueUrl:SendMessage' :: SendMessage -> Text
queueUrl :: Text
queueUrl} -> Text
queueUrl) (\s :: SendMessage
s@SendMessage' {} Text
a -> SendMessage
s {queueUrl = a} :: SendMessage)

-- | The message to send. The minimum size is one character. The maximum size
-- is 256 KB.
--
-- A message can include only XML, JSON, and unformatted text. The
-- following Unicode characters are allowed:
--
-- @#x9@ | @#xA@ | @#xD@ | @#x20@ to @#xD7FF@ | @#xE000@ to @#xFFFD@ |
-- @#x10000@ to @#x10FFFF@
--
-- Any characters not included in this list will be rejected. For more
-- information, see the
-- <http://www.w3.org/TR/REC-xml/#charsets W3C specification for characters>.
sendMessage_messageBody :: Lens.Lens' SendMessage Prelude.Text
sendMessage_messageBody :: Lens' SendMessage Text
sendMessage_messageBody = (SendMessage -> Text)
-> (SendMessage -> Text -> SendMessage) -> Lens' SendMessage Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessage' {Text
$sel:messageBody:SendMessage' :: SendMessage -> Text
messageBody :: Text
messageBody} -> Text
messageBody) (\s :: SendMessage
s@SendMessage' {} Text
a -> SendMessage
s {messageBody = a} :: SendMessage)

instance Core.AWSRequest SendMessage where
  type AWSResponse SendMessage = SendMessageResponse
  request :: (Service -> Service) -> SendMessage -> Request SendMessage
request Service -> Service
overrides =
    Service -> SendMessage -> Request SendMessage
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SendMessage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendMessage)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse SendMessage))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SendMessage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendMessage)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"SendMessageResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> SendMessageResponse
SendMessageResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> SendMessageResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> SendMessageResponse)
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)
Data..@? Text
"MD5OfMessageAttributes")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> SendMessageResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Int -> SendMessageResponse)
forall a b.
Either String (a -> b) -> Either String a -> Either String b
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)
Data..@? Text
"MD5OfMessageBody")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Int -> SendMessageResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> SendMessageResponse)
forall a b.
Either String (a -> b) -> Either String a -> Either String b
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)
Data..@? Text
"MD5OfMessageSystemAttributes")
            Either
  String (Maybe Text -> Maybe Text -> Int -> SendMessageResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> SendMessageResponse)
forall a b.
Either String (a -> b) -> Either String a -> Either String b
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)
Data..@? Text
"MessageId")
            Either String (Maybe Text -> Int -> SendMessageResponse)
-> Either String (Maybe Text)
-> Either String (Int -> SendMessageResponse)
forall a b.
Either String (a -> b) -> Either String a -> Either String b
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)
Data..@? Text
"SequenceNumber")
            Either String (Int -> SendMessageResponse)
-> Either String Int -> Either String SendMessageResponse
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall a. a -> Either String a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable SendMessage where
  hashWithSalt :: Int -> SendMessage -> Int
hashWithSalt Int
_salt SendMessage' {Maybe Int
Maybe (HashMap Text MessageAttributeValue)
Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
Maybe Text
Text
$sel:delaySeconds:SendMessage' :: SendMessage -> Maybe Int
$sel:messageAttributes:SendMessage' :: SendMessage -> Maybe (HashMap Text MessageAttributeValue)
$sel:messageDeduplicationId:SendMessage' :: SendMessage -> Maybe Text
$sel:messageGroupId:SendMessage' :: SendMessage -> Maybe Text
$sel:messageSystemAttributes:SendMessage' :: SendMessage
-> Maybe
     (HashMap
        MessageSystemAttributeNameForSends MessageSystemAttributeValue)
$sel:queueUrl:SendMessage' :: SendMessage -> Text
$sel:messageBody:SendMessage' :: SendMessage -> Text
delaySeconds :: Maybe Int
messageAttributes :: Maybe (HashMap Text MessageAttributeValue)
messageDeduplicationId :: Maybe Text
messageGroupId :: Maybe Text
messageSystemAttributes :: Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
queueUrl :: Text
messageBody :: Text
..} =
    Int
_salt
      Int -> Maybe Int -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
delaySeconds
      Int -> Maybe (HashMap Text MessageAttributeValue) -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text MessageAttributeValue)
messageAttributes
      Int -> Maybe Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
messageDeduplicationId
      Int -> Maybe Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
messageGroupId
      Int
-> Maybe
     (HashMap
        MessageSystemAttributeNameForSends MessageSystemAttributeValue)
-> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
messageSystemAttributes
      Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
queueUrl
      Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
messageBody

instance Prelude.NFData SendMessage where
  rnf :: SendMessage -> ()
rnf SendMessage' {Maybe Int
Maybe (HashMap Text MessageAttributeValue)
Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
Maybe Text
Text
$sel:delaySeconds:SendMessage' :: SendMessage -> Maybe Int
$sel:messageAttributes:SendMessage' :: SendMessage -> Maybe (HashMap Text MessageAttributeValue)
$sel:messageDeduplicationId:SendMessage' :: SendMessage -> Maybe Text
$sel:messageGroupId:SendMessage' :: SendMessage -> Maybe Text
$sel:messageSystemAttributes:SendMessage' :: SendMessage
-> Maybe
     (HashMap
        MessageSystemAttributeNameForSends MessageSystemAttributeValue)
$sel:queueUrl:SendMessage' :: SendMessage -> Text
$sel:messageBody:SendMessage' :: SendMessage -> Text
delaySeconds :: Maybe Int
messageAttributes :: Maybe (HashMap Text MessageAttributeValue)
messageDeduplicationId :: Maybe Text
messageGroupId :: Maybe Text
messageSystemAttributes :: Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
queueUrl :: Text
messageBody :: Text
..} =
    Maybe Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
delaySeconds
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe (HashMap Text MessageAttributeValue) -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text MessageAttributeValue)
messageAttributes
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messageDeduplicationId
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messageGroupId
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
-> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
messageSystemAttributes
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Text
queueUrl
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Text
messageBody

instance Data.ToHeaders SendMessage where
  toHeaders :: SendMessage -> ResponseHeaders
toHeaders = ResponseHeaders -> SendMessage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath SendMessage where
  toPath :: SendMessage -> ByteString
toPath = ByteString -> SendMessage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery SendMessage where
  toQuery :: SendMessage -> QueryString
toQuery SendMessage' {Maybe Int
Maybe (HashMap Text MessageAttributeValue)
Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
Maybe Text
Text
$sel:delaySeconds:SendMessage' :: SendMessage -> Maybe Int
$sel:messageAttributes:SendMessage' :: SendMessage -> Maybe (HashMap Text MessageAttributeValue)
$sel:messageDeduplicationId:SendMessage' :: SendMessage -> Maybe Text
$sel:messageGroupId:SendMessage' :: SendMessage -> Maybe Text
$sel:messageSystemAttributes:SendMessage' :: SendMessage
-> Maybe
     (HashMap
        MessageSystemAttributeNameForSends MessageSystemAttributeValue)
$sel:queueUrl:SendMessage' :: SendMessage -> Text
$sel:messageBody:SendMessage' :: SendMessage -> Text
delaySeconds :: Maybe Int
messageAttributes :: Maybe (HashMap Text MessageAttributeValue)
messageDeduplicationId :: Maybe Text
messageGroupId :: Maybe Text
messageSystemAttributes :: Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
queueUrl :: Text
messageBody :: Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"SendMessage" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2012-11-05" :: Prelude.ByteString),
        ByteString
"DelaySeconds" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
delaySeconds,
        Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( ByteString
-> ByteString
-> ByteString
-> HashMap Text MessageAttributeValue
-> QueryString
forall k v.
(ToQuery k, ToQuery v) =>
ByteString
-> ByteString -> ByteString -> HashMap k v -> QueryString
Data.toQueryMap ByteString
"MessageAttribute" ByteString
"Name" ByteString
"Value"
              (HashMap Text MessageAttributeValue -> QueryString)
-> Maybe (HashMap Text MessageAttributeValue) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text MessageAttributeValue)
messageAttributes
          ),
        ByteString
"MessageDeduplicationId"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
messageDeduplicationId,
        ByteString
"MessageGroupId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
messageGroupId,
        Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( ByteString
-> ByteString
-> ByteString
-> HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue
-> QueryString
forall k v.
(ToQuery k, ToQuery v) =>
ByteString
-> ByteString -> ByteString -> HashMap k v -> QueryString
Data.toQueryMap
              ByteString
"MessageSystemAttribute"
              ByteString
"Name"
              ByteString
"Value"
              (HashMap
   MessageSystemAttributeNameForSends MessageSystemAttributeValue
 -> QueryString)
-> Maybe
     (HashMap
        MessageSystemAttributeNameForSends MessageSystemAttributeValue)
-> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe
  (HashMap
     MessageSystemAttributeNameForSends MessageSystemAttributeValue)
messageSystemAttributes
          ),
        ByteString
"QueueUrl" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
queueUrl,
        ByteString
"MessageBody" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
messageBody
      ]

-- | The @MD5OfMessageBody@ and @MessageId@ elements.
--
-- /See:/ 'newSendMessageResponse' smart constructor.
data SendMessageResponse = SendMessageResponse'
  { -- | 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>.
    SendMessageResponse -> Maybe Text
mD5OfMessageAttributes :: Prelude.Maybe 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>.
    SendMessageResponse -> Maybe Text
mD5OfMessageBody :: 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.
    SendMessageResponse -> Maybe Text
mD5OfMessageSystemAttributes :: Prelude.Maybe Prelude.Text,
    -- | An attribute containing the @MessageId@ of the message sent to the
    -- queue. For more information, see
    -- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-message-identifiers.html Queue and Message Identifiers>
    -- in the /Amazon SQS Developer Guide/.
    SendMessageResponse -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text,
    -- | 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. @SequenceNumber@ continues
    -- to increase for a particular @MessageGroupId@.
    SendMessageResponse -> Maybe Text
sequenceNumber :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    SendMessageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SendMessageResponse -> SendMessageResponse -> Bool
(SendMessageResponse -> SendMessageResponse -> Bool)
-> (SendMessageResponse -> SendMessageResponse -> Bool)
-> Eq SendMessageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendMessageResponse -> SendMessageResponse -> Bool
== :: SendMessageResponse -> SendMessageResponse -> Bool
$c/= :: SendMessageResponse -> SendMessageResponse -> Bool
/= :: SendMessageResponse -> SendMessageResponse -> Bool
Prelude.Eq, ReadPrec [SendMessageResponse]
ReadPrec SendMessageResponse
Int -> ReadS SendMessageResponse
ReadS [SendMessageResponse]
(Int -> ReadS SendMessageResponse)
-> ReadS [SendMessageResponse]
-> ReadPrec SendMessageResponse
-> ReadPrec [SendMessageResponse]
-> Read SendMessageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SendMessageResponse
readsPrec :: Int -> ReadS SendMessageResponse
$creadList :: ReadS [SendMessageResponse]
readList :: ReadS [SendMessageResponse]
$creadPrec :: ReadPrec SendMessageResponse
readPrec :: ReadPrec SendMessageResponse
$creadListPrec :: ReadPrec [SendMessageResponse]
readListPrec :: ReadPrec [SendMessageResponse]
Prelude.Read, Int -> SendMessageResponse -> ShowS
[SendMessageResponse] -> ShowS
SendMessageResponse -> String
(Int -> SendMessageResponse -> ShowS)
-> (SendMessageResponse -> String)
-> ([SendMessageResponse] -> ShowS)
-> Show SendMessageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendMessageResponse -> ShowS
showsPrec :: Int -> SendMessageResponse -> ShowS
$cshow :: SendMessageResponse -> String
show :: SendMessageResponse -> String
$cshowList :: [SendMessageResponse] -> ShowS
showList :: [SendMessageResponse] -> ShowS
Prelude.Show, (forall x. SendMessageResponse -> Rep SendMessageResponse x)
-> (forall x. Rep SendMessageResponse x -> SendMessageResponse)
-> Generic SendMessageResponse
forall x. Rep SendMessageResponse x -> SendMessageResponse
forall x. SendMessageResponse -> Rep SendMessageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SendMessageResponse -> Rep SendMessageResponse x
from :: forall x. SendMessageResponse -> Rep SendMessageResponse x
$cto :: forall x. Rep SendMessageResponse x -> SendMessageResponse
to :: forall x. Rep SendMessageResponse x -> SendMessageResponse
Prelude.Generic)

-- |
-- Create a value of 'SendMessageResponse' 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:
--
-- 'mD5OfMessageAttributes', 'sendMessageResponse_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>.
--
-- 'mD5OfMessageBody', 'sendMessageResponse_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>.
--
-- 'mD5OfMessageSystemAttributes', 'sendMessageResponse_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.
--
-- 'messageId', 'sendMessageResponse_messageId' - An attribute containing the @MessageId@ of the message sent to the
-- queue. For more information, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-message-identifiers.html Queue and Message Identifiers>
-- in the /Amazon SQS Developer Guide/.
--
-- 'sequenceNumber', 'sendMessageResponse_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. @SequenceNumber@ continues
-- to increase for a particular @MessageGroupId@.
--
-- 'httpStatus', 'sendMessageResponse_httpStatus' - The response's http status code.
newSendMessageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SendMessageResponse
newSendMessageResponse :: Int -> SendMessageResponse
newSendMessageResponse Int
pHttpStatus_ =
  SendMessageResponse'
    { $sel:mD5OfMessageAttributes:SendMessageResponse' :: Maybe Text
mD5OfMessageAttributes =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:mD5OfMessageBody:SendMessageResponse' :: Maybe Text
mD5OfMessageBody = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:mD5OfMessageSystemAttributes:SendMessageResponse' :: Maybe Text
mD5OfMessageSystemAttributes = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:messageId:SendMessageResponse' :: Maybe Text
messageId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sequenceNumber:SendMessageResponse' :: Maybe Text
sequenceNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SendMessageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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>.
sendMessageResponse_mD5OfMessageAttributes :: Lens.Lens' SendMessageResponse (Prelude.Maybe Prelude.Text)
sendMessageResponse_mD5OfMessageAttributes :: Lens' SendMessageResponse (Maybe Text)
sendMessageResponse_mD5OfMessageAttributes = (SendMessageResponse -> Maybe Text)
-> (SendMessageResponse -> Maybe Text -> SendMessageResponse)
-> Lens' SendMessageResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageResponse' {Maybe Text
$sel:mD5OfMessageAttributes:SendMessageResponse' :: SendMessageResponse -> Maybe Text
mD5OfMessageAttributes :: Maybe Text
mD5OfMessageAttributes} -> Maybe Text
mD5OfMessageAttributes) (\s :: SendMessageResponse
s@SendMessageResponse' {} Maybe Text
a -> SendMessageResponse
s {mD5OfMessageAttributes = a} :: SendMessageResponse)

-- | 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>.
sendMessageResponse_mD5OfMessageBody :: Lens.Lens' SendMessageResponse (Prelude.Maybe Prelude.Text)
sendMessageResponse_mD5OfMessageBody :: Lens' SendMessageResponse (Maybe Text)
sendMessageResponse_mD5OfMessageBody = (SendMessageResponse -> Maybe Text)
-> (SendMessageResponse -> Maybe Text -> SendMessageResponse)
-> Lens' SendMessageResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageResponse' {Maybe Text
$sel:mD5OfMessageBody:SendMessageResponse' :: SendMessageResponse -> Maybe Text
mD5OfMessageBody :: Maybe Text
mD5OfMessageBody} -> Maybe Text
mD5OfMessageBody) (\s :: SendMessageResponse
s@SendMessageResponse' {} Maybe Text
a -> SendMessageResponse
s {mD5OfMessageBody = a} :: SendMessageResponse)

-- | 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.
sendMessageResponse_mD5OfMessageSystemAttributes :: Lens.Lens' SendMessageResponse (Prelude.Maybe Prelude.Text)
sendMessageResponse_mD5OfMessageSystemAttributes :: Lens' SendMessageResponse (Maybe Text)
sendMessageResponse_mD5OfMessageSystemAttributes = (SendMessageResponse -> Maybe Text)
-> (SendMessageResponse -> Maybe Text -> SendMessageResponse)
-> Lens' SendMessageResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageResponse' {Maybe Text
$sel:mD5OfMessageSystemAttributes:SendMessageResponse' :: SendMessageResponse -> Maybe Text
mD5OfMessageSystemAttributes :: Maybe Text
mD5OfMessageSystemAttributes} -> Maybe Text
mD5OfMessageSystemAttributes) (\s :: SendMessageResponse
s@SendMessageResponse' {} Maybe Text
a -> SendMessageResponse
s {mD5OfMessageSystemAttributes = a} :: SendMessageResponse)

-- | An attribute containing the @MessageId@ of the message sent to the
-- queue. For more information, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-message-identifiers.html Queue and Message Identifiers>
-- in the /Amazon SQS Developer Guide/.
sendMessageResponse_messageId :: Lens.Lens' SendMessageResponse (Prelude.Maybe Prelude.Text)
sendMessageResponse_messageId :: Lens' SendMessageResponse (Maybe Text)
sendMessageResponse_messageId = (SendMessageResponse -> Maybe Text)
-> (SendMessageResponse -> Maybe Text -> SendMessageResponse)
-> Lens' SendMessageResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageResponse' {Maybe Text
$sel:messageId:SendMessageResponse' :: SendMessageResponse -> Maybe Text
messageId :: Maybe Text
messageId} -> Maybe Text
messageId) (\s :: SendMessageResponse
s@SendMessageResponse' {} Maybe Text
a -> SendMessageResponse
s {messageId = a} :: SendMessageResponse)

-- | 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. @SequenceNumber@ continues
-- to increase for a particular @MessageGroupId@.
sendMessageResponse_sequenceNumber :: Lens.Lens' SendMessageResponse (Prelude.Maybe Prelude.Text)
sendMessageResponse_sequenceNumber :: Lens' SendMessageResponse (Maybe Text)
sendMessageResponse_sequenceNumber = (SendMessageResponse -> Maybe Text)
-> (SendMessageResponse -> Maybe Text -> SendMessageResponse)
-> Lens' SendMessageResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendMessageResponse' {Maybe Text
$sel:sequenceNumber:SendMessageResponse' :: SendMessageResponse -> Maybe Text
sequenceNumber :: Maybe Text
sequenceNumber} -> Maybe Text
sequenceNumber) (\s :: SendMessageResponse
s@SendMessageResponse' {} Maybe Text
a -> SendMessageResponse
s {sequenceNumber = a} :: SendMessageResponse)

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

instance Prelude.NFData SendMessageResponse where
  rnf :: SendMessageResponse -> ()
rnf SendMessageResponse' {Int
Maybe Text
$sel:mD5OfMessageAttributes:SendMessageResponse' :: SendMessageResponse -> Maybe Text
$sel:mD5OfMessageBody:SendMessageResponse' :: SendMessageResponse -> Maybe Text
$sel:mD5OfMessageSystemAttributes:SendMessageResponse' :: SendMessageResponse -> Maybe Text
$sel:messageId:SendMessageResponse' :: SendMessageResponse -> Maybe Text
$sel:sequenceNumber:SendMessageResponse' :: SendMessageResponse -> Maybe Text
$sel:httpStatus:SendMessageResponse' :: SendMessageResponse -> Int
mD5OfMessageAttributes :: Maybe Text
mD5OfMessageBody :: Maybe Text
mD5OfMessageSystemAttributes :: Maybe Text
messageId :: Maybe Text
sequenceNumber :: Maybe Text
httpStatus :: Int
..} =
    Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mD5OfMessageAttributes
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mD5OfMessageBody
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mD5OfMessageSystemAttributes
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messageId
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sequenceNumber
      () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq` Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus