{-# 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.DynamoDB.Types.ReplicaGlobalSecondaryIndexSettingsUpdate
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DynamoDB.Types.ReplicaGlobalSecondaryIndexSettingsUpdate where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.AutoScalingSettingsUpdate
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the settings of a global secondary index for a global table
-- that will be modified.
--
-- /See:/ 'newReplicaGlobalSecondaryIndexSettingsUpdate' smart constructor.
data ReplicaGlobalSecondaryIndexSettingsUpdate = ReplicaGlobalSecondaryIndexSettingsUpdate'
  { -- | Auto scaling settings for managing a global secondary index replica\'s
    -- read capacity units.
    ReplicaGlobalSecondaryIndexSettingsUpdate
-> Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingSettingsUpdate :: Prelude.Maybe AutoScalingSettingsUpdate,
    -- | The maximum number of strongly consistent reads consumed per second
    -- before DynamoDB returns a @ThrottlingException@.
    ReplicaGlobalSecondaryIndexSettingsUpdate -> Maybe Natural
provisionedReadCapacityUnits :: Prelude.Maybe Prelude.Natural,
    -- | The name of the global secondary index. The name must be unique among
    -- all other indexes on this table.
    ReplicaGlobalSecondaryIndexSettingsUpdate -> Text
indexName :: Prelude.Text
  }
  deriving (ReplicaGlobalSecondaryIndexSettingsUpdate
-> ReplicaGlobalSecondaryIndexSettingsUpdate -> Bool
(ReplicaGlobalSecondaryIndexSettingsUpdate
 -> ReplicaGlobalSecondaryIndexSettingsUpdate -> Bool)
-> (ReplicaGlobalSecondaryIndexSettingsUpdate
    -> ReplicaGlobalSecondaryIndexSettingsUpdate -> Bool)
-> Eq ReplicaGlobalSecondaryIndexSettingsUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaGlobalSecondaryIndexSettingsUpdate
-> ReplicaGlobalSecondaryIndexSettingsUpdate -> Bool
$c/= :: ReplicaGlobalSecondaryIndexSettingsUpdate
-> ReplicaGlobalSecondaryIndexSettingsUpdate -> Bool
== :: ReplicaGlobalSecondaryIndexSettingsUpdate
-> ReplicaGlobalSecondaryIndexSettingsUpdate -> Bool
$c== :: ReplicaGlobalSecondaryIndexSettingsUpdate
-> ReplicaGlobalSecondaryIndexSettingsUpdate -> Bool
Prelude.Eq, ReadPrec [ReplicaGlobalSecondaryIndexSettingsUpdate]
ReadPrec ReplicaGlobalSecondaryIndexSettingsUpdate
Int -> ReadS ReplicaGlobalSecondaryIndexSettingsUpdate
ReadS [ReplicaGlobalSecondaryIndexSettingsUpdate]
(Int -> ReadS ReplicaGlobalSecondaryIndexSettingsUpdate)
-> ReadS [ReplicaGlobalSecondaryIndexSettingsUpdate]
-> ReadPrec ReplicaGlobalSecondaryIndexSettingsUpdate
-> ReadPrec [ReplicaGlobalSecondaryIndexSettingsUpdate]
-> Read ReplicaGlobalSecondaryIndexSettingsUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaGlobalSecondaryIndexSettingsUpdate]
$creadListPrec :: ReadPrec [ReplicaGlobalSecondaryIndexSettingsUpdate]
readPrec :: ReadPrec ReplicaGlobalSecondaryIndexSettingsUpdate
$creadPrec :: ReadPrec ReplicaGlobalSecondaryIndexSettingsUpdate
readList :: ReadS [ReplicaGlobalSecondaryIndexSettingsUpdate]
$creadList :: ReadS [ReplicaGlobalSecondaryIndexSettingsUpdate]
readsPrec :: Int -> ReadS ReplicaGlobalSecondaryIndexSettingsUpdate
$creadsPrec :: Int -> ReadS ReplicaGlobalSecondaryIndexSettingsUpdate
Prelude.Read, Int -> ReplicaGlobalSecondaryIndexSettingsUpdate -> ShowS
[ReplicaGlobalSecondaryIndexSettingsUpdate] -> ShowS
ReplicaGlobalSecondaryIndexSettingsUpdate -> String
(Int -> ReplicaGlobalSecondaryIndexSettingsUpdate -> ShowS)
-> (ReplicaGlobalSecondaryIndexSettingsUpdate -> String)
-> ([ReplicaGlobalSecondaryIndexSettingsUpdate] -> ShowS)
-> Show ReplicaGlobalSecondaryIndexSettingsUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaGlobalSecondaryIndexSettingsUpdate] -> ShowS
$cshowList :: [ReplicaGlobalSecondaryIndexSettingsUpdate] -> ShowS
show :: ReplicaGlobalSecondaryIndexSettingsUpdate -> String
$cshow :: ReplicaGlobalSecondaryIndexSettingsUpdate -> String
showsPrec :: Int -> ReplicaGlobalSecondaryIndexSettingsUpdate -> ShowS
$cshowsPrec :: Int -> ReplicaGlobalSecondaryIndexSettingsUpdate -> ShowS
Prelude.Show, (forall x.
 ReplicaGlobalSecondaryIndexSettingsUpdate
 -> Rep ReplicaGlobalSecondaryIndexSettingsUpdate x)
-> (forall x.
    Rep ReplicaGlobalSecondaryIndexSettingsUpdate x
    -> ReplicaGlobalSecondaryIndexSettingsUpdate)
-> Generic ReplicaGlobalSecondaryIndexSettingsUpdate
forall x.
Rep ReplicaGlobalSecondaryIndexSettingsUpdate x
-> ReplicaGlobalSecondaryIndexSettingsUpdate
forall x.
ReplicaGlobalSecondaryIndexSettingsUpdate
-> Rep ReplicaGlobalSecondaryIndexSettingsUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicaGlobalSecondaryIndexSettingsUpdate x
-> ReplicaGlobalSecondaryIndexSettingsUpdate
$cfrom :: forall x.
ReplicaGlobalSecondaryIndexSettingsUpdate
-> Rep ReplicaGlobalSecondaryIndexSettingsUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ReplicaGlobalSecondaryIndexSettingsUpdate' 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:
--
-- 'provisionedReadCapacityAutoScalingSettingsUpdate', 'replicaGlobalSecondaryIndexSettingsUpdate_provisionedReadCapacityAutoScalingSettingsUpdate' - Auto scaling settings for managing a global secondary index replica\'s
-- read capacity units.
--
-- 'provisionedReadCapacityUnits', 'replicaGlobalSecondaryIndexSettingsUpdate_provisionedReadCapacityUnits' - The maximum number of strongly consistent reads consumed per second
-- before DynamoDB returns a @ThrottlingException@.
--
-- 'indexName', 'replicaGlobalSecondaryIndexSettingsUpdate_indexName' - The name of the global secondary index. The name must be unique among
-- all other indexes on this table.
newReplicaGlobalSecondaryIndexSettingsUpdate ::
  -- | 'indexName'
  Prelude.Text ->
  ReplicaGlobalSecondaryIndexSettingsUpdate
newReplicaGlobalSecondaryIndexSettingsUpdate :: Text -> ReplicaGlobalSecondaryIndexSettingsUpdate
newReplicaGlobalSecondaryIndexSettingsUpdate
  Text
pIndexName_ =
    ReplicaGlobalSecondaryIndexSettingsUpdate' :: Maybe AutoScalingSettingsUpdate
-> Maybe Natural
-> Text
-> ReplicaGlobalSecondaryIndexSettingsUpdate
ReplicaGlobalSecondaryIndexSettingsUpdate'
      { $sel:provisionedReadCapacityAutoScalingSettingsUpdate:ReplicaGlobalSecondaryIndexSettingsUpdate' :: Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingSettingsUpdate =
          Maybe AutoScalingSettingsUpdate
forall a. Maybe a
Prelude.Nothing,
        $sel:provisionedReadCapacityUnits:ReplicaGlobalSecondaryIndexSettingsUpdate' :: Maybe Natural
provisionedReadCapacityUnits =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:indexName:ReplicaGlobalSecondaryIndexSettingsUpdate' :: Text
indexName = Text
pIndexName_
      }

-- | Auto scaling settings for managing a global secondary index replica\'s
-- read capacity units.
replicaGlobalSecondaryIndexSettingsUpdate_provisionedReadCapacityAutoScalingSettingsUpdate :: Lens.Lens' ReplicaGlobalSecondaryIndexSettingsUpdate (Prelude.Maybe AutoScalingSettingsUpdate)
replicaGlobalSecondaryIndexSettingsUpdate_provisionedReadCapacityAutoScalingSettingsUpdate :: (Maybe AutoScalingSettingsUpdate
 -> f (Maybe AutoScalingSettingsUpdate))
-> ReplicaGlobalSecondaryIndexSettingsUpdate
-> f ReplicaGlobalSecondaryIndexSettingsUpdate
replicaGlobalSecondaryIndexSettingsUpdate_provisionedReadCapacityAutoScalingSettingsUpdate = (ReplicaGlobalSecondaryIndexSettingsUpdate
 -> Maybe AutoScalingSettingsUpdate)
-> (ReplicaGlobalSecondaryIndexSettingsUpdate
    -> Maybe AutoScalingSettingsUpdate
    -> ReplicaGlobalSecondaryIndexSettingsUpdate)
-> Lens
     ReplicaGlobalSecondaryIndexSettingsUpdate
     ReplicaGlobalSecondaryIndexSettingsUpdate
     (Maybe AutoScalingSettingsUpdate)
     (Maybe AutoScalingSettingsUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexSettingsUpdate' {Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingSettingsUpdate :: Maybe AutoScalingSettingsUpdate
$sel:provisionedReadCapacityAutoScalingSettingsUpdate:ReplicaGlobalSecondaryIndexSettingsUpdate' :: ReplicaGlobalSecondaryIndexSettingsUpdate
-> Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingSettingsUpdate} -> Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingSettingsUpdate) (\s :: ReplicaGlobalSecondaryIndexSettingsUpdate
s@ReplicaGlobalSecondaryIndexSettingsUpdate' {} Maybe AutoScalingSettingsUpdate
a -> ReplicaGlobalSecondaryIndexSettingsUpdate
s {$sel:provisionedReadCapacityAutoScalingSettingsUpdate:ReplicaGlobalSecondaryIndexSettingsUpdate' :: Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingSettingsUpdate = Maybe AutoScalingSettingsUpdate
a} :: ReplicaGlobalSecondaryIndexSettingsUpdate)

-- | The maximum number of strongly consistent reads consumed per second
-- before DynamoDB returns a @ThrottlingException@.
replicaGlobalSecondaryIndexSettingsUpdate_provisionedReadCapacityUnits :: Lens.Lens' ReplicaGlobalSecondaryIndexSettingsUpdate (Prelude.Maybe Prelude.Natural)
replicaGlobalSecondaryIndexSettingsUpdate_provisionedReadCapacityUnits :: (Maybe Natural -> f (Maybe Natural))
-> ReplicaGlobalSecondaryIndexSettingsUpdate
-> f ReplicaGlobalSecondaryIndexSettingsUpdate
replicaGlobalSecondaryIndexSettingsUpdate_provisionedReadCapacityUnits = (ReplicaGlobalSecondaryIndexSettingsUpdate -> Maybe Natural)
-> (ReplicaGlobalSecondaryIndexSettingsUpdate
    -> Maybe Natural -> ReplicaGlobalSecondaryIndexSettingsUpdate)
-> Lens
     ReplicaGlobalSecondaryIndexSettingsUpdate
     ReplicaGlobalSecondaryIndexSettingsUpdate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexSettingsUpdate' {Maybe Natural
provisionedReadCapacityUnits :: Maybe Natural
$sel:provisionedReadCapacityUnits:ReplicaGlobalSecondaryIndexSettingsUpdate' :: ReplicaGlobalSecondaryIndexSettingsUpdate -> Maybe Natural
provisionedReadCapacityUnits} -> Maybe Natural
provisionedReadCapacityUnits) (\s :: ReplicaGlobalSecondaryIndexSettingsUpdate
s@ReplicaGlobalSecondaryIndexSettingsUpdate' {} Maybe Natural
a -> ReplicaGlobalSecondaryIndexSettingsUpdate
s {$sel:provisionedReadCapacityUnits:ReplicaGlobalSecondaryIndexSettingsUpdate' :: Maybe Natural
provisionedReadCapacityUnits = Maybe Natural
a} :: ReplicaGlobalSecondaryIndexSettingsUpdate)

-- | The name of the global secondary index. The name must be unique among
-- all other indexes on this table.
replicaGlobalSecondaryIndexSettingsUpdate_indexName :: Lens.Lens' ReplicaGlobalSecondaryIndexSettingsUpdate Prelude.Text
replicaGlobalSecondaryIndexSettingsUpdate_indexName :: (Text -> f Text)
-> ReplicaGlobalSecondaryIndexSettingsUpdate
-> f ReplicaGlobalSecondaryIndexSettingsUpdate
replicaGlobalSecondaryIndexSettingsUpdate_indexName = (ReplicaGlobalSecondaryIndexSettingsUpdate -> Text)
-> (ReplicaGlobalSecondaryIndexSettingsUpdate
    -> Text -> ReplicaGlobalSecondaryIndexSettingsUpdate)
-> Lens
     ReplicaGlobalSecondaryIndexSettingsUpdate
     ReplicaGlobalSecondaryIndexSettingsUpdate
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexSettingsUpdate' {Text
indexName :: Text
$sel:indexName:ReplicaGlobalSecondaryIndexSettingsUpdate' :: ReplicaGlobalSecondaryIndexSettingsUpdate -> Text
indexName} -> Text
indexName) (\s :: ReplicaGlobalSecondaryIndexSettingsUpdate
s@ReplicaGlobalSecondaryIndexSettingsUpdate' {} Text
a -> ReplicaGlobalSecondaryIndexSettingsUpdate
s {$sel:indexName:ReplicaGlobalSecondaryIndexSettingsUpdate' :: Text
indexName = Text
a} :: ReplicaGlobalSecondaryIndexSettingsUpdate)

instance
  Prelude.Hashable
    ReplicaGlobalSecondaryIndexSettingsUpdate

instance
  Prelude.NFData
    ReplicaGlobalSecondaryIndexSettingsUpdate

instance
  Core.ToJSON
    ReplicaGlobalSecondaryIndexSettingsUpdate
  where
  toJSON :: ReplicaGlobalSecondaryIndexSettingsUpdate -> Value
toJSON ReplicaGlobalSecondaryIndexSettingsUpdate' {Maybe Natural
Maybe AutoScalingSettingsUpdate
Text
indexName :: Text
provisionedReadCapacityUnits :: Maybe Natural
provisionedReadCapacityAutoScalingSettingsUpdate :: Maybe AutoScalingSettingsUpdate
$sel:indexName:ReplicaGlobalSecondaryIndexSettingsUpdate' :: ReplicaGlobalSecondaryIndexSettingsUpdate -> Text
$sel:provisionedReadCapacityUnits:ReplicaGlobalSecondaryIndexSettingsUpdate' :: ReplicaGlobalSecondaryIndexSettingsUpdate -> Maybe Natural
$sel:provisionedReadCapacityAutoScalingSettingsUpdate:ReplicaGlobalSecondaryIndexSettingsUpdate' :: ReplicaGlobalSecondaryIndexSettingsUpdate
-> Maybe AutoScalingSettingsUpdate
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ ( Text
"ProvisionedReadCapacityAutoScalingSettingsUpdate"
                Text -> AutoScalingSettingsUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=
            )
              (AutoScalingSettingsUpdate -> Pair)
-> Maybe AutoScalingSettingsUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingSettingsUpdate,
            (Text
"ProvisionedReadCapacityUnits" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
provisionedReadCapacityUnits,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IndexName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
indexName)
          ]
      )