{-# 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.Capacity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude
data Capacity = Capacity'
{
Capacity -> Maybe Double
capacityUnits :: Prelude.Maybe Prelude.Double,
Capacity -> Maybe Double
readCapacityUnits :: Prelude.Maybe Prelude.Double,
Capacity -> Maybe Double
writeCapacityUnits :: Prelude.Maybe Prelude.Double
}
deriving (Capacity -> Capacity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Capacity -> Capacity -> Bool
$c/= :: Capacity -> Capacity -> Bool
== :: Capacity -> Capacity -> Bool
$c== :: Capacity -> Capacity -> Bool
Prelude.Eq, ReadPrec [Capacity]
ReadPrec Capacity
Int -> ReadS Capacity
ReadS [Capacity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Capacity]
$creadListPrec :: ReadPrec [Capacity]
readPrec :: ReadPrec Capacity
$creadPrec :: ReadPrec Capacity
readList :: ReadS [Capacity]
$creadList :: ReadS [Capacity]
readsPrec :: Int -> ReadS Capacity
$creadsPrec :: Int -> ReadS Capacity
Prelude.Read, Int -> Capacity -> ShowS
[Capacity] -> ShowS
Capacity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Capacity] -> ShowS
$cshowList :: [Capacity] -> ShowS
show :: Capacity -> String
$cshow :: Capacity -> String
showsPrec :: Int -> Capacity -> ShowS
$cshowsPrec :: Int -> Capacity -> ShowS
Prelude.Show, forall x. Rep Capacity x -> Capacity
forall x. Capacity -> Rep Capacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Capacity x -> Capacity
$cfrom :: forall x. Capacity -> Rep Capacity x
Prelude.Generic)
newCapacity ::
Capacity
newCapacity :: Capacity
newCapacity =
Capacity'
{ $sel:capacityUnits:Capacity' :: Maybe Double
capacityUnits = forall a. Maybe a
Prelude.Nothing,
$sel:readCapacityUnits:Capacity' :: Maybe Double
readCapacityUnits = forall a. Maybe a
Prelude.Nothing,
$sel:writeCapacityUnits:Capacity' :: Maybe Double
writeCapacityUnits = forall a. Maybe a
Prelude.Nothing
}
capacity_capacityUnits :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Double)
capacity_capacityUnits :: Lens' Capacity (Maybe Double)
capacity_capacityUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe Double
capacityUnits :: Maybe Double
$sel:capacityUnits:Capacity' :: Capacity -> Maybe Double
capacityUnits} -> Maybe Double
capacityUnits) (\s :: Capacity
s@Capacity' {} Maybe Double
a -> Capacity
s {$sel:capacityUnits:Capacity' :: Maybe Double
capacityUnits = Maybe Double
a} :: Capacity)
capacity_readCapacityUnits :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Double)
capacity_readCapacityUnits :: Lens' Capacity (Maybe Double)
capacity_readCapacityUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe Double
readCapacityUnits :: Maybe Double
$sel:readCapacityUnits:Capacity' :: Capacity -> Maybe Double
readCapacityUnits} -> Maybe Double
readCapacityUnits) (\s :: Capacity
s@Capacity' {} Maybe Double
a -> Capacity
s {$sel:readCapacityUnits:Capacity' :: Maybe Double
readCapacityUnits = Maybe Double
a} :: Capacity)
capacity_writeCapacityUnits :: Lens.Lens' Capacity (Prelude.Maybe Prelude.Double)
capacity_writeCapacityUnits :: Lens' Capacity (Maybe Double)
capacity_writeCapacityUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Capacity' {Maybe Double
writeCapacityUnits :: Maybe Double
$sel:writeCapacityUnits:Capacity' :: Capacity -> Maybe Double
writeCapacityUnits} -> Maybe Double
writeCapacityUnits) (\s :: Capacity
s@Capacity' {} Maybe Double
a -> Capacity
s {$sel:writeCapacityUnits:Capacity' :: Maybe Double
writeCapacityUnits = Maybe Double
a} :: Capacity)
instance Data.FromJSON Capacity where
parseJSON :: Value -> Parser Capacity
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Capacity"
( \Object
x ->
Maybe Double -> Maybe Double -> Maybe Double -> Capacity
Capacity'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CapacityUnits")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ReadCapacityUnits")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"WriteCapacityUnits")
)
instance Prelude.Hashable Capacity where
hashWithSalt :: Int -> Capacity -> Int
hashWithSalt Int
_salt Capacity' {Maybe Double
writeCapacityUnits :: Maybe Double
readCapacityUnits :: Maybe Double
capacityUnits :: Maybe Double
$sel:writeCapacityUnits:Capacity' :: Capacity -> Maybe Double
$sel:readCapacityUnits:Capacity' :: Capacity -> Maybe Double
$sel:capacityUnits:Capacity' :: Capacity -> Maybe Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
capacityUnits
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
readCapacityUnits
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
writeCapacityUnits
instance Prelude.NFData Capacity where
rnf :: Capacity -> ()
rnf Capacity' {Maybe Double
writeCapacityUnits :: Maybe Double
readCapacityUnits :: Maybe Double
capacityUnits :: Maybe Double
$sel:writeCapacityUnits:Capacity' :: Capacity -> Maybe Double
$sel:readCapacityUnits:Capacity' :: Capacity -> Maybe Double
$sel:capacityUnits:Capacity' :: Capacity -> Maybe Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
capacityUnits
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
readCapacityUnits
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
writeCapacityUnits