{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DynamoDB.Types.ReplicaGlobalSecondaryIndexAutoScalingUpdate 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.AutoScalingSettingsUpdate
import Amazonka.DynamoDB.Types.WriteRequest
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'
  { -- | The name of the global secondary index.
    ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
    ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate :: Prelude.Maybe AutoScalingSettingsUpdate
  }
  deriving (ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Bool
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]
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
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.
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:
--
-- 'indexName', 'replicaGlobalSecondaryIndexAutoScalingUpdate_indexName' - The name of the global secondary index.
--
-- 'provisionedReadCapacityAutoScalingUpdate', 'replicaGlobalSecondaryIndexAutoScalingUpdate_provisionedReadCapacityAutoScalingUpdate' - Undocumented member.
newReplicaGlobalSecondaryIndexAutoScalingUpdate ::
  ReplicaGlobalSecondaryIndexAutoScalingUpdate
newReplicaGlobalSecondaryIndexAutoScalingUpdate :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
newReplicaGlobalSecondaryIndexAutoScalingUpdate =
  ReplicaGlobalSecondaryIndexAutoScalingUpdate'
    { $sel:indexName:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: Maybe Text
indexName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedReadCapacityAutoScalingUpdate:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the global secondary index.
replicaGlobalSecondaryIndexAutoScalingUpdate_indexName :: Lens.Lens' ReplicaGlobalSecondaryIndexAutoScalingUpdate (Prelude.Maybe Prelude.Text)
replicaGlobalSecondaryIndexAutoScalingUpdate_indexName :: Lens' ReplicaGlobalSecondaryIndexAutoScalingUpdate (Maybe Text)
replicaGlobalSecondaryIndexAutoScalingUpdate_indexName = 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)

-- | Undocumented member.
replicaGlobalSecondaryIndexAutoScalingUpdate_provisionedReadCapacityAutoScalingUpdate :: Lens.Lens' ReplicaGlobalSecondaryIndexAutoScalingUpdate (Prelude.Maybe AutoScalingSettingsUpdate)
replicaGlobalSecondaryIndexAutoScalingUpdate_provisionedReadCapacityAutoScalingUpdate :: Lens'
  ReplicaGlobalSecondaryIndexAutoScalingUpdate
  (Maybe AutoScalingSettingsUpdate)
replicaGlobalSecondaryIndexAutoScalingUpdate_provisionedReadCapacityAutoScalingUpdate = 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)

instance
  Prelude.Hashable
    ReplicaGlobalSecondaryIndexAutoScalingUpdate
  where
  hashWithSalt :: Int -> ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Int
hashWithSalt
    Int
_salt
    ReplicaGlobalSecondaryIndexAutoScalingUpdate' {Maybe Text
Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
indexName :: Maybe Text
$sel:provisionedReadCapacityAutoScalingUpdate:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
$sel:indexName:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
indexName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate

instance
  Prelude.NFData
    ReplicaGlobalSecondaryIndexAutoScalingUpdate
  where
  rnf :: ReplicaGlobalSecondaryIndexAutoScalingUpdate -> ()
rnf ReplicaGlobalSecondaryIndexAutoScalingUpdate' {Maybe Text
Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
indexName :: Maybe Text
$sel:provisionedReadCapacityAutoScalingUpdate:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: ReplicaGlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
$sel:indexName:ReplicaGlobalSecondaryIndexAutoScalingUpdate' :: ReplicaGlobalSecondaryIndexAutoScalingUpdate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
indexName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AutoScalingSettingsUpdate
provisionedReadCapacityAutoScalingUpdate

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