{-# 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.DynamoDB.Types.ConsumedCapacity
-- 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.DynamoDB.Types.ConsumedCapacity where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.Capacity
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The capacity units consumed by an operation. The data returned includes
-- the total provisioned throughput consumed, along with statistics for the
-- table and any indexes involved in the operation. @ConsumedCapacity@ is
-- only returned if the request asked for it. For more information, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ProvisionedThroughputIntro.html Provisioned Throughput>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- /See:/ 'newConsumedCapacity' smart constructor.
data ConsumedCapacity = ConsumedCapacity'
  { -- | The total number of read capacity units consumed by the operation.
    ConsumedCapacity -> Maybe Double
readCapacityUnits :: Prelude.Maybe Prelude.Double,
    -- | The amount of throughput consumed on each global index affected by the
    -- operation.
    ConsumedCapacity -> Maybe (HashMap Text Capacity)
globalSecondaryIndexes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Capacity),
    -- | The total number of capacity units consumed by the operation.
    ConsumedCapacity -> Maybe Double
capacityUnits :: Prelude.Maybe Prelude.Double,
    -- | The total number of write capacity units consumed by the operation.
    ConsumedCapacity -> Maybe Double
writeCapacityUnits :: Prelude.Maybe Prelude.Double,
    -- | The amount of throughput consumed on each local index affected by the
    -- operation.
    ConsumedCapacity -> Maybe (HashMap Text Capacity)
localSecondaryIndexes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Capacity),
    -- | The amount of throughput consumed on the table affected by the
    -- operation.
    ConsumedCapacity -> Maybe Capacity
table :: Prelude.Maybe Capacity,
    -- | The name of the table that was affected by the operation.
    ConsumedCapacity -> Maybe Text
tableName :: Prelude.Maybe Prelude.Text
  }
  deriving (ConsumedCapacity -> ConsumedCapacity -> Bool
(ConsumedCapacity -> ConsumedCapacity -> Bool)
-> (ConsumedCapacity -> ConsumedCapacity -> Bool)
-> Eq ConsumedCapacity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConsumedCapacity -> ConsumedCapacity -> Bool
$c/= :: ConsumedCapacity -> ConsumedCapacity -> Bool
== :: ConsumedCapacity -> ConsumedCapacity -> Bool
$c== :: ConsumedCapacity -> ConsumedCapacity -> Bool
Prelude.Eq, ReadPrec [ConsumedCapacity]
ReadPrec ConsumedCapacity
Int -> ReadS ConsumedCapacity
ReadS [ConsumedCapacity]
(Int -> ReadS ConsumedCapacity)
-> ReadS [ConsumedCapacity]
-> ReadPrec ConsumedCapacity
-> ReadPrec [ConsumedCapacity]
-> Read ConsumedCapacity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConsumedCapacity]
$creadListPrec :: ReadPrec [ConsumedCapacity]
readPrec :: ReadPrec ConsumedCapacity
$creadPrec :: ReadPrec ConsumedCapacity
readList :: ReadS [ConsumedCapacity]
$creadList :: ReadS [ConsumedCapacity]
readsPrec :: Int -> ReadS ConsumedCapacity
$creadsPrec :: Int -> ReadS ConsumedCapacity
Prelude.Read, Int -> ConsumedCapacity -> ShowS
[ConsumedCapacity] -> ShowS
ConsumedCapacity -> String
(Int -> ConsumedCapacity -> ShowS)
-> (ConsumedCapacity -> String)
-> ([ConsumedCapacity] -> ShowS)
-> Show ConsumedCapacity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConsumedCapacity] -> ShowS
$cshowList :: [ConsumedCapacity] -> ShowS
show :: ConsumedCapacity -> String
$cshow :: ConsumedCapacity -> String
showsPrec :: Int -> ConsumedCapacity -> ShowS
$cshowsPrec :: Int -> ConsumedCapacity -> ShowS
Prelude.Show, (forall x. ConsumedCapacity -> Rep ConsumedCapacity x)
-> (forall x. Rep ConsumedCapacity x -> ConsumedCapacity)
-> Generic ConsumedCapacity
forall x. Rep ConsumedCapacity x -> ConsumedCapacity
forall x. ConsumedCapacity -> Rep ConsumedCapacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConsumedCapacity x -> ConsumedCapacity
$cfrom :: forall x. ConsumedCapacity -> Rep ConsumedCapacity x
Prelude.Generic)

-- |
-- Create a value of 'ConsumedCapacity' 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:
--
-- 'readCapacityUnits', 'consumedCapacity_readCapacityUnits' - The total number of read capacity units consumed by the operation.
--
-- 'globalSecondaryIndexes', 'consumedCapacity_globalSecondaryIndexes' - The amount of throughput consumed on each global index affected by the
-- operation.
--
-- 'capacityUnits', 'consumedCapacity_capacityUnits' - The total number of capacity units consumed by the operation.
--
-- 'writeCapacityUnits', 'consumedCapacity_writeCapacityUnits' - The total number of write capacity units consumed by the operation.
--
-- 'localSecondaryIndexes', 'consumedCapacity_localSecondaryIndexes' - The amount of throughput consumed on each local index affected by the
-- operation.
--
-- 'table', 'consumedCapacity_table' - The amount of throughput consumed on the table affected by the
-- operation.
--
-- 'tableName', 'consumedCapacity_tableName' - The name of the table that was affected by the operation.
newConsumedCapacity ::
  ConsumedCapacity
newConsumedCapacity :: ConsumedCapacity
newConsumedCapacity =
  ConsumedCapacity' :: Maybe Double
-> Maybe (HashMap Text Capacity)
-> Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Capacity)
-> Maybe Capacity
-> Maybe Text
-> ConsumedCapacity
ConsumedCapacity'
    { $sel:readCapacityUnits:ConsumedCapacity' :: Maybe Double
readCapacityUnits =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:globalSecondaryIndexes:ConsumedCapacity' :: Maybe (HashMap Text Capacity)
globalSecondaryIndexes = Maybe (HashMap Text Capacity)
forall a. Maybe a
Prelude.Nothing,
      $sel:capacityUnits:ConsumedCapacity' :: Maybe Double
capacityUnits = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:writeCapacityUnits:ConsumedCapacity' :: Maybe Double
writeCapacityUnits = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:localSecondaryIndexes:ConsumedCapacity' :: Maybe (HashMap Text Capacity)
localSecondaryIndexes = Maybe (HashMap Text Capacity)
forall a. Maybe a
Prelude.Nothing,
      $sel:table:ConsumedCapacity' :: Maybe Capacity
table = Maybe Capacity
forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:ConsumedCapacity' :: Maybe Text
tableName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of read capacity units consumed by the operation.
consumedCapacity_readCapacityUnits :: Lens.Lens' ConsumedCapacity (Prelude.Maybe Prelude.Double)
consumedCapacity_readCapacityUnits :: (Maybe Double -> f (Maybe Double))
-> ConsumedCapacity -> f ConsumedCapacity
consumedCapacity_readCapacityUnits = (ConsumedCapacity -> Maybe Double)
-> (ConsumedCapacity -> Maybe Double -> ConsumedCapacity)
-> Lens
     ConsumedCapacity ConsumedCapacity (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedCapacity' {Maybe Double
readCapacityUnits :: Maybe Double
$sel:readCapacityUnits:ConsumedCapacity' :: ConsumedCapacity -> Maybe Double
readCapacityUnits} -> Maybe Double
readCapacityUnits) (\s :: ConsumedCapacity
s@ConsumedCapacity' {} Maybe Double
a -> ConsumedCapacity
s {$sel:readCapacityUnits:ConsumedCapacity' :: Maybe Double
readCapacityUnits = Maybe Double
a} :: ConsumedCapacity)

-- | The amount of throughput consumed on each global index affected by the
-- operation.
consumedCapacity_globalSecondaryIndexes :: Lens.Lens' ConsumedCapacity (Prelude.Maybe (Prelude.HashMap Prelude.Text Capacity))
consumedCapacity_globalSecondaryIndexes :: (Maybe (HashMap Text Capacity)
 -> f (Maybe (HashMap Text Capacity)))
-> ConsumedCapacity -> f ConsumedCapacity
consumedCapacity_globalSecondaryIndexes = (ConsumedCapacity -> Maybe (HashMap Text Capacity))
-> (ConsumedCapacity
    -> Maybe (HashMap Text Capacity) -> ConsumedCapacity)
-> Lens
     ConsumedCapacity
     ConsumedCapacity
     (Maybe (HashMap Text Capacity))
     (Maybe (HashMap Text Capacity))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedCapacity' {Maybe (HashMap Text Capacity)
globalSecondaryIndexes :: Maybe (HashMap Text Capacity)
$sel:globalSecondaryIndexes:ConsumedCapacity' :: ConsumedCapacity -> Maybe (HashMap Text Capacity)
globalSecondaryIndexes} -> Maybe (HashMap Text Capacity)
globalSecondaryIndexes) (\s :: ConsumedCapacity
s@ConsumedCapacity' {} Maybe (HashMap Text Capacity)
a -> ConsumedCapacity
s {$sel:globalSecondaryIndexes:ConsumedCapacity' :: Maybe (HashMap Text Capacity)
globalSecondaryIndexes = Maybe (HashMap Text Capacity)
a} :: ConsumedCapacity) ((Maybe (HashMap Text Capacity)
  -> f (Maybe (HashMap Text Capacity)))
 -> ConsumedCapacity -> f ConsumedCapacity)
-> ((Maybe (HashMap Text Capacity)
     -> f (Maybe (HashMap Text Capacity)))
    -> Maybe (HashMap Text Capacity)
    -> f (Maybe (HashMap Text Capacity)))
-> (Maybe (HashMap Text Capacity)
    -> f (Maybe (HashMap Text Capacity)))
-> ConsumedCapacity
-> f ConsumedCapacity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Capacity)
  (HashMap Text Capacity)
  (HashMap Text Capacity)
  (HashMap Text Capacity)
-> Iso
     (Maybe (HashMap Text Capacity))
     (Maybe (HashMap Text Capacity))
     (Maybe (HashMap Text Capacity))
     (Maybe (HashMap Text Capacity))
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 Capacity)
  (HashMap Text Capacity)
  (HashMap Text Capacity)
  (HashMap Text Capacity)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The total number of capacity units consumed by the operation.
consumedCapacity_capacityUnits :: Lens.Lens' ConsumedCapacity (Prelude.Maybe Prelude.Double)
consumedCapacity_capacityUnits :: (Maybe Double -> f (Maybe Double))
-> ConsumedCapacity -> f ConsumedCapacity
consumedCapacity_capacityUnits = (ConsumedCapacity -> Maybe Double)
-> (ConsumedCapacity -> Maybe Double -> ConsumedCapacity)
-> Lens
     ConsumedCapacity ConsumedCapacity (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedCapacity' {Maybe Double
capacityUnits :: Maybe Double
$sel:capacityUnits:ConsumedCapacity' :: ConsumedCapacity -> Maybe Double
capacityUnits} -> Maybe Double
capacityUnits) (\s :: ConsumedCapacity
s@ConsumedCapacity' {} Maybe Double
a -> ConsumedCapacity
s {$sel:capacityUnits:ConsumedCapacity' :: Maybe Double
capacityUnits = Maybe Double
a} :: ConsumedCapacity)

-- | The total number of write capacity units consumed by the operation.
consumedCapacity_writeCapacityUnits :: Lens.Lens' ConsumedCapacity (Prelude.Maybe Prelude.Double)
consumedCapacity_writeCapacityUnits :: (Maybe Double -> f (Maybe Double))
-> ConsumedCapacity -> f ConsumedCapacity
consumedCapacity_writeCapacityUnits = (ConsumedCapacity -> Maybe Double)
-> (ConsumedCapacity -> Maybe Double -> ConsumedCapacity)
-> Lens
     ConsumedCapacity ConsumedCapacity (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedCapacity' {Maybe Double
writeCapacityUnits :: Maybe Double
$sel:writeCapacityUnits:ConsumedCapacity' :: ConsumedCapacity -> Maybe Double
writeCapacityUnits} -> Maybe Double
writeCapacityUnits) (\s :: ConsumedCapacity
s@ConsumedCapacity' {} Maybe Double
a -> ConsumedCapacity
s {$sel:writeCapacityUnits:ConsumedCapacity' :: Maybe Double
writeCapacityUnits = Maybe Double
a} :: ConsumedCapacity)

-- | The amount of throughput consumed on each local index affected by the
-- operation.
consumedCapacity_localSecondaryIndexes :: Lens.Lens' ConsumedCapacity (Prelude.Maybe (Prelude.HashMap Prelude.Text Capacity))
consumedCapacity_localSecondaryIndexes :: (Maybe (HashMap Text Capacity)
 -> f (Maybe (HashMap Text Capacity)))
-> ConsumedCapacity -> f ConsumedCapacity
consumedCapacity_localSecondaryIndexes = (ConsumedCapacity -> Maybe (HashMap Text Capacity))
-> (ConsumedCapacity
    -> Maybe (HashMap Text Capacity) -> ConsumedCapacity)
-> Lens
     ConsumedCapacity
     ConsumedCapacity
     (Maybe (HashMap Text Capacity))
     (Maybe (HashMap Text Capacity))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedCapacity' {Maybe (HashMap Text Capacity)
localSecondaryIndexes :: Maybe (HashMap Text Capacity)
$sel:localSecondaryIndexes:ConsumedCapacity' :: ConsumedCapacity -> Maybe (HashMap Text Capacity)
localSecondaryIndexes} -> Maybe (HashMap Text Capacity)
localSecondaryIndexes) (\s :: ConsumedCapacity
s@ConsumedCapacity' {} Maybe (HashMap Text Capacity)
a -> ConsumedCapacity
s {$sel:localSecondaryIndexes:ConsumedCapacity' :: Maybe (HashMap Text Capacity)
localSecondaryIndexes = Maybe (HashMap Text Capacity)
a} :: ConsumedCapacity) ((Maybe (HashMap Text Capacity)
  -> f (Maybe (HashMap Text Capacity)))
 -> ConsumedCapacity -> f ConsumedCapacity)
-> ((Maybe (HashMap Text Capacity)
     -> f (Maybe (HashMap Text Capacity)))
    -> Maybe (HashMap Text Capacity)
    -> f (Maybe (HashMap Text Capacity)))
-> (Maybe (HashMap Text Capacity)
    -> f (Maybe (HashMap Text Capacity)))
-> ConsumedCapacity
-> f ConsumedCapacity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Capacity)
  (HashMap Text Capacity)
  (HashMap Text Capacity)
  (HashMap Text Capacity)
-> Iso
     (Maybe (HashMap Text Capacity))
     (Maybe (HashMap Text Capacity))
     (Maybe (HashMap Text Capacity))
     (Maybe (HashMap Text Capacity))
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 Capacity)
  (HashMap Text Capacity)
  (HashMap Text Capacity)
  (HashMap Text Capacity)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The amount of throughput consumed on the table affected by the
-- operation.
consumedCapacity_table :: Lens.Lens' ConsumedCapacity (Prelude.Maybe Capacity)
consumedCapacity_table :: (Maybe Capacity -> f (Maybe Capacity))
-> ConsumedCapacity -> f ConsumedCapacity
consumedCapacity_table = (ConsumedCapacity -> Maybe Capacity)
-> (ConsumedCapacity -> Maybe Capacity -> ConsumedCapacity)
-> Lens
     ConsumedCapacity ConsumedCapacity (Maybe Capacity) (Maybe Capacity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedCapacity' {Maybe Capacity
table :: Maybe Capacity
$sel:table:ConsumedCapacity' :: ConsumedCapacity -> Maybe Capacity
table} -> Maybe Capacity
table) (\s :: ConsumedCapacity
s@ConsumedCapacity' {} Maybe Capacity
a -> ConsumedCapacity
s {$sel:table:ConsumedCapacity' :: Maybe Capacity
table = Maybe Capacity
a} :: ConsumedCapacity)

-- | The name of the table that was affected by the operation.
consumedCapacity_tableName :: Lens.Lens' ConsumedCapacity (Prelude.Maybe Prelude.Text)
consumedCapacity_tableName :: (Maybe Text -> f (Maybe Text))
-> ConsumedCapacity -> f ConsumedCapacity
consumedCapacity_tableName = (ConsumedCapacity -> Maybe Text)
-> (ConsumedCapacity -> Maybe Text -> ConsumedCapacity)
-> Lens ConsumedCapacity ConsumedCapacity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedCapacity' {Maybe Text
tableName :: Maybe Text
$sel:tableName:ConsumedCapacity' :: ConsumedCapacity -> Maybe Text
tableName} -> Maybe Text
tableName) (\s :: ConsumedCapacity
s@ConsumedCapacity' {} Maybe Text
a -> ConsumedCapacity
s {$sel:tableName:ConsumedCapacity' :: Maybe Text
tableName = Maybe Text
a} :: ConsumedCapacity)

instance Core.FromJSON ConsumedCapacity where
  parseJSON :: Value -> Parser ConsumedCapacity
parseJSON =
    String
-> (Object -> Parser ConsumedCapacity)
-> Value
-> Parser ConsumedCapacity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConsumedCapacity"
      ( \Object
x ->
          Maybe Double
-> Maybe (HashMap Text Capacity)
-> Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Capacity)
-> Maybe Capacity
-> Maybe Text
-> ConsumedCapacity
ConsumedCapacity'
            (Maybe Double
 -> Maybe (HashMap Text Capacity)
 -> Maybe Double
 -> Maybe Double
 -> Maybe (HashMap Text Capacity)
 -> Maybe Capacity
 -> Maybe Text
 -> ConsumedCapacity)
-> Parser (Maybe Double)
-> Parser
     (Maybe (HashMap Text Capacity)
      -> Maybe Double
      -> Maybe Double
      -> Maybe (HashMap Text Capacity)
      -> Maybe Capacity
      -> Maybe Text
      -> ConsumedCapacity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReadCapacityUnits")
            Parser
  (Maybe (HashMap Text Capacity)
   -> Maybe Double
   -> Maybe Double
   -> Maybe (HashMap Text Capacity)
   -> Maybe Capacity
   -> Maybe Text
   -> ConsumedCapacity)
-> Parser (Maybe (HashMap Text Capacity))
-> Parser
     (Maybe Double
      -> Maybe Double
      -> Maybe (HashMap Text Capacity)
      -> Maybe Capacity
      -> Maybe Text
      -> ConsumedCapacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Capacity)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GlobalSecondaryIndexes"
                            Parser (Maybe (Maybe (HashMap Text Capacity)))
-> Maybe (HashMap Text Capacity)
-> Parser (Maybe (HashMap Text Capacity))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Capacity)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Double
   -> Maybe Double
   -> Maybe (HashMap Text Capacity)
   -> Maybe Capacity
   -> Maybe Text
   -> ConsumedCapacity)
-> Parser (Maybe Double)
-> Parser
     (Maybe Double
      -> Maybe (HashMap Text Capacity)
      -> Maybe Capacity
      -> Maybe Text
      -> ConsumedCapacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CapacityUnits")
            Parser
  (Maybe Double
   -> Maybe (HashMap Text Capacity)
   -> Maybe Capacity
   -> Maybe Text
   -> ConsumedCapacity)
-> Parser (Maybe Double)
-> Parser
     (Maybe (HashMap Text Capacity)
      -> Maybe Capacity -> Maybe Text -> ConsumedCapacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WriteCapacityUnits")
            Parser
  (Maybe (HashMap Text Capacity)
   -> Maybe Capacity -> Maybe Text -> ConsumedCapacity)
-> Parser (Maybe (HashMap Text Capacity))
-> Parser (Maybe Capacity -> Maybe Text -> ConsumedCapacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Capacity)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LocalSecondaryIndexes"
                            Parser (Maybe (Maybe (HashMap Text Capacity)))
-> Maybe (HashMap Text Capacity)
-> Parser (Maybe (HashMap Text Capacity))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Capacity)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Capacity -> Maybe Text -> ConsumedCapacity)
-> Parser (Maybe Capacity)
-> Parser (Maybe Text -> ConsumedCapacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Capacity)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Table")
            Parser (Maybe Text -> ConsumedCapacity)
-> Parser (Maybe Text) -> Parser ConsumedCapacity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TableName")
      )

instance Prelude.Hashable ConsumedCapacity

instance Prelude.NFData ConsumedCapacity