{-# 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.DynamoDB.TransactGetItems
-- 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)
--
-- @TransactGetItems@ is a synchronous operation that atomically retrieves
-- multiple items from one or more tables (but not from indexes) in a
-- single account and Region. A @TransactGetItems@ call can contain up to
-- 25 @TransactGetItem@ objects, each of which contains a @Get@ structure
-- that specifies an item to retrieve from a table in the account and
-- Region. A call to @TransactGetItems@ cannot retrieve items from tables
-- in more than one AWS account or Region. The aggregate size of the items
-- in the transaction cannot exceed 4 MB.
--
-- DynamoDB rejects the entire @TransactGetItems@ request if any of the
-- following is true:
--
-- -   A conflicting operation is in the process of updating an item to be
--     read.
--
-- -   There is insufficient provisioned capacity for the transaction to be
--     completed.
--
-- -   There is a user error, such as an invalid data format.
--
-- -   The aggregate size of the items in the transaction cannot exceed 4
--     MB.
module Amazonka.DynamoDB.TransactGetItems
  ( -- * Creating a Request
    TransactGetItems (..),
    newTransactGetItems,

    -- * Request Lenses
    transactGetItems_returnConsumedCapacity,
    transactGetItems_transactItems,

    -- * Destructuring the Response
    TransactGetItemsResponse (..),
    newTransactGetItemsResponse,

    -- * Response Lenses
    transactGetItemsResponse_responses,
    transactGetItemsResponse_consumedCapacity,
    transactGetItemsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newTransactGetItems' smart constructor.
data TransactGetItems = TransactGetItems'
  { -- | A value of @TOTAL@ causes consumed capacity information to be returned,
    -- and a value of @NONE@ prevents that information from being returned. No
    -- other value is valid.
    TransactGetItems -> Maybe ReturnConsumedCapacity
returnConsumedCapacity :: Prelude.Maybe ReturnConsumedCapacity,
    -- | An ordered array of up to 25 @TransactGetItem@ objects, each of which
    -- contains a @Get@ structure.
    TransactGetItems -> NonEmpty TransactGetItem
transactItems :: Prelude.NonEmpty TransactGetItem
  }
  deriving (TransactGetItems -> TransactGetItems -> Bool
(TransactGetItems -> TransactGetItems -> Bool)
-> (TransactGetItems -> TransactGetItems -> Bool)
-> Eq TransactGetItems
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransactGetItems -> TransactGetItems -> Bool
$c/= :: TransactGetItems -> TransactGetItems -> Bool
== :: TransactGetItems -> TransactGetItems -> Bool
$c== :: TransactGetItems -> TransactGetItems -> Bool
Prelude.Eq, ReadPrec [TransactGetItems]
ReadPrec TransactGetItems
Int -> ReadS TransactGetItems
ReadS [TransactGetItems]
(Int -> ReadS TransactGetItems)
-> ReadS [TransactGetItems]
-> ReadPrec TransactGetItems
-> ReadPrec [TransactGetItems]
-> Read TransactGetItems
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransactGetItems]
$creadListPrec :: ReadPrec [TransactGetItems]
readPrec :: ReadPrec TransactGetItems
$creadPrec :: ReadPrec TransactGetItems
readList :: ReadS [TransactGetItems]
$creadList :: ReadS [TransactGetItems]
readsPrec :: Int -> ReadS TransactGetItems
$creadsPrec :: Int -> ReadS TransactGetItems
Prelude.Read, Int -> TransactGetItems -> ShowS
[TransactGetItems] -> ShowS
TransactGetItems -> String
(Int -> TransactGetItems -> ShowS)
-> (TransactGetItems -> String)
-> ([TransactGetItems] -> ShowS)
-> Show TransactGetItems
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransactGetItems] -> ShowS
$cshowList :: [TransactGetItems] -> ShowS
show :: TransactGetItems -> String
$cshow :: TransactGetItems -> String
showsPrec :: Int -> TransactGetItems -> ShowS
$cshowsPrec :: Int -> TransactGetItems -> ShowS
Prelude.Show, (forall x. TransactGetItems -> Rep TransactGetItems x)
-> (forall x. Rep TransactGetItems x -> TransactGetItems)
-> Generic TransactGetItems
forall x. Rep TransactGetItems x -> TransactGetItems
forall x. TransactGetItems -> Rep TransactGetItems x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TransactGetItems x -> TransactGetItems
$cfrom :: forall x. TransactGetItems -> Rep TransactGetItems x
Prelude.Generic)

-- |
-- Create a value of 'TransactGetItems' 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:
--
-- 'returnConsumedCapacity', 'transactGetItems_returnConsumedCapacity' - A value of @TOTAL@ causes consumed capacity information to be returned,
-- and a value of @NONE@ prevents that information from being returned. No
-- other value is valid.
--
-- 'transactItems', 'transactGetItems_transactItems' - An ordered array of up to 25 @TransactGetItem@ objects, each of which
-- contains a @Get@ structure.
newTransactGetItems ::
  -- | 'transactItems'
  Prelude.NonEmpty TransactGetItem ->
  TransactGetItems
newTransactGetItems :: NonEmpty TransactGetItem -> TransactGetItems
newTransactGetItems NonEmpty TransactGetItem
pTransactItems_ =
  TransactGetItems' :: Maybe ReturnConsumedCapacity
-> NonEmpty TransactGetItem -> TransactGetItems
TransactGetItems'
    { $sel:returnConsumedCapacity:TransactGetItems' :: Maybe ReturnConsumedCapacity
returnConsumedCapacity =
        Maybe ReturnConsumedCapacity
forall a. Maybe a
Prelude.Nothing,
      $sel:transactItems:TransactGetItems' :: NonEmpty TransactGetItem
transactItems = Tagged
  (NonEmpty TransactGetItem) (Identity (NonEmpty TransactGetItem))
-> Tagged
     (NonEmpty TransactGetItem) (Identity (NonEmpty TransactGetItem))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty TransactGetItem) (Identity (NonEmpty TransactGetItem))
 -> Tagged
      (NonEmpty TransactGetItem) (Identity (NonEmpty TransactGetItem)))
-> NonEmpty TransactGetItem -> NonEmpty TransactGetItem
forall t b. AReview t b -> b -> t
Lens.# NonEmpty TransactGetItem
pTransactItems_
    }

-- | A value of @TOTAL@ causes consumed capacity information to be returned,
-- and a value of @NONE@ prevents that information from being returned. No
-- other value is valid.
transactGetItems_returnConsumedCapacity :: Lens.Lens' TransactGetItems (Prelude.Maybe ReturnConsumedCapacity)
transactGetItems_returnConsumedCapacity :: (Maybe ReturnConsumedCapacity -> f (Maybe ReturnConsumedCapacity))
-> TransactGetItems -> f TransactGetItems
transactGetItems_returnConsumedCapacity = (TransactGetItems -> Maybe ReturnConsumedCapacity)
-> (TransactGetItems
    -> Maybe ReturnConsumedCapacity -> TransactGetItems)
-> Lens
     TransactGetItems
     TransactGetItems
     (Maybe ReturnConsumedCapacity)
     (Maybe ReturnConsumedCapacity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransactGetItems' {Maybe ReturnConsumedCapacity
returnConsumedCapacity :: Maybe ReturnConsumedCapacity
$sel:returnConsumedCapacity:TransactGetItems' :: TransactGetItems -> Maybe ReturnConsumedCapacity
returnConsumedCapacity} -> Maybe ReturnConsumedCapacity
returnConsumedCapacity) (\s :: TransactGetItems
s@TransactGetItems' {} Maybe ReturnConsumedCapacity
a -> TransactGetItems
s {$sel:returnConsumedCapacity:TransactGetItems' :: Maybe ReturnConsumedCapacity
returnConsumedCapacity = Maybe ReturnConsumedCapacity
a} :: TransactGetItems)

-- | An ordered array of up to 25 @TransactGetItem@ objects, each of which
-- contains a @Get@ structure.
transactGetItems_transactItems :: Lens.Lens' TransactGetItems (Prelude.NonEmpty TransactGetItem)
transactGetItems_transactItems :: (NonEmpty TransactGetItem -> f (NonEmpty TransactGetItem))
-> TransactGetItems -> f TransactGetItems
transactGetItems_transactItems = (TransactGetItems -> NonEmpty TransactGetItem)
-> (TransactGetItems
    -> NonEmpty TransactGetItem -> TransactGetItems)
-> Lens
     TransactGetItems
     TransactGetItems
     (NonEmpty TransactGetItem)
     (NonEmpty TransactGetItem)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransactGetItems' {NonEmpty TransactGetItem
transactItems :: NonEmpty TransactGetItem
$sel:transactItems:TransactGetItems' :: TransactGetItems -> NonEmpty TransactGetItem
transactItems} -> NonEmpty TransactGetItem
transactItems) (\s :: TransactGetItems
s@TransactGetItems' {} NonEmpty TransactGetItem
a -> TransactGetItems
s {$sel:transactItems:TransactGetItems' :: NonEmpty TransactGetItem
transactItems = NonEmpty TransactGetItem
a} :: TransactGetItems) ((NonEmpty TransactGetItem -> f (NonEmpty TransactGetItem))
 -> TransactGetItems -> f TransactGetItems)
-> ((NonEmpty TransactGetItem -> f (NonEmpty TransactGetItem))
    -> NonEmpty TransactGetItem -> f (NonEmpty TransactGetItem))
-> (NonEmpty TransactGetItem -> f (NonEmpty TransactGetItem))
-> TransactGetItems
-> f TransactGetItems
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty TransactGetItem -> f (NonEmpty TransactGetItem))
-> NonEmpty TransactGetItem -> f (NonEmpty TransactGetItem)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest TransactGetItems where
  type
    AWSResponse TransactGetItems =
      TransactGetItemsResponse
  request :: TransactGetItems -> Request TransactGetItems
request = Service -> TransactGetItems -> Request TransactGetItems
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy TransactGetItems
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TransactGetItems)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse TransactGetItems))
-> Logger
-> Service
-> Proxy TransactGetItems
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TransactGetItems)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe (NonEmpty ItemResponse)
-> Maybe [ConsumedCapacity] -> Int -> TransactGetItemsResponse
TransactGetItemsResponse'
            (Maybe (NonEmpty ItemResponse)
 -> Maybe [ConsumedCapacity] -> Int -> TransactGetItemsResponse)
-> Either String (Maybe (NonEmpty ItemResponse))
-> Either
     String
     (Maybe [ConsumedCapacity] -> Int -> TransactGetItemsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe (NonEmpty ItemResponse))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"Responses")
            Either
  String
  (Maybe [ConsumedCapacity] -> Int -> TransactGetItemsResponse)
-> Either String (Maybe [ConsumedCapacity])
-> Either String (Int -> TransactGetItemsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Key -> Either String (Maybe (Maybe [ConsumedCapacity]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"ConsumedCapacity"
                            Either String (Maybe (Maybe [ConsumedCapacity]))
-> Maybe [ConsumedCapacity]
-> Either String (Maybe [ConsumedCapacity])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ConsumedCapacity]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> TransactGetItemsResponse)
-> Either String Int -> Either String TransactGetItemsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
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 TransactGetItems

instance Prelude.NFData TransactGetItems

instance Core.ToHeaders TransactGetItems where
  toHeaders :: TransactGetItems -> ResponseHeaders
toHeaders =
    ResponseHeaders -> TransactGetItems -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DynamoDB_20120810.TransactGetItems" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON TransactGetItems where
  toJSON :: TransactGetItems -> Value
toJSON TransactGetItems' {Maybe ReturnConsumedCapacity
NonEmpty TransactGetItem
transactItems :: NonEmpty TransactGetItem
returnConsumedCapacity :: Maybe ReturnConsumedCapacity
$sel:transactItems:TransactGetItems' :: TransactGetItems -> NonEmpty TransactGetItem
$sel:returnConsumedCapacity:TransactGetItems' :: TransactGetItems -> Maybe ReturnConsumedCapacity
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ReturnConsumedCapacity" Key -> ReturnConsumedCapacity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=)
              (ReturnConsumedCapacity -> Pair)
-> Maybe ReturnConsumedCapacity -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReturnConsumedCapacity
returnConsumedCapacity,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Key
"TransactItems" Key -> NonEmpty TransactGetItem -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= NonEmpty TransactGetItem
transactItems)
          ]
      )

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

instance Core.ToQuery TransactGetItems where
  toQuery :: TransactGetItems -> QueryString
toQuery = QueryString -> TransactGetItems -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newTransactGetItemsResponse' smart constructor.
data TransactGetItemsResponse = TransactGetItemsResponse'
  { -- | An ordered array of up to 25 @ItemResponse@ objects, each of which
    -- corresponds to the @TransactGetItem@ object in the same position in the
    -- /TransactItems/ array. Each @ItemResponse@ object contains a Map of the
    -- name-value pairs that are the projected attributes of the requested
    -- item.
    --
    -- If a requested item could not be retrieved, the corresponding
    -- @ItemResponse@ object is Null, or if the requested item has no projected
    -- attributes, the corresponding @ItemResponse@ object is an empty Map.
    TransactGetItemsResponse -> Maybe (NonEmpty ItemResponse)
responses :: Prelude.Maybe (Prelude.NonEmpty ItemResponse),
    -- | If the /ReturnConsumedCapacity/ value was @TOTAL@, this is an array of
    -- @ConsumedCapacity@ objects, one for each table addressed by
    -- @TransactGetItem@ objects in the /TransactItems/ parameter. These
    -- @ConsumedCapacity@ objects report the read-capacity units consumed by
    -- the @TransactGetItems@ call in that table.
    TransactGetItemsResponse -> Maybe [ConsumedCapacity]
consumedCapacity :: Prelude.Maybe [ConsumedCapacity],
    -- | The response's http status code.
    TransactGetItemsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (TransactGetItemsResponse -> TransactGetItemsResponse -> Bool
(TransactGetItemsResponse -> TransactGetItemsResponse -> Bool)
-> (TransactGetItemsResponse -> TransactGetItemsResponse -> Bool)
-> Eq TransactGetItemsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransactGetItemsResponse -> TransactGetItemsResponse -> Bool
$c/= :: TransactGetItemsResponse -> TransactGetItemsResponse -> Bool
== :: TransactGetItemsResponse -> TransactGetItemsResponse -> Bool
$c== :: TransactGetItemsResponse -> TransactGetItemsResponse -> Bool
Prelude.Eq, ReadPrec [TransactGetItemsResponse]
ReadPrec TransactGetItemsResponse
Int -> ReadS TransactGetItemsResponse
ReadS [TransactGetItemsResponse]
(Int -> ReadS TransactGetItemsResponse)
-> ReadS [TransactGetItemsResponse]
-> ReadPrec TransactGetItemsResponse
-> ReadPrec [TransactGetItemsResponse]
-> Read TransactGetItemsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransactGetItemsResponse]
$creadListPrec :: ReadPrec [TransactGetItemsResponse]
readPrec :: ReadPrec TransactGetItemsResponse
$creadPrec :: ReadPrec TransactGetItemsResponse
readList :: ReadS [TransactGetItemsResponse]
$creadList :: ReadS [TransactGetItemsResponse]
readsPrec :: Int -> ReadS TransactGetItemsResponse
$creadsPrec :: Int -> ReadS TransactGetItemsResponse
Prelude.Read, Int -> TransactGetItemsResponse -> ShowS
[TransactGetItemsResponse] -> ShowS
TransactGetItemsResponse -> String
(Int -> TransactGetItemsResponse -> ShowS)
-> (TransactGetItemsResponse -> String)
-> ([TransactGetItemsResponse] -> ShowS)
-> Show TransactGetItemsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransactGetItemsResponse] -> ShowS
$cshowList :: [TransactGetItemsResponse] -> ShowS
show :: TransactGetItemsResponse -> String
$cshow :: TransactGetItemsResponse -> String
showsPrec :: Int -> TransactGetItemsResponse -> ShowS
$cshowsPrec :: Int -> TransactGetItemsResponse -> ShowS
Prelude.Show, (forall x.
 TransactGetItemsResponse -> Rep TransactGetItemsResponse x)
-> (forall x.
    Rep TransactGetItemsResponse x -> TransactGetItemsResponse)
-> Generic TransactGetItemsResponse
forall x.
Rep TransactGetItemsResponse x -> TransactGetItemsResponse
forall x.
TransactGetItemsResponse -> Rep TransactGetItemsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransactGetItemsResponse x -> TransactGetItemsResponse
$cfrom :: forall x.
TransactGetItemsResponse -> Rep TransactGetItemsResponse x
Prelude.Generic)

-- |
-- Create a value of 'TransactGetItemsResponse' 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:
--
-- 'responses', 'transactGetItemsResponse_responses' - An ordered array of up to 25 @ItemResponse@ objects, each of which
-- corresponds to the @TransactGetItem@ object in the same position in the
-- /TransactItems/ array. Each @ItemResponse@ object contains a Map of the
-- name-value pairs that are the projected attributes of the requested
-- item.
--
-- If a requested item could not be retrieved, the corresponding
-- @ItemResponse@ object is Null, or if the requested item has no projected
-- attributes, the corresponding @ItemResponse@ object is an empty Map.
--
-- 'consumedCapacity', 'transactGetItemsResponse_consumedCapacity' - If the /ReturnConsumedCapacity/ value was @TOTAL@, this is an array of
-- @ConsumedCapacity@ objects, one for each table addressed by
-- @TransactGetItem@ objects in the /TransactItems/ parameter. These
-- @ConsumedCapacity@ objects report the read-capacity units consumed by
-- the @TransactGetItems@ call in that table.
--
-- 'httpStatus', 'transactGetItemsResponse_httpStatus' - The response's http status code.
newTransactGetItemsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  TransactGetItemsResponse
newTransactGetItemsResponse :: Int -> TransactGetItemsResponse
newTransactGetItemsResponse Int
pHttpStatus_ =
  TransactGetItemsResponse' :: Maybe (NonEmpty ItemResponse)
-> Maybe [ConsumedCapacity] -> Int -> TransactGetItemsResponse
TransactGetItemsResponse'
    { $sel:responses:TransactGetItemsResponse' :: Maybe (NonEmpty ItemResponse)
responses =
        Maybe (NonEmpty ItemResponse)
forall a. Maybe a
Prelude.Nothing,
      $sel:consumedCapacity:TransactGetItemsResponse' :: Maybe [ConsumedCapacity]
consumedCapacity = Maybe [ConsumedCapacity]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:TransactGetItemsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An ordered array of up to 25 @ItemResponse@ objects, each of which
-- corresponds to the @TransactGetItem@ object in the same position in the
-- /TransactItems/ array. Each @ItemResponse@ object contains a Map of the
-- name-value pairs that are the projected attributes of the requested
-- item.
--
-- If a requested item could not be retrieved, the corresponding
-- @ItemResponse@ object is Null, or if the requested item has no projected
-- attributes, the corresponding @ItemResponse@ object is an empty Map.
transactGetItemsResponse_responses :: Lens.Lens' TransactGetItemsResponse (Prelude.Maybe (Prelude.NonEmpty ItemResponse))
transactGetItemsResponse_responses :: (Maybe (NonEmpty ItemResponse)
 -> f (Maybe (NonEmpty ItemResponse)))
-> TransactGetItemsResponse -> f TransactGetItemsResponse
transactGetItemsResponse_responses = (TransactGetItemsResponse -> Maybe (NonEmpty ItemResponse))
-> (TransactGetItemsResponse
    -> Maybe (NonEmpty ItemResponse) -> TransactGetItemsResponse)
-> Lens
     TransactGetItemsResponse
     TransactGetItemsResponse
     (Maybe (NonEmpty ItemResponse))
     (Maybe (NonEmpty ItemResponse))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransactGetItemsResponse' {Maybe (NonEmpty ItemResponse)
responses :: Maybe (NonEmpty ItemResponse)
$sel:responses:TransactGetItemsResponse' :: TransactGetItemsResponse -> Maybe (NonEmpty ItemResponse)
responses} -> Maybe (NonEmpty ItemResponse)
responses) (\s :: TransactGetItemsResponse
s@TransactGetItemsResponse' {} Maybe (NonEmpty ItemResponse)
a -> TransactGetItemsResponse
s {$sel:responses:TransactGetItemsResponse' :: Maybe (NonEmpty ItemResponse)
responses = Maybe (NonEmpty ItemResponse)
a} :: TransactGetItemsResponse) ((Maybe (NonEmpty ItemResponse)
  -> f (Maybe (NonEmpty ItemResponse)))
 -> TransactGetItemsResponse -> f TransactGetItemsResponse)
-> ((Maybe (NonEmpty ItemResponse)
     -> f (Maybe (NonEmpty ItemResponse)))
    -> Maybe (NonEmpty ItemResponse)
    -> f (Maybe (NonEmpty ItemResponse)))
-> (Maybe (NonEmpty ItemResponse)
    -> f (Maybe (NonEmpty ItemResponse)))
-> TransactGetItemsResponse
-> f TransactGetItemsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ItemResponse)
  (NonEmpty ItemResponse)
  (NonEmpty ItemResponse)
  (NonEmpty ItemResponse)
-> Iso
     (Maybe (NonEmpty ItemResponse))
     (Maybe (NonEmpty ItemResponse))
     (Maybe (NonEmpty ItemResponse))
     (Maybe (NonEmpty ItemResponse))
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
  (NonEmpty ItemResponse)
  (NonEmpty ItemResponse)
  (NonEmpty ItemResponse)
  (NonEmpty ItemResponse)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If the /ReturnConsumedCapacity/ value was @TOTAL@, this is an array of
-- @ConsumedCapacity@ objects, one for each table addressed by
-- @TransactGetItem@ objects in the /TransactItems/ parameter. These
-- @ConsumedCapacity@ objects report the read-capacity units consumed by
-- the @TransactGetItems@ call in that table.
transactGetItemsResponse_consumedCapacity :: Lens.Lens' TransactGetItemsResponse (Prelude.Maybe [ConsumedCapacity])
transactGetItemsResponse_consumedCapacity :: (Maybe [ConsumedCapacity] -> f (Maybe [ConsumedCapacity]))
-> TransactGetItemsResponse -> f TransactGetItemsResponse
transactGetItemsResponse_consumedCapacity = (TransactGetItemsResponse -> Maybe [ConsumedCapacity])
-> (TransactGetItemsResponse
    -> Maybe [ConsumedCapacity] -> TransactGetItemsResponse)
-> Lens
     TransactGetItemsResponse
     TransactGetItemsResponse
     (Maybe [ConsumedCapacity])
     (Maybe [ConsumedCapacity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransactGetItemsResponse' {Maybe [ConsumedCapacity]
consumedCapacity :: Maybe [ConsumedCapacity]
$sel:consumedCapacity:TransactGetItemsResponse' :: TransactGetItemsResponse -> Maybe [ConsumedCapacity]
consumedCapacity} -> Maybe [ConsumedCapacity]
consumedCapacity) (\s :: TransactGetItemsResponse
s@TransactGetItemsResponse' {} Maybe [ConsumedCapacity]
a -> TransactGetItemsResponse
s {$sel:consumedCapacity:TransactGetItemsResponse' :: Maybe [ConsumedCapacity]
consumedCapacity = Maybe [ConsumedCapacity]
a} :: TransactGetItemsResponse) ((Maybe [ConsumedCapacity] -> f (Maybe [ConsumedCapacity]))
 -> TransactGetItemsResponse -> f TransactGetItemsResponse)
-> ((Maybe [ConsumedCapacity] -> f (Maybe [ConsumedCapacity]))
    -> Maybe [ConsumedCapacity] -> f (Maybe [ConsumedCapacity]))
-> (Maybe [ConsumedCapacity] -> f (Maybe [ConsumedCapacity]))
-> TransactGetItemsResponse
-> f TransactGetItemsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ConsumedCapacity]
  [ConsumedCapacity]
  [ConsumedCapacity]
  [ConsumedCapacity]
-> Iso
     (Maybe [ConsumedCapacity])
     (Maybe [ConsumedCapacity])
     (Maybe [ConsumedCapacity])
     (Maybe [ConsumedCapacity])
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
  [ConsumedCapacity]
  [ConsumedCapacity]
  [ConsumedCapacity]
  [ConsumedCapacity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData TransactGetItemsResponse