{-# 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.KeySpaces.Types.CapacitySpecificationSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KeySpaces.Types.CapacitySpecificationSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KeySpaces.Types.ThroughputMode
import qualified Amazonka.Prelude as Prelude

-- | The read\/write throughput capacity mode for a table. The options are:
--
-- • @throughputMode:PAY_PER_REQUEST@ and
--
-- • @throughputMode:PROVISIONED@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/keyspaces/latest/devguide/ReadWriteCapacityMode.html Read\/write capacity modes>
-- in the /Amazon Keyspaces Developer Guide/.
--
-- /See:/ 'newCapacitySpecificationSummary' smart constructor.
data CapacitySpecificationSummary = CapacitySpecificationSummary'
  { -- | The timestamp of the last operation that changed the provisioned
    -- throughput capacity of a table.
    CapacitySpecificationSummary -> Maybe POSIX
lastUpdateToPayPerRequestTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The throughput capacity specified for @read@ operations defined in
    -- @read capacity units@ @(RCUs)@.
    CapacitySpecificationSummary -> Maybe Natural
readCapacityUnits :: Prelude.Maybe Prelude.Natural,
    -- | The throughput capacity specified for @write@ operations defined in
    -- @write capacity units@ @(WCUs)@.
    CapacitySpecificationSummary -> Maybe Natural
writeCapacityUnits :: Prelude.Maybe Prelude.Natural,
    -- | The read\/write throughput capacity mode for a table. The options are:
    --
    -- • @throughputMode:PAY_PER_REQUEST@ and
    --
    -- • @throughputMode:PROVISIONED@ - Provisioned capacity mode requires
    -- @readCapacityUnits@ and @writeCapacityUnits@ as input.
    --
    -- The default is @throughput_mode:PAY_PER_REQUEST@.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/keyspaces/latest/devguide/ReadWriteCapacityMode.html Read\/write capacity modes>
    -- in the /Amazon Keyspaces Developer Guide/.
    CapacitySpecificationSummary -> ThroughputMode
throughputMode :: ThroughputMode
  }
  deriving (CapacitySpecificationSummary
-> CapacitySpecificationSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CapacitySpecificationSummary
-> CapacitySpecificationSummary -> Bool
$c/= :: CapacitySpecificationSummary
-> CapacitySpecificationSummary -> Bool
== :: CapacitySpecificationSummary
-> CapacitySpecificationSummary -> Bool
$c== :: CapacitySpecificationSummary
-> CapacitySpecificationSummary -> Bool
Prelude.Eq, ReadPrec [CapacitySpecificationSummary]
ReadPrec CapacitySpecificationSummary
Int -> ReadS CapacitySpecificationSummary
ReadS [CapacitySpecificationSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CapacitySpecificationSummary]
$creadListPrec :: ReadPrec [CapacitySpecificationSummary]
readPrec :: ReadPrec CapacitySpecificationSummary
$creadPrec :: ReadPrec CapacitySpecificationSummary
readList :: ReadS [CapacitySpecificationSummary]
$creadList :: ReadS [CapacitySpecificationSummary]
readsPrec :: Int -> ReadS CapacitySpecificationSummary
$creadsPrec :: Int -> ReadS CapacitySpecificationSummary
Prelude.Read, Int -> CapacitySpecificationSummary -> ShowS
[CapacitySpecificationSummary] -> ShowS
CapacitySpecificationSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CapacitySpecificationSummary] -> ShowS
$cshowList :: [CapacitySpecificationSummary] -> ShowS
show :: CapacitySpecificationSummary -> String
$cshow :: CapacitySpecificationSummary -> String
showsPrec :: Int -> CapacitySpecificationSummary -> ShowS
$cshowsPrec :: Int -> CapacitySpecificationSummary -> ShowS
Prelude.Show, forall x.
Rep CapacitySpecificationSummary x -> CapacitySpecificationSummary
forall x.
CapacitySpecificationSummary -> Rep CapacitySpecificationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CapacitySpecificationSummary x -> CapacitySpecificationSummary
$cfrom :: forall x.
CapacitySpecificationSummary -> Rep CapacitySpecificationSummary x
Prelude.Generic)

-- |
-- Create a value of 'CapacitySpecificationSummary' 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:
--
-- 'lastUpdateToPayPerRequestTimestamp', 'capacitySpecificationSummary_lastUpdateToPayPerRequestTimestamp' - The timestamp of the last operation that changed the provisioned
-- throughput capacity of a table.
--
-- 'readCapacityUnits', 'capacitySpecificationSummary_readCapacityUnits' - The throughput capacity specified for @read@ operations defined in
-- @read capacity units@ @(RCUs)@.
--
-- 'writeCapacityUnits', 'capacitySpecificationSummary_writeCapacityUnits' - The throughput capacity specified for @write@ operations defined in
-- @write capacity units@ @(WCUs)@.
--
-- 'throughputMode', 'capacitySpecificationSummary_throughputMode' - The read\/write throughput capacity mode for a table. The options are:
--
-- • @throughputMode:PAY_PER_REQUEST@ and
--
-- • @throughputMode:PROVISIONED@ - Provisioned capacity mode requires
-- @readCapacityUnits@ and @writeCapacityUnits@ as input.
--
-- The default is @throughput_mode:PAY_PER_REQUEST@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/keyspaces/latest/devguide/ReadWriteCapacityMode.html Read\/write capacity modes>
-- in the /Amazon Keyspaces Developer Guide/.
newCapacitySpecificationSummary ::
  -- | 'throughputMode'
  ThroughputMode ->
  CapacitySpecificationSummary
newCapacitySpecificationSummary :: ThroughputMode -> CapacitySpecificationSummary
newCapacitySpecificationSummary ThroughputMode
pThroughputMode_ =
  CapacitySpecificationSummary'
    { $sel:lastUpdateToPayPerRequestTimestamp:CapacitySpecificationSummary' :: Maybe POSIX
lastUpdateToPayPerRequestTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:readCapacityUnits:CapacitySpecificationSummary' :: Maybe Natural
readCapacityUnits = forall a. Maybe a
Prelude.Nothing,
      $sel:writeCapacityUnits:CapacitySpecificationSummary' :: Maybe Natural
writeCapacityUnits = forall a. Maybe a
Prelude.Nothing,
      $sel:throughputMode:CapacitySpecificationSummary' :: ThroughputMode
throughputMode = ThroughputMode
pThroughputMode_
    }

-- | The timestamp of the last operation that changed the provisioned
-- throughput capacity of a table.
capacitySpecificationSummary_lastUpdateToPayPerRequestTimestamp :: Lens.Lens' CapacitySpecificationSummary (Prelude.Maybe Prelude.UTCTime)
capacitySpecificationSummary_lastUpdateToPayPerRequestTimestamp :: Lens' CapacitySpecificationSummary (Maybe UTCTime)
capacitySpecificationSummary_lastUpdateToPayPerRequestTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacitySpecificationSummary' {Maybe POSIX
lastUpdateToPayPerRequestTimestamp :: Maybe POSIX
$sel:lastUpdateToPayPerRequestTimestamp:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe POSIX
lastUpdateToPayPerRequestTimestamp} -> Maybe POSIX
lastUpdateToPayPerRequestTimestamp) (\s :: CapacitySpecificationSummary
s@CapacitySpecificationSummary' {} Maybe POSIX
a -> CapacitySpecificationSummary
s {$sel:lastUpdateToPayPerRequestTimestamp:CapacitySpecificationSummary' :: Maybe POSIX
lastUpdateToPayPerRequestTimestamp = Maybe POSIX
a} :: CapacitySpecificationSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The throughput capacity specified for @read@ operations defined in
-- @read capacity units@ @(RCUs)@.
capacitySpecificationSummary_readCapacityUnits :: Lens.Lens' CapacitySpecificationSummary (Prelude.Maybe Prelude.Natural)
capacitySpecificationSummary_readCapacityUnits :: Lens' CapacitySpecificationSummary (Maybe Natural)
capacitySpecificationSummary_readCapacityUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacitySpecificationSummary' {Maybe Natural
readCapacityUnits :: Maybe Natural
$sel:readCapacityUnits:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe Natural
readCapacityUnits} -> Maybe Natural
readCapacityUnits) (\s :: CapacitySpecificationSummary
s@CapacitySpecificationSummary' {} Maybe Natural
a -> CapacitySpecificationSummary
s {$sel:readCapacityUnits:CapacitySpecificationSummary' :: Maybe Natural
readCapacityUnits = Maybe Natural
a} :: CapacitySpecificationSummary)

-- | The throughput capacity specified for @write@ operations defined in
-- @write capacity units@ @(WCUs)@.
capacitySpecificationSummary_writeCapacityUnits :: Lens.Lens' CapacitySpecificationSummary (Prelude.Maybe Prelude.Natural)
capacitySpecificationSummary_writeCapacityUnits :: Lens' CapacitySpecificationSummary (Maybe Natural)
capacitySpecificationSummary_writeCapacityUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacitySpecificationSummary' {Maybe Natural
writeCapacityUnits :: Maybe Natural
$sel:writeCapacityUnits:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe Natural
writeCapacityUnits} -> Maybe Natural
writeCapacityUnits) (\s :: CapacitySpecificationSummary
s@CapacitySpecificationSummary' {} Maybe Natural
a -> CapacitySpecificationSummary
s {$sel:writeCapacityUnits:CapacitySpecificationSummary' :: Maybe Natural
writeCapacityUnits = Maybe Natural
a} :: CapacitySpecificationSummary)

-- | The read\/write throughput capacity mode for a table. The options are:
--
-- • @throughputMode:PAY_PER_REQUEST@ and
--
-- • @throughputMode:PROVISIONED@ - Provisioned capacity mode requires
-- @readCapacityUnits@ and @writeCapacityUnits@ as input.
--
-- The default is @throughput_mode:PAY_PER_REQUEST@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/keyspaces/latest/devguide/ReadWriteCapacityMode.html Read\/write capacity modes>
-- in the /Amazon Keyspaces Developer Guide/.
capacitySpecificationSummary_throughputMode :: Lens.Lens' CapacitySpecificationSummary ThroughputMode
capacitySpecificationSummary_throughputMode :: Lens' CapacitySpecificationSummary ThroughputMode
capacitySpecificationSummary_throughputMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacitySpecificationSummary' {ThroughputMode
throughputMode :: ThroughputMode
$sel:throughputMode:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> ThroughputMode
throughputMode} -> ThroughputMode
throughputMode) (\s :: CapacitySpecificationSummary
s@CapacitySpecificationSummary' {} ThroughputMode
a -> CapacitySpecificationSummary
s {$sel:throughputMode:CapacitySpecificationSummary' :: ThroughputMode
throughputMode = ThroughputMode
a} :: CapacitySpecificationSummary)

instance Data.FromJSON CapacitySpecificationSummary where
  parseJSON :: Value -> Parser CapacitySpecificationSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CapacitySpecificationSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Natural
-> Maybe Natural
-> ThroughputMode
-> CapacitySpecificationSummary
CapacitySpecificationSummary'
            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
"lastUpdateToPayPerRequestTimestamp")
            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")
            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
"throughputMode")
      )

instance
  Prelude.Hashable
    CapacitySpecificationSummary
  where
  hashWithSalt :: Int -> CapacitySpecificationSummary -> Int
hashWithSalt Int
_salt CapacitySpecificationSummary' {Maybe Natural
Maybe POSIX
ThroughputMode
throughputMode :: ThroughputMode
writeCapacityUnits :: Maybe Natural
readCapacityUnits :: Maybe Natural
lastUpdateToPayPerRequestTimestamp :: Maybe POSIX
$sel:throughputMode:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> ThroughputMode
$sel:writeCapacityUnits:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe Natural
$sel:readCapacityUnits:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe Natural
$sel:lastUpdateToPayPerRequestTimestamp:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdateToPayPerRequestTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
readCapacityUnits
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
writeCapacityUnits
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ThroughputMode
throughputMode

instance Prelude.NFData CapacitySpecificationSummary where
  rnf :: CapacitySpecificationSummary -> ()
rnf CapacitySpecificationSummary' {Maybe Natural
Maybe POSIX
ThroughputMode
throughputMode :: ThroughputMode
writeCapacityUnits :: Maybe Natural
readCapacityUnits :: Maybe Natural
lastUpdateToPayPerRequestTimestamp :: Maybe POSIX
$sel:throughputMode:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> ThroughputMode
$sel:writeCapacityUnits:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe Natural
$sel:readCapacityUnits:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe Natural
$sel:lastUpdateToPayPerRequestTimestamp:CapacitySpecificationSummary' :: CapacitySpecificationSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdateToPayPerRequestTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
readCapacityUnits
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
writeCapacityUnits
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ThroughputMode
throughputMode