{-# 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.ProvisionedThroughput 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 ProvisionedThroughput = ProvisionedThroughput'
{
ProvisionedThroughput -> Natural
readCapacityUnits :: Prelude.Natural,
ProvisionedThroughput -> Natural
writeCapacityUnits :: Prelude.Natural
}
deriving (ProvisionedThroughput -> ProvisionedThroughput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisionedThroughput -> ProvisionedThroughput -> Bool
$c/= :: ProvisionedThroughput -> ProvisionedThroughput -> Bool
== :: ProvisionedThroughput -> ProvisionedThroughput -> Bool
$c== :: ProvisionedThroughput -> ProvisionedThroughput -> Bool
Prelude.Eq, ReadPrec [ProvisionedThroughput]
ReadPrec ProvisionedThroughput
Int -> ReadS ProvisionedThroughput
ReadS [ProvisionedThroughput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisionedThroughput]
$creadListPrec :: ReadPrec [ProvisionedThroughput]
readPrec :: ReadPrec ProvisionedThroughput
$creadPrec :: ReadPrec ProvisionedThroughput
readList :: ReadS [ProvisionedThroughput]
$creadList :: ReadS [ProvisionedThroughput]
readsPrec :: Int -> ReadS ProvisionedThroughput
$creadsPrec :: Int -> ReadS ProvisionedThroughput
Prelude.Read, Int -> ProvisionedThroughput -> ShowS
[ProvisionedThroughput] -> ShowS
ProvisionedThroughput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisionedThroughput] -> ShowS
$cshowList :: [ProvisionedThroughput] -> ShowS
show :: ProvisionedThroughput -> String
$cshow :: ProvisionedThroughput -> String
showsPrec :: Int -> ProvisionedThroughput -> ShowS
$cshowsPrec :: Int -> ProvisionedThroughput -> ShowS
Prelude.Show, forall x. Rep ProvisionedThroughput x -> ProvisionedThroughput
forall x. ProvisionedThroughput -> Rep ProvisionedThroughput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProvisionedThroughput x -> ProvisionedThroughput
$cfrom :: forall x. ProvisionedThroughput -> Rep ProvisionedThroughput x
Prelude.Generic)
newProvisionedThroughput ::
Prelude.Natural ->
Prelude.Natural ->
ProvisionedThroughput
newProvisionedThroughput :: Natural -> Natural -> ProvisionedThroughput
newProvisionedThroughput
Natural
pReadCapacityUnits_
Natural
pWriteCapacityUnits_ =
ProvisionedThroughput'
{ $sel:readCapacityUnits:ProvisionedThroughput' :: Natural
readCapacityUnits =
Natural
pReadCapacityUnits_,
$sel:writeCapacityUnits:ProvisionedThroughput' :: Natural
writeCapacityUnits = Natural
pWriteCapacityUnits_
}
provisionedThroughput_readCapacityUnits :: Lens.Lens' ProvisionedThroughput Prelude.Natural
provisionedThroughput_readCapacityUnits :: Lens' ProvisionedThroughput Natural
provisionedThroughput_readCapacityUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionedThroughput' {Natural
readCapacityUnits :: Natural
$sel:readCapacityUnits:ProvisionedThroughput' :: ProvisionedThroughput -> Natural
readCapacityUnits} -> Natural
readCapacityUnits) (\s :: ProvisionedThroughput
s@ProvisionedThroughput' {} Natural
a -> ProvisionedThroughput
s {$sel:readCapacityUnits:ProvisionedThroughput' :: Natural
readCapacityUnits = Natural
a} :: ProvisionedThroughput)
provisionedThroughput_writeCapacityUnits :: Lens.Lens' ProvisionedThroughput Prelude.Natural
provisionedThroughput_writeCapacityUnits :: Lens' ProvisionedThroughput Natural
provisionedThroughput_writeCapacityUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionedThroughput' {Natural
writeCapacityUnits :: Natural
$sel:writeCapacityUnits:ProvisionedThroughput' :: ProvisionedThroughput -> Natural
writeCapacityUnits} -> Natural
writeCapacityUnits) (\s :: ProvisionedThroughput
s@ProvisionedThroughput' {} Natural
a -> ProvisionedThroughput
s {$sel:writeCapacityUnits:ProvisionedThroughput' :: Natural
writeCapacityUnits = Natural
a} :: ProvisionedThroughput)
instance Data.FromJSON ProvisionedThroughput where
parseJSON :: Value -> Parser ProvisionedThroughput
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ProvisionedThroughput"
( \Object
x ->
Natural -> Natural -> ProvisionedThroughput
ProvisionedThroughput'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 a
Data..: Key
"WriteCapacityUnits")
)
instance Prelude.Hashable ProvisionedThroughput where
hashWithSalt :: Int -> ProvisionedThroughput -> Int
hashWithSalt Int
_salt ProvisionedThroughput' {Natural
writeCapacityUnits :: Natural
readCapacityUnits :: Natural
$sel:writeCapacityUnits:ProvisionedThroughput' :: ProvisionedThroughput -> Natural
$sel:readCapacityUnits:ProvisionedThroughput' :: ProvisionedThroughput -> Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
readCapacityUnits
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
writeCapacityUnits
instance Prelude.NFData ProvisionedThroughput where
rnf :: ProvisionedThroughput -> ()
rnf ProvisionedThroughput' {Natural
writeCapacityUnits :: Natural
readCapacityUnits :: Natural
$sel:writeCapacityUnits:ProvisionedThroughput' :: ProvisionedThroughput -> Natural
$sel:readCapacityUnits:ProvisionedThroughput' :: ProvisionedThroughput -> Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Natural
readCapacityUnits
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
writeCapacityUnits
instance Data.ToJSON ProvisionedThroughput where
toJSON :: ProvisionedThroughput -> Value
toJSON ProvisionedThroughput' {Natural
writeCapacityUnits :: Natural
readCapacityUnits :: Natural
$sel:writeCapacityUnits:ProvisionedThroughput' :: ProvisionedThroughput -> Natural
$sel:readCapacityUnits:ProvisionedThroughput' :: ProvisionedThroughput -> Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"ReadCapacityUnits" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
readCapacityUnits),
forall a. a -> Maybe a
Prelude.Just
(Key
"WriteCapacityUnits" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
writeCapacityUnits)
]
)