{-# 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.ChangeMessageVisibilityBatchRequestEntry
-- 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.ChangeMessageVisibilityBatchRequestEntry where

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

-- | Encloses a receipt handle and an entry id for each message in
-- @ ChangeMessageVisibilityBatch.@
--
-- All of the following list parameters must be prefixed with
-- @ChangeMessageVisibilityBatchRequestEntry.n@, where @n@ is an integer
-- value starting with @1@. For example, a parameter list for this action
-- might look like this:
--
-- @&ChangeMessageVisibilityBatchRequestEntry.1.Id=change_visibility_msg_2@
--
-- @&ChangeMessageVisibilityBatchRequestEntry.1.ReceiptHandle=your_receipt_handle@
--
-- @&ChangeMessageVisibilityBatchRequestEntry.1.VisibilityTimeout=45@
--
-- /See:/ 'newChangeMessageVisibilityBatchRequestEntry' smart constructor.
data ChangeMessageVisibilityBatchRequestEntry = ChangeMessageVisibilityBatchRequestEntry'
  { -- | The new value (in seconds) for the message\'s visibility timeout.
    ChangeMessageVisibilityBatchRequestEntry -> Maybe Int
visibilityTimeout :: Prelude.Maybe Prelude.Int,
    -- | An identifier for this particular receipt handle used to communicate the
    -- result.
    --
    -- The @Id@s of a batch request need to be unique within a request.
    --
    -- This identifier can have up to 80 characters. The following characters
    -- are accepted: alphanumeric characters, hyphens(-), and underscores (_).
    ChangeMessageVisibilityBatchRequestEntry -> Text
id :: Prelude.Text,
    -- | A receipt handle.
    ChangeMessageVisibilityBatchRequestEntry -> Text
receiptHandle :: Prelude.Text
  }
  deriving (ChangeMessageVisibilityBatchRequestEntry
-> ChangeMessageVisibilityBatchRequestEntry -> Bool
(ChangeMessageVisibilityBatchRequestEntry
 -> ChangeMessageVisibilityBatchRequestEntry -> Bool)
-> (ChangeMessageVisibilityBatchRequestEntry
    -> ChangeMessageVisibilityBatchRequestEntry -> Bool)
-> Eq ChangeMessageVisibilityBatchRequestEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChangeMessageVisibilityBatchRequestEntry
-> ChangeMessageVisibilityBatchRequestEntry -> Bool
$c/= :: ChangeMessageVisibilityBatchRequestEntry
-> ChangeMessageVisibilityBatchRequestEntry -> Bool
== :: ChangeMessageVisibilityBatchRequestEntry
-> ChangeMessageVisibilityBatchRequestEntry -> Bool
$c== :: ChangeMessageVisibilityBatchRequestEntry
-> ChangeMessageVisibilityBatchRequestEntry -> Bool
Prelude.Eq, ReadPrec [ChangeMessageVisibilityBatchRequestEntry]
ReadPrec ChangeMessageVisibilityBatchRequestEntry
Int -> ReadS ChangeMessageVisibilityBatchRequestEntry
ReadS [ChangeMessageVisibilityBatchRequestEntry]
(Int -> ReadS ChangeMessageVisibilityBatchRequestEntry)
-> ReadS [ChangeMessageVisibilityBatchRequestEntry]
-> ReadPrec ChangeMessageVisibilityBatchRequestEntry
-> ReadPrec [ChangeMessageVisibilityBatchRequestEntry]
-> Read ChangeMessageVisibilityBatchRequestEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChangeMessageVisibilityBatchRequestEntry]
$creadListPrec :: ReadPrec [ChangeMessageVisibilityBatchRequestEntry]
readPrec :: ReadPrec ChangeMessageVisibilityBatchRequestEntry
$creadPrec :: ReadPrec ChangeMessageVisibilityBatchRequestEntry
readList :: ReadS [ChangeMessageVisibilityBatchRequestEntry]
$creadList :: ReadS [ChangeMessageVisibilityBatchRequestEntry]
readsPrec :: Int -> ReadS ChangeMessageVisibilityBatchRequestEntry
$creadsPrec :: Int -> ReadS ChangeMessageVisibilityBatchRequestEntry
Prelude.Read, Int -> ChangeMessageVisibilityBatchRequestEntry -> ShowS
[ChangeMessageVisibilityBatchRequestEntry] -> ShowS
ChangeMessageVisibilityBatchRequestEntry -> String
(Int -> ChangeMessageVisibilityBatchRequestEntry -> ShowS)
-> (ChangeMessageVisibilityBatchRequestEntry -> String)
-> ([ChangeMessageVisibilityBatchRequestEntry] -> ShowS)
-> Show ChangeMessageVisibilityBatchRequestEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChangeMessageVisibilityBatchRequestEntry] -> ShowS
$cshowList :: [ChangeMessageVisibilityBatchRequestEntry] -> ShowS
show :: ChangeMessageVisibilityBatchRequestEntry -> String
$cshow :: ChangeMessageVisibilityBatchRequestEntry -> String
showsPrec :: Int -> ChangeMessageVisibilityBatchRequestEntry -> ShowS
$cshowsPrec :: Int -> ChangeMessageVisibilityBatchRequestEntry -> ShowS
Prelude.Show, (forall x.
 ChangeMessageVisibilityBatchRequestEntry
 -> Rep ChangeMessageVisibilityBatchRequestEntry x)
-> (forall x.
    Rep ChangeMessageVisibilityBatchRequestEntry x
    -> ChangeMessageVisibilityBatchRequestEntry)
-> Generic ChangeMessageVisibilityBatchRequestEntry
forall x.
Rep ChangeMessageVisibilityBatchRequestEntry x
-> ChangeMessageVisibilityBatchRequestEntry
forall x.
ChangeMessageVisibilityBatchRequestEntry
-> Rep ChangeMessageVisibilityBatchRequestEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ChangeMessageVisibilityBatchRequestEntry x
-> ChangeMessageVisibilityBatchRequestEntry
$cfrom :: forall x.
ChangeMessageVisibilityBatchRequestEntry
-> Rep ChangeMessageVisibilityBatchRequestEntry x
Prelude.Generic)

-- |
-- Create a value of 'ChangeMessageVisibilityBatchRequestEntry' 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:
--
-- 'visibilityTimeout', 'changeMessageVisibilityBatchRequestEntry_visibilityTimeout' - The new value (in seconds) for the message\'s visibility timeout.
--
-- 'id', 'changeMessageVisibilityBatchRequestEntry_id' - An identifier for this particular receipt handle used to communicate the
-- result.
--
-- The @Id@s of a batch request need to be unique within a request.
--
-- This identifier can have up to 80 characters. The following characters
-- are accepted: alphanumeric characters, hyphens(-), and underscores (_).
--
-- 'receiptHandle', 'changeMessageVisibilityBatchRequestEntry_receiptHandle' - A receipt handle.
newChangeMessageVisibilityBatchRequestEntry ::
  -- | 'id'
  Prelude.Text ->
  -- | 'receiptHandle'
  Prelude.Text ->
  ChangeMessageVisibilityBatchRequestEntry
newChangeMessageVisibilityBatchRequestEntry :: Text -> Text -> ChangeMessageVisibilityBatchRequestEntry
newChangeMessageVisibilityBatchRequestEntry
  Text
pId_
  Text
pReceiptHandle_ =
    ChangeMessageVisibilityBatchRequestEntry' :: Maybe Int
-> Text -> Text -> ChangeMessageVisibilityBatchRequestEntry
ChangeMessageVisibilityBatchRequestEntry'
      { $sel:visibilityTimeout:ChangeMessageVisibilityBatchRequestEntry' :: Maybe Int
visibilityTimeout =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:id:ChangeMessageVisibilityBatchRequestEntry' :: Text
id = Text
pId_,
        $sel:receiptHandle:ChangeMessageVisibilityBatchRequestEntry' :: Text
receiptHandle = Text
pReceiptHandle_
      }

-- | The new value (in seconds) for the message\'s visibility timeout.
changeMessageVisibilityBatchRequestEntry_visibilityTimeout :: Lens.Lens' ChangeMessageVisibilityBatchRequestEntry (Prelude.Maybe Prelude.Int)
changeMessageVisibilityBatchRequestEntry_visibilityTimeout :: (Maybe Int -> f (Maybe Int))
-> ChangeMessageVisibilityBatchRequestEntry
-> f ChangeMessageVisibilityBatchRequestEntry
changeMessageVisibilityBatchRequestEntry_visibilityTimeout = (ChangeMessageVisibilityBatchRequestEntry -> Maybe Int)
-> (ChangeMessageVisibilityBatchRequestEntry
    -> Maybe Int -> ChangeMessageVisibilityBatchRequestEntry)
-> Lens
     ChangeMessageVisibilityBatchRequestEntry
     ChangeMessageVisibilityBatchRequestEntry
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeMessageVisibilityBatchRequestEntry' {Maybe Int
visibilityTimeout :: Maybe Int
$sel:visibilityTimeout:ChangeMessageVisibilityBatchRequestEntry' :: ChangeMessageVisibilityBatchRequestEntry -> Maybe Int
visibilityTimeout} -> Maybe Int
visibilityTimeout) (\s :: ChangeMessageVisibilityBatchRequestEntry
s@ChangeMessageVisibilityBatchRequestEntry' {} Maybe Int
a -> ChangeMessageVisibilityBatchRequestEntry
s {$sel:visibilityTimeout:ChangeMessageVisibilityBatchRequestEntry' :: Maybe Int
visibilityTimeout = Maybe Int
a} :: ChangeMessageVisibilityBatchRequestEntry)

-- | An identifier for this particular receipt handle used to communicate the
-- result.
--
-- The @Id@s of a batch request need to be unique within a request.
--
-- This identifier can have up to 80 characters. The following characters
-- are accepted: alphanumeric characters, hyphens(-), and underscores (_).
changeMessageVisibilityBatchRequestEntry_id :: Lens.Lens' ChangeMessageVisibilityBatchRequestEntry Prelude.Text
changeMessageVisibilityBatchRequestEntry_id :: (Text -> f Text)
-> ChangeMessageVisibilityBatchRequestEntry
-> f ChangeMessageVisibilityBatchRequestEntry
changeMessageVisibilityBatchRequestEntry_id = (ChangeMessageVisibilityBatchRequestEntry -> Text)
-> (ChangeMessageVisibilityBatchRequestEntry
    -> Text -> ChangeMessageVisibilityBatchRequestEntry)
-> Lens
     ChangeMessageVisibilityBatchRequestEntry
     ChangeMessageVisibilityBatchRequestEntry
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeMessageVisibilityBatchRequestEntry' {Text
id :: Text
$sel:id:ChangeMessageVisibilityBatchRequestEntry' :: ChangeMessageVisibilityBatchRequestEntry -> Text
id} -> Text
id) (\s :: ChangeMessageVisibilityBatchRequestEntry
s@ChangeMessageVisibilityBatchRequestEntry' {} Text
a -> ChangeMessageVisibilityBatchRequestEntry
s {$sel:id:ChangeMessageVisibilityBatchRequestEntry' :: Text
id = Text
a} :: ChangeMessageVisibilityBatchRequestEntry)

-- | A receipt handle.
changeMessageVisibilityBatchRequestEntry_receiptHandle :: Lens.Lens' ChangeMessageVisibilityBatchRequestEntry Prelude.Text
changeMessageVisibilityBatchRequestEntry_receiptHandle :: (Text -> f Text)
-> ChangeMessageVisibilityBatchRequestEntry
-> f ChangeMessageVisibilityBatchRequestEntry
changeMessageVisibilityBatchRequestEntry_receiptHandle = (ChangeMessageVisibilityBatchRequestEntry -> Text)
-> (ChangeMessageVisibilityBatchRequestEntry
    -> Text -> ChangeMessageVisibilityBatchRequestEntry)
-> Lens
     ChangeMessageVisibilityBatchRequestEntry
     ChangeMessageVisibilityBatchRequestEntry
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeMessageVisibilityBatchRequestEntry' {Text
receiptHandle :: Text
$sel:receiptHandle:ChangeMessageVisibilityBatchRequestEntry' :: ChangeMessageVisibilityBatchRequestEntry -> Text
receiptHandle} -> Text
receiptHandle) (\s :: ChangeMessageVisibilityBatchRequestEntry
s@ChangeMessageVisibilityBatchRequestEntry' {} Text
a -> ChangeMessageVisibilityBatchRequestEntry
s {$sel:receiptHandle:ChangeMessageVisibilityBatchRequestEntry' :: Text
receiptHandle = Text
a} :: ChangeMessageVisibilityBatchRequestEntry)

instance
  Prelude.Hashable
    ChangeMessageVisibilityBatchRequestEntry

instance
  Prelude.NFData
    ChangeMessageVisibilityBatchRequestEntry

instance
  Core.ToQuery
    ChangeMessageVisibilityBatchRequestEntry
  where
  toQuery :: ChangeMessageVisibilityBatchRequestEntry -> QueryString
toQuery ChangeMessageVisibilityBatchRequestEntry' {Maybe Int
Text
receiptHandle :: Text
id :: Text
visibilityTimeout :: Maybe Int
$sel:receiptHandle:ChangeMessageVisibilityBatchRequestEntry' :: ChangeMessageVisibilityBatchRequestEntry -> Text
$sel:id:ChangeMessageVisibilityBatchRequestEntry' :: ChangeMessageVisibilityBatchRequestEntry -> Text
$sel:visibilityTimeout:ChangeMessageVisibilityBatchRequestEntry' :: ChangeMessageVisibilityBatchRequestEntry -> Maybe Int
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"VisibilityTimeout" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
visibilityTimeout,
        ByteString
"Id" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
id,
        ByteString
"ReceiptHandle" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
receiptHandle
      ]