{-# 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.ReplicaGlobalSecondaryIndexAutoScalingUpdate
-- 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.ReplicaGlobalSecondaryIndexAutoScalingUpdate 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 auto scaling settings of a global secondary index for a
-- replica that will be modified.
--
-- /See:/ 'newReplicaGlobalSecondaryIndexAutoScalingUpdate' smart constructor.
data ReplicaGlobalSecondaryIndexAutoScalingUpdate = ReplicaGlobalSecondaryIndexAutoScalingUpdate'
  { ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate :: Prelude.Maybe AutoScalingSettingsUpdate,
    -- | The name of the global secondary index.
    ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Bool
(ReplicaGlobalSecondaryIndexAutoScalingUpdate
 -> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Bool)
-> (ReplicaGlobalSecondaryIndexAutoScalingUpdate
    -> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Bool)
-> Eq ReplicaGlobalSecondaryIndexAutoScalingUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Bool
$c/= :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Bool
== :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Bool
$c== :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Bool
Prelude.Eq, ReadPrec [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
ReadPrec ReplicaGlobalSecondaryIndexAutoScalingUpdate
Int -> ReadS ReplicaGlobalSecondaryIndexAutoScalingUpdate
ReadS [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
(Int -> ReadS ReplicaGlobalSecondaryIndexAutoScalingUpdate)
-> ReadS [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
-> ReadPrec ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> ReadPrec [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
-> Read ReplicaGlobalSecondaryIndexAutoScalingUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
$creadListPrec :: ReadPrec [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
readPrec :: ReadPrec ReplicaGlobalSecondaryIndexAutoScalingUpdate
$creadPrec :: ReadPrec ReplicaGlobalSecondaryIndexAutoScalingUpdate
readList :: ReadS [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
$creadList :: ReadS [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
readsPrec :: Int -> ReadS ReplicaGlobalSecondaryIndexAutoScalingUpdate
$creadsPrec :: Int -> ReadS ReplicaGlobalSecondaryIndexAutoScalingUpdate
Prelude.Read, Int -> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> ShowS
[ReplicaGlobalSecondaryIndexAutoScalingUpdate] -> ShowS
ReplicaGlobalSecondaryIndexAutoScalingUpdate -> String
(Int -> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> ShowS)
-> (ReplicaGlobalSecondaryIndexAutoScalingUpdate -> String)
-> ([ReplicaGlobalSecondaryIndexAutoScalingUpdate] -> ShowS)
-> Show ReplicaGlobalSecondaryIndexAutoScalingUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaGlobalSecondaryIndexAutoScalingUpdate] -> ShowS
$cshowList :: [ReplicaGlobalSecondaryIndexAutoScalingUpdate] -> ShowS
show :: ReplicaGlobalSecondaryIndexAutoScalingUpdate -> String
$cshow :: ReplicaGlobalSecondaryIndexAutoScalingUpdate -> String
showsPrec :: Int -> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> ShowS
$cshowsPrec :: Int -> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> ShowS
Prelude.Show, (forall x.
 ReplicaGlobalSecondaryIndexAutoScalingUpdate
 -> Rep ReplicaGlobalSecondaryIndexAutoScalingUpdate x)
-> (forall x.
    Rep ReplicaGlobalSecondaryIndexAutoScalingUpdate x
    -> ReplicaGlobalSecondaryIndexAutoScalingUpdate)
-> Generic ReplicaGlobalSecondaryIndexAutoScalingUpdate
forall x.
Rep ReplicaGlobalSecondaryIndexAutoScalingUpdate x
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate
forall x.
ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> Rep ReplicaGlobalSecondaryIndexAutoScalingUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicaGlobalSecondaryIndexAutoScalingUpdate x
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate
$cfrom :: forall x.
ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> Rep ReplicaGlobalSecondaryIndexAutoScalingUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ReplicaGlobalSecondaryIndexAutoScalingUpdate' 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:
--
-- 'provisionedReadCapacityAutoScalingUpdate', 'replicaGlobalSecondaryIndexAutoScalingUpdate_provisionedReadCapacityAutoScalingUpdate' - Undocumented member.
--
-- 'indexName', 'replicaGlobalSecondaryIndexAutoScalingUpdate_indexName' - The name of the global secondary index.
newReplicaGlobalSecondaryIndexAutoScalingUpdate ::
  ReplicaGlobalSecondaryIndexAutoScalingUpdate
newReplicaGlobalSecondaryIndexAutoScalingUpdate :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
newReplicaGlobalSecondaryIndexAutoScalingUpdate =
  ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
-> Maybe Text -> ReplicaGlobalSecondaryIndexAutoScalingUpdate
ReplicaGlobalSecondaryIndexAutoScalingUpdate'
    { $sel:provisionedReadCapacityAutoScalingUpdate:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate =
        Maybe AutoScalingSettingsUpdate
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
replicaGlobalSecondaryIndexAutoScalingUpdate_provisionedReadCapacityAutoScalingUpdate :: Lens.Lens' ReplicaGlobalSecondaryIndexAutoScalingUpdate (Prelude.Maybe AutoScalingSettingsUpdate)
replicaGlobalSecondaryIndexAutoScalingUpdate_provisionedReadCapacityAutoScalingUpdate :: (Maybe AutoScalingSettingsUpdate
 -> f (Maybe AutoScalingSettingsUpdate))
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> f ReplicaGlobalSecondaryIndexAutoScalingUpdate
replicaGlobalSecondaryIndexAutoScalingUpdate_provisionedReadCapacityAutoScalingUpdate = (ReplicaGlobalSecondaryIndexAutoScalingUpdate
 -> Maybe AutoScalingSettingsUpdate)
-> (ReplicaGlobalSecondaryIndexAutoScalingUpdate
    -> Maybe AutoScalingSettingsUpdate
    -> ReplicaGlobalSecondaryIndexAutoScalingUpdate)
-> Lens
     ReplicaGlobalSecondaryIndexAutoScalingUpdate
     ReplicaGlobalSecondaryIndexAutoScalingUpdate
     (Maybe AutoScalingSettingsUpdate)
     (Maybe AutoScalingSettingsUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexAutoScalingUpdate' {Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
$sel:provisionedReadCapacityAutoScalingUpdate:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate} -> Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate) (\s :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
s@ReplicaGlobalSecondaryIndexAutoScalingUpdate' {} Maybe AutoScalingSettingsUpdate
a -> ReplicaGlobalSecondaryIndexAutoScalingUpdate
s {$sel:provisionedReadCapacityAutoScalingUpdate:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate = Maybe AutoScalingSettingsUpdate
a} :: ReplicaGlobalSecondaryIndexAutoScalingUpdate)

-- | The name of the global secondary index.
replicaGlobalSecondaryIndexAutoScalingUpdate_indexName :: Lens.Lens' ReplicaGlobalSecondaryIndexAutoScalingUpdate (Prelude.Maybe Prelude.Text)
replicaGlobalSecondaryIndexAutoScalingUpdate_indexName :: (Maybe Text -> f (Maybe Text))
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> f ReplicaGlobalSecondaryIndexAutoScalingUpdate
replicaGlobalSecondaryIndexAutoScalingUpdate_indexName = (ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Maybe Text)
-> (ReplicaGlobalSecondaryIndexAutoScalingUpdate
    -> Maybe Text -> ReplicaGlobalSecondaryIndexAutoScalingUpdate)
-> Lens
     ReplicaGlobalSecondaryIndexAutoScalingUpdate
     ReplicaGlobalSecondaryIndexAutoScalingUpdate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexAutoScalingUpdate' {Maybe Text
indexName :: Maybe Text
$sel:indexName:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
s@ReplicaGlobalSecondaryIndexAutoScalingUpdate' {} Maybe Text
a -> ReplicaGlobalSecondaryIndexAutoScalingUpdate
s {$sel:indexName:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: Maybe Text
indexName = Maybe Text
a} :: ReplicaGlobalSecondaryIndexAutoScalingUpdate)

instance
  Prelude.Hashable
    ReplicaGlobalSecondaryIndexAutoScalingUpdate

instance
  Prelude.NFData
    ReplicaGlobalSecondaryIndexAutoScalingUpdate

instance
  Core.ToJSON
    ReplicaGlobalSecondaryIndexAutoScalingUpdate
  where
  toJSON :: ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Value
toJSON
    ReplicaGlobalSecondaryIndexAutoScalingUpdate' {Maybe Text
Maybe AutoScalingSettingsUpdate
indexName :: Maybe Text
provisionedReadCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
$sel:indexName:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Maybe Text
$sel:provisionedReadCapacityAutoScalingUpdate:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"ProvisionedReadCapacityAutoScalingUpdate" 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
provisionedReadCapacityAutoScalingUpdate,
              (Text
"IndexName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
indexName
            ]
        )