{-# 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 #-}
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
data ConsumedCapacity = ConsumedCapacity'
{
ConsumedCapacity -> Maybe Double
readCapacityUnits :: Prelude.Maybe Prelude.Double,
ConsumedCapacity -> Maybe (HashMap Text Capacity)
globalSecondaryIndexes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Capacity),
ConsumedCapacity -> Maybe Double
capacityUnits :: Prelude.Maybe Prelude.Double,
ConsumedCapacity -> Maybe Double
writeCapacityUnits :: Prelude.Maybe Prelude.Double,
ConsumedCapacity -> Maybe (HashMap Text Capacity)
localSecondaryIndexes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Capacity),
ConsumedCapacity -> Maybe Capacity
table :: Prelude.Maybe Capacity,
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)
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
}
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)
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
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)
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)
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
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)
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