{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ProvisionedThroughput = ProvisionedThroughput'
{
ProvisionedThroughput -> Natural
readCapacityUnits :: Prelude.Natural,
ProvisionedThroughput -> Natural
writeCapacityUnits :: Prelude.Natural
}
deriving (ProvisionedThroughput -> ProvisionedThroughput -> Bool
(ProvisionedThroughput -> ProvisionedThroughput -> Bool)
-> (ProvisionedThroughput -> ProvisionedThroughput -> Bool)
-> Eq ProvisionedThroughput
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]
(Int -> ReadS ProvisionedThroughput)
-> ReadS [ProvisionedThroughput]
-> ReadPrec ProvisionedThroughput
-> ReadPrec [ProvisionedThroughput]
-> Read 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
(Int -> ProvisionedThroughput -> ShowS)
-> (ProvisionedThroughput -> String)
-> ([ProvisionedThroughput] -> ShowS)
-> Show ProvisionedThroughput
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. ProvisionedThroughput -> Rep ProvisionedThroughput x)
-> (forall x. Rep ProvisionedThroughput x -> ProvisionedThroughput)
-> Generic ProvisionedThroughput
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' :: Natural -> Natural -> ProvisionedThroughput
ProvisionedThroughput'
{ $sel:readCapacityUnits:ProvisionedThroughput' :: Natural
readCapacityUnits =
Natural
pReadCapacityUnits_,
$sel:writeCapacityUnits:ProvisionedThroughput' :: Natural
writeCapacityUnits = Natural
pWriteCapacityUnits_
}
provisionedThroughput_readCapacityUnits :: Lens.Lens' ProvisionedThroughput Prelude.Natural
provisionedThroughput_readCapacityUnits :: (Natural -> f Natural)
-> ProvisionedThroughput -> f ProvisionedThroughput
provisionedThroughput_readCapacityUnits = (ProvisionedThroughput -> Natural)
-> (ProvisionedThroughput -> Natural -> ProvisionedThroughput)
-> Lens ProvisionedThroughput ProvisionedThroughput Natural Natural
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 :: (Natural -> f Natural)
-> ProvisionedThroughput -> f ProvisionedThroughput
provisionedThroughput_writeCapacityUnits = (ProvisionedThroughput -> Natural)
-> (ProvisionedThroughput -> Natural -> ProvisionedThroughput)
-> Lens ProvisionedThroughput ProvisionedThroughput Natural Natural
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 Core.FromJSON ProvisionedThroughput where
parseJSON :: Value -> Parser ProvisionedThroughput
parseJSON =
String
-> (Object -> Parser ProvisionedThroughput)
-> Value
-> Parser ProvisionedThroughput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ProvisionedThroughput"
( \Object
x ->
Natural -> Natural -> ProvisionedThroughput
ProvisionedThroughput'
(Natural -> Natural -> ProvisionedThroughput)
-> Parser Natural -> Parser (Natural -> ProvisionedThroughput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ReadCapacityUnits")
Parser (Natural -> ProvisionedThroughput)
-> Parser Natural -> Parser ProvisionedThroughput
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"WriteCapacityUnits")
)
instance Prelude.Hashable ProvisionedThroughput
instance Prelude.NFData ProvisionedThroughput
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ReadCapacityUnits" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
readCapacityUnits),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"WriteCapacityUnits" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
writeCapacityUnits)
]
)